|
@@ -8,60 +8,54 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- fname: null, //用户名
|
|
|
- frole: null, //角色
|
|
|
- fphonenumber: null, //手机号
|
|
|
- fsex: null, //性别
|
|
|
- fbirthdate: null, //生日
|
|
|
- femail: null, //邮箱
|
|
|
- fwechatno: null, //微信
|
|
|
- faddress: null, //地址
|
|
|
+ fname: "", //用户名
|
|
|
+ frole: "", //角色
|
|
|
+ fphonenumber: "", //手机号
|
|
|
+ fsex: "", //性别
|
|
|
+ fbirthdate: "", //生日
|
|
|
+ femail: "", //邮箱
|
|
|
+ fwechatno: "", //微信
|
|
|
+ faddress: "", //地址
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": getApp().globalData.userMsg.token,
|
|
|
- "classname": "customer.usercenter.usermsg.usermsg",
|
|
|
- "method": "query_usermsg",
|
|
|
- "content": {}
|
|
|
- }).then(s => {
|
|
|
- if (s.msg != "成功") return;
|
|
|
- this.setData({
|
|
|
- fname: s.data[0].fname,
|
|
|
- frole: s.data[0].frole,
|
|
|
- fsex: s.data[0].fsex,
|
|
|
- fbirthdate: s.data[0].fbirthdate,
|
|
|
- femail: s.data[0].femail,
|
|
|
- fwechatno: s.data[0].fwechatno,
|
|
|
- faddress: s.data[0].faddress,
|
|
|
- frole: s.data[0].frole,
|
|
|
- faddress: s.data[0].faddress,
|
|
|
- fphonenumber: s.data[0].fphonenumber,
|
|
|
- })
|
|
|
+ const data = JSON.parse(options.data)
|
|
|
+ this.setData({
|
|
|
+ fname: data.fname,
|
|
|
+ frole: data.frole,
|
|
|
+ fsex: data.fsex,
|
|
|
+ fbirthdate: data.fbirthdate,
|
|
|
+ femail: data.femail,
|
|
|
+ fwechatno: data.fwechatno,
|
|
|
+ faddress: data.faddress,
|
|
|
+ frole: data.frole,
|
|
|
+ faddress: data.faddress,
|
|
|
+ fphonenumber: data.fphonenumber,
|
|
|
})
|
|
|
},
|
|
|
/* 表单提交 */
|
|
|
formSubmit() {
|
|
|
_Http.basic({
|
|
|
- "accesstoken": getApp().globalData.userMsg.token,
|
|
|
+ "accesstoken": wx.getStorageSync('token'),
|
|
|
"classname": "customer.usercenter.usermsg.usermsg",
|
|
|
"method": "update_usermsg",
|
|
|
"content": {
|
|
|
fname: this.data.fname,
|
|
|
- frole: this.data.frole,
|
|
|
- fsex: this.data.fsex,
|
|
|
- fbirthdate: this.data.fbirthdate,
|
|
|
- femail: this.data.femail,
|
|
|
- fwechatno: this.data.fwechatno,
|
|
|
- faddress: this.data.faddress,
|
|
|
+ frole: this.data.frole,
|
|
|
+ fsex: this.data.fsex,
|
|
|
+ fbirthdate: this.data.fbirthdate,
|
|
|
+ femail: this.data.femail,
|
|
|
+ fwechatno: this.data.fwechatno,
|
|
|
+ faddress: this.data.faddress,
|
|
|
}
|
|
|
}).then(s => {
|
|
|
+ console.log(s)
|
|
|
if (s.msg != "成功") return;
|
|
|
wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
+ title: '保存成功',
|
|
|
})
|
|
|
this.setData({
|
|
|
userMsg: s.data[0]
|