diff --git a/src/App.vue b/src/App.vue index 0c97814..dceb137 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,12 +8,10 @@ import { computed } from 'vue' import { useGlobalStore } from '@/stores' const globalStore = useGlobalStore() - const loading = computed(() => globalStore.state.loading) - + const loading = computed(() => globalStore.state.loading || globalStore.state.view_loading) diff --git a/src/router/index.ts b/src/router/index.ts index 3f99f95..a98f9da 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -7,53 +7,58 @@ import { createRouter, createWebHistory } from 'vue-router' * 3. 路由的name默认是文件名,如果文件名与name不一致,通过defineOptions({ name: 'componentName' })来设置 */ const router = createRouter({ - history: createWebHistory('/'), - // history: createWebHistory(import.meta.env.VITE_APP_URL), - routes: [ - { - path: '/', - redirect: '/home' - }, - { - path: '/', - name: 'index', - component: () => import('../views/login/index.vue') - }, - { - path: '/login', - name: 'login', - component: () => import('../views/login/login.vue') - }, - { - path: '/home', - name: 'home', - component: () => import('../views/home/index.vue'), - children: [ - { - path: 'test', - name: 'test', - component: () => import('../views/home/test.vue'), - meta: { topNavStyle: '2' } - }, - { - path: '/home/versionTree', - name: 'versionTree', - component: () => import('../views/home/versionTree.vue'), - meta: { topNavStyle: '2' } - }, - { - path: 'mainInput', - name: 'mainInput', - component: () => import('../views/home/mainInput.vue') - } - ] - }, - { - path: '/:pathMatch(.*)', - name: '404', - component: () => import('../views/404.vue') - } - ] + history: createWebHistory('/'), + // history: createWebHistory(import.meta.env.VITE_APP_URL), + routes: [ + { + path: '/', + redirect: '/index' + }, + { + path: '/index', + name: 'index', + component: () => import('../views/login/index.vue'), + }, + { + path: '/login', + name: 'login', + component: () => import('../views/login/login.vue'), + }, + { + path: '/register', + name: 'register', + component: () => import('../views/login/register.vue'), + }, + { + path: '/home', + name: 'home', + component: () => import('../views/home/index.vue'), + children: [ + { + path: 'test', + name: 'test', + component: () => import('../views/home/test.vue'), + meta: { topNavStyle: '2' } + }, + { + path: '/home/versionTree', + name: 'versionTree', + component: () => import('../views/home/versionTree.vue'), + meta: { topNavStyle: '2' } + }, + { + path: 'mainInput', + name: 'mainInput', + component: () => import('../views/home/mainInput.vue') + } + ] + }, + { + path: '/:pathMatch(.*)', + name: '404', + component: () => import('../views/404.vue'), + } + ] }) export default router diff --git a/src/router/router-config.ts b/src/router/router-config.ts index bff05c0..45191ca 100644 --- a/src/router/router-config.ts +++ b/src/router/router-config.ts @@ -1,8 +1,11 @@ import router from './index' +import { useGlobalStore } from '@/stores/global' router.beforeEach((to, from, next) => { + useGlobalStore().setViewLoading(true) next() }) router.afterEach(() => { + useGlobalStore().setViewLoading(false) }) diff --git a/src/stores/global.ts b/src/stores/global.ts index 018db4b..787f476 100644 --- a/src/stores/global.ts +++ b/src/stores/global.ts @@ -3,15 +3,18 @@ import { ref, computed } from 'vue' export const useGlobalStore = defineStore('global', () => { const state = ref({ loading: false,// 全局loading + view_loading: false,// 页面跳转loading homeLeftNavCollapse: false,// 首页左侧导航是否折叠 }) const setLoading = (v: boolean) => { state.value.loading = v } + const setViewLoading = (v: boolean) => { state.value.view_loading = v } const setHomeLeftNavCollapse = (v: boolean) => { state.value.homeLeftNavCollapse = v } return { state, setLoading, + setViewLoading, setHomeLeftNavCollapse, } }) diff --git a/src/utils/tools.ts b/src/utils/tools.ts index eac100e..47e2b5d 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -102,6 +102,18 @@ export function FormatDate(value: Date | number | string, format: string = 'yyyy return str; } +/** + * 倒计时 + * @param time 倒计时时间,单位秒 + * @returns 倒计时字符串,格式为 mm:ss +*/ +export function CountDown(time: number) { + const mm = String(Math.floor(time / 60)).padStart(2, '0'); + const ss = String(time % 60).padStart(2, '0'); + return `${mm}:${ss}`; +} + + /** * 下载图片 diff --git a/src/views/css/style.css b/src/views/css/style.css new file mode 100644 index 0000000..aba66b7 --- /dev/null +++ b/src/views/css/style.css @@ -0,0 +1,184 @@ +.register, +.login { + width: 100%; + height: 100%; + overflow: hidden; + padding: 2.5rem; + display: flex; +} +.register > .left, +.login > .left { + flex: 1; + height: 100%; + position: relative; + overflow: hidden; +} +.register > .left > .bg, +.login > .left > .bg { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 2rem; +} +.register > .left > .logo, +.login > .left > .logo { + position: absolute; + top: 2.4rem; + left: 4.2rem; +} +.register > .left > .logo > img, +.login > .left > .logo > img { + width: 6rem; + height: auto; +} +.register > .left > .logo > span, +.login > .left > .logo > span { + font-weight: 600; + font-size: 3.3rem; +} +.register > .right, +.login > .right { + width: 90rem; + min-width: 600px; + display: flex; + flex-direction: column; +} +.register > .right > .top, +.login > .right > .top { + display: flex; + padding: 0 3rem; +} +.register > .right > .top > .back, +.login > .right > .top > .back { + width: 5rem; + height: 5rem; + border-radius: 1.2rem; + border: 0.25rem solid #dfdfdf; + background-color: transparent; + cursor: pointer; +} +.register > .right > .box, +.login > .right > .box { + min-width: 50rem; + flex: 1; + overflow-y: auto; + margin: 0 auto; + display: flex; + flex-direction: column; + align-items: center; +} +.register > .right > .box > img, +.login > .right > .box > img { + width: 11rem; + height: auto; + margin-top: 2rem; +} +.register > .right > .box > .visible-code, +.login > .right > .box > .visible-code { + margin-top: 1.7rem; + margin-bottom: 7.2rem; +} +.register > .right > .box > .title, +.login > .right > .box > .title { + font-weight: 600; + font-size: 7rem; + display: flex; + align-items: center; + justify-content: center; + color: #252727; + margin-top: 1.7rem; +} +.register > .right > .box > .title > img, +.login > .right > .box > .title > img { + width: auto; + height: 9.8rem; +} +.register > .right > .box > .tip, +.login > .right > .box > .tip { + font-weight: 400; + font-family: General Sans Variable; + font-style: Regular; + font-size: 1.8rem; + color: #666; + margin-top: 0.4rem; +} +.register > .right > .box > .el-form, +.login > .right > .box > .el-form { + margin-top: 5rem; + width: 100%; +} +.register > .right > .box > .el-form::v-deep .el-form-item, +.login > .right > .box > .el-form::v-deep .el-form-item { + margin-bottom: 2rem; +} +.register > .right > .box > .el-form::v-deep .el-form-item__label, +.login > .right > .box > .el-form::v-deep .el-form-item__label { + color: #252727; + font-size: 1.8rem; + margin-bottom: 0.8rem; +} +.register > .right > .box > .el-form::v-deep .el-input, +.login > .right > .box > .el-form::v-deep .el-input { + --el-input-height: 5rem; + --el-input-border-radius: 0.8rem; + --el-input-text-color: #252727; + --el-border-color: #dfdfdf; + font-size: 1.4rem; +} +.register > .right > .box > .el-form::v-deep .forgetPassword, +.login > .right > .box > .el-form::v-deep .forgetPassword { + margin-top: -1.2rem; + margin-bottom: 2rem; + font-size: 1.6rem; + text-align: right; + color: #666666; + cursor: pointer; + text-decoration: underline; +} +.register > .right > .box > .el-form::v-deep .privacy, +.login > .right > .box > .el-form::v-deep .privacy { + --el-checkbox-height: auto; + margin-bottom: 4rem; +} +.register > .right > .box > .el-form::v-deep .privacy .el-checkbox__label, +.login > .right > .box > .el-form::v-deep .privacy .el-checkbox__label { + font-size: 1.6rem; + color: #666666; + font-weight: 400; +} +.register > .right > .box > .el-form::v-deep .privacy .el-checkbox__label > span, +.login > .right > .box > .el-form::v-deep .privacy .el-checkbox__label > span { + text-decoration: underline; + cursor: pointer; +} +.register > .right > .box > .el-form::v-deep .el-form-item__error, +.login > .right > .box > .el-form::v-deep .el-form-item__error { + padding-top: 1px; + font-size: 1.4rem; +} +.register > .right > .box > .el-form::v-deep .submit, +.login > .right > .box > .el-form::v-deep .submit { + width: 100%; + height: 6rem; + background: #252727; + font-size: 2rem; + border-radius: 0.8rem; + color: #fff; + font-weight: 600; +} +.register > .right > .box > .tip-2, +.login > .right > .box > .tip-2 { + font-weight: 400; + font-size: 1.6rem; + color: #666; +} +.register > .right > .box > .tip-2 > span, +.login > .right > .box > .tip-2 > span { + text-decoration: underline; + color: #FF7A50; + cursor: pointer; +} +.register > .right > .box > .other-login, +.login > .right > .box > .other-login { + margin-top: 5rem; +} diff --git a/src/views/home/index.vue b/src/views/home/index.vue index ef639f2..4fb1ea7 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,5 +1,5 @@