panhui 3 yıl önce
ebeveyn
işleme
189da62cf0

+ 6 - 1
src/components/common/UserAvatar.vue

@@ -57,7 +57,12 @@ function goVip() {
                     {{ userInfo.name ?? 'ChenZhaoYu' }}
                 </h2>
                 <img class="h-[18px] block ml-1" v-if="isVip" src="@/assets/vip-icon.png" alt="" />
-                <img class="h-[18px] block ml-1" v-else-if="!!userMemberStore.userMember.expireAt" src="@/assets/vip-not-icon.png" alt="" />
+                <img
+                    class="h-[18px] block ml-1"
+                    v-else-if="userMemberStore.userMember.memberType == 'PAID'"
+                    src="@/assets/vip-not-icon.png"
+                    alt=""
+                />
             </div>
             <p class="overflow-hidden text-xs text-ellipsis whitespace-nowrap text-left" v-if="isVip">
                 <span>{{ userMemberStore.getExpireAt() }}</span>

+ 15 - 2
src/main.ts

@@ -45,8 +45,7 @@ if (query.code) {
                     desc: '人工智能技术驱动的自然语言处理工具',
                     link: location.origin + '/ui',
                     imgUrl: 'https://cdn.raex.vip/image/2023-04-20-19-12-26ndDGBmTC.png',
-                    success: function () {
-                    }
+                    success: function () {}
                 })
                 wx.updateTimelineShareData({
                     title: 'ChillGPT——人工智能技术驱动的自然语言处理工具',
@@ -54,6 +53,20 @@ if (query.code) {
                 })
             })
         })
+        .catch(e => {
+            if (e.message === 'code been used') {
+                if (isWechat) {
+                    fetchRedirectUrl().then(res => {
+                        const str = String(res).replace(
+                            /redirect_uri=undefined/g,
+                            'redirect_uri=' + encodeURIComponent(resolveUrl(baseURL, '#/home'))
+                        )
+
+                        window.location.href = str
+                    })
+                }
+            }
+        })
 } else if (isWechat) {
     fetchRedirectUrl().then(res => {
         const str = String(res).replace(

+ 3 - 1
src/store/modules/memberShip/helper.ts

@@ -15,6 +15,7 @@ export interface UserMember {
     planId?: number | null
     expireAt: any
     createdAt: any
+    memberType: string | null
 }
 
 export interface UserMemberState {
@@ -25,7 +26,8 @@ export function defaultSetting(): UserMemberState {
     return {
         userMember: {
             expireAt: '2023-04-19T09:04:21.332Z',
-            createdAt: '2023-04-19T09:04:21.332Z'
+            createdAt: '2023-04-19T09:04:21.332Z',
+            memberType: 'TRIAL'
         }
     }
 }

+ 1 - 1
src/store/modules/memberShip/index.ts

@@ -41,7 +41,7 @@ export const useUserMemberStore = defineStore('userMember-store', {
         },
 
         isVip() {
-            if (this.userMember.expireAt) {
+            if (this.userMember.memberType!=='TRIAL') {
                 return isAfter(new Date(this.userMember.expireAt), new Date())
             }
             return false