|
|
@@ -11,6 +11,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ newAdd: false, //是否新增
|
|
|
fname: '', //用户名称
|
|
|
frole: '', //身份/职位
|
|
|
fphonenumber: '', //手机号码
|
|
|
@@ -31,7 +32,6 @@ Page({
|
|
|
onLoad: function (options) {
|
|
|
if (options.data) {
|
|
|
const memberMessage = JSON.parse(options.data);
|
|
|
- console.log(memberMessage)
|
|
|
this.setData({
|
|
|
fname: memberMessage.fname,
|
|
|
frole: memberMessage.frole,
|
|
|
@@ -40,6 +40,10 @@ Page({
|
|
|
subusers: memberMessage.subusers,
|
|
|
tenterprise_userid: memberMessage.tenterprise_userid
|
|
|
})
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ newAdd: true
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
/* 提交 */
|
|
|
@@ -48,28 +52,37 @@ Page({
|
|
|
title: '请检查表单内容',
|
|
|
icon: "none"
|
|
|
});
|
|
|
+ let content = {
|
|
|
+ "tenterprise_userid": this.data.tenterprise_userid,
|
|
|
+ "fname": this.data.fname,
|
|
|
+ "frole": this.data.frole,
|
|
|
+ "fphonenumber": this.data.fphonenumber,
|
|
|
+ "subusers": this.data.subusers
|
|
|
+ };
|
|
|
+ if (this.data.newAdd) {
|
|
|
+ content = {
|
|
|
+ "tenterprise_userid": 0
|
|
|
+ }
|
|
|
+ }
|
|
|
_Http.basic({
|
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
|
"classname": "customer.usercenter.teammsg.teammsg",
|
|
|
"method": "update_userMsg",
|
|
|
- "content": {
|
|
|
- "tenterprise_userid": this.data.tenterprise_userid,
|
|
|
- "fname": this.data.fname,
|
|
|
- "frole": this.data.frole,
|
|
|
- "fphonenumber": this.data.fphonenumber,
|
|
|
- "subusers": this.data.subusers
|
|
|
- }
|
|
|
+ "content": content
|
|
|
}).then(res => {
|
|
|
console.log(res)
|
|
|
- if (res.msg == "成功") {
|
|
|
+ if (res.msg == "成功" && !this.data.newAdd) {
|
|
|
wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
+ title: '保存成功',
|
|
|
});
|
|
|
- setTimeout(()=>{
|
|
|
+ this.setData({
|
|
|
+ newAdd: false
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
wx.navigateBack({
|
|
|
delta: 1
|
|
|
- })
|
|
|
- },500)
|
|
|
+ })
|
|
|
+ }, 500)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -160,7 +173,9 @@ Page({
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function () {
|
|
|
-
|
|
|
+ if(this.data.newAdd){
|
|
|
+ console.log("成员删除")
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|