|
|
@@ -5,23 +5,9 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ wusercenter: false, //个人中心权限
|
|
|
userMsg: {},
|
|
|
- pathList: [{
|
|
|
- name: "团队管理",
|
|
|
- icon: "icon-a-wodetuanduiguanli",
|
|
|
- color: "var(--assist)",
|
|
|
- path: "/pages/teams/index"
|
|
|
- }, {
|
|
|
- name: "修改登录密码",
|
|
|
- icon: "icon-a-wodeguanyuyingyong",
|
|
|
- color: "var(--warning)",
|
|
|
- path: "/pages/tabbar/mine/changePassword/index"
|
|
|
- }, {
|
|
|
- name: "绑定微信",
|
|
|
- icon: "icon-a-wodebangdingweixin",
|
|
|
- color: "var(--success)",
|
|
|
- path: "#"
|
|
|
- }]
|
|
|
+ pathList: [], //功能权限
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -29,6 +15,45 @@ Page({
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
this.queryUserMsg();
|
|
|
+ let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心'])[0].apps;
|
|
|
+ let wusercenter = 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}`,
|
|
|
+ meta: v.meta
|
|
|
+ })
|
|
|
+ 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)"
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ wusercenter,
|
|
|
+ pathList
|
|
|
+ })
|
|
|
},
|
|
|
/* 查询用户信息 */
|
|
|
queryUserMsg() {
|
|
|
@@ -114,46 +139,48 @@ Page({
|
|
|
phonenumber,
|
|
|
attinfos
|
|
|
} = this.data.userMsg;
|
|
|
+ /* &auth=${JSON.stringify(this.data.wusercenter.meta.auth)} */
|
|
|
wx.navigateTo({
|
|
|
url: `./userMsg/index?attinfos=${JSON.stringify(attinfos)}&name=${name}&phonenumber=${phonenumber}`
|
|
|
})
|
|
|
},
|
|
|
listClick(e) {
|
|
|
const {
|
|
|
- name
|
|
|
+ item
|
|
|
} = e.currentTarget.dataset;
|
|
|
const that = this;
|
|
|
- if (name == '绑定微信') {
|
|
|
- wx.showModal({
|
|
|
- title: "提示",
|
|
|
- content: "是否使用当前微信绑定此账号?",
|
|
|
- success: res => {
|
|
|
- if (res.confirm) {
|
|
|
- wx.login({
|
|
|
- success(res) {
|
|
|
- if (res.code) _Http.basic({
|
|
|
- "classname": "common.usercenter.usercenter",
|
|
|
- "method": "WechatBinding",
|
|
|
- "content": {
|
|
|
- "wechat_code": res.code
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 0) return wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: '绑定成功',
|
|
|
- })
|
|
|
- that.setData({
|
|
|
- "userMsg.iswechatbinding": true
|
|
|
- })
|
|
|
+ if (item.name == '绑定微信') return wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "是否使用当前微信绑定此账号?",
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.login({
|
|
|
+ success(res) {
|
|
|
+ if (res.code) _Http.basic({
|
|
|
+ "classname": "common.usercenter.usercenter",
|
|
|
+ "method": "WechatBinding",
|
|
|
+ "content": {
|
|
|
+ "wechat_code": res.code
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 0) return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '绑定成功',
|
|
|
})
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ that.setData({
|
|
|
+ "userMsg.iswechatbinding": true
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ wx.navigateTo({
|
|
|
+ url: item.meta ? `${item.path}?auth=${JSON.stringify(item.meta)}` : item.path
|
|
|
+ })
|
|
|
}
|
|
|
})
|