diff --git a/package-lock.json b/package-lock.json index 6daad32..154a29d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@vue-flow/core": "^1.48.2", "axios": "^1.3.6", "crypto-js": "^4.2.0", + "dagre": "^0.8.5", "element-plus": "^2.13.2", "gsap": "^3.13.0", "markdown-it": "^14.1.0", @@ -2401,6 +2402,16 @@ "node": ">=12" } }, + "node_modules/dagre": { + "version": "0.8.5", + "resolved": "https://registry.npmmirror.com/dagre/-/dagre-0.8.5.tgz", + "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==", + "license": "MIT", + "dependencies": { + "graphlib": "^2.1.8", + "lodash": "^4.17.15" + } + }, "node_modules/data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -3680,6 +3691,15 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, + "node_modules/graphlib": { + "version": "2.1.8", + "resolved": "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz", + "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + } + }, "node_modules/gsap": { "version": "3.13.0", "resolved": "https://registry.npmmirror.com/gsap/-/gsap-3.13.0.tgz", @@ -10373,6 +10393,15 @@ "d3-transition": "2 - 3" } }, + "dagre": { + "version": "0.8.5", + "resolved": "https://registry.npmmirror.com/dagre/-/dagre-0.8.5.tgz", + "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==", + "requires": { + "graphlib": "^2.1.8", + "lodash": "^4.17.15" + } + }, "data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -11359,6 +11388,14 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, + "graphlib": { + "version": "2.1.8", + "resolved": "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz", + "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==", + "requires": { + "lodash": "^4.17.15" + } + }, "gsap": { "version": "3.13.0", "resolved": "https://registry.npmmirror.com/gsap/-/gsap-3.13.0.tgz", diff --git a/package.json b/package.json index 850d9a5..adefe3f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@vue-flow/core": "^1.48.2", "axios": "^1.3.6", "crypto-js": "^4.2.0", + "dagre": "^0.8.5", "element-plus": "^2.13.2", "gsap": "^3.13.0", "markdown-it": "^14.1.0", 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 @@