|
|
// pages/jobDetail/editDetail/index.js
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
zhengceTextList:[{name:'一条政策',value:1},{name:'二条政策',value:2},{name:'三条政策',value:3},{name:'四条政策',value:4},{name:'五条政策',value:5},{name:'六条政策',value:6},{name:'七条政策',value:7},{name:'八条政策',value:8}],
|
|
|
policyIdx: -1,
|
|
|
jobDetail:{},
|
|
|
name:"",
|
|
|
defaultValue:"",
|
|
|
title:"",
|
|
|
countries: ['中国', '美国', '英国'],
|
|
|
countryIndex: 0,
|
|
|
},
|
|
|
bindPickerChangePolicy(e) {
|
|
|
console.log("picker发送选择改变,携带值为", e.detail.value);
|
|
|
this.setData({
|
|
|
policyIdx: e.detail.value,
|
|
|
});
|
|
|
},
|
|
|
bindPickerChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
index: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
console.log(options.title);
|
|
|
// console.log(options.content);
|
|
|
console.log(options.namestr);
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: options.title,
|
|
|
})
|
|
|
this.setData({
|
|
|
name:options.namestr,
|
|
|
title: options.title,
|
|
|
jobDetail : wx.getStorageSync('jobDetail')
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow() {
|
|
|
var that = this;
|
|
|
var currName = this.data.name
|
|
|
that.setData({
|
|
|
defaultValue : that.data.jobDetail.storeJob[currName],
|
|
|
})
|
|
|
console.log(that.data.jobDetail.storeJob.policyNum);
|
|
|
if(that.data.jobDetail.storeJob.policyNum == '' || that.data.jobDetail.storeJob.policyNum == 0){
|
|
|
that.setData({
|
|
|
policyIdx : -1,
|
|
|
})
|
|
|
}else{
|
|
|
that.setData({
|
|
|
policyIdx : Number(that.data.jobDetail.storeJob.policyNum) - 1,
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
formSubmit(e){
|
|
|
var that = this;
|
|
|
// console.log(e.detail.value);
|
|
|
// console.log(that.data.name);
|
|
|
// console.log(e.detail.value[that.data.name]);
|
|
|
wx.showLoading({
|
|
|
title: '提交中...',
|
|
|
})
|
|
|
|
|
|
let currData = {};
|
|
|
currData["id"] = that.data.jobDetail.storeJob.id;
|
|
|
currData["fieldName"] = 'policyNum';
|
|
|
currData["value"] = Number(that.data.policyIdx) + 1;
|
|
|
console.log(currData)
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
url: app.globalData.ip + "/store/job/updateJobField",
|
|
|
header: app.globalData.header,
|
|
|
data:currData,
|
|
|
method: "POST",
|
|
|
success: function (res) {
|
|
|
// console.log(res.data);
|
|
|
// that.setData({
|
|
|
// record: res.data.data,
|
|
|
// });
|
|
|
wx.setStorageSync('isLoad', true);
|
|
|
|
|
|
wx.showToast({
|
|
|
title: '修改成功',
|
|
|
icon:'success',
|
|
|
duration:1000
|
|
|
})
|
|
|
setTimeout(function(){
|
|
|
wx.hideLoading({
|
|
|
success: (res) => {},
|
|
|
})
|
|
|
wx.navigateBack({
|
|
|
delta: 1,
|
|
|
})
|
|
|
},1000)
|
|
|
|
|
|
// debugger;
|
|
|
},
|
|
|
fail: function (res) {
|
|
|
wx.hideLoading({
|
|
|
success: (res) => {},
|
|
|
})
|
|
|
console.log(res);
|
|
|
},
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
}
|
|
|
}) |