Commit 731bb05a authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents c57ae60f b1849dd9
......@@ -26,19 +26,53 @@
</template>
<script>
import { mapGetters } from "vuex";
export default {
data() {
return {};
return {
timeOut: null,
defaultTimes: 300,
times: 0,
};
},
computed: {
...mapGetters(["times"]),
created() {
this.isTimeOut();
},
created() {},
methods: {
handleBack() {
this.$router.back();
},
// 返回首页
startTimer() {
clearInterval(this.timeOut);
this.times = this.defaultTimes;
this.timeOut = setInterval(() => {
if (this.times == 0) {
this.$router.push({ path: "/" });
}
this.times -= 1;
}, 1000);
},
// 无任何操作返回首页
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);
this.timeOut && clearInterval(this.timeOut);
},
};
</script>
......
......@@ -598,22 +598,22 @@ export default {
// box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
// &::before {
// content: "";
// position: absolute;
// width: 200px;
// height: 300%;
// left: -200px;
// transform: rotateZ(-45deg);
// background: linear-gradient(
// to right,
// transparent 1%,
// rgba(255, 255, 255, 0.2) 30%,
// rgba(255, 255, 255, 0.5) 60%,
// transparent 100%
// );
// animation: shadow 6s infinite;
// }
&::before {
content: "";
position: absolute;
width: 200px;
height: 300%;
left: -200px;
transform: rotateZ(-45deg);
background: linear-gradient(
to right,
transparent 1%,
rgba(255, 255, 255, 0.2) 30%,
rgba(255, 255, 255, 0.5) 60%,
transparent 100%
);
animation: shadow 6s infinite;
}
// .fill-btn-text1 {
// animation: ring 6s 20ms infinite;
......
......@@ -5,51 +5,53 @@
</template>
<script>
import { mapMutations, mapGetters } from "vuex";
// import { mapMutations, mapGetters } from "vuex";
export default {
data() {
return {};
return {
defaultTimes: 300,
};
},
computed: {
...mapGetters(["times", "defaultTimes"]),
// ...mapGetters(["times"]),
},
created() {
this.isTimeOut();
// this.isTimeOut();
},
methods: {
...mapMutations(["SET_times"]),
// ...mapMutations(["SET_times"]),
// 返回首页
startTimer() {
clearInterval(this.timeOut);
this.SET_times(this.defaultTimes);
this.timeOut = setInterval(() => {
if (this.times == 0) {
this.$router.push({ path: "/" });
}
this.SET_times(this.times - 1);
}, 1000);
},
// 无任何操作返回首页
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);
// startTimer() {
// clearInterval(this.timeOut);
// this.SET_times(this.defaultTimes);
// this.timeOut = setInterval(() => {
// if (this.times == 0) {
// this.$router.push({ path: "/" });
// }
// this.SET_times(this.times - 1);
// }, 1000);
// },
// // 无任何操作返回首页
// 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>
......
import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
import SecureLS from "secure-ls";
var ls = new SecureLS({ isCompression: false });
// import createPersistedState from "vuex-persistedstate";
// import SecureLS from "secure-ls";
// var ls = new SecureLS({ isCompression: false });
Vue.use(Vuex);
export default new Vuex.Store({
......@@ -12,8 +12,7 @@ export default new Vuex.Store({
datumList: [], // 首页材料
matterList: [], // 首页事项
deviceCode: "", // 设备编码
times: 300, // 倒计时时间
defaultTimes: 300, // 倒计时时间
times: 0, // 倒计时时间
operTime: "", // 样表打开时间
},
getters: {
......@@ -23,9 +22,6 @@ export default new Vuex.Store({
times(state) {
return state.times;
},
defaultTimes(state) {
return state.defaultTimes;
},
operTime(state) {
return state.operTime;
},
......@@ -60,13 +56,13 @@ export default new Vuex.Store({
// createPersistedState({
// storage: window.sessionStorage,
// }),
createPersistedState({
key: "info",
storage: {
getItem: (key) => ls.get(key),
setItem: (key, value) => ls.set(key, value),
removeItem: (key) => ls.remove(key),
},
}),
// createPersistedState({
// key: "info",
// storage: {
// getItem: (key) => ls.get(key),
// setItem: (key, value) => ls.set(key, value),
// removeItem: (key) => ls.remove(key),
// },
// }),
],
});
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