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.
|
|
|
|
|
// pages/myCreatMan/index.js
|
|
|
|
|
|
let app = getApp();
|
|
|
|
|
|
const commonUtil = require("../../../utils/commonUtil.js");
|
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
data: {
|
|
|
|
|
|
agencyId:'',
|
|
|
|
|
|
record:{},
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
|
*/
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
console.log(options.agencyId);
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
agencyId: options.agencyId
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
|
*/
|
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
|
*/
|
|
|
|
|
|
onShow() {
|
|
|
|
|
|
this.getDetail();
|
|
|
|
|
|
|
|
|
|
|
|
console.log(commonUtil.getAgencyPermissionsByRole(1));
|
|
|
|
|
|
},
|
|
|
|
|
|
getDetail() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + "/agency/getDetailById?id=" + that.data.agencyId,
|
|
|
|
|
|
header: app.globalData.header,
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res.data);
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
record: res.data.data,
|
|
|
|
|
|
});
|
|
|
|
|
|
// debugger;
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
wx.hideLoading({
|
|
|
|
|
|
success: (res) => {},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
formSubmit(e) {
|
|
|
|
|
|
console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
if(e.detail.value.userName == ""){
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
title: '姓名不能为空',
|
|
|
|
|
|
icon:'error',
|
|
|
|
|
|
duration:1000
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if(e.detail.value.tel == ""){
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
title: '电话不能为空',
|
|
|
|
|
|
icon:'error',
|
|
|
|
|
|
duration:1000
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let currData = {};
|
|
|
|
|
|
currData["userId"] = that.data.record.userId;
|
|
|
|
|
|
currData["userName"] = e.detail.value.userName;
|
|
|
|
|
|
currData["tel"] = e.detail.value.tel;
|
|
|
|
|
|
currData["agencyRole"] = 1;
|
|
|
|
|
|
currData["agencyPermissions"] = commonUtil.getAgencyPermissionsByRole(1)
|
|
|
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + "/agency/updateMember",
|
|
|
|
|
|
header: app.globalData.header,
|
|
|
|
|
|
data:currData,
|
|
|
|
|
|
method: "post",
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res.data);
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
title: '修改成功',
|
|
|
|
|
|
icon:'success',
|
|
|
|
|
|
duration:1000
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
|
wx.navigateBack({
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
})
|
|
|
|
|
|
},1000)
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
|
*/
|
|
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
|
*/
|
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
|
*/
|
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
|
*/
|
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
|
*/
|
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|