Bläddra i källkod

页面跳转判断校验

hy 1 vecka sedan
förälder
incheckning
ff0c55750f
2 ändrade filer med 24 tillägg och 17 borttagningar
  1. 9 0
      pnpm-lock.yaml
  2. 15 17
      src/pages/my/my.vue

+ 9 - 0
pnpm-lock.yaml

@@ -84,6 +84,9 @@ importers:
       js-cookie:
         specifier: ^3.0.5
         version: 3.0.5
+      lz-string:
+        specifier: ^1.5.0
+        version: 1.5.0
       mescroll-uni:
         specifier: ^1.3.7
         version: 1.3.7
@@ -4543,6 +4546,10 @@ packages:
   lru-queue@0.1.0:
     resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==}
 
+  lz-string@1.5.0:
+    resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
+    hasBin: true
+
   magic-string@0.30.18:
     resolution: {integrity: sha512-yi8swmWbO17qHhwIBNeeZxTceJMeBvWJaId6dyvTSOwTipqeHhMhOrz6513r1sOKnpvQ7zkhlG8tPrpilwTxHQ==}
 
@@ -12107,6 +12114,8 @@ snapshots:
     dependencies:
       es5-ext: 0.10.64
 
+  lz-string@1.5.0: {}
+
   magic-string@0.30.18:
     dependencies:
       '@jridgewell/sourcemap-codec': 1.5.5

+ 15 - 17
src/pages/my/my.vue

@@ -1,7 +1,7 @@
 <script lang="ts" setup>
 import { useRequest } from 'alova/client'
 import { storeToRefs } from 'pinia'
-import { computed, ref } from 'vue'
+import { computed, ref,watch } from 'vue'
 import { getCouponSituation } from '@/api/home'
 import { getCouponIssuerApplyById, getShareState } from '@/api/me'
 import { useShare } from '@/hooks/useShare'
@@ -34,10 +34,6 @@ const { send: getShareStateRequest, data: shareStateData, loading: shareStateLoa
     immediate: false,
 })
 
-// 发卷人查询审核状态
-const { send: getCouponIssuerApplyByIdRequest, data: couponIssuerApplyByIdData } = useRequest(getCouponIssuerApplyById, {
-    immediate: false,
-})
 // 昵称输入值
 const nicknameInput = ref('')
 onShow(async () => {
@@ -47,11 +43,6 @@ onShow(async () => {
         await getCouponSituationRequest({ queryType: 'time' })
         await getShareStateRequest()
         deadline.value = Date.now()
-        await getCouponIssuerApplyByIdRequest()
-        if (couponIssuerApplyByIdData.value?.status === '0') {
-            console.log('优惠券统计数据:', couponSituationData.value)
-            // open()
-        }
     }
 })
 
@@ -122,10 +113,6 @@ async function menuClick(page, otherJs?: () => Promise<boolean>) {
             return
         }
     }
-    if (couponIssuerApplyByIdData.value?.status === '0') {
-        open()
-        return
-    }
     uni.navigateTo({
         url: `/pages-A/${page}/index?couponSituation=${JSON.stringify(couponSituationData.value)}`,
     })
@@ -134,13 +121,14 @@ async function menuClick(page, otherJs?: () => Promise<boolean>) {
 // 判断是否是发券人
 function isCouponIssuer(currentPage?: string) {
     // 发券人相关页面
-    const validPages = ['myInviter']
+    const validPages = ['myInviter', 'shareFriend', 'invitePage']
+    console.log('111111111111')
     // 判断跳转页面是否是发券人相关页面
     if (!validPages.includes(currentPage)) {
         return Promise.resolve(true)
     }
     // 是否已经成为发券人
-    if (userStore.isPassIssuer) {
+    if (userStore.isPassIssuer()) {
         return Promise.resolve(true)
     }
     else {
@@ -153,6 +141,16 @@ function isCouponIssuer(currentPage?: string) {
     }
 }
 
+//展开弹窗
+function watchUserStatus() {
+    if (userInfo.value.status === '0') {
+        open();
+        return Promise.resolve(false)
+    }
+    return Promise.resolve(true)  
+    
+}
+
 async function getInviteInfo(currentPage?: string) {
     const isCouponIssuerRes = await isCouponIssuer(currentPage)
     if (!isCouponIssuerRes) {
@@ -291,7 +289,7 @@ onShareTimeline(async () => {
             </view>
             <!-- 菜单 -->
             <view class="me-header-menu">
-                <view class="me-header-menu-item" @click="menuClick('applyForm')">
+                <view class="me-header-menu-item" @click="menuClick('applyForm',watchUserStatus)">
                     <view class="me-header-menu-icon">
                         <image :src="getImageUrl('@img/me/coupon-need.png')" mode="aspectFill" />
                         <view class="me-header-menu-text">