From 5204b7a912218ae771cda3d08011121327088e00 Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 14:15:20 +0800 Subject: [PATCH 1/4] save --- src/layout/header/search/SearchSuggestion.tsx | 4 ++-- src/settings/SettingsOverlay.tsx | 9 +++++++-- src/widgets/discount/Middle.tsx | 1 + src/widgets/work/useTomatoStore.ts | 19 ++++++++++--------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/layout/header/search/SearchSuggestion.tsx b/src/layout/header/search/SearchSuggestion.tsx index 27a8e9b..a924f3c 100644 --- a/src/layout/header/search/SearchSuggestion.tsx +++ b/src/layout/header/search/SearchSuggestion.tsx @@ -51,7 +51,7 @@ export default defineComponent(() => { prefix={aIUrl} path={search.searchStr} label="AI搜索:" - icon={mita} + icon={mita} current={search.current} num={0} /> @@ -59,7 +59,7 @@ export default defineComponent(() => { prefix={translateUrl} path={search.searchStr} label="AI翻译:" - icon={translate} + icon={translate} current={search.current} num={1} /> diff --git a/src/settings/SettingsOverlay.tsx b/src/settings/SettingsOverlay.tsx index 693ca31..596616e 100644 --- a/src/settings/SettingsOverlay.tsx +++ b/src/settings/SettingsOverlay.tsx @@ -100,12 +100,17 @@ export default defineComponent(() => { ) : (
{ - router.go('settings-user') + if (profile.id) { + router.go('settings-user') + }else { + router.go('global-login') + } + // router.go('settings-user') }} > 登录注册 diff --git a/src/widgets/discount/Middle.tsx b/src/widgets/discount/Middle.tsx index 1c91629..7b01d65 100644 --- a/src/widgets/discount/Middle.tsx +++ b/src/widgets/discount/Middle.tsx @@ -14,6 +14,7 @@ export default defineComponent(() => { idx.value = 0 } }, 5000) + }) return () => (
{ const audio = new Audio() const time = useTimeStore() const remainingTime = computed(() => { - if (!state.isStart) { - return 0 - } + return dayjs(state.beginTime).add(1, 'minute').diff(dayjs(time.date), 'second') }) @@ -61,11 +59,7 @@ export default defineStore("work", () => { state.isStart = false state.beginTime = -1 stopMusic() - if (remainingTime.value <= 0) { - state.timeList.push( - dayjs().valueOf() - ) - } + } const togglePlay = () => { if (state.isPlaying) { @@ -97,10 +91,17 @@ export default defineStore("work", () => { } watch(remainingTime, (val) => { - if (val <= 0) { + console.log(val); + + if (val < 0) { stopTomatoTime() } + if (remainingTime.value === 0) { + state.timeList.push( + dayjs().valueOf() + ) + } }) const openShowModel = ref() const openFullscreen = ref(false) From 528cd07ee89cc7023a89e169b09d5fa3bc64e1ed Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 17:22:56 +0800 Subject: [PATCH 2/4] save --- src/App.vue | 17 +++++- src/GlobalModal.tsx | 7 ++- src/layout/header/GlobalTime.tsx | 89 +++++++++++++++++++--------- src/layout/header/ModeChange.tsx | 94 +++++++++++++++++++++++++++--- src/main.css | 7 +-- src/settings/useSettingsStore.ts | 30 +++++++++- src/widgets/work/useTomatoStore.ts | 1 - 7 files changed, 195 insertions(+), 50 deletions(-) diff --git a/src/App.vue b/src/App.vue index e32c46d..2e89d85 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,13 +34,24 @@ const layout = useLayoutStore() - + - -
+ +
diff --git a/src/GlobalModal.tsx b/src/GlobalModal.tsx index c9d8634..3e8ea1c 100644 --- a/src/GlobalModal.tsx +++ b/src/GlobalModal.tsx @@ -24,9 +24,10 @@ export default defineComponent(() => { watch(router, () => { full.value = false }) + return () => (
e.stopPropagation()} onKeydown={(e) => e.stopPropagation()} > @@ -42,10 +43,10 @@ export default defineComponent(() => { )} {/* 弹框主体 */} - + {show.value && (
- {settings.state.showTime && ( -
- {text.value.timeStr} -
- )} + + { + layout.state.simple ? + settings.state.simpleModeShowString.includes('showTime') && +
+ {text.value.timeStr} +
+ : + settings.state!.showTime && +
+ {text.value.timeStr} +
+ }
- {settings.state.showTime && ( -
- {settings.state.timeOptions.includes('date') &&
{text.value.dateStr}
} - - {!layout.isCompact && settings.state.timeOptions.includes('week') && ( -
星期{info.value.dayWeek}
- )} -
- - {!layout.isCompact && settings.state.timeOptions.includes('lunal') && ( -
{info.value.day}
- )} -
-
- )} + { + layout.state.simple ? + settings.state.simpleModeShowString.includes('showDate') && +
+ {settings.state.timeOptions.includes('date') &&
{text.value.dateStr}
} + + {!layout.isCompact && settings.state.timeOptions.includes('week') && ( +
星期{info.value.dayWeek}
+ )} +
+ + {!layout.isCompact && settings.state.timeOptions.includes('lunal') && ( +
{info.value.day}
+ )} +
+
+ : + settings.state!.showTime && +
+ {settings.state.timeOptions.includes('date') &&
{text.value.dateStr}
} + + {!layout.isCompact && settings.state.timeOptions.includes('week') && ( +
星期{info.value.dayWeek}
+ )} +
+ + {!layout.isCompact && settings.state.timeOptions.includes('lunal') && ( +
{info.value.day}
+ )} +
+
+ } +
) diff --git a/src/layout/header/ModeChange.tsx b/src/layout/header/ModeChange.tsx index d17026b..30d8fb2 100644 --- a/src/layout/header/ModeChange.tsx +++ b/src/layout/header/ModeChange.tsx @@ -1,16 +1,50 @@ import { addIcons, OhVueIcon } from "oh-vue-icons"; import { defineComponent, ref } from "vue"; import { BiEyeFill } from "oh-vue-icons/icons"; -import { BiEyeSlashFill } from "oh-vue-icons/icons"; +import { BiEyeSlashFill, MdMorevert } from "oh-vue-icons/icons"; import useLayoutStore from "../useLayoutStore"; import clsx from "clsx"; -import useSettingsStore from "@/settings/useSettingsStore"; -addIcons(BiEyeFill, BiEyeSlashFill) +import useSettingsStore, { SimpleShowStringType } from "@/settings/useSettingsStore"; +import { Dropdown, type MenuProps } from "ant-design-vue"; +addIcons(BiEyeFill, BiEyeSlashFill, MdMorevert) +const items: MenuProps['items'] = [ + { + key: '1', + label: ( + + 1st menu item + + ), + }, + { + key: '2', + label: ( + + 2nd menu item (disabled) + + ), + disabled: true, + }, + { + key: '3', + label: ( + + 3rd menu item (disabled) + + ), + disabled: true, + }, + { + key: '4', + danger: true, + label: 'a danger item', + }, +]; export default defineComponent(() => { const layoutStore = useLayoutStore() const settingStore = useSettingsStore() const show = ref(false) - + const showOptions = ref(false) return () => (
{ : '-top-[30px]' : 'top-5' )}> - { - layoutStore.state.simple = !layoutStore.state.simple - }} - >{layoutStore.state.simple ? '极简' : '常规'} +
+ { + e.stopPropagation() + showOptions.value = !showOptions.value + }}> + { + layoutStore.state.simple && + + + } + { + showOptions.value + && +
{ + showOptions.value = false + }}> + { + SimpleShowStringType.map(item => ( +
{ + e.stopPropagation() + settingStore.state.simpleModeShowString.includes(item.value) ? + settingStore.state.simpleModeShowString = settingStore.state.simpleModeShowString.filter(el => el !== item.value) + : + settingStore.state.simpleModeShowString.push(item.value) + }} + > + {item.label} +
+ )) + } +
+ } + +
+ { + layoutStore.state.simple = !layoutStore.state.simple + }} + >{layoutStore.state.simple ? '极简' : '常规'} +
+
{ settingStore.state.showTop = settingStore.state.showTop === 'auto' ? 'show' : 'auto' }}> diff --git a/src/main.css b/src/main.css index 5250346..0ac2a4b 100644 --- a/src/main.css +++ b/src/main.css @@ -163,19 +163,16 @@ body { .modal-enter-active, .modal-leave-active { transition: - transform 0.3s ease-in-out, - opacity 0.3s ease-in-out; + transform 2s ease-in-out, + opacity 2s ease-in-out; } .modal-enter-from { - transform: translate(-50%, -60%); opacity: 0; } .modal-leave-to { - transform: translate(-50%, -40%); opacity: 0; } - /* 设置框动画 */ .settings-enter-active, .settings-leave-active { diff --git a/src/settings/useSettingsStore.ts b/src/settings/useSettingsStore.ts index f397d60..d0c8fa7 100644 --- a/src/settings/useSettingsStore.ts +++ b/src/settings/useSettingsStore.ts @@ -3,6 +3,32 @@ import { computed, reactive } from 'vue' export type VisibleState = 'show' | 'auto' | '' export type TimeUnit = 'date' | 'week' | '12hour' | 'lunal' | 'second' + + +export const SimpleShowStringType = [{ + label: "侧边栏", + value: 'showSider', +}, +{ + label: "底部栏", + value: 'showDock', + +}, +{ + label: "时间", + value: 'showTime', + +}, { + label: "日期", + value: 'showDate', + +}, { + label: "AI助手", + value: 'showPet', +} +] +type SimpleValueType = typeof SimpleShowStringType[number]['value']; + export default defineStore( 'settings', () => { @@ -33,7 +59,9 @@ export default defineStore( // 侧边栏 siderDirection: 'left' as 'left' | 'right', // 禁用快捷键 - disabledShortcut: false + disabledShortcut: false, + // 极简模式显式 + simpleModeShowString: ['showTime', 'showDate'] as SimpleValueType[] }) return { state, blockInner: computed(() => state.blockSize - 2 * state.blockPadding) } }, diff --git a/src/widgets/work/useTomatoStore.ts b/src/widgets/work/useTomatoStore.ts index 32315fd..2a26fe5 100644 --- a/src/widgets/work/useTomatoStore.ts +++ b/src/widgets/work/useTomatoStore.ts @@ -91,7 +91,6 @@ export default defineStore("work", () => { } watch(remainingTime, (val) => { - console.log(val); if (val < 0) { stopTomatoTime() From a627a4b0ecc92f18ae3ff48b5e0a7a97dd1e939c Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 17:53:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A0=8F=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/header/search/SearchHistory.tsx | 9 ++++----- src/layout/header/search/SearchSuggestion.tsx | 13 +++++++++++-- src/layout/header/search/useSearchStore.ts | 7 +++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/layout/header/search/SearchHistory.tsx b/src/layout/header/search/SearchHistory.tsx index 01239dc..e589a70 100644 --- a/src/layout/header/search/SearchHistory.tsx +++ b/src/layout/header/search/SearchHistory.tsx @@ -1,11 +1,10 @@ import { defineComponent } from 'vue' import { OhVueIcon, addIcons } from 'oh-vue-icons' -import { MdHistory, MdRemove } from 'oh-vue-icons/icons' +import { MdHistory, MdRemove, RiCloseCircleLine } from 'oh-vue-icons/icons' import useSearchConfigStore from './useSearchConfigStore' import jump from '@/utils/jump' import useSettingsStore from '@/settings/useSettingsStore' -addIcons(MdHistory) -addIcons(MdRemove) +addIcons(MdHistory, RiCloseCircleLine) export default defineComponent(() => { const searchConfig = useSearchConfigStore() const settings = useSettingsStore() @@ -15,7 +14,7 @@ export default defineComponent(() => { {searchConfig.history.map((item, idx) => (
{ jump(searchConfig.current.url + item) }} @@ -34,7 +33,7 @@ export default defineComponent(() => { searchConfig.removeHistory(idx) }} > - +
))} diff --git a/src/layout/header/search/SearchSuggestion.tsx b/src/layout/header/search/SearchSuggestion.tsx index a924f3c..4691c42 100644 --- a/src/layout/header/search/SearchSuggestion.tsx +++ b/src/layout/header/search/SearchSuggestion.tsx @@ -23,7 +23,7 @@ export const Item = defineComponent({ return () => (
{ @@ -46,7 +46,7 @@ export default defineComponent(() => { const searchConfig = useSearchConfigStore() return () => ( -
+
{ current={search.current} num={1} /> + { + search.addList.map((el, idx) => ( +
+ icon + {el.name} + +
+ )) + } {search.sugList.map((el, idx) => ( { ) const debouncedHandler = debounce((newValue) => { console.log('数值改变并已防抖处理:', newValue) - request("GET", `/api/app/searchBars`).then((res) => { + request("GET", `/api/app/searchBars?keyword=${newValue || 'undefine'}`).then((res) => { addList.value = res + console.log(addList.value); + }) }, 500) // watch(searchStr, (newValue) => { @@ -111,6 +113,7 @@ export default defineStore('search', () => { focus, showSearchConfig, current, - sugList + sugList, addList + } }) From d89f7f3d8c134d9f0fa8b73aca71ecd26fef040c Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 18:43:13 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.ts | 2 +- src/layout/header/search/useSearchConfigStore.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.ts b/src/config.ts index 71c89ee..20c3049 100644 --- a/src/config.ts +++ b/src/config.ts @@ -15,7 +15,7 @@ export const ossCdnBase = import.meta.env.PROD ? ossBase : ossBase // 后端地址 export const apiBase = import.meta.env.PROD - ? 'http://106.15.37.113:8300' + ? 'https://goosetab.com/api' : 'http://192.168.110.28:8300' // 后端 cdn 加速地址 diff --git a/src/layout/header/search/useSearchConfigStore.ts b/src/layout/header/search/useSearchConfigStore.ts index 65e9c25..25e7b60 100644 --- a/src/layout/header/search/useSearchConfigStore.ts +++ b/src/layout/header/search/useSearchConfigStore.ts @@ -12,25 +12,25 @@ const defaultSearchList: SearchInfo[] = [ { name: '百度', url: 'https://www.baidu.com/s?wd=', - icon: 'tab/searchIcons/baidu.png', + icon: import.meta.env.PROD ? '/tab/searchIcons/baidu.png' : 'tab/searchIcons/baidu.png', show: true }, { name: '必应', url: 'https://cn.bing.com/search?q=', - icon: 'tab/searchIcons/bing.png', + icon: import.meta.env.PROD ? '/tab/searchIcons/bing.png' : 'tab/searchIcons/bing.png', show: true }, { name: '谷歌', url: 'https://www.google.com/search?q=', - icon: 'tab/searchIcons/google.png', + icon: import.meta.env.PROD ? '/tab/searchIcons/google.png' : 'tab/searchIcons/google.png', show: true }, { name: '360', url: 'https://www.so.com/s?q=', - icon: 'tab/searchIcons/360.png', + icon: import.meta.env.PROD ? '/tab/searchIcons/360.png' : 'tab/searchIcons/360.png', show: true }