-
Notifications
You must be signed in to change notification settings - Fork 10
/
app.vue
114 lines (106 loc) · 2.96 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!--
* @Author: NMTuan
* @Email: NMTuan@qq.com
* @Date: 2024-02-18 11:35:10
* @LastEditTime: 2024-03-31 15:28:58
* @LastEditors: NMTuan
* @Description:
* @FilePath: \timeNow\app.vue
-->
<template>
<div class="group w-full h-screen overflow-hidden flex flex-col items-center justify-between">
<Header> </Header>
<div class="bg-white/5 w-full flex flex-col items-center justify-center py-[4vw]">
<div class="select-none">
<ClockWeek></ClockWeek>
<ClockBoard></ClockBoard>
<ClockDate></ClockDate>
</div>
</div>
<div class="w-full px-[4px] mt-[26px] flex-shrink-0">
<div v-if="settingStore.showTimeLine" class="px-[4px]">
<TimeLine></TimeLine>
</div>
<div class="my-[4px]">
<DayLine v-if="settingStore.showDayLine"></DayLine>
<MonthLine v-if="settingStore.showMonthLine"></MonthLine>
</div>
</div>
<UModal v-model="modalState">
<ComCard label="remind" :close="close">
<pre class="text-sm leading-6">{{ currentRemind.content }}</pre>
<template #header>
<UIcon name="i-ri-circle-fill" class="mr-2" :style="{ color: currentRemind.color }" />
{{ currentRemind.time }}
</template>
<template #footer>
<div class="flex items-center justify-end">
<UButton @click="close">知道了!</UButton>
</div>
</template>
</ComCard>
</UModal>
</div>
</template>
<script setup>
const dateStore = useDateStore()
const settingStore = useSettingStore()
const remindStore = useRemindStore()
const modalState = ref(false)
const currentRemind = ref({})
let dt
onMounted(() => {
dateStore.getNow()
dt = setInterval(() => {
dateStore.getNow()
handlerRemind()
}, 1000)
})
onBeforeUnmount(() => {
clearInterval(dt)
})
const title = computed(() => {
let tit = ''
tit += dateStore.hour12
tit += ':' + dateStore.minute
if (settingStore.showSecond) {
tit += ':' + dateStore.second
}
tit += ' - 压感时钟'
return tit
})
useHead({
title: title
})
const handlerRemind = () => {
if (remindStore.list.length === 0) {
return
}
const remind = remindStore.list.find(item => `${item.time}:00` === `${dateStore.hour}:${dateStore.minute}:${dateStore.second}`)
if (!remind) {
return
}
currentRemind.value = remind
modalState.value = true
}
const close = () => {
modalState.value = false
currentRemind.value = {}
}
</script>
<style lang="scss">
html,
body,
#__nuxt {
background-color: #000;
}
@font-face {
font-family: 'DigitalDismay';
src: url('/fonts/DigitalDismay.otf') format('opentype');
}
.font {
&-digital-dismay {
font-family: 'DigitalDismay';
}
}
</style>