Commit f972f22e authored by Damon's avatar Damon

refactor: 更新机构ID逻辑调整

parent 78504518
......@@ -78,17 +78,25 @@ export default {
},
// 更新机构ID
updateOrgId(options) {
const orgId = options?.query?.orgId || -1
const orgId = options?.query?.orgId
// 需要更新机构ID的场景,详细可参考 https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html
const scene = [1005, 1006, 1011, 1012, 1013, 1026, 1035, 1047, 1048, 1049, 1053, 1058, 1067, 1091, 1145, 1135, 1183]
if (!this.orgId) {
this.$u.vuex('orgId', orgId)
const scene = [1005, 1006, 1011, 1012, 1013, 1026, 1035, 1047, 1048, 1049, 1053, 1058, 1067, 1091, 1145, 1135, 1183, 1017]
if (!this.orgId) { // 没有机构ID,更新
this.$u.vuex('orgId', orgId || -1)
} else {
if (scene.includes(options.scene)) {
if (orgId !== this.orgId) this.logout()
this.$u.vuex('orgId', orgId)
if (scene.includes(options.scene)) { // 如果需要更新机构ID
if (!orgId) { // 针对重新载入小程序 安卓的query参数会清空
// 如果没有参数,需要重置为平台的场景
const platformScene = [1005, 1006, 1026, 1011, 1012, 1013, 1047, 1048, 1049, 1053, 1145, 1183, 1017]
if (platformScene.includes(options.scene)) {
this.$u.vuex('orgId', -1)
}
return
}
if (orgId && orgId !== this.orgId) {
this.logout()
this.$u.vuex('orgId', orgId)
}
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment