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.

144 lines
2.6 KiB
JavaScript

2 years ago
// 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.store[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["storeId"] = that.data.jobDetail.store.id;
currData["storeInfo"] =e.detail.value[that.data.name];
// currData["value"] = e.detail.value[that.data.name];
wx.request({
url: app.globalData.ip + "/store/updateStoreInfo",
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.navigateBack({
delta: 1,
})
},1000)
// debugger;
},
fail: function (res) {
console.log(res);
},
});
wx.hideLoading({
success: (res) => {},
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})