diff --git a/src/api/axios.ts b/src/api/axios.ts index 1eb87d16..2d8b9b65 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -1,7 +1,7 @@ import axios, { AxiosResponse, AxiosRequestConfig } from 'axios' import { ResultEnum } from "@/enums/httpEnum" import { ErrorPageNameMap } from "@/enums/pageEnum" -import { redirectErrorPage } from '@/utils' +import { redirectErrorPage } from '@/utils/page' const axiosInstance = axios.create({ baseURL: import.meta.env.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH, diff --git a/src/styles/common/animation.scss b/src/styles/common/animation.scss new file mode 100644 index 00000000..fa284f7a --- /dev/null +++ b/src/styles/common/animation.scss @@ -0,0 +1,23 @@ +.v-modal-enter { + animation: v-modal-in 0.2s ease; +} + +.v-modal-leave { + animation: v-modal-out 0.2s ease forwards; +} + +@keyframes v-modal-in { + 0% { + opacity: 0; + } + 100% { + } +} + +@keyframes v-modal-out { + 0% { + } + 100% { + opacity: 0; + } +} diff --git a/src/styles/common/mixins/config.scss b/src/styles/common/mixins/config.scss index 950044ab..3be6d24f 100644 --- a/src/styles/common/mixins/config.scss +++ b/src/styles/common/mixins/config.scss @@ -1,4 +1,4 @@ $namespace: 'go'; $theme-light: 'light'; -$theme-dart: 'dart'; +$theme-dark: 'dark'; $state-prefix: 'is-'; diff --git a/src/styles/common/mixins/mixins.scss b/src/styles/common/mixins/mixins.scss index 3b86be89..8e4dfc08 100644 --- a/src/styles/common/mixins/mixins.scss +++ b/src/styles/common/mixins/mixins.scss @@ -15,7 +15,7 @@ } @mixin go-d($block) { - $B: $namespace + '-' + $theme-dart + '-' + $block !global; + $B: $namespace + '-' + $theme-dark + '-' + $block !global; .#{$B} { @content; } diff --git a/src/styles/common/style.scss b/src/styles/common/style.scss index b7bf1f81..a2419cf7 100644 --- a/src/styles/common/style.scss +++ b/src/styles/common/style.scss @@ -1,13 +1,14 @@ @import './var.scss'; +@import './animation.scss'; // 毛玻璃 .--background-filter { - backdrop-filter: $--filter-blur; - background-color: $--filter-color; + backdrop-filter: $--filter-blur-base; + background-color: $--filter-color-base; } // 边框圆角 .--border-radius { - border-radius: $--border-radius; + border-radius: $--border-radius-base; overflow: hidden; } diff --git a/src/styles/common/var.scss b/src/styles/common/var.scss index a6d8e03b..ea59ff8b 100644 --- a/src/styles/common/var.scss +++ b/src/styles/common/var.scss @@ -1,6 +1,10 @@ // 模糊 -$--filter-blur: blur(2px); +$--filter-blur-base: blur(2px); // 毛玻璃 -$--filter-color: rgba(0, 0, 0, 0.07); +$--filter-color-base: rgba(0, 0, 0, 0.07); // 边框 -$--border-radius: 5px; +$--border-radius-base: 5px; +/// 阴影 +$--box-shadow-base: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04) !default; +$--box-shadow-dark: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.12) !default; +$--box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1) !default; diff --git a/src/utils/comp.ts b/src/utils/comp.ts deleted file mode 100644 index 24bf0bbc..00000000 --- a/src/utils/comp.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Component, DefineComponent } from "vue"; -import { App, Plugin, getCurrentInstance } from "vue"; - -interface Registed { - [key: string]: boolean; -} -let registed: Registed = {}; - -interface Comp { - displayName?: string; - name?: string; -} - -type RegisteComp = (comp: Comp & Plugin) => void; - -const registeComp: RegisteComp = comp => { - const name = comp.displayName || comp.name; - - if (name && !registed[name]) { - const instance = getCurrentInstance(); - const app = instance?.appContext.app; - if (app) { - app.use(comp); - registed[name] = true; - } - } -}; - -const regComp: (comp: any) => void = comp => { - const instance = getCurrentInstance(); - const app = instance?.appContext.app; - app?.component(comp?.name, comp); -}; -export { registeComp, regComp }; diff --git a/src/utils/index.ts b/src/utils/index.ts index 122965c4..d69a2050 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,8 +1,5 @@ import { h } from 'vue'; import { NIcon } from 'naive-ui'; -import { ResultEnum } from "@/enums/httpEnum" -import { ErrorPageNameMap } from "@/enums/pageEnum" -import router from '@/router'; /** * * 生成一个用不重复的ID @@ -24,14 +21,4 @@ export const renderIcon = (icon: any) => { return () => h(NIcon, null, { default: () => h(icon) }); } -/** - * * 错误页重定向 - * @param icon - * @returns - */ -export const redirectErrorPage = (code: ResultEnum) => { - router.push({ - name: ErrorPageNameMap.get(code) - }) -} diff --git a/src/utils/page.ts b/src/utils/page.ts new file mode 100644 index 00000000..f27faf5b --- /dev/null +++ b/src/utils/page.ts @@ -0,0 +1,25 @@ +import { ResultEnum } from "@/enums/httpEnum" +import { ErrorPageNameMap } from "@/enums/pageEnum" +import router from '@/router'; + +/** + * * 错误页重定向 + * @param icon + * @returns + */ +export const redirectErrorPage = (code: ResultEnum) => { + if(!code) return false + const pageName = ErrorPageNameMap.get(code) + if(!pageName) return false + routerTurnByName(pageName) +} + +/** + * * 根据名字跳转路由 + * @param pageName + */ +export const routerTurnByName = (pageName: string) => { + router.push({ + name: pageName + }) +} \ No newline at end of file diff --git a/src/views/exception/403.vue b/src/views/exception/403.vue index e314d9be..3ca43dde 100644 --- a/src/views/exception/403.vue +++ b/src/views/exception/403.vue @@ -1,5 +1,5 @@ diff --git a/src/views/exception/404.vue b/src/views/exception/404.vue index 1933bec1..8e96385f 100644 --- a/src/views/exception/404.vue +++ b/src/views/exception/404.vue @@ -13,11 +13,10 @@ diff --git a/src/views/exception/500.vue b/src/views/exception/500.vue index 076d274a..3d2fb344 100644 --- a/src/views/exception/500.vue +++ b/src/views/exception/500.vue @@ -1,5 +1,5 @@