@peng_kai/kit 0.3.0-beta.22 → 0.3.0-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,7 +78,7 @@ const current = customRef((track, trigger) => {
78
78
  <Select class="tta-tz-select" v-model:value="current" :bordered="false" :virtual="false"
79
79
  :dropdownMatchSelectWidth="120" :options="offsetOptions">
80
80
  <template #suffixIcon>
81
- <i class="i-iconoir:time-zone text-5 text-white" />
81
+ <i class="i-iconoir:time-zone text-5 text-$antd-colorTextBase" />
82
82
  </template>
83
83
  </Select>
84
84
  </template>
@@ -9,7 +9,6 @@ import audioURL from './y682.mp3?url';
9
9
 
10
10
  const noticeAudio = new Audio(audioURL);
11
11
  noticeAudio.src = audioURL;
12
- noticeAudio.muted = true;
13
12
  document.body.append(noticeAudio);
14
13
 
15
14
  const faviconEle = document.querySelector('link[rel="icon"]');
@@ -28,26 +27,37 @@ interface TNotice {
28
27
 
29
28
  <script lang="ts" setup>
30
29
  const props = defineProps<{
31
- noticesQry: UseQueryReturnType<TNotice[], Error>
30
+ noticesQry: UseQueryReturnType<{num: number; list: TNotice[]}, Error>
31
+ onOpen?: (item: TNotice) => void;
32
32
  }>()
33
33
 
34
34
  const router = useRouter();
35
35
  const visible = ref(false);
36
- const noticeNum = computed(() => props.noticesQry.data.value?.length ?? 0);
36
+ const noticeNum = computed(() => props.noticesQry.data.value?.num ?? 0);
37
+ const noticeList = computed(() => props.noticesQry.data.value?.list ?? []);
37
38
 
38
39
  function operate(notice: TNotice) {
40
+ if (props.onOpen) {
41
+ props.onOpen(notice);
42
+ return;
43
+ }
44
+
39
45
  if (router.currentRoute.value.path !== notice.url) {
40
46
  router.push(notice.url);
41
47
  }
42
48
  }
43
49
 
44
- watch(noticeNum, (num = 0, oldNum = 0) => {
45
- num > oldNum && noticeAudio.play();
46
- }, { immediate: true });
50
+ // watch(noticeNum, (num = 0, oldNum = 0) => {
51
+ // num > oldNum && noticeAudio.play();
52
+ // }, { immediate: true });
47
53
 
48
54
  useIntervalFn(() => {
49
55
  const num = noticeNum.value;
50
56
 
57
+ if (num) {
58
+ noticeAudio.paused && noticeAudio.play();
59
+ }
60
+
51
61
  if (!num || !faviconEle || document.visibilityState === 'visible') {
52
62
  faviconEle?.setAttribute('href', logoFaviconHref);
53
63
  return;
@@ -87,11 +97,11 @@ useIntervalFn(() => {
87
97
  </div>
88
98
  <template #overlay>
89
99
  <Menu v-if="noticeNum" @click="visible = false" class="max-h-100 overflow-y-auto">
90
- <MenuItem v-for="(item, i) of noticesQry.data.value" :key="i" @click="operate(item)">
100
+ <MenuItem v-for="(item, i) of noticeList" :key="i" @click="operate(item)">
91
101
  <div class="min-w-50">
92
102
  <div>{{ item.title }}</div>
93
103
  <div class="mt-1 text-xs text-$antd-colorTextSecondary">
94
- {{ dayjs().format('MM-DD HH:mm:ss') }}
104
+ {{ dayjs(item.time).format('MM-DD HH:mm:ss') }}
95
105
  </div>
96
106
  </div>
97
107
  </MenuItem>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.3.0-beta.22",
4
+ "version": "0.3.0-beta.24",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",