From 4d038dbaf924458a1ce8811be9c75f3754618e11 Mon Sep 17 00:00:00 2001 From: zhouyanli <593579392@qq.com> Date: Tue, 4 Aug 2026 08:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huakai-app/pageSubPack/api/request.js | 15 +-- huakai-app/pages.json | 92 +++++++++--------- .../pages/paymentIndex/paymentIndex.vue | 97 ++----------------- 3 files changed, 56 insertions(+), 148 deletions(-) diff --git a/huakai-app/pageSubPack/api/request.js b/huakai-app/pageSubPack/api/request.js index 5a2e252..1f0df05 100644 --- a/huakai-app/pageSubPack/api/request.js +++ b/huakai-app/pageSubPack/api/request.js @@ -3,7 +3,7 @@ if (process.env.NODE_ENV === 'development') { // baseUrl = 'https://wuyeapi.ckdzkj.com'; // 开发环境 baseUrl = "http://192.168.1.222:8080" } else { - baseUrl = 'https://wuyeapi.bugtc.com'; // 生产环境 + baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境 } /** @@ -42,21 +42,10 @@ export default function request(url, data = {}, method = "GET") { const resData = res.data || {}; - // token 过期 — 清除登录态,提示用户,但不强制跳转(用户可继续浏览非敏感页面) + // token 过期 — 静默清除登录态,不强制跳转登录页 if (resData.code === 401) { - uni.showToast({ title: '登录已过期,请重新登录', icon: 'none', duration: 2000 }); uni.removeStorageSync('token'); uni.removeStorageSync('userId'); - // 使用 navigateTo 而非 reLaunch,用户可通过返回按钮退出登录页 - setTimeout(() => { - uni.navigateTo({ - url: '/pageSubPack/loginSub/pwd-login', - fail: () => { - // 如果 navigateTo 失败(如页面栈满),则用 reLaunch - uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' }); - } - }); - }, 1500); reject({ msg: '登录过期', code: 401 }); return; } diff --git a/huakai-app/pages.json b/huakai-app/pages.json index 1c1575b..97fdb16 100644 --- a/huakai-app/pages.json +++ b/huakai-app/pages.json @@ -8,52 +8,52 @@ } ], "subPackages": [ - { - "root": "pageSubPack/loginSub", - "pages": [ - { - "path": "register-new-user", - "style": { - "navigationBarTitleText": "注册新用户", - "navigationStyle": "custom" - } - }, - { - "path": "pwd-login", - "style": { - "navigationBarTitleText": "账号密码登录", - "navigationStyle": "custom" - } - }, - { - "path": "login", - "style": { - "navigationBarTitleText": "验证码登录", - "navigationStyle": "custom" - } - }, - { - "path": "forget-pwd", - "style": { - "navigationBarTitleText": "忘记密码", - "navigationStyle": "custom" - } - }, - { - "path": "change-pwd", - "style": { - "navigationBarTitleText": "修改密码", - "navigationStyle": "custom" - } - }, - { - "path": "privacy", - "style": { - "navigationBarTitleText": "用户隐私政策" - } - } - ] - }, + // { + // "root": "pageSubPack/loginSub", + // "pages": [ + // { + // "path": "register-new-user", + // "style": { + // "navigationBarTitleText": "注册新用户", + // "navigationStyle": "custom" + // } + // }, + // { + // "path": "pwd-login", + // "style": { + // "navigationBarTitleText": "账号密码登录", + // "navigationStyle": "custom" + // } + // }, + // { + // "path": "login", + // "style": { + // "navigationBarTitleText": "验证码登录", + // "navigationStyle": "custom" + // } + // }, + // { + // "path": "forget-pwd", + // "style": { + // "navigationBarTitleText": "忘记密码", + // "navigationStyle": "custom" + // } + // }, + // { + // "path": "change-pwd", + // "style": { + // "navigationBarTitleText": "修改密码", + // "navigationStyle": "custom" + // } + // }, + // { + // "path": "privacy", + // "style": { + // "navigationBarTitleText": "用户隐私政策" + // } + // } + // ] + // }, { "root": "pageSubPack/payment-list", "pages": [ diff --git a/huakai-app/pages/paymentIndex/paymentIndex.vue b/huakai-app/pages/paymentIndex/paymentIndex.vue index f8ff4e8..439b110 100644 --- a/huakai-app/pages/paymentIndex/paymentIndex.vue +++ b/huakai-app/pages/paymentIndex/paymentIndex.vue @@ -9,15 +9,8 @@ - - - - - + + { if (!isLogin.value) return; try { @@ -126,19 +119,13 @@ // ===== 生命周期 ===== onLoad(() => { refreshLoginState(); - if (isLogin.value) { - postOpenId(); - // 检查是否由 App 跳转而来,携带了支付参数 - checkAppLaunchPayment(); - // getPayList(); - } + postOpenId(); + // 检查是否由 App 跳转而来,携带了支付参数 + checkAppLaunchPayment(); }); onShow(() => { refreshLoginState(); - if (isLogin.value) { - // getPayList(); - } }); // ===== App 跳转支付:检测 extraData 并直接进入支付页 ===== @@ -158,63 +145,21 @@ uni.redirectTo({ url: "/pages/arrearsPayment/arrearsPayment" }) } - // ===== 点击事件(统一用 isLogin 判断) ===== - - // 点击"去登录"提示条 - const handleLoginPrompt = () => { - if (isLogin.value) return; - requireAuth({ - title: '查看缴费账单', - onLoggedIn: () => { - refreshLoginState(); - // getPayList(); - } - }); - }; + // ===== 点击事件 ===== // 点击账单明细 const goToBill = (item) => { - if (!isLogin.value) { - requireAuth({ - title: '查看缴费详情', - onLoggedIn: () => { - refreshLoginState(); - goToBill(item); - } - }); - return; - } uni.setStorageSync('arrearsPayment', item) uni.redirectTo({ url: '/pages/arrearsPayment/arrearsPayment' }) }; // 点击缴费记录 const goToRecord = () => { - if (!isLogin.value) { - requireAuth({ - title: '查看缴费记录', - onLoggedIn: () => { - refreshLoginState(); - goToRecord(); - } - }); - return; - } uni.redirectTo({ url: '/pageSubPack/payment-list/paymentRecord' }) }; // 点击新增缴费(水表/电表等) const goToAdd = (type) => { - if (!isLogin.value) { - requireAuth({ - title: '新增缴费', - onLoggedIn: () => { - refreshLoginState(); - goToAdd(type); - } - }); - return; - } if (type.name == '燃气' || type.name == '暖气') { uni.redirectTo({ url: '/pageSubPack/payment-list/selectPaymentEntity' }) } else if (type.name == '水表' || type.name == '电表') { @@ -272,32 +217,6 @@ bottom: -140rpx; } - /* ===== 未登录提示条 ===== */ - .login-tip { - display: flex; - align-items: center; - background-color: #fff; - padding: 24rpx 30rpx; - border-radius: 10rpx; - margin-bottom: 30rpx; - box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05); - } - .login-tip-icon { - width: 40rpx; - height: 40rpx; - margin-right: 16rpx; - } - .login-tip-text { - flex: 1; - font-size: 28rpx; - color: #666; - } - .login-tip-link { - font-size: 28rpx; - color: #1677ff; - font-weight: 500; - } - .bill-list { margin-bottom: 40rpx; background-color: #fff;