Parcourir la source

h5退出时,跳转至小程序实现

ming il y a 5 mois
Parent
commit
175a170eb8
3 fichiers modifiés avec 16 ajouts et 3 suppressions
  1. 2 1
      src/manifest.json
  2. 1 0
      src/pages/login.vue
  3. 13 2
      src/store/modules/setting.js

+ 2 - 1
src/manifest.json

@@ -190,7 +190,8 @@
             "urlCheck" : false,
             "checkSiteMap" : false
         },
-        "usingComponents" : true
+        "usingComponents" : true,
+        "navigateToMiniProgramAppIdList":["wxf5ad8734295d43f8"]
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 1 - 0
src/pages/login.vue

@@ -307,6 +307,7 @@ onLoad((options) => {
 
   if(options.dataToken){
       localStorage.setItem("App-Token", options.dataToken)
+      localStorage.setItem("type", 'innerH5')
       useStore.GetInfo()
       proxy.$tab.reLaunch("/pages/index");
 

+ 13 - 2
src/store/modules/setting.js

@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
 import { useStores } from "@/store/modules/index";
 import { storage, storageSystem } from "@/utils/storage";
 import { getToken, setToken, removeToken } from "@/utils/auth";
+import wx from 'weixin-js-sdk'
 // 接口引用
 import { uploadAvatar, updateUserProfile } from "@/api/system/user";
 import { baseAppInfoApi } from "@/api/common/index";
@@ -359,10 +360,20 @@ const settingStores = defineStore("storage-setting", {
             const useStore = useStores();
             modal.confirm("确定注销并退出系统吗?").then(() => {
                 useStore.LogOut().then(() => {
-                    tab.reLaunch("/pages/index");
+                   
+                    if(localStorage.getItem("type")) {
+                        console.log('内嵌h5')
+                        wx.miniProgram.navigateTo({
+                            appId:'wxf5ad8734295d43f8',
+                            url:'/pages/login?type=logout'
+                          })
+                    }  else{
+                        tab.reLaunch("/pages/index");
+                    }                 
+
                 });
             });
-        },
+        },     
         /**
          * @初始化默认主题
          */