From 1e9a05ca33e55acb5d942af7a5722381eb7bb484 Mon Sep 17 00:00:00 2001 From: plightfield <1207120484@qq.com> Date: Wed, 11 Sep 2024 13:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=92=8C=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + public/logo.png | Bin 0 -> 3769 bytes src/App.vue | 4 + src/config.ts | 6 + src/db.ts | 39 +----- src/layout/header/search/SearchPage.tsx | 110 ++++++--------- src/layout/layout.types.ts | 25 ++-- src/layout/sider/ModeSwitch.tsx | 179 ++++++++++++++++++++++++ src/layout/sider/icons.ts | 159 +++++++++++++++++++++ src/layout/sider/index.tsx | 171 ++++++++++++++++++++++ src/layout/useLayoutStore.ts | 41 ++++-- src/main.css | 24 +++- src/settings/SettingsButton.tsx | 2 +- src/settings/SettingsOverlay.tsx | 12 +- src/useRouterStore.ts | 2 +- src/user/LoginModal.tsx | 58 ++++++++ src/user/UserPage.tsx | 20 ++- src/utils/ImageUploader.tsx | 2 +- src/utils/request.ts | 57 ++++++++ 19 files changed, 772 insertions(+), 141 deletions(-) create mode 100644 public/logo.png create mode 100644 src/layout/sider/ModeSwitch.tsx create mode 100644 src/layout/sider/icons.ts create mode 100644 src/layout/sider/index.tsx create mode 100644 src/user/LoginModal.tsx create mode 100644 src/utils/request.ts diff --git a/package.json b/package.json index 9a1517f..cbe5b3c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "oh-vue-icons": "^1.0.0-rc3", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.3", + "ua-parser-js": "^1.0.38", "uuid": "^10.0.0", "v-viewer": "^3.0.13", "viewerjs": "^1.11.6", @@ -33,6 +34,7 @@ "@tsconfig/node20": "^20.1.4", "@types/ali-oss": "^6.16.11", "@types/node": "^20.14.5", + "@types/ua-parser-js": "^0.7.39", "@types/uuid": "^10.0.0", "@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue-jsx": "^4.0.0", diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..8c0897a5340a8a53a6841405d3a7c6d15e8d2acc GIT binary patch literal 3769 zcmV;q4o2~bP)Px@b4f%&RCr$PT}xWq$QG`W`z|281hND&XmT?o-GIligk%Y131JDagfKSHHw@E| zL9>MR5}FNQ)%}j5a%5Sm^Pf{kHi_*Ss8o+r|9@WfkawBC-~Jfydmm1nbNh8wkKX&U zqHq^qCX>g^>X%-B^ZR&rR)kN^xt-R-s@)LW^!{dYY2B`MeQ(C&7v)oV8oWO(oV%O_ zfARIt$*pxetFCVdJiHl?cV@G29x>*<|IjtA5W>gi|Eb*F_2kS#273qNWAEKg2o=^} zH0r#)zqxv=ZR7Rf__ST8cj3bM;^FRka>3Q>+Xbk?j+Y+WmC-~MzB~@jzw2+rpIDP= z@8Ia44)V6Ua620LlOYrcCs5=$k@u+#pM7w<3xEsZ?C#I&PH-ai4pC;^c&N$ycZ)QV zp*}k2-)nK$MX=?@bvS>0aCn~PkDHE4fAZyjlZUdy|E0rKCOG8iIejuDDW4+O}-g*>~y-;NGdH6Tw4mp(tEx#+&Lk&<=@94T*KLJ|Brt*p zA;3j)MsOi@-6htYIxDGv?H1TM$_&d~jIJ4Z{m0=)%G#o{H5&O}hfHKuiM+z?N^$~d z-<@-h_cvF+3d)-n9hkr@9`+87C_Xf`zEMDk2S82}8OpUcKx@?{g$(y?`hyK|<@X?o;pnhq`}ch>|}vvu$F5 ziKM~%g|#Z{jU4EtS`wJz+As^}X!e+!6v6Z9Xyo4_?wFuXQPCU%=imVbcp{@*ZzdrU zb2NeWDM*Y5XN5tF&MJa9uq*dt*fLtqO$fB<(~))!Iu67Nu8g?lYKnpsD!FU|3sz{r5-tPkO=_@$t&l5D`93nY49 zn!Kt8X0VNJAOa7%)zm`XRL8pT0Jh7zzo->P6P;*%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out/background' import GLobalModal from './GlobalModal' import SettingsButton from './settings/SettingsButton' import SettingsOverlay from './settings/SettingsOverlay' +import Sider from './layout/sider' +import LoginModal from './user/LoginModal' import { computed } from 'vue' const settings = useSettingsStore() const blockSize = computed(() => settings.state.blockSize + 'rem') @@ -19,6 +21,8 @@ const blockRadius = computed(() => settings.state.blockRadius + 'rem') + + diff --git a/src/config.ts b/src/config.ts index 06871f7..4dcbc19 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,3 +8,9 @@ export const ossKeyUrl = import.meta.env.PROD export const ossBase = import.meta.env.PROD ? 'http://btab.oss-cn-hangzhou.aliyuncs.com' : 'http://btab.oss-cn-hangzhou.aliyuncs.com' + +export const apiBase = import.meta.env.PROD + ? 'http://192.168.110.28:8300' + : 'http://192.168.110.28:8300' + +export const cdnBase = import.meta.env.PROD ? apiBase : apiBase diff --git a/src/db.ts b/src/db.ts index f58dae8..441bf47 100644 --- a/src/db.ts +++ b/src/db.ts @@ -1,45 +1,8 @@ import { createInstance, INDEXEDDB } from 'localforage' -import { reactive, toRaw, watch, type WatchStopHandle } from 'vue' -const db = createInstance({ +export default createInstance({ driver: INDEXEDDB, name: 'fatfox', version: 1.0, storeName: 'fat_fox_key_value_pairs' }) - -export function useForageStore( - name: string, - defaultData: T, - partialWrite: (res: T) => T = (res) => res -) { - const state = reactive(defaultData) - const writeWatch = () => - watch( - state, - (d) => { - db.setItem(name, partialWrite(toRaw(d) as T)) - }, - { deep: true } - ) - let stopWatch: WatchStopHandle = () => {} - const refresh = () => { - stopWatch() - state.loading = true - db.getItem<{ data: T }>(name).then((res) => { - if (res?.data) { - Object.assign(state, res.data) - } - state.loading = false - stopWatch = writeWatch() - }) - } - refresh() - document.addEventListener('visibilitychange', () => { - if (document.visibilityState === 'visible') { - refresh() - } - }) -} - -export default db diff --git a/src/layout/header/search/SearchPage.tsx b/src/layout/header/search/SearchPage.tsx index 9f93a88..693fa9d 100644 --- a/src/layout/header/search/SearchPage.tsx +++ b/src/layout/header/search/SearchPage.tsx @@ -1,17 +1,7 @@ -import { defineComponent, reactive, ref } from 'vue' -import zhCN from 'ant-design-vue/es/locale/zh_CN' -import { - Button, - Checkbox, - ConfigProvider, - Divider, - Form, - Input, - message, - Modal -} from 'ant-design-vue' -import useSearchConfigStore, { type SearchInfo } from './useSearchConfigStore' -import { EditOutlined, DeleteOutlined, PlusOutlined, CheckOutlined } from '@ant-design/icons-vue' +import { defineComponent, ref } from 'vue' +import { Button, Checkbox, Divider, message, Modal } from 'ant-design-vue' +import useSearchConfigStore from './useSearchConfigStore' +import { EditOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue' import asyncLoader from '@/utils/asyncLoader' const SearchAdder = asyncLoader(() => import('./SearchAdder')) const SearchItem = defineComponent({ @@ -125,69 +115,61 @@ export default defineComponent(() => { const showAdder = ref<{ [key: string]: any } | null | undefined>(undefined) return () => (
e.stopPropagation()} > - -

管理搜索引擎

-
- 默认 - 自定义 +

管理搜索引擎

+
+ 默认 + 自定义 +
+