Commit bbef1970 authored by yyh's avatar yyh

认证成功倒计时

parent d6b463d3
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<p class="title">恭喜您,资料上传成功</p> <p class="title">恭喜您,资料上传成功</p>
<p class="desc">我们会在24小时内审核完成。</p> <p class="desc">我们会在24小时内审核完成。</p>
<div @click="goUserCenter" class="btn">返回个人中心</div> <div @click="goUserCenter" class="btn">返回个人中心</div>
<div class="tip">5秒后跳转到个人中心</div> <div class="tip">{{count}}秒后跳转到个人中心</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -24,12 +24,18 @@ import { Route } from 'vue-router'; ...@@ -24,12 +24,18 @@ import { Route } from 'vue-router';
}, },
}) })
export default class UploadSuccess extends Vue { export default class UploadSuccess extends Vue {
private count: number = 5;
private mounted() { private mounted() {
const timer = setTimeout(() => { const timer = setInterval(() => {
this.$router.replace('/userCenter/index'); const { count } = this;
}, 5000); if ( count <= 0) {
clearInterval(timer);
return this.$router.replace('/userCenter/index');
}
this.count--;
}, 1000);
this.$once('hook:beforeDestory', () => { this.$once('hook:beforeDestory', () => {
clearTimeout(timer); clearInterval(timer);
}); });
} }
private goUserCenter() { private goUserCenter() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment