|
@@ -8,6 +8,7 @@ Page({
|
|
|
wusercenter: false, //个人中心权限
|
|
|
userMsg: {},
|
|
|
pathList: [], //功能权限
|
|
|
+ bdWeChat: false, //绑定微信权限
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
@@ -15,42 +16,38 @@ Page({
|
|
|
onLoad(options) {
|
|
|
this.queryUserMsg();
|
|
|
let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心'])[0].apps;
|
|
|
- let wusercenter = false; //个人中心
|
|
|
+ let wusercenter = false, //个人中心
|
|
|
+ bdWeChat = false; //绑定微信
|
|
|
let pathList = [];
|
|
|
auth.forEach(v => {
|
|
|
- if (v.name == 'wusercenter') {
|
|
|
- wusercenter = true;
|
|
|
- } else {
|
|
|
- switch (v.name) {
|
|
|
- case "teamManagement":
|
|
|
- pathList.push({
|
|
|
- name: "团队管理",
|
|
|
- icon: "icon-a-wodetuanduiguanli",
|
|
|
- color: "var(--assist)",
|
|
|
- path: `/${v.path}`
|
|
|
- })
|
|
|
- break;
|
|
|
- case "changePassword":
|
|
|
- pathList.push({
|
|
|
- name: "修改登录密码",
|
|
|
- icon: "icon-a-wodeguanyuyingyong",
|
|
|
- color: "var(--warning)",
|
|
|
- path: `/${v.path}`
|
|
|
- })
|
|
|
- break;
|
|
|
- case "wechatAgreement":
|
|
|
- pathList.push({
|
|
|
- name: "绑定微信",
|
|
|
- icon: "icon-a-wodebangdingweixin",
|
|
|
- color: "var(--success)",
|
|
|
- path: `#`
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
+ switch (v.name) {
|
|
|
+ case "wusercenter":
|
|
|
+ wusercenter = true;
|
|
|
+ break;
|
|
|
+ case "teamManagement":
|
|
|
+ pathList.push({
|
|
|
+ name: "团队管理",
|
|
|
+ icon: "icon-a-wodetuanduiguanli",
|
|
|
+ color: "var(--assist)",
|
|
|
+ path: `/${v.path}`
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "changePassword":
|
|
|
+ pathList.push({
|
|
|
+ name: "修改登录密码",
|
|
|
+ icon: "icon-a-wodeguanyuyingyong",
|
|
|
+ color: "var(--warning)",
|
|
|
+ path: `/${v.path}`
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "wechatAgreement":
|
|
|
+ bdWeChat = true;
|
|
|
+ break;
|
|
|
}
|
|
|
});
|
|
|
this.setData({
|
|
|
wusercenter,
|
|
|
+ bdWeChat,
|
|
|
pathList
|
|
|
})
|
|
|
},
|
|
@@ -101,13 +98,26 @@ Page({
|
|
|
url: `./userMsg/index?attinfos=${JSON.stringify(attinfos)}&name=${name}&phonenumber=${phonenumber}`
|
|
|
})
|
|
|
},
|
|
|
- listClick(e) {
|
|
|
- const {
|
|
|
- item
|
|
|
- } = e.currentTarget.dataset;
|
|
|
- const that = this;
|
|
|
- if (item.name == '绑定微信') return wx.getUserProfile({
|
|
|
- desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
+ /* 绑定或解绑微信 */
|
|
|
+ bindingWechat(e) {
|
|
|
+ if (this.data.userMsg.iswechatbinding) {
|
|
|
+ let that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "是否解除绑定",
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.confirm) that.handleBDWechat(0);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.handleBDWechat(1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleBDWechat(isbinging) {
|
|
|
+ let that = this;
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '用于完善用户资料',
|
|
|
success: ({
|
|
|
userInfo
|
|
|
}) => {
|
|
@@ -118,31 +128,31 @@ Page({
|
|
|
"method": "WechatBinding",
|
|
|
content: {
|
|
|
"wechat_code": res.code,
|
|
|
- isbinging: 1, // 0解绑 1绑定
|
|
|
+ isbinging, // 0解绑 1绑定
|
|
|
wechatuserinfo: userInfo
|
|
|
}
|
|
|
- }).then(res => {
|
|
|
- console.log(res)
|
|
|
- if (res.code == 0) return wx.showToast({
|
|
|
- title: res.data,
|
|
|
+ }).then(s => {
|
|
|
+ if (s.msg != '成功') return wx.showToast({
|
|
|
+ title: s.data,
|
|
|
icon: "none"
|
|
|
});
|
|
|
- wx.showToast({
|
|
|
- title: '绑定成功',
|
|
|
- })
|
|
|
- that.setData({
|
|
|
- "userMsg.iswechatbinding": true
|
|
|
- })
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.showToast({
|
|
|
+ title: isbinging == 0 ? '解除成功' : '绑定成功',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }, 100);
|
|
|
+ that.queryUserMsg();
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
fail: () => {
|
|
|
wx.showToast({
|
|
|
- title: '绑定失败,未获得授权',
|
|
|
+ title: '操作失败,未获得授权',
|
|
|
icon: "none"
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
})
|