From fa548bd17090a6f060f9f42524c6713c63c7e687 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Thu, 27 May 2021 11:54:57 +0800 Subject: [PATCH] no message --- pages/index/index.js | 14 +++++++++++++- pages/login/index.js | 8 ++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 13caa74..a3adade 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -50,17 +50,23 @@ Scene({ const item = element.factoryInfos[nIndex] if(item.factoryId == app.userInfo.factoryId){ this.data.mActiveIndex = mIndex + if(element.isEnterprisePrimary){ + app.userInfo.type = 'ADMIN' + } else { + app.userInfo.type = item.type || '' + } } if(nIndex >= 1){ this.data.arrow = true } var factory = { id: item.factoryId } - if(item.applicationStatus == 0 && !element.isAdmin){ + if(item.applicationStatus == 0 && !element.isEnterprisePrimary){ factory.text = item.factoryName + '(申请中)' factory.disabled = true } else { factory.text = item.factoryName } + factory.index = nIndex children.push(factory) } enterprise.children = children @@ -131,6 +137,12 @@ Scene({ wx.showLoading({ title: '正在切换', mask: true }) app.userInfo.factoryId = detail.id storage.put('X-FACTORY-ID' + app.userInfo.userId, detail.id) + const element = app.userInfo.enterpriseInfos[this.data.mActiveIndex] + if(element.isEnterprisePrimary){ + app.userInfo.type = 'ADMIN' + } else { + app.userInfo.type = element.factoryInfos[detail.index].type || '' + } headerFactoryId(detail.id) var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) if (pageView && this.data.tabIndex != 3) { diff --git a/pages/login/index.js b/pages/login/index.js index 0ba659e..763cb3e 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -135,14 +135,14 @@ Page({ this.setData({ loging: false, metaData: this.data.metaData }) } } else if(app.userInfo.enterpriseInfos && app.userInfo.enterpriseInfos.length){ - var isEnterpriseAdmin = false + var isEnterprisePrimary = false for (let index = 0; index < app.userInfo.enterpriseInfos.length; index++) { - if(app.userInfo.enterpriseInfos[index].isEnterpriseAdmin){ - isEnterpriseAdmin = true + if(app.userInfo.enterpriseInfos[index].isEnterprisePrimary){ + isEnterprisePrimary = true break } } - if(isEnterpriseAdmin){ + if(isEnterprisePrimary){ this.toIndex() return }