From 408994e4f008707dd872a89481f03bc55003ff1a Mon Sep 17 00:00:00 2001 From: 05412 <2738076308@qq.com> Date: Tue, 30 Jul 2024 17:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/items/LoginDialog.vue | 68 +--------------------------- src/components/views/HomeView.vue | 39 +++++++++++++--- src/components/views/LoginView.vue | 5 +- src/components/views/ServiceView.vue | 11 +++++ src/components/views/TestView.vue | 32 +++++++++++++ src/main.ts | 16 ++----- src/plugins/pinia.ts | 3 ++ src/plugins/vuetify.ts | 17 +++++++ src/router.ts | 8 ++++ src/stores/userinfo-store.ts | 17 +++++-- src/style.css | 3 ++ 11 files changed, 128 insertions(+), 91 deletions(-) create mode 100644 src/components/views/ServiceView.vue create mode 100644 src/components/views/TestView.vue create mode 100644 src/plugins/pinia.ts create mode 100644 src/plugins/vuetify.ts diff --git a/src/components/items/LoginDialog.vue b/src/components/items/LoginDialog.vue index c36e61d..90ab8d6 100644 --- a/src/components/items/LoginDialog.vue +++ b/src/components/items/LoginDialog.vue @@ -1,73 +1,9 @@ + \ No newline at end of file diff --git a/src/components/views/HomeView.vue b/src/components/views/HomeView.vue index 16bb073..e8a0115 100644 --- a/src/components/views/HomeView.vue +++ b/src/components/views/HomeView.vue @@ -1,4 +1,11 @@ - \ No newline at end of file diff --git a/src/components/views/LoginView.vue b/src/components/views/LoginView.vue index 854a64c..511bb32 100644 --- a/src/components/views/LoginView.vue +++ b/src/components/views/LoginView.vue @@ -1,13 +1,14 @@ \ No newline at end of file diff --git a/src/components/views/TestView.vue b/src/components/views/TestView.vue new file mode 100644 index 0000000..5ae19de --- /dev/null +++ b/src/components/views/TestView.vue @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 6eeb368..a0a6e27 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,22 +1,12 @@ import {createApp} from 'vue' import './style.css' import 'vuetify/styles' +import '@mdi/font/css/materialdesignicons.css' import {router} from "./router.ts"; import App from "./App.vue"; -import {createVuetify} from "vuetify"; -import {createPinia, Pinia} from "pinia"; +import {vuetify} from "./plugins/vuetify.ts"; +import {pinia} from "./plugins/pinia.ts"; -const vuetify = createVuetify({ - icons: { - defaultSet: 'mdi' - }, - defaults: { - global: { - ripple: true - } - } -}) -const pinia: Pinia = createPinia() createApp(App) .use(router) .use(vuetify) diff --git a/src/plugins/pinia.ts b/src/plugins/pinia.ts new file mode 100644 index 0000000..73a75bb --- /dev/null +++ b/src/plugins/pinia.ts @@ -0,0 +1,3 @@ +import {createPinia} from "pinia"; + +export const pinia = createPinia() \ No newline at end of file diff --git a/src/plugins/vuetify.ts b/src/plugins/vuetify.ts new file mode 100644 index 0000000..1f149da --- /dev/null +++ b/src/plugins/vuetify.ts @@ -0,0 +1,17 @@ +import {createVuetify} from "vuetify"; +import {aliases, mdi} from "vuetify/iconsets/mdi"; + +export const vuetify = createVuetify({ + icons: { + defaultSet: 'mdi', + aliases, + sets: { + mdi + } + }, + defaults: { + global: { + ripple: true + } + } +}) \ No newline at end of file diff --git a/src/router.ts b/src/router.ts index bcb4231..95a24f6 100644 --- a/src/router.ts +++ b/src/router.ts @@ -2,6 +2,8 @@ import {createRouter, createWebHistory} from "vue-router"; import Login from "./components/views/LoginView.vue"; import InputBox from "./components/items/InputBox.vue"; import IntroView from "./components/views/IntroView.vue"; +import TestView from "./components/views/TestView.vue"; +import ServiceView from "./components/views/ServiceView.vue"; const routes = [ { @@ -13,6 +15,12 @@ const routes = [ }, { path: '/input', component: InputBox + }, { + path: '/test', + component: TestView + }, { + path: '/services', + component: ServiceView } ] export const router = createRouter({ diff --git a/src/stores/userinfo-store.ts b/src/stores/userinfo-store.ts index 8936f01..78e3e9d 100644 --- a/src/stores/userinfo-store.ts +++ b/src/stores/userinfo-store.ts @@ -1,8 +1,19 @@ import {defineStore} from "pinia"; -import {ref} from "vue"; +import {computed, ref} from "vue"; -export const useUserinfoStore = defineStore('userinfo', ()=>{ +export const useUserinfoStore = defineStore('userinfo', () => { const token = ref('') const username = ref('') - return { token, username } + const isLogin = computed(() => token.value.length == 0) + const setToken = (t: string): void => { + token.value = t + localStorage.setItem('token', t) + } + const getToken = (): string => { + if (token.value.length == 0) { + token.value = localStorage.getItem('token') ?? '' + } + return token.value + } + return {token, username, isLogin, setToken, getToken} }) \ No newline at end of file diff --git a/src/style.css b/src/style.css index 1f41254..dea6d18 100644 --- a/src/style.css +++ b/src/style.css @@ -9,3 +9,6 @@ --color-primary-deeper: #1B8EF2; --color-primary-lighter: #38BDF2; } +.v-overlay.v-dialog{ + backdrop-filter: blur(3px); +} \ No newline at end of file