From 16016b924897a010c684a777c159c84f62d42510 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Mon, 17 Oct 2022 16:59:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E4=B8=8D=E8=87=AA=E5=8A=A8=E9=80=80=E5=87=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coupon/details.html | 17 ++++++++++++----- coupon/myCoupon.html | 17 ++++++++++++----- coupon/myOrder.html | 7 +++++-- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/coupon/details.html b/coupon/details.html index 84a3d36..b6c00a3 100644 --- a/coupon/details.html +++ b/coupon/details.html @@ -346,15 +346,21 @@ } if (this.isLogin) { - /*跳转起始页面*/ - let entryLink = localStorage.getItem('entryLink'); - setTimeout(() => { - window.location.replace(entryLink); - }, 3000); + this.delayedOut() } }, + /* 延时自动退出 */ + delayedOut (time = 1) { + let entryLink = localStorage.getItem('entryLink'); + setTimeout(() => { + window.location.replace(entryLink); + }, time * 1000); + }, + + + //兑换商品 exchangeGoodsFn () { if (this.goodsDetail.type === 1) { /* 兑换码 */ @@ -433,6 +439,7 @@ } else { this.openErrorDialog(res.message); if (res.code == 403) { + this.delayedOut(3) this.isLogin = true } } diff --git a/coupon/myCoupon.html b/coupon/myCoupon.html index f56b823..5089420 100644 --- a/coupon/myCoupon.html +++ b/coupon/myCoupon.html @@ -156,13 +156,18 @@ /* 重定向 */ backFunction () { if (this.redirect) { - let entryLink = localStorage.getItem('entryLink'); - setTimeout(() => { - window.location.replace(entryLink); - }, 1000); + this.delayedOut() } }, + /* 延时自动退出 */ + delayedOut (time = 1) { + let entryLink = localStorage.getItem('entryLink'); + setTimeout(() => { + window.location.replace(entryLink); + }, time * 1000); + }, + /* 请求数据 */ getCouponList () { const token = localStorage.getItem('token') @@ -179,7 +184,9 @@ this.popText = message this.popStatus = 2 this.popShow = true - return this.redirect = true + this.redirect = true + this.delayedOut(3) + return } if (code === 200) { const productArray = [] diff --git a/coupon/myOrder.html b/coupon/myOrder.html index ad5e626..c4982a5 100644 --- a/coupon/myOrder.html +++ b/coupon/myOrder.html @@ -208,6 +208,7 @@ req.axiosPut(`/key/order/setPayType/${this.activeOrder.order_number}/${this.active}`).then(({ code, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) return this.redirect = true } @@ -226,6 +227,7 @@ req.axiosGet(`/key/coupon/createPay/${this.activeOrder.order_number}`).then(({ code, data, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) return this.redirect = true } @@ -260,6 +262,7 @@ req.axiosGet(`/key/order/${token}`, { page: this.page, limit: this.limit }).then(({ data, code, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) return this.redirect = true } if (code === 200) { @@ -272,11 +275,11 @@ }, /*跳转起始页面*/ - toPage () { + toPage (time = 1) { let entryLink = localStorage.getItem('entryLink'); setTimeout(() => { window.location.replace(entryLink); - }, 1000); + }, time * 1000); }, /* 弹窗回调 */