فهرست منبع

微信小程序登录逻辑梳理_v8

John-Hong 2 سال پیش
والد
کامیت
d4af18b7e5
3فایلهای تغییر یافته به همراه13 افزوده شده و 1 حذف شده
  1. 1 1
      public/index.html
  2. 11 0
      src/App.vue
  3. 1 0
      src/store/index.js

+ 1 - 1
public/index.html

@@ -15,7 +15,7 @@
   <script>
     // CONFIGURATIONS_PLACEHOLDER
     
-    if (/dev-/.test(window?.injectConfig.api) || window.location.href.indexOf(8080) > -1) {
+    if (/dev-/.test(window?.injectConfig?.api) || window.location.href.indexOf(8080) > -1) {
       window.injectConfig = {
         ...window.injectConfig,
         api: 'https://qa-crm-kpl.kerryprops.com.cn',

+ 11 - 0
src/App.vue

@@ -137,6 +137,16 @@ export default {
         if (openid && openid !== 'undefined') {
           this.$store.commit('SET_OPENID', openid);
         } */
+        if (!openid) {
+          // 当进入其他页面时,需要先打开路由展示
+          this.isInit = true;
+          // 前往授权页面
+          this.$router.replace({
+            path: '/openWx',
+            query: query,
+          });
+          return;
+        }
         if (!kipAccessToken) {
           /* if (!openid) {
             // 当进入其他页面时,需要先打开路由展示
@@ -245,6 +255,7 @@ export default {
         return;
       }
       /* 微信小程序 webview 配置 */
+      console.log(258, uni.getStorageSync('pageId'));
       if (
         !uni.getStorageSync('pageId') ||
         uni.getStorageSync('pageId') === 'undefined'

+ 1 - 0
src/store/index.js

@@ -127,6 +127,7 @@ const store = new Vuex.Store({
           kipUserId,
           mallId,
         });
+        console.log(130, memberRes);
         // 请求 projectId
         window.toWXSendMsg({
           type: 'getProjectId',