Bläddra i källkod

兼容体验会员

shmily1213 1 månad sedan
förälder
incheckning
fbb5f2e5a1
4 ändrade filer med 23 tillägg och 2 borttagningar
  1. 13 0
      src/common/enum.ts
  2. 4 0
      src/pagesMain/pages/me/components/me-info.vue
  3. 4 1
      src/store/userStore.ts
  4. 2 1
      src/types/user.ts

+ 13 - 0
src/common/enum.ts

@@ -291,4 +291,17 @@ export enum EnumEvent {
    * 打开VIP弹窗
    */
   OPEN_VIP_POPUP = 'OPEN_VIP_POPUP'
+}
+
+/**
+ * 卡类型
+ */
+export enum CardType {
+  VIP = 1,
+  DEPT = 2,
+  PLATFORM = 6,
+  /**
+   * 体验卡
+   */
+  EXPERIENCE = 9
 }

+ 4 - 0
src/pagesMain/pages/me/components/me-info.vue

@@ -53,12 +53,16 @@ const nickName = computed(() => userStore.nickName);
 const phonenumber = computed(() => userStore.anonymousPhoneNumber);
 const isVip = computed(() => userStore.isVip);
 const isLogin = computed(() => userStore.isLogin);
+const isExperienceVip = computed(() => userStore.isExperienceVip);
 const vipInfo = computed(() => userStore.vipInfo);
 const roleDesc = computed(() => {
   if (isLogin.value && !isVip && !userStore.isStudent) {
     return '普通会员';
   }
   if (isVip.value) {
+    if (isExperienceVip.value) {
+      return '体验会员';
+    }
     return 'VIP会员';
   }
   if (userStore.isAgent) {

+ 4 - 1
src/store/userStore.ts

@@ -11,7 +11,7 @@ import defaultAvatar from '@/static/personal/avatar_default.png'
 
 // @ts-ignore
 import { useUserStore as useOldUserStore } from '@/hooks/useUserStore';
-import { EnumReviewMode, EnumUserType } from '@/common/enum';
+import { CardType, EnumReviewMode, EnumUserType } from '@/common/enum';
 import { OPEN_VIP_POPUP } from '@/types/injectionSymbols';
 import { getDirectedSchool, saveDirectedSchool } from '@/api/modules/study';
 const oldUserStore = useOldUserStore()
@@ -66,6 +66,9 @@ export const useUserStore = defineStore('ie-user', {
     isVip(): boolean {
       return !!this.userInfo.cardId;
     },
+    isExperienceVip(): boolean {
+      return this.card?.type === CardType.EXPERIENCE;
+    },
     vipInfo(state: UserStoreState): VipCardInfo {
       if (state.card) {
         return state.card;

+ 2 - 1
src/types/user.ts

@@ -1,4 +1,4 @@
-import { EnumExamType, EnumSmsType, EnumUserType } from "@/common/enum";
+import { CardType, EnumExamType, EnumSmsType, EnumUserType } from "@/common/enum";
 
 export interface LoginInfo {
   accessToken: string;
@@ -169,6 +169,7 @@ export interface VipCardInfo {
   year: number; // 入学年份
   endYear: number; // 毕业年份
   outDate: string; // 到期时间
+  type: CardType;
 }
 
 export type UserRole = 'vip' | 'normal' | 'guest' | 'teacher' | 'agent' | 'auditor'