From 780a8a67b874ca1c8d05c2561f88081cc4ec4b28 Mon Sep 17 00:00:00 2001 From: Vben Date: Thu, 8 Apr 2021 22:08:55 +0800 Subject: [PATCH] fix: improve login page style --- CHANGELOG.zh_CN.md | 6 ++++++ build/vite/plugin/theme.ts | 5 +++++ package.json | 2 +- src/components/Form/src/components/FormItem.vue | 2 +- src/views/sys/login/Login.vue | 14 ++++++++++++-- src/views/sys/login/LoginForm.vue | 2 +- yarn.lock | 8 ++++---- 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 5c4c568b7..919c1bf3d 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,3 +1,9 @@ +## Wip + +### 🐛 Bug Fixes + +- 登录页样式修复 + ## 2.2.0 (2021-04-06) ### ✨ Features diff --git a/build/vite/plugin/theme.ts b/build/vite/plugin/theme.ts index b0b89588f..994c8b78a 100644 --- a/build/vite/plugin/theme.ts +++ b/build/vite/plugin/theme.ts @@ -3,6 +3,7 @@ * https://github.com/anncwb/vite-plugin-theme */ import type { Plugin } from 'vite'; +import path from 'path'; import { viteThemePlugin, antdDarkThemePlugin, @@ -25,6 +26,10 @@ export function configThemePlugin(isBuild: boolean): Plugin[] { colorVariables: [...getThemeColors(), ...colors], }), antdDarkThemePlugin({ + preloadFiles: [ + path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.less'), + path.resolve(process.cwd(), 'src/design/index.less'), + ], filter: (id) => (isBuild ? !id.endsWith('antd.less') : true), // extractCss: false, darkModifyVars: { diff --git a/package.json b/package.json index 34eb9ee68..77a463aae 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "vite-plugin-pwa": "^0.7.0", "vite-plugin-style-import": "^0.9.2", "vite-plugin-svg-icons": "^0.4.1", - "vite-plugin-theme": "^0.6.1", + "vite-plugin-theme": "^0.6.3", "vite-plugin-windicss": "0.12.5", "vue-eslint-parser": "^7.6.0" }, diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue index fba740bfb..06e24be30 100644 --- a/src/components/Form/src/components/FormItem.vue +++ b/src/components/Form/src/components/FormItem.vue @@ -210,7 +210,7 @@ props.setFormModel(field, value); }, }; - const Comp = componentMap.get(component) as typeof defineComponent; + const Comp = componentMap.get(component) as ReturnType; const { autoSetPlaceHolder, size } = props.formProps; const propsData: Recordable = { diff --git a/src/views/sys/login/Login.vue b/src/views/sys/login/Login.vue index 18566fcde..6d8b81f4d 100644 --- a/src/views/sys/login/Login.vue +++ b/src/views/sys/login/Login.vue @@ -30,6 +30,7 @@
@@ -89,10 +90,11 @@ @prefix-cls: ~'@{namespace}-login'; @logo-prefix-cls: ~'@{namespace}-app-logo'; @countdown-prefix-cls: ~'@{namespace}-countdown-input'; + @dark-bg: #293146; html[data-theme='dark'] { .@{prefix-cls} { - background: #293146; + background: @dark-bg; &::before { background-image: url(/@/assets/svg/login-bg-dark.svg); @@ -106,13 +108,21 @@ .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) { border: 1px solid #4a5569; } + + &-form { + background: transparent !important; + } } } .@{prefix-cls} { overflow: hidden; @media (max-width: @screen-xl) { - background: linear-gradient(180deg, #1c3faa, #1c3faa); + background: #293146; + + .@{prefix-cls}-form { + background: #fff; + } } &::before { diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue index 1cd4b3791..c9e3736f3 100644 --- a/src/views/sys/login/LoginForm.vue +++ b/src/views/sys/login/LoginForm.vue @@ -46,7 +46,7 @@ {{ t('sys.login.mobileSignInFormTitle') }} - + diff --git a/yarn.lock b/yarn.lock index 41ac4bc1e..4f9ddf531 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9173,10 +9173,10 @@ vite-plugin-svg-icons@^0.4.1: svg-baker "1.7.0" svgo "^2.3.0" -vite-plugin-theme@^0.6.1: - version "0.6.1" - resolved "https://registry.npmjs.org/vite-plugin-theme/-/vite-plugin-theme-0.6.1.tgz#8fd87e1d57ae83f49531aeb65bfc8f6adcf2b71f" - integrity sha512-r+v+AxeatliReg6fBkCbKQ/PHpv0J9EG22QLoAyXNPdZxei+xydxdHVWrN2nUh231im0v9fZzWKzOOxw5VW0fA== +vite-plugin-theme@^0.6.3: + version "0.6.3" + resolved "https://registry.npmjs.org/vite-plugin-theme/-/vite-plugin-theme-0.6.3.tgz#77be00b039eb53452c9adfce7fd90e39a39a81ee" + integrity sha512-ffhnqCtCG/0Y7egfiF9upJRo5ZEKS6lQOQsSztqu8gA2/SGsNTm3lsmEWvARMeUAj/8aF5PYzAv5EikfhcPENQ== dependencies: "@types/node" "^14.14.37" "@types/tinycolor2" "^1.4.2"