import _ from '../../commons/js/commons' const app = getApp() Page({ data: { imgUrl:_.config.imgUrl, isShowAddStaff:false, name:'', mobile:'', isShowProfile:true,//是否显示授权用户信息按钮 isShowSwitchingRoles:false, }, onLoad: function (options) { for (let key in options) { this.setData({ [key]: options[key] }) } let list = [] if(this.data.source=='channel'){ list = [ // { // icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-zichan2.png', // title:'我的资产', // url:'', // }, { icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-sezhi2.png', title:'账户设置', url:'/pages/mine/install/index', }, ] }else if(this.data.source=='shop'){ list = [ // { // icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-zichan2.png', // title:'我的资产', // url:'', // }, { icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-sucai2.png', title:'签到码', url:'/pages/signup/code', }, { icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-sezhi2.png', title:'账户设置', url:'/pages/mine/install/index', }, // { // icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-siyutong2.png', // title:'私域通', // url:'/pages/siyutong/index', // }, ] } this.setData({ list:list, }) this.getUserInfo() wx.getSystemInfo({ success (res) { if(res.system.indexOf('Android')>-1){ wx.setBackgroundColor({ backgroundColor: '#34ac9f', }) } } }) //消息通讯 是否显示授权用户信息按钮 _.eventBus.on("isShowProfile", this, function(res){ this.setData({ isShowProfile:res, }) }) }, onShow: function () { }, //生命周期函数--监听页面卸载 onUnload: function () { //卸载消息通讯 是否显示授权用户信息 _.eventBus.remove('isShowProfile',this); }, //获取用户信息 getUserInfo(){ _.apiQuery.getUserInfo().then(res => { this.setData({ userInfo: res }) // if(res.group_id==2||res.group_id==3){ // let list = this.data.list // list.push({ // icon:'https://qs.haodian.cn/wechat_app/lichebao/mine/icon-jieshao2.png', // title:'转介绍', // url:'/pages/recommend/index', // }) // this.setData({ // list, // }) // } }); }, //退出登录 logout(){ wx.clearStorage() wx.reLaunch({ url: '/pages/login/index' }) }, //推送链接 pushLink(e) { if(e.currentTarget.dataset.url){ _.$router.openUrlScheme(e.currentTarget.dataset.url) } }, //推送链接-敬请期待 pushLinkMsg(e) { if (e.currentTarget.dataset.url) { _.$router.openUrlScheme(e.currentTarget.dataset.url) }else{ wx.showToast({ title:'开发中,敬请期待!', icon: "none" }); } }, //切换角色 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, }) }, })