diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index 5e4a32e..47e2e72 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -14,15 +14,15 @@ - + {{ userInfo?.nickName || '点击注册会员' }} - + {{ userInfo?.integration || 0 }} 积分 - + {{ userInfo?.balance || 0 }} 余额(元) @@ -33,12 +33,12 @@ - + 会员充值 - + 优惠券 diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index 17e8349..831220a 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -136,15 +136,17 @@ onLoad(() => { }); onShow(async () => { - const { list } = await getOrderList({ - pageNum: 1, - pageSize: 9999, - obj: { payStatus: 1 } - }); - unPaidOrderCount.value = list.filter((item: any) => isPending(item))?.length || 0; - const { cardurl } = await getCardLink(); - cardLink.value = cardurl; - await userStore.getProfile(); + if(isLogin()) { + const { list } = await getOrderList({ + pageNum: 1, + pageSize: 9999, + obj: { payStatus: 1 } + }); + unPaidOrderCount.value = list.filter((item: any) => isPending(item))?.length || 0; + const { cardurl } = await getCardLink(); + cardLink.value = cardurl; + await userStore.getProfile(); + } }); const openCard = () => { @@ -173,7 +175,7 @@ const gotoPath = (path: string) => { phoneNumber: companyInfo.value.telphone }); } else { - goPath(path); + goPath(path, true); } }; diff --git a/src/pages/qrcode/index.vue b/src/pages/qrcode/index.vue index 5d38acb..1a0eb2d 100644 --- a/src/pages/qrcode/index.vue +++ b/src/pages/qrcode/index.vue @@ -11,7 +11,7 @@ 账户余额:{{ userInfo?.balance || 0 }}元 - + 去充值 @@ -36,7 +36,6 @@ 店铺名称({{ userInfo?.creatorName }}) {{ userInfo?.storeId }} - diff --git a/src/permission.ts b/src/permission.ts index 4d899f3..f82b16c 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -25,11 +25,12 @@ list.forEach((item) => { return true; } else { - if (checkWhite(to.url)) - return true; - - uni.reLaunch({ url: loginPage }); - return false; + // if (checkWhite(to.url)) + // return true; + // + // uni.reLaunch({ url: loginPage }); + // return false; + return true; } }, fail(err) { diff --git a/src/utils/common/index.ts b/src/utils/common/index.ts index b54aba9..708812e 100644 --- a/src/utils/common/index.ts +++ b/src/utils/common/index.ts @@ -1,5 +1,7 @@ // 小程序更新检测 +import { isLogin } from '@/utils'; + export function mpUpdate() { const updateManager = uni.getUpdateManager(); updateManager.onCheckForUpdate((res) => { @@ -50,7 +52,20 @@ export function showToast(title: string, { icon, duration, complete }: ToastOpti }); } -export function goPath(path: string) { +export function goPath(path: string, needAuth: boolean = false) { + if(needAuth && !isLogin()) { + uni.showModal({ + title: '提示', + content: '您还未登录,请先登录', + showCancel: true, + success: (res) => { + if(res.confirm) { + goLogin(); + } + } + }); + return; + } if(path.includes('home/index') || path.includes('mall/index') || path.includes('qrcode/index') || path.includes('mine/index')) { uni.switchTab({ url: path diff --git a/src/utils/request/interceptors.ts b/src/utils/request/interceptors.ts index f9b520a..c7312fc 100644 --- a/src/utils/request/interceptors.ts +++ b/src/utils/request/interceptors.ts @@ -86,7 +86,14 @@ function responseInterceptors() { // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示 if(custom?.toast !== false) { - uni.$u.toast(data.message || data.retinfo); + if(data?.retinfo?.includes('未登录') + || data?.retinfo?.includes('未登陆') + || data.message?.includes('未登录') + || data.message?.includes('未登陆')) { + getApp()?.globalData?.logger.error('未登录'); + } else { + uni.$u.toast(data.message || data.retinfo); + } } // 如果需要catch返回,则进行reject