Ver código fonte

修复小程序跳转后首页无法获取租户ID

wangtao 1 semana atrás
pai
commit
e0b51978ab
1 arquivos alterados com 4 adições e 1 exclusões
  1. 4 1
      src/pages/index.vue

+ 4 - 1
src/pages/index.vue

@@ -235,7 +235,7 @@ async function init(options) {
     tenantIdChange.value = useStore.tenantId; //切换租户ID
     getTenantList(useStore.userId); //调用获取企业列表方法
   }
-  //#ifdef H5
+  //#ifdef H5 || MP-WEIXIN
   await useStore.GetWxOpenId(2, options); //调用获取微信公众号openId
   //#endif
 
@@ -447,6 +447,9 @@ function getAppRoutersData() {
 
 onLoad((options) => {
   if(options?.xcxData){
+    let xcxData = JSON.parse(decrypt(decodeURIComponent(options.xcxData)))
+    useStore.SET_STORAGE_OBJECT_KEYS({ tenantId: xcxData.tenantId })
+    localStorage.setItem("tenantId", xcxData.tenantId )
     useStore.Login(JSON.parse(decrypt(decodeURIComponent(options.xcxData)))).then(() => {
       useStore.GetInfo().then((res) => {
         proxy.$settingStore.initThemeColor(storageSystem.get("themeColor")); //初始化默认主题