Commit ce2c9a01 authored by limeimei's avatar limeimei

修改

parent f3e56942
Pipeline #1942 canceled with stages
......@@ -33,6 +33,7 @@
percentage: 100,
currentIndex: "", //当前移动到的路径
time: 120, //时间设定为360
timer: null, //定时器
}
},
watch: {
......@@ -40,6 +41,7 @@
// $route可以用引号,也可以不用引号 监听的对象
handler(to) {
this.title = to.meta.title
this.time = 120;
},
},
......@@ -52,28 +54,29 @@
methods: {
// 自定义进度条
format(percentage) {
const remainingTime = Math.ceil((percentage / 100) * 120);
return `${remainingTime}s`;
return `${this.time}s`;
},
// 倒计时
decrease() {
// this.timer && clearInterval(this.timer);
var that = this;
that.timer = setInterval(() => {
that.time--;
console.log(123)
// 计算进度百分比
that.percentage = (that.time / 120) * 100;
// 检查是否倒计时结束
if (that.time <= 0) {
clearInterval(that.timer); // 清除定时器
// that.gohome();
that.gohome();
}
}, 1000); // 每1000毫秒(1秒)更新一次
},
// 返回主页
gohome() {
clearInterval(this.timer);
this.$router.replace({
name: "visitor",
});
......
......@@ -69,12 +69,14 @@
percentage: 100,
currentIndex: "", //当前移动到的路径
time: 120, //时间设定为360
timer: null, //定时器
}
}, watch: {
$route: {
// $route可以用引号,也可以不用引号 监听的对象
handler(to) {
this.currentIndex = to.meta.index;
this.time = 120;
},
},
......@@ -90,11 +92,11 @@
methods: {
// 自定义进度条
format(percentage) {
const remainingTime = Math.ceil((percentage / 100) * 120);
return `${remainingTime}s`;
return `${this.time}s`;
},
// 倒计时
decrease() {
// this.timer && clearInterval(this.timer);
var that = this;
that.timer = setInterval(() => {
that.time--;
......@@ -104,14 +106,14 @@
// 检查是否倒计时结束
if (that.time <= 0) {
clearInterval(that.timer); // 清除定时器
// that.gohome();
that.gohome();
}
}, 1000); // 每1000毫秒(1秒)更新一次
},
// 返回主页
gohome() {
clearInterval(this.timer);
this.$router.replace({
name: "sim",
});
......
......@@ -82,6 +82,7 @@
padding: 0 50px;
box-sizing: border-box;
align-items: center;
cursor: pointer;
}
.sim_center {
......
......@@ -124,6 +124,10 @@
color: #FFFFFF;
}
.item_active {
background: #437AE5;
}
::v-deep .el-button {
width: 141px;
height: 51px;
......
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