浏览代码

💊 修改细节问题

快乐的梦鱼 1 月之前
父节点
当前提交
025bc20ec4
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 1 1
      src/pages/collect/login.vue
  2. 10 1
      src/store/auth.ts

+ 1 - 1
src/pages/collect/login.vue

@@ -157,7 +157,7 @@ async function handleSubmit() {
     }
 
     //如果用户未绑定微信,提示用户绑定微信
-    if (!authStore.userInfo?.openId && tipBindWechat.isTimeout()) {
+    if (!authStore.userInfo?.openId && !authStore.isLoginMp && tipBindWechat.isTimeout()) {
       tipBindWechat.recordTime();
 
       if (await confirm({

+ 10 - 1
src/store/auth.ts

@@ -15,6 +15,7 @@ export const useAuthStore = defineStore('auth', {
     userId: 0,
     userInfo: null as null|UserInfo,
     loginType: -1,
+    loginMp: false,
   }),
   actions: {
     async loadLoginState() {
@@ -28,6 +29,7 @@ export const useAuthStore = defineStore('auth', {
         this.expireAt = authInfo.expireAt;
         this.userInfo = authInfo.userInfo;
         this.loginType = authInfo.loginType ?? -1;
+        this.loginMp = authInfo.loginMp ?? false;
         this.shareLoginInfo();
 
         //检查登录是否过期
@@ -37,6 +39,7 @@ export const useAuthStore = defineStore('auth', {
         this.token = '';
         this.userId = 0;
         this.userInfo = null;
+        this.loginMp = false;
 
         console.log('loadLoginState', error);
       }
@@ -58,6 +61,7 @@ export const useAuthStore = defineStore('auth', {
       } else {
         this.loginType = LOGIN_TYPE_USER;
       }
+      this.loginMp = true;
       this.loginResultHandle(loginResult, this.loginType);
     },
     async loginMobile(mobile: string, password: string) {
@@ -65,6 +69,7 @@ export const useAuthStore = defineStore('auth', {
         mobile,
         password,
       })
+      this.loginMp = false;
       this.loginResultHandle(loginResult);
     },
     async loginCollect(mobile: string, password: string, loginType: number) {
@@ -81,6 +86,7 @@ export const useAuthStore = defineStore('auth', {
         })
       } else
         throw 'login type error';
+      this.loginMp = false;
       this.loginResultHandle(loginResult, loginType);
     },
     async loginResultHandle(loginResult: LoginResult, loginType: number = -1) {
@@ -117,11 +123,14 @@ export const useAuthStore = defineStore('auth', {
       this.token = '';
       this.userId = 0;
       this.userInfo = null;
-
+      this.loginMp = false;
       uni.removeStorage({ key: STORAGE_KEY });
     }
   },
   getters: {
+    isLoginMp(state) {
+      return state.loginMp;
+    },
     isLogged(state) {
       return state.token != '' && state.userId != 0
     },