You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
2.7 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// pages/jobDetail/editDetail/index.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
array: ['时薪', '日薪', '月薪', '日本'],
index: 0,
jobDetail:{},
name:"",
defaultValue:"",
title:""
},
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);
},
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"] =that.data.name;
currData["value"] = e.detail.value[that.data.name];
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() {
}
})