Browse Source

no message

feature/v1.6
xpz2018 4 years ago
parent
commit
fa548bd170
2 changed files with 17 additions and 5 deletions
  1. 14
      pages/index/index.js
  2. 8
      pages/login/index.js

14
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) {

8
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
}

Loading…
Cancel
Save