|
|
|
@ -113,6 +113,21 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
contactMeta: function(metaData){ |
|
|
|
for (let mIndex = 0; mIndex < app.userInfo.enterpriseInfos.length; mIndex++) { |
|
|
|
const element = app.userInfo.enterpriseInfos[mIndex] |
|
|
|
if(element.isEnterprisePrimary && element.enterpriseId == metaData.enterpriseId){ |
|
|
|
return true |
|
|
|
} |
|
|
|
for (let nIndex = 0; nIndex < element.factoryInfos.length; nIndex++) { |
|
|
|
const item = element.factoryInfos[nIndex] |
|
|
|
if(item.factoryId == metaData.factoryId){ |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
}, |
|
|
|
fetchUserInfo: function(authorization){ |
|
|
|
config.header = { 'Authorization': 'QNT ' + authorization } |
|
|
|
// token 切换流程
|
|
|
|
@ -126,6 +141,11 @@ Page({ |
|
|
|
app.globalData.token = authorization |
|
|
|
storage.put('Authorization', app.globalData.token) |
|
|
|
if(this.data.metaData){ |
|
|
|
// 如果metaData的factoryId或者enterpriseId已经包含用户信息中了,那就直接登录;
|
|
|
|
if(this.contactMeta(this.data.metaData)){ |
|
|
|
this.toIndex() |
|
|
|
return |
|
|
|
} |
|
|
|
// 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作;
|
|
|
|
if(this.data.metaData.qrPage == '/page/index/register'){ |
|
|
|
this.data.metaData.userName = this.data.metaData.factoryCustomerName || '默认姓名' |
|
|
|
|