diff --git a/commons/js/config.js b/commons/js/config.js index c3523a4..d70acc6 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -1,4 +1,4 @@ -const env = "d"; +const env = "p"; const version = 1, @@ -165,6 +165,8 @@ api = { appOptions:'app/options', //获取车辆选装包 + appResetgroupid:'app/user/resetgroupid', //切换角色 + } //远程图片存储地址 diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index cf0f83a..80c6a40 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -959,4 +959,11 @@ apiQuery.getAppOptions = function (params) { }) } +//切换角色 +apiQuery.putAppResetgroupid = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appResetgroupid, 2, params, "PUT", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/pages/mine/index.js b/pages/mine/index.js index af1b371..a25972f 100644 --- a/pages/mine/index.js +++ b/pages/mine/index.js @@ -7,6 +7,7 @@ Page({ name:'', mobile:'', isShowProfile:true,//是否显示授权用户信息按钮 + isShowSwitchingRoles:false, }, onLoad: function (options) { @@ -136,4 +137,34 @@ Page({ } }, + //切换角色 + putAppResetgroupid(e){ + let params = {}; + params['group_id'] = e.currentTarget.dataset.key; + _.apiQuery.putAppResetgroupid(params).then(res=>{ + _.apiQuery.getUserInfo().then(res => { + if(res.biz_type==4){ + wx.reLaunch({ + url: '/pages/allot/index', + }) + }else if(res.group_id==4){ + wx.reLaunch({ + url: '/pages/channel/index', + }) + }else{ + wx.reLaunch({ + url: '/pages/index/index', + }) + } + }); + }) + }, + + //显示切换角色 + switchingRoles(){ + this.setData({ + isShowSwitchingRoles:!this.data.isShowSwitchingRoles, + }) + }, + }) \ No newline at end of file diff --git a/pages/mine/index.wxml b/pages/mine/index.wxml index e6f0c15..434b427 100644 --- a/pages/mine/index.wxml +++ b/pages/mine/index.wxml @@ -13,8 +13,14 @@ {{userInfo.biz_name}} - - 退出 + + + + 切换角色 + + + 退出 + @@ -43,4 +49,21 @@ - \ No newline at end of file + + + + + + 当前角色: + + {{userInfo.group_name}} + + + + + + \ No newline at end of file