diff --git a/pages/assets/bmt-sign-agreement.vue b/pages/assets/bmt-sign-agreement.vue index 02a8693..7e99a4a 100644 --- a/pages/assets/bmt-sign-agreement.vue +++ b/pages/assets/bmt-sign-agreement.vue @@ -34,7 +34,9 @@ 恭喜签约完成 - 完成 + + {{ countdown > 0 ? `完成(${countdown}s)` : "完成" }} + @@ -44,6 +46,7 @@ import AssetPageShell from "../../components/asset-page-shell.vue"; import { checkBmtSignCondition, startBmtSigning } from "../../api/bmt"; const READ_BOTTOM_THRESHOLD = 15; +const DONE_COUNTDOWN_SECONDS = 5; export default { components: { @@ -60,6 +63,8 @@ export default { isReachBottom: false, scrollViewHeight: 0, scrollTimer: null, + countdownTimer: null, + countdown: 0, contractId: "", }; }, @@ -84,6 +89,8 @@ export default { if (this.scrollTimer) { clearTimeout(this.scrollTimer); } + + this.clearCountdownTimer(); }, methods: { async loadAgreement() { @@ -218,6 +225,7 @@ export default { } this.signStatus = false; + this.startCountdown(); } catch (error) { this.signing = false; uni.showToast({ @@ -253,7 +261,32 @@ export default { url: targetUrl, }); }, + /** 签约完成后固定倒计时,结束后才允许点「完成」 */ + startCountdown() { + this.clearCountdownTimer(); + this.countdown = DONE_COUNTDOWN_SECONDS; + + this.countdownTimer = setInterval(() => { + this.countdown -= 1; + + if (this.countdown <= 0) { + this.countdown = 0; + this.clearCountdownTimer(); + } + }, 1000); + }, + clearCountdownTimer() { + if (this.countdownTimer) { + clearInterval(this.countdownTimer); + this.countdownTimer = null; + } + }, compute() { + // 倒计时结束前不可点击 + if (this.countdown > 0) { + return; + } + uni.navigateBack({ delta: 1, }); @@ -422,4 +455,8 @@ export default { font-weight: 600; color: #ffffff; } + +.bmt-agree-success__btn.is-disabled { + opacity: 0.5; +} diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html new file mode 100644 index 0000000..2ebe4ca --- /dev/null +++ b/unpackage/dist/build/web/index.html @@ -0,0 +1,2 @@ +