Przeglądaj źródła

随身邦,身份认证

armg 6 dni temu
rodzic
commit
67eab559d3
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      src/router/index.ts

+ 6 - 3
src/router/index.ts

@@ -1,7 +1,7 @@
 import Vue from "vue";
 import VueRouter from "vue-router";
 import layout from "@/layout/index.vue";
-import { checkWxWorkEnvAndUserCache } from '@/utils/index'
+import { checkWxWorkEnvAndUserCache, getAgentFrom } from '@/utils/index'
 import { checkLoginStatus, initGuidInfo, doWecomLogin, getQyCode, getGuid, getMD5 } from '@/utils/wecomLogin.ts';
 import { doWxidLogin } from "@/api/indexAI";
 Vue.use(VueRouter);
@@ -165,11 +165,14 @@ function handleNewLoginMode(to, next, wxId) {
     doWxidLogin(formData)
       .then((res) => {
         if (res && res.StatusCode === 200 && res.Data && res.Data.token) {
-        console.log("res=",res)
+          console.log("res=", res)
           window.localStorage.setItem('AIToken', res.Data.token);
           window.localStorage.setItem('isRefreshProvider', res.Data.isRefreshProvider);
+          const { WecomType } = to.query;
+          console.log("WecomType===",WecomType)
+          window.localStorage.setItem('agentFrom', getAgentFrom(parseInt(WecomType)));
+          window.localStorage.setItem('agentFromAI', getAgentFrom(parseInt(WecomType)));
           console.log(`新登录成功,Token已缓存,即将进入 ${to.path}`);
-          // next({ path: to.path, query: {}, replace: true });
           next();
         } else {
           throw new Error('新登录失败,未获取到Token');