|
1 | 1 | <script setup lang="ts"> |
2 | 2 | definePageMeta({ middleware: 'require-login' }) |
3 | 3 |
|
4 | | -const dateLimit = ref<string | undefined>(undefined) |
5 | | -const timeLimit = ref<string | undefined>(undefined) |
6 | | -const maimaiMaid = ref<string | undefined>(undefined) |
| 4 | +const contextStore = useContextStore() |
7 | 5 |
|
8 | 6 | onMounted(() => { |
9 | 7 | const route = useRoute() |
10 | | - dateLimit.value = route.query.date as string | undefined |
11 | | - timeLimit.value = route.query.time as string | undefined |
12 | | - maimaiMaid.value = route.query.maid as string | undefined |
| 8 | + if (route.query.date) |
| 9 | + contextStore.dateLimit = route.query.date as string |
| 10 | + if (route.query.time) |
| 11 | + contextStore.timeLimit = route.query.time as string |
| 12 | + if (route.query.maid) |
| 13 | + contextStore.maimaiMaid = route.query.maid as string |
13 | 14 | }) |
14 | 15 |
|
15 | 16 | const { data: profile } = await useLeporid<UserProfile>('/api/nuxt/profile') |
@@ -50,8 +51,8 @@ const simplifiedCode = computed(() => { |
50 | 51 | // 覆盖优先级:用户偏好设置 > 页面参数 |
51 | 52 | if (profile.value?.preference.simplifiedCode) |
52 | 53 | return profile.value?.preference.simplifiedCode |
53 | | - if (maimaiMaid.value) |
54 | | - return maimaiMaid.value?.slice(8, 28).match(/.{1,4}/g)?.join(' ') |
| 54 | + if (contextStore.maimaiMaid) |
| 55 | + return contextStore.maimaiMaid?.slice(8, 28).match(/.{1,4}/g)?.join(' ') |
55 | 56 | return undefined |
56 | 57 | }) |
57 | 58 |
|
@@ -82,18 +83,18 @@ const maimaiVersion = computed(() => { |
82 | 83 | </div> |
83 | 84 |
|
84 | 85 | <WidgetCharaInfo |
85 | | - :chara-name="profile.preference.characterName || undefined" :time-limit="timeLimit" |
86 | | - :date-limit="dateLimit" :show-date="profile.preference.showDate" |
| 86 | + :chara-name="profile.preference.characterName || undefined" :time-limit="contextStore.timeLimit" |
| 87 | + :date-limit="contextStore.dateLimit" :show-date="profile.preference.showDate" |
87 | 88 | :chara-info-color="profile.preference.charaInfoColor" class="bottom-[18%] absolute" |
88 | 89 | /> |
89 | 90 |
|
90 | | - <WidgetQrCode v-if="maimaiMaid" class="absolute right-0 bottom-[6%]" :content="maimaiMaid" :size="profile.preference.qrSize" /> |
| 91 | + <WidgetQrCode v-if="contextStore.maimaiMaid" class="absolute right-0 bottom-[6%]" :content="contextStore.maimaiMaid" :size="profile.preference.qrSize" /> |
91 | 92 |
|
92 | 93 | <div |
93 | 94 | id="c-footer" class="flex absolute bottom-0 items-center justify-center w-full pb-[0.8%]" |
94 | 95 | :style="{ '--b-bottom': `url(${img(profile.preference.frameId)})` }" |
95 | 96 | > |
96 | | - <button class="cursor-pointer" @click="triggerCrawl({ date: dateLimit || '', time: timeLimit || '', maid: maimaiMaid || '' })"> |
| 97 | + <button class="cursor-pointer" @click="triggerCrawl({ date: contextStore.dateLimit || '', time: contextStore.timeLimit || '', maid: contextStore.maimaiMaid || '' })"> |
97 | 98 | <div class="p-1 rounded-full bg-white dark:bg-gray-800" aria-label="rocket" role="img"> |
98 | 99 | <svg |
99 | 100 | xmlns="http://www.w3.org/2000/svg" class="footer-icon" viewBox="-4 -4 32 32" |
|
0 commit comments