|
|
@@ -43,7 +43,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import global from '../Global'
|
|
|
+import '../Global'
|
|
|
import '../libs/rem';
|
|
|
import QRCode from 'qrcodejs2'
|
|
|
|
|
|
@@ -66,62 +66,71 @@ export default {
|
|
|
curLogoClass: 'logo_bsw',
|
|
|
currunVersion: runVersion,
|
|
|
curheadapi: headapi,
|
|
|
- timer: null,
|
|
|
+ // timer: null,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log("Headside mounted");
|
|
|
- // console.log("this.timer = " + this.timer);
|
|
|
+ console.log("route: " + this.$route.path);
|
|
|
+ console.log("[Headside mounted] timer_headclock = " + timer_headclock);
|
|
|
|
|
|
this.getLogo();
|
|
|
+ this.getCurVersion();
|
|
|
|
|
|
- if (this.timer == null) {
|
|
|
- this.timer = setInterval(() => {
|
|
|
- let date = new Date();
|
|
|
-
|
|
|
- let h = date.getHours();
|
|
|
- h = h < 10 ? '0' + h + ':' : h + ':';
|
|
|
-
|
|
|
- let m = date.getMinutes()
|
|
|
- m = m < 10 ? '0' + m + ':' : m + ':';
|
|
|
-
|
|
|
- let s = date.getSeconds()
|
|
|
- s = s < 10 ? '0' + s : s;
|
|
|
-
|
|
|
- this.nowTime = h + m + s;
|
|
|
- // this.nowTime = h + m;
|
|
|
- // console.log(this.nowTime);
|
|
|
+ this.clearTimer();
|
|
|
+ console.log("[Headside mounted] clearTimer run! timer_headclock = " + timer_headclock);
|
|
|
|
|
|
- this.nowDayFunc();
|
|
|
-
|
|
|
- // 获取版本号
|
|
|
- this.version = localStorage.version;
|
|
|
- this.currunVersion = runVersion
|
|
|
- this.curheadapi = headapi
|
|
|
+ // if (this.timer == null) {
|
|
|
+ if (timer_headclock == null) {
|
|
|
+ timer_headclock = setInterval(() => {
|
|
|
+ this.getCurrentTime();
|
|
|
}, 1000);
|
|
|
+ console.log("[Headside mounted] getCurrentTime run! timer_headclock = " + timer_headclock);
|
|
|
|
|
|
this.$once('hook:beforeDestroy', () => {
|
|
|
- console.log("Headside hook:beforeDestroy");
|
|
|
- clearInterval(this.timer);
|
|
|
- this.timer = null;
|
|
|
+ console.log("[Headside hook:beforeDestroy] timer_headclock = " + timer_headclock);
|
|
|
+ this.clearTimer();
|
|
|
+ console.log("[Headside hook:beforeDestroy] timer_headclock = " + timer_headclock);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- this.getCurVersion();
|
|
|
+ else {
|
|
|
+ console.log("[Headside mounted] 不加载时间 timer_headclock = " + timer_headclock);
|
|
|
+ }
|
|
|
},
|
|
|
- // watch: {
|
|
|
- // '$route': function (val) {
|
|
|
- // console.log("Headside val.path: " + val.path);
|
|
|
- // clearInterval(this.timer);
|
|
|
- // this.timer = null;
|
|
|
- // }
|
|
|
- // },
|
|
|
// beforeDestroy() {
|
|
|
- // console.log("Headside beforeDestroy");
|
|
|
- // clearInterval(this.timer);
|
|
|
- // this.timer = null;
|
|
|
+ // console.log("[Headside beforeDestroy] timer_headclock = " + timer_headclock);
|
|
|
+ // this.clearTimer();
|
|
|
+ // console.log("[Headside beforeDestroy] timer_headclock = " + timer_headclock);
|
|
|
// },
|
|
|
methods: {
|
|
|
+ clearTimer() {
|
|
|
+ if (timer_headclock != null) {
|
|
|
+ clearInterval(timer_headclock);
|
|
|
+ timer_headclock = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getCurrentTime() {
|
|
|
+ let date = new Date();
|
|
|
+ let h = date.getHours();
|
|
|
+ h = h < 10 ? '0' + h + ':' : h + ':';
|
|
|
+
|
|
|
+ let m = date.getMinutes();
|
|
|
+ m = m < 10 ? '0' + m + ':' : m + ':';
|
|
|
+
|
|
|
+ let s = date.getSeconds();
|
|
|
+ s = s < 10 ? '0' + s : s;
|
|
|
+
|
|
|
+ this.nowTime = h + m + s;
|
|
|
+ // this.nowTime = h + m;
|
|
|
+ // console.log(this.nowTime);
|
|
|
+
|
|
|
+ this.nowDayFunc();
|
|
|
+
|
|
|
+ // 获取版本号
|
|
|
+ this.version = localStorage.version;
|
|
|
+ this.currunVersion = runVersion;
|
|
|
+ this.curheadapi = headapi;
|
|
|
+ },
|
|
|
getLogo() {
|
|
|
if (this.curAppType == 1) { // 1: 小飞龙
|
|
|
this.curLogoImg = logo_xfl;
|