修改样式细节,修改utils

This commit is contained in:
MTrun 2021-12-14 16:41:43 +08:00
parent 7e5d5aa067
commit 0b326c4e76
12 changed files with 98 additions and 89 deletions

View File

@ -1,7 +1,7 @@
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios' import axios, { AxiosResponse, AxiosRequestConfig } from 'axios'
import { ResultEnum } from "@/enums/httpEnum" import { ResultEnum } from "@/enums/httpEnum"
import { ErrorPageNameMap } from "@/enums/pageEnum" import { ErrorPageNameMap } from "@/enums/pageEnum"
import { redirectErrorPage } from '@/utils' import { redirectErrorPage } from '@/utils/page'
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: import.meta.env.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH, baseURL: import.meta.env.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH,

View File

@ -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;
}
}

View File

@ -1,4 +1,4 @@
$namespace: 'go'; $namespace: 'go';
$theme-light: 'light'; $theme-light: 'light';
$theme-dart: 'dart'; $theme-dark: 'dark';
$state-prefix: 'is-'; $state-prefix: 'is-';

View File

@ -15,7 +15,7 @@
} }
@mixin go-d($block) { @mixin go-d($block) {
$B: $namespace + '-' + $theme-dart + '-' + $block !global; $B: $namespace + '-' + $theme-dark + '-' + $block !global;
.#{$B} { .#{$B} {
@content; @content;
} }

View File

@ -1,13 +1,14 @@
@import './var.scss'; @import './var.scss';
@import './animation.scss';
// 毛玻璃 // 毛玻璃
.--background-filter { .--background-filter {
backdrop-filter: $--filter-blur; backdrop-filter: $--filter-blur-base;
background-color: $--filter-color; background-color: $--filter-color-base;
} }
// 边框圆角 // 边框圆角
.--border-radius { .--border-radius {
border-radius: $--border-radius; border-radius: $--border-radius-base;
overflow: hidden; overflow: hidden;
} }

View File

@ -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;

View File

@ -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 };

View File

@ -1,8 +1,5 @@
import { h } from 'vue'; import { h } from 'vue';
import { NIcon } from 'naive-ui'; import { NIcon } from 'naive-ui';
import { ResultEnum } from "@/enums/httpEnum"
import { ErrorPageNameMap } from "@/enums/pageEnum"
import router from '@/router';
/** /**
* * ID * * ID
@ -24,14 +21,4 @@ export const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) }); return () => h(NIcon, null, { default: () => h(icon) });
} }
/**
* *
* @param icon
* @returns
*/
export const redirectErrorPage = (code: ResultEnum) => {
router.push({
name: ErrorPageNameMap.get(code)
})
}

25
src/utils/page.ts Normal file
View File

@ -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
})
}

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col justify-center page-container"> <div class="go-error">
<div class="text-center"> <div class="text-center">
<img src="~@/assets/images/exception/403.svg" alt="" /> <img src="~@/assets/images/exception/403.svg" alt="" />
</div> </div>
@ -11,30 +11,32 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router'
const router = useRouter(); import { PageEnum } from '@/enums/pageEnum'
function goHome() { import { routerTurnByName } from '@/utils/page'
router.push('/'); const router = useRouter()
} function goHome() {
routerTurnByName(PageEnum.BASE_HOME_NAME)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page-container { @include go(error) {
width: 100%; display: flex;
border-radius: 4px; flex-direction: column;
padding: 50px 0; align-items: center;
height: 100vh; width: 100%;
padding: 100px 0;
.text-center { .text-center {
h1 { h1 {
color: #666; color: #666;
padding: 20px 0; padding: 20px 0;
}
}
img {
width: 350px;
margin: 0 auto;
} }
} }
img {
width: 350px;
margin: 0 auto;
}
}
</style> </style>

View File

@ -13,11 +13,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { PageEnum } from '@/enums/pageEnum' import { PageEnum } from '@/enums/pageEnum'
import { routerTurnByName } from '@/utils/page'
const router = useRouter() const router = useRouter()
function goHome() { function goHome() {
router.push({ routerTurnByName(PageEnum.BASE_HOME_NAME)
name: PageEnum.BASE_HOME_NAME
})
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col justify-center page-container"> <div class="go-error">
<div class="text-center"> <div class="text-center">
<img src="~@/assets/images/exception/500.svg" alt="" /> <img src="~@/assets/images/exception/500.svg" alt="" />
</div> </div>
@ -12,19 +12,21 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { PageEnum } from '@/enums/pageEnum'
import { routerTurnByName } from '@/utils/page'
const router = useRouter() const router = useRouter()
const goHome = () => { function goHome() {
router.push('/') routerTurnByName(PageEnum.BASE_HOME_NAME)
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page-container { @include go(error) {
display: flex;
flex-direction: column;
align-items: center;
width: 100%; width: 100%;
border-radius: 4px; padding: 100px 0;
padding: 50px 0;
height: 100vh;
.text-center { .text-center {
h1 { h1 {
color: #666; color: #666;