haiyang před 1 týdnem
rodič
revize
1afa902ff3

+ 6 - 0
src/App.vue

@@ -11,6 +11,12 @@ onShow((options) => {
     // 获取当前页面路径
     const pages = getCurrentPages()
     const currentPage = pages[pages.length - 1]
+
+    if (!currentPage) {
+        console.log('App.vue onShow: currentPage is undefined, skipping...')
+        return
+    }
+
     const currentPath = `/${currentPage.route}`
 
     // 如果当前已经是登录页,不触发拦截器

+ 0 - 9
src/api/coupon.ts

@@ -1,9 +0,0 @@
-import { API_DOMAINS, http } from '@/http/alova'
-
-export function getCouponList() {
-    return http.Get('/couponCenter/APP/couponTemplate/queryByType', {
-        meta: {
-            ignoreAuth: true,
-        },
-    })
-}

+ 22 - 0
src/api/home.ts

@@ -0,0 +1,22 @@
+import type { AccountCount, CouponList, CouponSituation } from '@/api/types/coupon'
+import { API_DOMAINS, http } from '@/http/alova'
+
+/**
+ *
+ * @returns 获取首页优惠券数据
+ */
+export function getCouponList() {
+    return http.Get<CouponList>('/couponCenter/APP/couponTemplate/queryByType', {
+        meta: {
+            ignoreAuth: true,
+        },
+    })
+}
+
+export function getAccountCount() {
+    return http.Get<AccountCount>('/couponCenter/APP/couponIssuerAccount/queryByUserId')
+}
+
+export function getCouponSituation() {
+    return http.Get<CouponSituation>('/couponCenter/APP/couponUserAsset/queryBySendUserId')
+}

+ 14 - 0
src/api/types/coupon.ts

@@ -0,0 +1,14 @@
+export interface CouponList {
+    discountCoupon: []
+    equityVoucher: []
+}
+
+export interface AccountCount {
+    balance: number
+}
+
+export interface CouponSituation {
+    usedQuantity: number
+    quantityToBeUsed: number
+    quantityForComplimentary: number
+}

+ 44 - 32
src/components/discountCoupon.vue

@@ -1,35 +1,38 @@
 <script lang="ts" setup>
 import CouponImg from '@img/index/coupon2.png'
-import { pathToBase64 } from 'image-tools'
-import { ref } from 'vue'
 
-const couponBgBase64 = ref('')
-
-// 将图片路径转换为base64格式
-async function convertImageToBase64() {
-    try {
-        // 转换首页背景图
-        couponBgBase64.value = await pathToBase64(CouponImg)
-
-        console.log('图片转换base64成功')
+const props = defineProps({
+    coupon: {
+        type: Object,
+        default: () => ({
+            ruleDiscountRate: '0',
+            ruleMinSpendAmount: '0',
+            relatedName: '',
+            ruleDiscountCapAmount: '0',
+            validityType: '1',
+        }),
+    }
+})
+const coupon = computed(() => props.coupon)
+const deadline = computed(() => {
+    const type = props.coupon.validityType
+    if (type === '1') {
+        return `自领取之日起${props.coupon.validDays}日内使用`
     }
-    catch (error) {
-        console.error('图片转换base64失败:', error)
+    else if (type === '2') {
+        return `限${props.coupon.validStartTime}到${props.coupon.validEndTime}日内使用`
     }
-}
-
-onLoad(async () => {
-    console.log('测试 uni API 自动引入: onLoad')
-    await convertImageToBase64()
+    return '长期有效'
 })
 </script>
 
 <template>
-    <view class="discount-coupon" :style="{ backgroundImage: `url(${couponBgBase64})` }">
+    <view class="discount-coupon">
+        <image class="coupon-bg" :src="CouponImg" mode="aspectFill" />
         <view class="discount-content">
             <view class="discount-amount">
                 <view class="discount-amount-number">
-                    8
+                    {{ coupon.ruleDiscountRate }}
                 </view>
                 <view class="discount-amount-unit">
@@ -37,15 +40,15 @@ onLoad(async () => {
             </view>
             <view class="discount-desc">
                 <view class="discount-desc-text">
-                    满100元可用
+                    满{{ coupon.ruleMinSpendAmount }}元可用
                 </view>
                 <view class="discount-desc-type">
-                    限汽车分类商品使用
+                    限{{ coupon.relatedName }}商品使用
                 </view>
             </view>
         </view>
         <view class="discount-desc-time">
-            自领取之日起七日内使用,最高优惠50
+            {{ deadline }},最高优惠{{ coupon.ruleDiscountCapAmount }}
         </view>
         <view class="discount-btn">
             <view>立即</view>
@@ -58,22 +61,30 @@ onLoad(async () => {
 .discount-coupon {
     width: 670rpx;
     height: 209rpx;
-    background-repeat: no-repeat;
-    background-position: right top;
-    background-size: cover;
     position: relative;
+    overflow: hidden;
+
+    .coupon-bg {
+        position: absolute;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        z-index: 0;
+    }
 
     .discount-content {
         height: 95rpx;
         position: absolute;
-        top: 38%;
+        top: 40%;
         left: 40%;
-        transform: translate(-50%, -50%);
+        transform: translate(-48%, -60%);
         display: flex;
         flex-direction: row;
         justify-content: center;
         align-items: center;
         gap: 30rpx;
+        z-index: 1;
 
         .discount-amount {
             display: flex;
@@ -121,12 +132,13 @@ onLoad(async () => {
 
     .discount-desc-time {
         position: absolute;
-        bottom: 5%;
+        bottom: 8%;
         left: 29%;
         transform: translate(-50%, -50%);
         font-weight: 400;
         font-size: 18rpx;
         color: #666666;
+        z-index: 1;
     }
 
     .discount-btn {
@@ -135,14 +147,14 @@ onLoad(async () => {
         font-size: 28rpx;
         color: #ffffff;
         top: 50%;
-        right: 20rpx;
-        transform: translate(-51%, -49%);
-
+        right: 3%;
+        transform: translate(-49%, -60%);
         display: flex;
         flex-direction: column;
         justify-content: center;
         align-items: center;
         gap: 10rpx;
+        z-index: 1;
     }
 }
 </style>

+ 25 - 6
src/components/spendAndSaveCoupon.vue

@@ -1,5 +1,14 @@
 <script lang="ts" setup>
-
+const props = defineProps({
+    coupon: {
+        type: Object,
+        default: () => ({
+            ruleReductionAmount: '0',
+            ruleMinSpendAmount: '0',
+        }),
+    }
+})
+const coupon = computed(() => props.coupon)
 </script>
 
 <template>
@@ -7,19 +16,20 @@
         <view class="coupon-content">
             <view class="coupon-amount">
                 <view class="coupon-amount-text">
-                    50
+                    {{ coupon.ruleReductionAmount }}
                 </view>
                 <view class="coupon-amount-icon">
                 </view>
             </view>
             <view class="coupon-desc">
-                满699元可用
+                满{{ coupon.ruleMinSpendAmount }}元可用
             </view>
         </view>
-        <view class="coupon-btn">
+
+        <button class="coupon-btn">
             去发券
-        </view>
+        </button>
     </view>
 </template>
 
@@ -85,7 +95,16 @@
         color: #f26e5f;
         bottom: 2rpx;
         left: 50%;
-        transform: translate(-54%, -55%);
+        transform: translate(-54%, 5%);
+        padding: 0;
+        background-color: transparent;
+        border: none;
+
+        &::after {
+            border: none;
+            position: unset;
+            height: inherit;
+        }
     }
 }
 </style>

+ 21 - 5
src/http/alova.ts

@@ -24,11 +24,13 @@ const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthenticati
     // 如果下面拦截不到,请使用 refreshTokenOnSuccess by 群友@琛
     refreshTokenOnError: {
         isExpired: (error) => {
+            console.log('error', error)
             return error.response?.status === ResultEnum.Unauthorized
         },
         handler: async () => {
             try {
                 // await authLogin();
+                console.log('拦截token失效')
             }
             catch (error) {
                 // 切换到登录页
@@ -46,10 +48,10 @@ const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthenticati
 const alovaInstance = createAlova({
     baseURL: API_DOMAINS.DEFAULT,
     ...AdapterUniapp(),
-    timeout: 5000,
+    // timeout: 7000,
     statesHook: VueHook,
 
-    beforeRequest: onAuthRequired((method) => {
+    beforeRequest: (method) => {
         // 设置默认 Content-Type
         method.config.headers = {
             ContentType: ContentTypeEnum.JSON,
@@ -81,9 +83,9 @@ const alovaInstance = createAlova({
             method.baseURL = config.meta.domain
             console.log('当前域名', method.baseURL)
         }
-    }),
+    },
 
-    responded: onResponseRefreshToken((response, method) => {
+    responded: (response, method) => {
         const { config } = method
         const { requestType } = config
         const {
@@ -99,6 +101,20 @@ const alovaInstance = createAlova({
 
         // 处理 HTTP 状态码错误
         if (statusCode !== 200) {
+            // 直接处理401错误,跳转到登录页面
+            if (statusCode === 401) {
+                uni.showToast({
+                    title: '登录已过期,请重新登录',
+                    icon: 'error',
+                    duration: 1500,
+                })
+                useTokenStore().cleanToken()
+                setTimeout(() => {
+                    toLoginPage({ mode: 'reLaunch' })
+                }, 1500)
+                throw new Error('登录已过期')
+            }
+
             const errorMessage = ShowMessage(statusCode) || `HTTP请求错误[${statusCode}]`
             console.error('errorMessage===>', errorMessage)
             uni.showToast({
@@ -122,7 +138,7 @@ const alovaInstance = createAlova({
         }
         // 处理成功响应,返回业务数据
         return data
-    }),
+    },
 })
 
 export const http = alovaInstance

+ 76 - 46
src/pages/index/index.vue

@@ -1,9 +1,10 @@
 <script lang="ts" setup>
 import couponBg from '@img/index/coupon-bg.png'
 import indexBg from '@img/index/index-bg.png'
-import { pathToBase64 } from 'image-tools'
+import { useRequest } from 'alova/client'
 import { storeToRefs } from 'pinia'
 import { ref, watch } from 'vue'
+import { getAccountCount, getCouponSituation } from '@/api/home'
 import DiscountCoupon from '@/components/discountCoupon.vue'
 import SpendAndSaveCoupon from '@/components/spendAndSaveCoupon.vue'
 import { useCouponStore } from '@/store/coupon'
@@ -22,38 +23,41 @@ definePage({
         navigationBarTitleText: '首页',
     },
 })
-const couponBgBase64 = ref(couponBg)
-const indexBgBase64 = ref(indexBg)
-const isLogin = ref(false)
 
 const tokenStore = useTokenStore()
 const { hasLogin } = storeToRefs(tokenStore)
 
 // 获取优惠券
 const couponStore = useCouponStore()
+const { couponList, discountVoucherList } = storeToRefs(couponStore)
 
-// 将图片路径转换为base64格式
-async function convertImageToBase64() {
-    try {
-        // 转换首页背景图
-        indexBgBase64.value = await pathToBase64(indexBg)
-
-        // 转换优惠券背景图
-        couponBgBase64.value = await pathToBase64(couponBg)
+// 获取首页收益
+const { send: getAccountCountRequest, data: accountCountData } = useRequest(getAccountCount, {
+    immediate: false,
+})
 
-        console.log('图片转换base64成功')
-    }
-    catch (error) {
-        console.error('图片转换base64失败:', error)
-    }
-}
+// 获取首页领券情况数据
+const { send: getCouponSituationRequest, data: couponSituationData } = useRequest(getCouponSituation, {
+    immediate: false,
+})
 
 onLoad(async () => {
-    await convertImageToBase64()
     // 获取优惠券
     couponStore.getCouponListByType()
 })
 
+onShow(() => {
+    // 登录后查询收益数据
+    if (hasLogin) {
+        getAccountCountRequest()
+        getCouponSituationRequest()
+    }
+})
+
+watch(() => couponSituationData, (newVal) => {
+    console.log('首页领券情况数据:', newVal)
+})
+
 // #ifdef MP-WEIXIN
 async function login() {
     const currentPage = getCurrentPages()[0]
@@ -82,24 +86,25 @@ getNavigationBarHeight()
 <template>
     <view class="home-container">
         <!-- 顶部区域 -->
-        <view class="home-header" :style="{ backgroundImage: `url('${indexBgBase64}')` }">
+        <view class="home-header">
+            <image class="home-header-bg" :src="indexBg" mode="aspectFill" />
+            <view class="absolute left-5 z-3 text-xl c-white" :style="{ top: `${navigationBarHeight - 39}px` }">
+                券中心
+            </view>
             <view class="home-header-avatar-info" :style="{ paddingTop: `${navigationBarHeight + 10}px` }">
-                <view class="absolute left-5 z-1 text-xl c-white" :style="{ top: `${navigationBarHeight - 39}px` }">
-                    券中心
-                </view>
                 <view class="home-header-balance">
                     我的收益(元)
                 </view>
                 <view class="home-header-balance-num">
                     <view class="home-header-balance-num-amount">
-                        7297491.08
+                        {{ accountCountData.balance || 0 }}
                     </view>
                 </view>
             </view>
             <view class="home-header-tips">
                 <view class="home-header-tips-item">
                     <view class="home-header-tips-item-num">
-                        115
+                        {{ couponSituationData?.usedQuantity || 0 }}
                     </view>
                     <view class="home-header-tips-item-des">
                         已核销
@@ -107,7 +112,7 @@ getNavigationBarHeight()
                 </view>
                 <view class="home-header-tips-item">
                     <view class="home-header-tips-item-num">
-                        68
+                        {{ couponSituationData?.quantityToBeUsed || 0 }}
                     </view>
                     <view class="home-header-tips-item-des">
                         未核销
@@ -115,7 +120,7 @@ getNavigationBarHeight()
                 </view>
                 <view class="home-header-tips-item">
                     <view class="home-header-tips-item-num">
-                        68
+                        {{ couponSituationData?.quantityForComplimentary || 0 }}
                     </view>
                     <view class="home-header-tips-item-des">
                         已发放
@@ -130,7 +135,8 @@ getNavigationBarHeight()
             </view>
         </view>
         <!-- 满减券 -->
-        <view class="home-header-coupon" :style="{ backgroundImage: `url('${couponBgBase64}')` }">
+        <view class="home-header-coupon">
+            <image class="home-header-coupon-bg" :src="couponBg" mode="aspectFill" />
             <view class="home-header-coupon-title">
                 <image class="home-header-coupon-title-icon" src="@img/index/icon1.png" mode="scaleToFill" />
                 <view class="home-header-coupon-title-text">
@@ -141,9 +147,9 @@ getNavigationBarHeight()
                 </view>
             </view>
             <view class="home-header-coupon-content">
-                <spend-and-save-coupon />
-                <spend-and-save-coupon />
-                <spend-and-save-coupon />
+                <template v-for="item in discountVoucherList" :key="item.id">
+                    <spend-and-save-coupon :coupon="item" />
+                </template>
             </view>
             <view class="home-header-coupon-btn">
                 <up-button class="home-header-coupon-btn-text" text="查看更多优惠券"
@@ -168,9 +174,9 @@ getNavigationBarHeight()
                 </view>
             </view>
             <view class="home-coupon-content">
-                <discount-coupon />
-                <discount-coupon />
-                <discount-coupon />
+                <template v-for="item in couponList" :key="item.id">
+                    <discount-coupon :coupon="item" />
+                </template>
             </view>
         </view>
     </view>
@@ -178,19 +184,25 @@ getNavigationBarHeight()
 
 <style lang="scss" scoped>
 .home-container {
-    font-family: Alibaba PuHuiTi;
-    min-height: 100vh;
     background-color: #f5f5f5;
     line-height: 1;
     position: relative;
 
     .home-header {
         height: 550rpx;
-        // background-image: url('@img/index/index-bg.png');
-        background-repeat: no-repeat;
-        background-position: -80px top;
-        background-size: 125% 200%;
-        box-sizing: border-box;
+        position: relative;
+        overflow: hidden;
+
+        .home-header-bg {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 125%;
+            height: 200%;
+            object-fit: cover;
+            transform: translate(-80px, 0);
+            z-index: 0;
+        }
 
         .home-header-avatar-info {
             display: flex;
@@ -199,6 +211,8 @@ getNavigationBarHeight()
             text-align: center;
             gap: 30rpx;
             padding: 0 24rpx;
+            position: relative;
+            z-index: 1;
 
             .home-header-balance {
                 font-weight: 400;
@@ -245,9 +259,10 @@ getNavigationBarHeight()
         .home-header-tips {
             height: 124rpx;
             display: flex;
-            // background: linear-gradient(114deg, #f67873, #fb847f, #f67873);
             border-radius: 10rpx;
             margin: 47rpx 24rpx 0 24rpx;
+            position: relative;
+            z-index: 1;
 
             .home-header-tips-item {
                 flex: 1;
@@ -298,6 +313,7 @@ getNavigationBarHeight()
             background-color: rgba(255, 255, 255, 0.1);
             backdrop-filter: blur(25rpx);
             -webkit-backdrop-filter: blur(25rpx);
+            z-index: 2;
 
             .home-hidden-img {
                 width: 209rpx;
@@ -317,17 +333,27 @@ getNavigationBarHeight()
     // 优惠券
     .home-header-coupon {
         position: relative;
-        background-repeat: no-repeat;
-        background-position: right top;
-        background-size: 100% auto;
         height: 419rpx;
-        margin: -75rpx 20rpx 20rpx 20rpx;
+        margin: -58rpx 20rpx 20rpx 20rpx;
         gap: 20rpx;
         padding: 28rpx 20rpx;
+        overflow: hidden;
+        z-index: 3;
+
+        .home-header-coupon-bg {
+            position: absolute;
+            top: 0;
+            right: 0;
+            width: 100%;
+            object-fit: cover;
+            z-index: 0;
+        }
 
         .home-header-coupon-title {
             display: flex;
             flex-direction: row;
+            position: relative;
+            z-index: 1;
 
             .home-header-coupon-title-icon {
                 width: 38rpx;
@@ -358,10 +384,14 @@ getNavigationBarHeight()
             flex-direction: row;
             align-items: flex-end;
             gap: 20rpx;
+            position: relative;
+            z-index: 1;
         }
 
         .home-header-coupon-btn {
             padding: 21rpx 70rpx 22px 69rpx;
+            position: relative;
+            z-index: 1;
 
             .home-header-coupon-btn-text {
                 box-shadow: 0rpx 4rpx 7rpx 0rpx rgba(230, 77, 13, 0.17);

+ 3 - 2
src/store/coupon.ts

@@ -1,5 +1,5 @@
 import { defineStore } from 'pinia'
-import { getCouponList } from '@/api/coupon'
+import { getCouponList } from '@/api/home'
 
 export const useCouponStore = defineStore('coupon', {
     state: () => ({
@@ -9,7 +9,8 @@ export const useCouponStore = defineStore('coupon', {
     actions: {
         async getCouponListByType() {
             const res = await getCouponList()
-            console.log(res)
+            this.discountVoucherList = res.discountCoupon || []
+            this.couponList = res.equityVoucher || []
         }
     }
 })

+ 43 - 34
src/store/token.ts

@@ -55,8 +55,8 @@ export const useTokenStore = defineStore(
         }
 
         /**
-                                                                     * 判断token是否过期
-                                                                     */
+                                                                         * 判断token是否过期
+                                                                         */
         const isTokenExpired = computed(() => {
             if (!tokenInfo.value) {
                 return true
@@ -71,8 +71,8 @@ export const useTokenStore = defineStore(
         })
 
         /**
-                                                                     * 判断refreshToken是否过期
-                                                                     */
+                                                                         * 判断refreshToken是否过期
+                                                                         */
         const isRefreshTokenExpired = computed(() => {
             if (!isDoubleTokenMode)
                 return true
@@ -86,9 +86,9 @@ export const useTokenStore = defineStore(
         })
 
         /**
-                                                                     * 登录成功后处理逻辑
-                                                                     * @param tokenInfo 登录返回的token信息
-                                                                     */
+                                                                         * 登录成功后处理逻辑
+                                                                         * @param tokenInfo 登录返回的token信息
+                                                                         */
         async function _postLogin(tokenInfo: IAuthLoginRes) {
             setTokenInfo(tokenInfo)
             // const userStore = useUserStore()
@@ -96,12 +96,12 @@ export const useTokenStore = defineStore(
         }
 
         /**
-                                                                     * 用户登录
-                                                                     * 有的时候后端会用一个接口返回token和用户信息,有的时候会分开2个接口,一个获取token,一个获取用户信息
-                                                                     * (各有利弊,看业务场景和系统复杂度),这里使用2个接口返回的来模拟
-                                                                     * @param loginForm 登录参数
-                                                                     * @returns 登录结果
-                                                                     */
+                                                                         * 用户登录
+                                                                         * 有的时候后端会用一个接口返回token和用户信息,有的时候会分开2个接口,一个获取token,一个获取用户信息
+                                                                         * (各有利弊,看业务场景和系统复杂度),这里使用2个接口返回的来模拟
+                                                                         * @param loginForm 登录参数
+                                                                         * @returns 登录结果
+                                                                         */
         const login = async (loginForm: ILoginForm) => {
             try {
                 const res = await _login(loginForm)
@@ -124,11 +124,11 @@ export const useTokenStore = defineStore(
         }
 
         /**
-                                                                     * 微信登录
-                                                                     * 有的时候后端会用一个接口返回token和用户信息,有的时候会分开2个接口,一个获取token,一个获取用户信息
-                                                                     * (各有利弊,看业务场景和系统复杂度),这里使用2个接口返回的来模拟
-                                                                     * @returns 登录结果
-                                                                     */
+                                                                         * 微信登录
+                                                                         * 有的时候后端会用一个接口返回token和用户信息,有的时候会分开2个接口,一个获取token,一个获取用户信息
+                                                                         * (各有利弊,看业务场景和系统复杂度),这里使用2个接口返回的来模拟
+                                                                         * @returns 登录结果
+                                                                         */
         const wxLogin = async () => {
             try {
                 // 获取用户信息
@@ -157,8 +157,8 @@ export const useTokenStore = defineStore(
         }
 
         /**
-                                                                     * 退出登录 并 删除用户信息
-                                                                     */
+                                                                         * 退出登录 并 删除用户信息
+                                                                         */
         const logout = async () => {
             try {
                 // TODO 实现自己的退出登录逻辑
@@ -180,10 +180,18 @@ export const useTokenStore = defineStore(
             }
         }
 
+        const cleanToken = () => {
+            uni.removeStorageSync('accessTokenExpireTime')
+            uni.removeStorageSync('refreshTokenExpireTime')
+            console.log('退出登录-清除用户信息')
+            tokenInfo.value = { ...tokenInfoState }
+            uni.removeStorageSync('token')
+        }
+
         /**
-                                                                     * 刷新token
-                                                                     * @returns 刷新结果
-                                                                     */
+                                                                         * 刷新token
+                                                                         * @returns 刷新结果
+                                                                         */
         const refreshToken = async () => {
             if (!isDoubleTokenMode) {
                 console.error('单token模式不支持刷新token')
@@ -209,10 +217,10 @@ export const useTokenStore = defineStore(
         }
 
         /**
-                                                                     * 获取有效的token
-                                                                     * 注意:在computed中不直接调用异步函数,只做状态判断
-                                                                     * 实际的刷新操作应由调用方处理
-                                                                     */
+                                                                         * 获取有效的token
+                                                                         * 注意:在computed中不直接调用异步函数,只做状态判断
+                                                                         * 实际的刷新操作应由调用方处理
+                                                                         */
         const getValidToken = computed(() => {
             // token已过期,返回空
             if (isTokenExpired.value) {
@@ -228,8 +236,8 @@ export const useTokenStore = defineStore(
         })
 
         /**
-                                                                     * 检查是否有登录信息(不考虑token是否过期)
-                                                                     */
+                                                                         * 检查是否有登录信息(不考虑token是否过期)
+                                                                         */
         const hasLoginInfo = computed(() => {
             if (!tokenInfo.value) {
                 return false
@@ -243,17 +251,17 @@ export const useTokenStore = defineStore(
         })
 
         /**
-                     * 检查是否已登录且token有效
-                     */
+                         * 检查是否已登录且token有效
+                         */
         const hasValidLogin = computed(() => {
             console.log('hasValidLogin', hasLoginInfo.value && !isTokenExpired.value, hasLoginInfo.value, !isTokenExpired.value)
             return hasLoginInfo.value && !isTokenExpired.value
         })
 
         /**
-                 * 尝试获取有效的token,如果过期且可刷新,则刷新token
-                 * @returns 有效的token或空字符串
-                 */
+                     * 尝试获取有效的token,如果过期且可刷新,则刷新token
+                     * @returns 有效的token或空字符串
+                     */
         const tryGetValidToken = async (): Promise<string> => {
             if (!getValidToken.value && isDoubleTokenMode && !isRefreshTokenExpired.value) {
                 try {
@@ -285,6 +293,7 @@ export const useTokenStore = defineStore(
             // 调试或特殊场景可能需要直接访问的信息
             tokenInfo,
             setTokenInfo,
+            cleanToken
         }
     },
     {

+ 0 - 23
src/tabbar/index.vue

@@ -131,29 +131,6 @@ function getImageByIndex(index: number, item: CustomTabBarItem) {
                     </view>
                 </view>
             </view>
-            <!-- <up-tabbar
-        class="text-20px"
-        :value="tabbarStore.curIdx"
-        :safe-area-inset-bottom="true"
-        :fixed="true"
-        @change="(index) => handleClick(index)"
-      >
-        <template v-for="(item, index) in tabbarList" :key="index">
-          <up-tabbar-item :text="item.text">
-            <template #active-icon>
-              <template v-if="item.iconType === 'unocss' || item.iconType === 'iconfont'">
-                <view :class="item.icon" />
-              </template>
-            </template>
-            <template #inactive-icon>
-              <template v-if="item.iconType === 'unocss' || item.iconType === 'iconfont'">
-                <view :class="item.icon" />
-              </template>
-              <image :src="getImageByIndex(index, item)" mode="scaleToFill" class="h-20px w-20px" />
-            </template>
-          </up-tabbar-item>
-        </template>
-      </up-tabbar> -->
 
             <view class="pb-safe" />
         </view>