Commit ce2c9a01 authored by limeimei's avatar limeimei

修改

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