Commit 4cec7159 authored by YIyiyi's avatar YIyiyi

pref:修改页面

parent ed02f100
......@@ -18,41 +18,11 @@ export default {
data() {
return {};
},
created() {
this.isTimeOut();
},
created() {},
methods: {
handleBack() {
this.$router.back();
},
// 5分钟返回首页
startTimer() {
let that = this;
clearInterval(that.timeOut);
this.timeOut = setInterval(function () {
that.$router.push({ path: "/" });
}, 1000 * 60 * 5);
},
// 5分钟无任何操作返回首页
isTimeOut() {
if (this.$route.path == "/" || this.$route.path == "/home") {
return;
}
this.startTimer();
document.body.addEventListener("mousemove", this.startTimer);
document.body.addEventListener("mouseup", this.startTimer);
document.body.addEventListener("keyup", this.startTimer);
document.body.addEventListener("click", this.startTimer);
document.body.addEventListener("touchend", this.startTimer);
},
},
beforeDestroy() {
document.body.removeEventListener("mousemove", this.startTimer);
document.body.removeEventListener("mouseup", this.startTimer);
document.body.removeEventListener("keyup", this.startTimer);
document.body.removeEventListener("click", this.startTimer);
document.body.removeEventListener("touchend", this.startTimer);
clearInterval(this.timeOut);
},
};
</script>
......@@ -63,6 +33,7 @@ export default {
height: 100px;
padding: 0px 40px;
background: url("../assets/img/title.jpg") no-repeat center;
background-size: 100% 100%;
box-shadow: 0px 2px 6px 6px #ccc;
.back-text {
font-size: 28px;
......@@ -75,4 +46,4 @@ export default {
color: #ffffff;
}
}
</style>
\ No newline at end of file
</style>
......@@ -5,12 +5,49 @@
</template>
<script>
export default {};
export default {
data() {
return {};
},
created() {
this.isTimeOut();
},
methods: {
// 返回首页
startTimer() {
let that = this;
clearInterval(that.timeOut);
this.timeOut = setInterval(function () {
that.$router.push({ path: "/" });
}, 1000 * 60 * 2);
},
// 无任何操作返回首页
isTimeOut() {
if (this.$route.path == "/" || this.$route.path == "/home") {
return;
}
this.startTimer();
document.body.addEventListener("mousemove", this.startTimer);
document.body.addEventListener("mouseup", this.startTimer);
document.body.addEventListener("keyup", this.startTimer);
document.body.addEventListener("click", this.startTimer);
document.body.addEventListener("touchend", this.startTimer);
},
},
beforeDestroy() {
document.body.removeEventListener("mousemove", this.startTimer);
document.body.removeEventListener("mouseup", this.startTimer);
document.body.removeEventListener("keyup", this.startTimer);
document.body.removeEventListener("click", this.startTimer);
document.body.removeEventListener("touchend", this.startTimer);
clearInterval(this.timeOut);
},
};
</script>
<style lang="less" >
<style lang="less">
.layouts {
width: 100%;
height: auto;
}
</style>
\ No newline at end of file
</style>
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