From e14d412b1d9dafd15b611fad7edfda94689152f2 Mon Sep 17 00:00:00 2001 From: Aresn Date: Tue, 10 Sep 2024 10:18:48 +0800 Subject: [PATCH] add private --- app.config.ts | 5 ++++- app.vue | 10 ++++++++++ components/i/Aside.vue | 4 ++-- components/i/Nav.vue | 3 ++- components/i/search/Content.vue | 4 +++- components/i/search/Header.vue | 5 +++-- composables/useConfig.js | 5 +++++ pages/index.vue | 32 ++++++++++++++++++++++++++++++-- 8 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 composables/useConfig.js diff --git a/app.config.ts b/app.config.ts index f64b252..9dbcee5 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,6 +1,9 @@ +import useConfig from '@/composables/useConfig'; +const { deploymentType } = useConfig(); + export default defineAppConfig({ ui: { - primary: 'emerald', + primary: deploymentType === 'saas' ? 'emerald' : 'blue', gray: 'cool', // notifications: { // position: 'top-8 bottom-auto' diff --git a/app.vue b/app.vue index c85c4fd..59a2053 100644 --- a/app.vue +++ b/app.vue @@ -15,4 +15,14 @@ useHead({ nextTick(() => { $updateUserInfo() }) +const userId = useCookie('user-id', { + maxAge: 86400 * 28 +}); +// 初始化时,获取URL的query userId,如果有值,则赋值给 cookie:userId +const route = useRoute(); +const queryUserId = route.query.userId; + +if (queryUserId) { + userId.value = queryUserId; +} diff --git a/components/i/Aside.vue b/components/i/Aside.vue index 21020fa..da2768d 100644 --- a/components/i/Aside.vue +++ b/components/i/Aside.vue @@ -24,8 +24,7 @@ -
+
@@ -34,6 +33,7 @@ \ No newline at end of file + diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index d04d4f6..85b27ed 100644 --- a/components/i/search/Header.vue +++ b/components/i/search/Header.vue @@ -33,7 +33,7 @@ :label="$selectCollectionId.length ? '已收藏' : '收藏'" @click="handleOpenSelect" /> - + Layout.removeCollectData, (data) => { function handleDeletedThread () { navigateTo('/') } - \ No newline at end of file + diff --git a/composables/useConfig.js b/composables/useConfig.js new file mode 100644 index 0000000..58e42eb --- /dev/null +++ b/composables/useConfig.js @@ -0,0 +1,5 @@ +export default function () { + return { + deploymentType: 'private', // saas || private + } +} diff --git a/pages/index.vue b/pages/index.vue index c9be8fd..7747db9 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -23,7 +23,8 @@ \ No newline at end of file + -- GitLab