Browse Source

fix: 计时器和倒计时

master
guoapeng 2 months ago
parent
commit
7b484776f3
  1. 3
      src/components/common/Countdown.vue
  2. 4
      src/layouts/default.vue
  3. 3
      src/stores/systemStore.ts
  4. 1
      src/types/system.d.ts

3
src/components/common/Countdown.vue

@ -72,6 +72,9 @@ watch(
seconds.value = '00'
return
}
else {
visible.value = true
}
days.value = Math.floor(newVal / (1000 * 60 * 60 * 24))

4
src/layouts/default.vue

@ -20,6 +20,10 @@ const { currentTime } = useServerTime()
const systemStore = useSystemStore()
const router = useRouter()
watch(() => currentTime.value, () => {
systemStore.currentTime = currentTime.value
})
onMounted(async () => {
if (!systemStore.systemStatus.selfTest && systemStore.systemStatus.currentUser?.username !== 'test') {
isCheck.value = true

3
src/stores/systemStore.ts

@ -66,6 +66,8 @@ export const useSystemStore = defineStore('system', {
fanOpen: false,
targetTemperature: 0,
temperature: 0,
startHeatTime: 1749126403564,
targetTime: 1800,
},
{
moduleCode: 'heat_module_02',
@ -228,6 +230,7 @@ export const useSystemStore = defineStore('system', {
streamVisible: false,
systemList: [],
systemLogList: [],
currentTime: '0000-00-00 00:00:00',
}),
actions: {
insertLog(log: System.SystemLog) {

1
src/types/system.d.ts

@ -9,6 +9,7 @@ declare namespace System {
systemUser: SystemUser
loginForm: LoginForm
systemLogList: SystemLog[]
currentTime: string
}
interface SystemLog {
cmdName: string

Loading…
Cancel
Save