Kaynağa Gözat

缓存weChat

armg 2 hafta önce
ebeveyn
işleme
ea0384382c
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      src/router/index.ts

+ 3 - 1
src/router/index.ts

@@ -108,6 +108,9 @@ router.beforeEach(async (to, from, next) => {
     // 判断当前登录模式,分发处理逻辑
     const isNewLoginMode = sessionStorage.getItem('isNewLoginMode') === 'true';
     if (isNewLoginMode) {
+      if(wxid){
+        window.localStorage.setItem('weChat', wxid);
+      }
       await handleWxidLoginMode(to, next, wxid, WecomType);
     } else {
       await handleCodeLoginMode(to, next);
@@ -138,7 +141,6 @@ async function handleWxidLoginMode(to, next, wxid, WecomType) {
     // 4. wxid参数校验
     let wxId = wxid ? wxid : window.localStorage.getItem("weChat");
     if (!wxId) return redirectToError(next, "wxid参数缺失,无权限");
-    window.localStorage.setItem('weChat', wxId);
     const formData = new FormData();
     const timestamp = new Date().getTime().toString();
     const nonce = getGuid();