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

Merge remote-tracking branch 'origin/master'

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