implement timezone

This commit is contained in:
LouisLam
2021-07-01 21:47:14 +08:00
parent 1d64f643b1
commit 55bd6b6d7a
9 changed files with 441 additions and 384 deletions

View File

@@ -1,5 +1,6 @@
import {io} from "socket.io-client";
import { useToast } from 'vue-toastification'
import dayjs from "dayjs";
const toast = useToast()
let storage = localStorage;
@@ -15,6 +16,7 @@ export default {
connected: false,
connectCount: 0,
},
userTimezone: localStorage.timezone || "auto",
allowLoginDialog: false, // Allowed to show login dialog, but "loggedIn" have to be true too. This exists because prevent the login dialog show 0.1s in first before the socket server auth-ed.
loggedIn: false,
monitorList: { },
@@ -26,7 +28,7 @@ export default {
},
created() {
socket = io("http://localhost:3001", {
socket = io(":3001", {
transports: ['websocket']
});
@@ -186,6 +188,17 @@ export default {
},
computed: {
timezone() {
if (this.userTimezone === "auto") {
return dayjs.tz.guess()
} else {
return this.userTimezone
}
},
lastHeartbeatList() {
let result = {}