diff --git a/.prettierrc.js b/.prettierrc.js index 0aea8bf7..5ee69f71 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -12,7 +12,6 @@ module.exports = { eslintIntegration: false, //不让prettier使用eslint的代码格式进行校验 htmlWhitespaceSensitivity: 'ignore', // 指定HTML文件的全局空白区域敏感度 有效选项:"css"- 遵守CSS display属性的默认值。"strict" - 空格被认为是敏感的。"ignore" - 空格被认为是不敏感的。html 中空格也会占位,影响布局,prettier 格式化的时候可能会将文本换行,造成布局错乱 ignorePath: '.prettierignore', // 不使用prettier格式化的文件填写在项目的.prettierignore文件中 - jsxBracketSameLine: false, // 在jsx中把'>' 是否单独放一行 jsxSingleQuote: false, // 在jsx中使用单引号代替双引号 // parser: 'babylon', // 格式化的解析器,默认是babylon requireConfig: false, // Require a 'prettierconfig' to format prettier diff --git a/package.json b/package.json index fecdc3f1..ee35f4c9 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@vueuse/core": "^6.3.2", "axios": "^0.21.4", "chroma-js": "^2.1.2", - "dayjs": "^1.10.6", + "dayjs": "^1.10.7", "form-data": "^4.0.0", "naive-ui": "^2.18.1", "pinia": "^2.0.0-rc.4", @@ -33,7 +33,7 @@ "devDependencies": { "@commitlint/cli": "^13.1.0", "@commitlint/config-conventional": "^13.1.0", - "@iconify/json": "^1.1.399", + "@iconify/json": "^1.1.400", "@iconify/vue": "^3.0.0", "@types/chroma-js": "^2.1.3", "@types/nprogress": "^0.2.0", @@ -60,7 +60,7 @@ "patch-package": "^6.4.7", "postinstall-postinstall": "^2.1.0", "prettier": "^2.4.0", - "sass": "^1.39.0", + "sass": "^1.39.2", "typescript": "^4.4.2", "unplugin-icons": "^0.7.6", "unplugin-vue-components": "^0.15.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e082323c..e5cb5b7a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,7 +3,7 @@ lockfileVersion: 5.3 specifiers: '@commitlint/cli': ^13.1.0 '@commitlint/config-conventional': ^13.1.0 - '@iconify/json': ^1.1.399 + '@iconify/json': ^1.1.400 '@iconify/vue': ^3.0.0 '@types/chroma-js': ^2.1.3 '@types/nprogress': ^0.2.0 @@ -21,7 +21,7 @@ specifiers: commitizen: ^4.2.4 cz-conventional-changelog: ^3.3.0 cz-customizable: ^6.3.0 - dayjs: ^1.10.6 + dayjs: ^1.10.7 dotenv: ^10.0.0 eslint: ^7.32.0 eslint-config-airbnb-base: ^14.2.1 @@ -38,7 +38,7 @@ specifiers: postinstall-postinstall: ^2.1.0 prettier: ^2.4.0 qs: ^6.10.1 - sass: ^1.39.0 + sass: ^1.39.2 smoothscroll-polyfill: ^0.4.4 typescript: ^4.4.2 unplugin-icons: ^0.7.6 @@ -55,7 +55,7 @@ dependencies: '@vueuse/core': registry.nlark.com/@vueuse/core/6.3.2_vue@3.2.10 axios: registry.nlark.com/axios/0.21.4 chroma-js: registry.nlark.com/chroma-js/2.1.2 - dayjs: registry.nlark.com/dayjs/1.10.6 + dayjs: registry.nlark.com/dayjs/1.10.7 form-data: 4.0.0 naive-ui: registry.nlark.com/naive-ui/2.18.1_vue@3.2.10 pinia: registry.nlark.com/pinia/2.0.0-rc.4_typescript@4.4.2+vue@3.2.10 @@ -67,7 +67,7 @@ dependencies: devDependencies: '@commitlint/cli': registry.nlark.com/@commitlint/cli/13.1.0 '@commitlint/config-conventional': registry.nlark.com/@commitlint/config-conventional/13.1.0 - '@iconify/json': registry.nlark.com/@iconify/json/1.1.399 + '@iconify/json': registry.nlark.com/@iconify/json/1.1.400 '@iconify/vue': registry.nlark.com/@iconify/vue/3.0.0_vue@3.2.10 '@types/chroma-js': registry.nlark.com/@types/chroma-js/2.1.3 '@types/nprogress': registry.nlark.com/@types/nprogress/0.2.0 @@ -94,9 +94,9 @@ devDependencies: patch-package: registry.nlark.com/patch-package/6.4.7 postinstall-postinstall: registry.nlark.com/postinstall-postinstall/2.1.0 prettier: registry.nlark.com/prettier/2.4.0 - sass: registry.nlark.com/sass/1.39.0 + sass: registry.nlark.com/sass/1.39.2 typescript: registry.nlark.com/typescript/4.4.2 - unplugin-icons: registry.nlark.com/unplugin-icons/0.7.6_5d72f6392975d02ee45d0acbc066efa3 + unplugin-icons: registry.nlark.com/unplugin-icons/0.7.6_ab88f3ed6cd34af3ce86467cf77018e8 unplugin-vue-components: registry.nlark.com/unplugin-vue-components/0.15.0_vite@2.5.6+vue@3.2.10 vite: registry.nlark.com/vite/2.5.6 vite-plugin-html: registry.nlark.com/vite-plugin-html/2.1.0_vite@2.5.6 @@ -2345,10 +2345,10 @@ packages: version: 1.0.10 dev: true - registry.nlark.com/@iconify/json/1.1.399: - resolution: {integrity: sha1-hdBstQTkqkRkdYzo9n//lH1VKDU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@iconify/json/download/@iconify/json-1.1.399.tgz} + registry.nlark.com/@iconify/json/1.1.400: + resolution: {integrity: sha1-ZlZgMgOxo4klDH396+BrL9+LGwE=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@iconify/json/download/@iconify/json-1.1.400.tgz} name: '@iconify/json' - version: 1.1.399 + version: 1.1.400 dev: true registry.nlark.com/@iconify/vue/3.0.0_vue@3.2.10: @@ -3461,10 +3461,10 @@ packages: engines: {node: '>=0.11'} dev: false - registry.nlark.com/dayjs/1.10.6: - resolution: {integrity: sha1-KIsqqC8thBimydTfWJjAc3rQKmM=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/dayjs/download/dayjs-1.10.6.tgz} + registry.nlark.com/dayjs/1.10.7: + resolution: {integrity: sha1-LPX5Gt0oEWdIRAhmoKHSbzps5Gg=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/dayjs/download/dayjs-1.10.7.tgz} name: dayjs - version: 1.10.6 + version: 1.10.7 dev: false registry.nlark.com/debug/2.6.9: @@ -5176,10 +5176,10 @@ packages: tslib: registry.nlark.com/tslib/1.14.1 dev: true - registry.nlark.com/sass/1.39.0: - resolution: {integrity: sha1-bGRpXRxDd2fI8aTkcSiOgx+B0DU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/sass/download/sass-1.39.0.tgz} + registry.nlark.com/sass/1.39.2: + resolution: {integrity: sha1-FoGWQ3j1jXb8ZKalAmGb1ayZ9mA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/sass/download/sass-1.39.2.tgz?cache=0&sync_timestamp=1631232791563&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsass%2Fdownload%2Fsass-1.39.2.tgz} name: sass - version: 1.39.0 + version: 1.39.2 engines: {node: '>=8.9.0'} hasBin: true dependencies: @@ -5532,7 +5532,7 @@ packages: hasBin: true dev: true - registry.nlark.com/unplugin-icons/0.7.6_5d72f6392975d02ee45d0acbc066efa3: + registry.nlark.com/unplugin-icons/0.7.6_ab88f3ed6cd34af3ce86467cf77018e8: resolution: {integrity: sha1-CLYc+b2imJyKfcbU6oBStluwkKA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/unplugin-icons/download/unplugin-icons-0.7.6.tgz} id: registry.nlark.com/unplugin-icons/0.7.6 name: unplugin-icons @@ -5553,7 +5553,7 @@ packages: vue-template-es2015-compiler: optional: true dependencies: - '@iconify/json': registry.nlark.com/@iconify/json/1.1.399 + '@iconify/json': registry.nlark.com/@iconify/json/1.1.400 '@iconify/json-tools': registry.nlark.com/@iconify/json-tools/1.0.10 '@vue/compiler-sfc': registry.nlark.com/@vue/compiler-sfc/3.2.11 has-pkg: registry.nlark.com/has-pkg/0.0.1 @@ -5858,6 +5858,9 @@ packages: peerDependencies: '@vue/composition-api': ^1.0.0-rc.1 vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true dependencies: vue: registry.nlark.com/vue/3.2.10 dev: false diff --git a/src/assets/img/common/logo-fill.png b/src/assets/img/common/logo-fill.png new file mode 100644 index 00000000..55fa1495 Binary files /dev/null and b/src/assets/img/common/logo-fill.png differ diff --git a/src/assets/img/logo/bg.png b/src/assets/img/logo/bg.png deleted file mode 100644 index b9414134..00000000 Binary files a/src/assets/img/logo/bg.png and /dev/null differ diff --git a/src/components/common/LoginBg/components/CornerBottom.vue b/src/components/common/LoginBg/components/CornerBottom.vue new file mode 100644 index 00000000..8a93286c --- /dev/null +++ b/src/components/common/LoginBg/components/CornerBottom.vue @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/common/LoginBg/components/CornerTop.vue b/src/components/common/LoginBg/components/CornerTop.vue new file mode 100644 index 00000000..35ba2f4a --- /dev/null +++ b/src/components/common/LoginBg/components/CornerTop.vue @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/common/LoginBg/components/index.ts b/src/components/common/LoginBg/components/index.ts new file mode 100644 index 00000000..33e9bf12 --- /dev/null +++ b/src/components/common/LoginBg/components/index.ts @@ -0,0 +1,4 @@ +import CornerTop from './CornerTop.vue'; +import CornerBottom from './CornerBottom.vue'; + +export { CornerTop, CornerBottom }; diff --git a/src/components/common/LoginBg/index.vue b/src/components/common/LoginBg/index.vue new file mode 100644 index 00000000..81a0c6c0 --- /dev/null +++ b/src/components/common/LoginBg/index.vue @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/src/components/common/SystemLogo/index.vue b/src/components/common/SystemLogo/index.vue new file mode 100644 index 00000000..897fee3f --- /dev/null +++ b/src/components/common/SystemLogo/index.vue @@ -0,0 +1,19 @@ + + + + + + diff --git a/src/components/common/index.ts b/src/components/common/index.ts index 5751dc08..5cc976be 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -1,6 +1,7 @@ import AppProviderContent from './AppProviderContent/index.vue'; +import SystemLogo from './SystemLogo/index.vue'; import ExceptionSvg from './ExceptionSvg/index.vue'; +import LoginBg from './LoginBg/index.vue'; import BannerSvg from './BannerSvg/index.vue'; -import CountTo from './CountTo/index.vue'; -export { AppProviderContent, ExceptionSvg, BannerSvg, CountTo }; +export { AppProviderContent, SystemLogo, ExceptionSvg, LoginBg, BannerSvg }; diff --git a/src/components/common/CountTo/index.vue b/src/components/custom/CountTo/index.vue similarity index 100% rename from src/components/common/CountTo/index.vue rename to src/components/custom/CountTo/index.vue diff --git a/src/components/custom/index.ts b/src/components/custom/index.ts new file mode 100644 index 00000000..4a841b08 --- /dev/null +++ b/src/components/custom/index.ts @@ -0,0 +1,3 @@ +import CountTo from './CountTo/index.vue'; + +export { CountTo }; diff --git a/src/components/index.ts b/src/components/index.ts index 42cbc0cf..3becafa9 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1 +1,2 @@ -export { AppProviderContent, ExceptionSvg, BannerSvg, CountTo } from './common'; +export { AppProviderContent, SystemLogo, ExceptionSvg, LoginBg, BannerSvg } from './common'; +export { CountTo } from './custom'; diff --git a/src/enum/common.ts b/src/enum/common.ts index 2964a6b6..ee36d509 100644 --- a/src/enum/common.ts +++ b/src/enum/common.ts @@ -19,3 +19,12 @@ export enum EnumDataType { set = '[object Set]', map = '[object Map]' } + +/** 登录模块 */ +export enum EnumLoginModule { + 'pwd-login' = '账密登录', + 'code-login' = '手机验证码登录', + 'register' = '注册', + 'reset-pwd' = '重置密码', + 'bind-wechat' = '微信绑定' +} diff --git a/src/enum/index.ts b/src/enum/index.ts index 6c1dbd7d..6d234aaf 100644 --- a/src/enum/index.ts +++ b/src/enum/index.ts @@ -1,4 +1,4 @@ -export { ContentType, EnumDataType } from './common'; +export { ContentType, EnumDataType, EnumLoginModule } from './common'; export { EnumAnimate } from './animate'; export { EnumNavMode, EnumNavTheme } from './theme'; export { EnumRoutePaths } from './route'; diff --git a/src/hooks/business/index.ts b/src/hooks/business/index.ts new file mode 100644 index 00000000..c349b452 --- /dev/null +++ b/src/hooks/business/index.ts @@ -0,0 +1,4 @@ +import useCountDown from './useCountDown'; +import useSmsCode from './useSmsCode'; + +export { useCountDown, useSmsCode }; diff --git a/src/hooks/business/useCountDown.ts b/src/hooks/business/useCountDown.ts new file mode 100644 index 00000000..45358fa4 --- /dev/null +++ b/src/hooks/business/useCountDown.ts @@ -0,0 +1,46 @@ +import { ref, computed } from 'vue'; + +/** + * 倒计时 + * @param second - 倒计时的时间(s) + */ +export default function useCountDown(second: number) { + if (second <= 0 && second % 1 !== 0) { + throw Error('倒计时的时间应该为一个正整数!'); + } + const counts = ref(0); + const isCounting = computed(() => Boolean(counts.value)); + + let intervalId: any; + + /** + * 开始计时 + * @param updateSecond - 更改初时传入的倒计时时间 + */ + function start(updateSecond: number = second) { + if (!counts.value) { + counts.value = updateSecond; + intervalId = setInterval(() => { + counts.value -= 1; + if (counts.value <= 0) { + clearInterval(intervalId); + } + }, 1000); + } + } + + /** + * 停止计时 + */ + function stop() { + intervalId = clearInterval(intervalId); + counts.value = 0; + } + + return { + counts, + isCounting, + start, + stop + }; +} diff --git a/src/hooks/business/useSmsCode.ts b/src/hooks/business/useSmsCode.ts new file mode 100644 index 00000000..0988751c --- /dev/null +++ b/src/hooks/business/useSmsCode.ts @@ -0,0 +1,15 @@ +import { computed } from 'vue'; +import useCountDown from './useCountDown'; + +export default function useSmsCode() { + const { counts, start, isCounting } = useCountDown(60); + const initLabel = '获取验证码'; + const countingLabel = (second: number) => `${second}秒后重新获取`; + const label = computed(() => (isCounting.value ? countingLabel(counts.value) : initLabel)); + + return { + label, + start, + isCounting + }; +} diff --git a/src/hooks/common/index.ts b/src/hooks/common/index.ts new file mode 100644 index 00000000..8edf8436 --- /dev/null +++ b/src/hooks/common/index.ts @@ -0,0 +1,5 @@ +import useAppTitle from './useAppTitle'; +import useCreateContext from './useCreateContext'; +import useRouterChange from './useRouterChange'; + +export { useAppTitle, useCreateContext, useRouterChange }; diff --git a/src/hooks/common/useAppTitle.ts b/src/hooks/common/useAppTitle.ts new file mode 100644 index 00000000..6685cdf8 --- /dev/null +++ b/src/hooks/common/useAppTitle.ts @@ -0,0 +1,6 @@ +/** 项目名称 */ +export default function useAppTitle() { + const title = import.meta.env.VITE_APP_TITLE as string; + + return title; +} diff --git a/src/hooks/common/useCreateContext.ts b/src/hooks/common/useCreateContext.ts new file mode 100644 index 00000000..01f8ae06 --- /dev/null +++ b/src/hooks/common/useCreateContext.ts @@ -0,0 +1,20 @@ +import { provide, inject } from 'vue'; +import type { InjectionKey } from 'vue'; + +/** 创建共享上下文状态 */ +export default function useCreateContext(contextName: string = 'context') { + const injectKey: InjectionKey = Symbol(contextName); + + function useProvider(shareState: T) { + provide(injectKey, shareState); + } + + function useContext() { + return inject(injectKey); + } + + return { + useProvider, + useContext + }; +} diff --git a/src/hooks/common/useRouterChange.ts b/src/hooks/common/useRouterChange.ts new file mode 100644 index 00000000..ba51585b --- /dev/null +++ b/src/hooks/common/useRouterChange.ts @@ -0,0 +1,42 @@ +import { useRouter } from 'vue-router'; +import { EnumRoutePaths } from '@/enum'; +import { RouteNameMap } from '@/router'; +import type { LoginModuleType } from '@/interface'; + +export default function useRouterChange() { + const router = useRouter(); + + /** + * 跳转登录页面(通过vue路由) + * @param module - 展示的登录模块 + * @param redirectUrl - 登录后重定向的页面路径 + */ + function toLogin(module: LoginModuleType = 'pwd-login', redirectUrl?: string) { + router.push({ + name: RouteNameMap.get('login'), + params: { + module + }, + query: { + redirectUrl + } + }); + } + /** + * 跳转登录页面(通过window.location) + * @param module - 展示的登录模块 + * @param redirectUrl - 登录后重定向的页面路径 + */ + function toLoginByLocation(module: LoginModuleType = 'pwd-login', redirectUrl?: string) { + let href = `${window.location.origin + EnumRoutePaths.login}/${module}`; + if (redirectUrl) { + href += redirectUrl; + } + window.location.href = href; + } + + return { + toLogin, + toLoginByLocation + }; +} diff --git a/src/hooks/index.ts b/src/hooks/index.ts index e69de29b..4f96d75b 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -0,0 +1,2 @@ +export { useAppTitle, useCreateContext, useRouterChange } from './common'; +export { useCountDown, useSmsCode } from './business'; diff --git a/src/interface/common.ts b/src/interface/common.ts index e69de29b..d4649b6b 100644 --- a/src/interface/common.ts +++ b/src/interface/common.ts @@ -0,0 +1,4 @@ +import { EnumRoutePaths, EnumLoginModule } from '@/enum'; + +export type RoutePathKey = keyof typeof EnumRoutePaths; +export type LoginModuleType = keyof typeof EnumLoginModule; diff --git a/src/interface/index.ts b/src/interface/index.ts index 1ee945d2..626ff1b6 100644 --- a/src/interface/index.ts +++ b/src/interface/index.ts @@ -1,2 +1,3 @@ export { UserInfo } from './business'; export { ThemeSettings, NavMode, AnimateType } from './theme'; +export { RoutePathKey, LoginModuleType } from './common'; diff --git a/src/layouts/BasicLayout/components/common/GlobalLogo.vue b/src/layouts/BasicLayout/components/common/GlobalLogo.vue index 641aa8c5..daeab1d3 100644 --- a/src/layouts/BasicLayout/components/common/GlobalLogo.vue +++ b/src/layouts/BasicLayout/components/common/GlobalLogo.vue @@ -8,10 +8,11 @@ diff --git a/src/layouts/BasicLayout/components/common/GlobalMenu.vue b/src/layouts/BasicLayout/components/common/GlobalMenu.vue index 3d08339c..82c4db74 100644 --- a/src/layouts/BasicLayout/components/common/GlobalMenu.vue +++ b/src/layouts/BasicLayout/components/common/GlobalMenu.vue @@ -1,6 +1,9 @@ 菜单 + + 登录页 + diff --git a/src/layouts/index.ts b/src/layouts/index.ts index a52c5971..90c3e369 100644 --- a/src/layouts/index.ts +++ b/src/layouts/index.ts @@ -1,5 +1,4 @@ import BasicLayout from './BasicLayout/index.vue'; import BlankLayout from './BlankLayout/index.vue'; -import BlankChildLayout from './BlankChildLayout/index.vue'; -export { BasicLayout, BlankLayout, BlankChildLayout }; +export { BasicLayout, BlankLayout }; diff --git a/src/router/index.ts b/src/router/index.ts index d2b4777f..f5cb71b2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'; import type { App } from 'vue'; import type { RouteRecordRaw } from 'vue-router'; -import { constantRoutes, customRoutes } from './routes'; +import { constantRoutes, customRoutes, RouteNameMap } from './routes'; import createRouterGuide from './permission'; const routes: Array = [...customRoutes, ...constantRoutes]; @@ -19,3 +19,5 @@ export async function setupRouter(app: App) { createRouterGuide(router); await router.isReady(); } + +export { RouteNameMap }; diff --git a/src/router/routes.ts b/src/router/routes.ts index 2391bc70..7b465fa8 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -1,11 +1,15 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout, BlankLayout, BlankChildLayout } from '@/layouts'; +import { BasicLayout, BlankLayout } from '@/layouts'; import { EnumRoutePaths } from '@/enum'; - -type RouteKey = keyof typeof EnumRoutePaths; +import type { RoutePathKey, LoginModuleType } from '@/interface'; +import { getLoginModuleRegExp } from '@/utils'; /** 路由名称 */ -export const RouteNameMap = new Map((Object.keys(EnumRoutePaths) as RouteKey[]).map(v => [v, v])); +export const RouteNameMap = new Map( + (Object.keys(EnumRoutePaths) as RoutePathKey[]).map(v => [v, v]) +); + +const loginModuleRegExp = getLoginModuleRegExp(); /** * 固定不变的路由 @@ -21,8 +25,14 @@ export const constantRoutes: Array = [ // 登录 { name: RouteNameMap.get('login'), - path: EnumRoutePaths.login, + path: `${EnumRoutePaths.login}/:module(/${loginModuleRegExp}/)?`, component: () => import('@/views/system/login/index.vue'), + props: route => { + const moduleType: LoginModuleType = (route.params.module as LoginModuleType) || 'pwd-login'; + return { + module: moduleType + }; + }, meta: { fullPage: true } @@ -70,47 +80,45 @@ export const customRoutes: Array = [ { name: 'root', path: '/', + redirect: { name: RouteNameMap.get('dashboard-analysis') } + }, + { + name: 'dashboard', + path: '/dashboard', + component: BasicLayout, redirect: { name: RouteNameMap.get('dashboard-analysis') }, + children: [ + { + name: RouteNameMap.get('dashboard-analysis'), + path: EnumRoutePaths['dashboard-analysis'], + component: () => import('@/views/dashboard/analysis/index.vue') + }, + { + name: RouteNameMap.get('dashboard-workbench'), + path: EnumRoutePaths['dashboard-workbench'], + component: () => import('@/views/dashboard/workbench/index.vue') + } + ] + }, + { + name: 'exception', + path: '/exception', component: BasicLayout, children: [ { - name: 'dashboard', - path: '/dashboard', - component: BlankChildLayout, - children: [ - { - name: RouteNameMap.get('dashboard-analysis'), - path: EnumRoutePaths['dashboard-analysis'], - component: () => import('@/views/dashboard/analysis/index.vue') - }, - { - name: RouteNameMap.get('dashboard-workbench'), - path: EnumRoutePaths['dashboard-workbench'], - component: () => import('@/views/dashboard/workbench/index.vue') - } - ] + name: RouteNameMap.get('exception-403'), + path: EnumRoutePaths['exception-403'], + component: () => import('@/views/system/exception/403.vue') }, { - name: 'exception', - path: '/exception', - component: BlankChildLayout, - children: [ - { - name: RouteNameMap.get('exception-403'), - path: EnumRoutePaths['exception-403'], - component: () => import('@/views/system/exception/403.vue') - }, - { - name: RouteNameMap.get('exception-404'), - path: EnumRoutePaths['exception-404'], - component: () => import('@/views/system/exception/404.vue') - }, - { - name: RouteNameMap.get('exception-500'), - path: EnumRoutePaths['exception-500'], - component: () => import('@/views/system/exception/500.vue') - } - ] + name: RouteNameMap.get('exception-404'), + path: EnumRoutePaths['exception-404'], + component: () => import('@/views/system/exception/404.vue') + }, + { + name: RouteNameMap.get('exception-500'), + path: EnumRoutePaths['exception-500'], + component: () => import('@/views/system/exception/500.vue') } ] } diff --git a/src/styles/css/global.css b/src/styles/css/global.css index 04f45f76..da91f83e 100644 --- a/src/styles/css/global.css +++ b/src/styles/css/global.css @@ -16,6 +16,3 @@ html { font-size: 14px; color: rgba(0, 0, 0, 0.65); } -svg { - display: inline-block; -} diff --git a/src/utils/auth/index.ts b/src/utils/auth/index.ts index dcc1adc6..2238dd3a 100644 --- a/src/utils/auth/index.ts +++ b/src/utils/auth/index.ts @@ -1,5 +1,13 @@ -export function getStorageToken() { +import type { LoginModuleType } from '@/interface'; + +export function getToken() { return ''; } -export function getStorageUserInfo() {} +export function getUserInfo() {} + +/** 获取登录模块的正则字符串 */ +export function getLoginModuleRegExp() { + const arr: LoginModuleType[] = ['pwd-login', 'code-login', 'register', 'reset-pwd', 'bind-wechat']; + return arr.join('|'); +} diff --git a/src/utils/index.ts b/src/utils/index.ts index 183b6e1f..58fd70bd 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -export { getStorageToken, getStorageUserInfo } from './auth'; +export { getToken, getUserInfo, getLoginModuleRegExp } from './auth'; export { isNumber, isString, diff --git a/src/views/dashboard/analysis/index.vue b/src/views/dashboard/analysis/index.vue index 351a6819..c306b3b3 100644 --- a/src/views/dashboard/analysis/index.vue +++ b/src/views/dashboard/analysis/index.vue @@ -2,12 +2,14 @@ + workbench + diff --git a/src/views/home/index.vue b/src/views/home/index.vue deleted file mode 100644 index 0556b052..00000000 --- a/src/views/home/index.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - - {{ item.label }} - - - - Default - Primary - Info - Success - Warning - Error - - system - - primary - info - success - warning - error - - {{ i }} - - - - - diff --git a/src/layouts/BlankChildLayout/index.vue b/src/views/system/login/components/BindWechat/index.vue similarity index 81% rename from src/layouts/BlankChildLayout/index.vue rename to src/views/system/login/components/BindWechat/index.vue index f6e290d9..cac5cad1 100644 --- a/src/layouts/BlankChildLayout/index.vue +++ b/src/views/system/login/components/BindWechat/index.vue @@ -1,5 +1,5 @@ - + diff --git a/src/views/system/login/components/CodeLogin/index.vue b/src/views/system/login/components/CodeLogin/index.vue new file mode 100644 index 00000000..4815deec --- /dev/null +++ b/src/views/system/login/components/CodeLogin/index.vue @@ -0,0 +1,67 @@ + + + + + + + + + + + {{ label }} + + + + 确定 + 返回 + + + + + + + diff --git a/src/views/system/login/components/PwdLogin/index.vue b/src/views/system/login/components/PwdLogin/index.vue new file mode 100644 index 00000000..00cdbd05 --- /dev/null +++ b/src/views/system/login/components/PwdLogin/index.vue @@ -0,0 +1,72 @@ + + + + + + + + + + + + 记住我 + 忘记密码? + + 确定 + + + {{ EnumLoginModule['code-login'] }} + + + {{ EnumLoginModule.register }} + + + + + + + + + diff --git a/src/views/system/login/components/Register/index.vue b/src/views/system/login/components/Register/index.vue new file mode 100644 index 00000000..c44192d7 --- /dev/null +++ b/src/views/system/login/components/Register/index.vue @@ -0,0 +1,87 @@ + + + + + + + + + + + {{ label }} + + + + + + + + + + 我已经仔细阅读并接受用户协议和隐私政策 + 确定 + 返回 + + + + + + + diff --git a/src/views/system/login/components/ResetPwd/index.vue b/src/views/system/login/components/ResetPwd/index.vue new file mode 100644 index 00000000..89417b4f --- /dev/null +++ b/src/views/system/login/components/ResetPwd/index.vue @@ -0,0 +1,85 @@ + + + + + + + + + + + {{ label }} + + + + + + + + + + 确定 + 返回 + + + + + + + diff --git a/src/views/system/login/components/common/OtherLogin/index.vue b/src/views/system/login/components/common/OtherLogin/index.vue new file mode 100644 index 00000000..ba1c4546 --- /dev/null +++ b/src/views/system/login/components/common/OtherLogin/index.vue @@ -0,0 +1,13 @@ + + + 其他登录方式 + + + + + + + + diff --git a/src/views/system/login/components/common/index.ts b/src/views/system/login/components/common/index.ts new file mode 100644 index 00000000..ba97ab9d --- /dev/null +++ b/src/views/system/login/components/common/index.ts @@ -0,0 +1,3 @@ +import OtherLogin from './OtherLogin/index.vue'; + +export { OtherLogin }; diff --git a/src/views/system/login/components/index.ts b/src/views/system/login/components/index.ts new file mode 100644 index 00000000..df9f43c8 --- /dev/null +++ b/src/views/system/login/components/index.ts @@ -0,0 +1,7 @@ +import PwdLogin from './PwdLogin/index.vue'; +import CodeLogin from './CodeLogin/index.vue'; +import Register from './Register/index.vue'; +import ResetPwd from './ResetPwd/index.vue'; +import BindWechat from './BindWechat/index.vue'; + +export { PwdLogin, CodeLogin, Register, ResetPwd, BindWechat }; diff --git a/src/views/system/login/composable.ts b/src/views/system/login/composable.ts new file mode 100644 index 00000000..0a67e2e7 --- /dev/null +++ b/src/views/system/login/composable.ts @@ -0,0 +1,17 @@ +import type { Ref } from 'vue'; +import { useCreateContext } from '@/hooks'; +import { LoginModuleType } from '@/interface'; + +interface ShareState { + activeModule: Ref; + handleLoginModule(module: LoginModuleType): void; +} + +const { useContext, useProvider } = useCreateContext(); + +export function useLoginContext() { + return { + useContext, + useProvider + }; +} diff --git a/src/views/system/login/index.vue b/src/views/system/login/index.vue index 6075511f..d7d0f021 100644 --- a/src/views/system/login/index.vue +++ b/src/views/system/login/index.vue @@ -1,18 +1,53 @@ - - - 登录 - - - + + + + + + + + {{ title }} + + + + {{ item.label }} + + +
{{ i }}