3秒后跳转到首页

This commit is contained in:
zhangsir
2024-12-05 14:02:29 +08:00
parent 693879d6b3
commit 00d2a3b89c

View File

@@ -223,7 +223,11 @@
<el-dialog v-model="centerDialogVisible" title="" width="70%" center :show-close="false" :align-center="true"> <el-dialog v-model="centerDialogVisible" title="" width="70%" center :show-close="false" :align-center="true">
<div style="text-align: center;font-size:16px;"> <span style="color:black"> <div style="text-align: center;font-size:16px;"> <span style="color:black">
您已完成评估 您已完成评估
</span></div> </span>
<div style="color:black;font-size:16px;">
将于<span style="margin: 0 2px 0 2px;">{{ deadline }}</span>秒后跳转到首页
</div>
</div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button class="cancel" <el-button class="cancel"
@@ -231,7 +235,7 @@
@click="centerDialogVisible = false">取消</el-button> @click="centerDialogVisible = false">取消</el-button>
<el-button class="back" <el-button class="back"
style="background: #387DF7;box-shadow: 1px 2px 15px 1px rgba(56,125,247,0.34);border: 0px;padding: 8px 32px;" style="background: #387DF7;box-shadow: 1px 2px 15px 1px rgba(56,125,247,0.34);border: 0px;padding: 8px 32px;"
type="primary" @click="centerDialogVisible = false"> type="primary" @click="pauseCountdown()">
确定 确定
</el-button> </el-button>
</span> </span>
@@ -434,11 +438,31 @@ onMounted(() => {
}) })
console.log(data,'data') console.log(data,'data')
}); });
const deadline = ref(3);
const centerDialogVisible = ref(false); const centerDialogVisible = ref(false);
const timer = ref(null);
const open = () => { const open = () => {
centerDialogVisible.value = true; centerDialogVisible.value = true;
timer.value = setInterval(() => {
if (deadline.value > 0) {
deadline.value -= 1;
} else {
pauseCountdown();
}
}, 1000);
};
const goBack = () => {
window.location.href =
window.location.protocol + import.meta.env.VITE_BOE_HOME;
}
const pauseCountdown = () => {
centerDialogVisible.value = false;
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
goBack()
}
}; };
const isEmptyValue = ref(false); const isEmptyValue = ref(false);
function emptyValuePromp() { function emptyValuePromp() {
if (data.value.isSubmit) { if (data.value.isSubmit) {