diff --git a/src/assets/images/login-bg.mp4 b/src/assets/images/login-bg.mp4 new file mode 100644 index 0000000..ae43f45 Binary files /dev/null and b/src/assets/images/login-bg.mp4 differ diff --git a/src/settings.ts b/src/settings.ts index cda29e9..8aac99f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -25,6 +25,10 @@ interface DefaultSettings { * 是否深色侧边栏 */ sidebarDark: boolean; + /** + * 登录是否显示视频背景 + */ + showVideo: boolean; /** * 导航栏布局 */ @@ -46,12 +50,13 @@ interface DefaultSettings { } const defaultSettings: DefaultSettings = { - title: '联美运营驾驶舱管理系统', + title: 'vue-vite-project-admin', showSettings: true, tagsView: true, fixedHeader: false, sidebarLogo: true, - sidebarDark:true, + sidebarDark: true, + showVideo: true, layout: 'left', /** * 主题模式 @@ -64,4 +69,4 @@ const defaultSettings: DefaultSettings = { language: 'zh-cn' // zh-cn| en }; -export default defaultSettings; +export default defaultSettings; \ No newline at end of file diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 38e2376..d9cae94 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -10,6 +10,7 @@ export const useSettingsStore = defineStore('setting', () => { const showSettings = ref(defaultSettings.showSettings); const fixedHeader = ref(defaultSettings.fixedHeader); const sidebarLogo = ref(defaultSettings.sidebarLogo); + const showVideo = ref(defaultSettings.showVideo); const sidebarDark = ref(defaultSettings.sidebarDark); const layout = useStorage('layout', defaultSettings.layout); @@ -29,6 +30,9 @@ export const useSettingsStore = defineStore('setting', () => { case 'sidevarLogo': sidebarLogo.value = value; break; + case 'showVideo': + showVideo.value = value; + break; case 'sidebarDark': sidebarDark.value = value; break; @@ -46,8 +50,9 @@ export const useSettingsStore = defineStore('setting', () => { tagsView, fixedHeader, sidebarLogo, + showVideo, sidebarDark, layout, changeSetting }; -}); +}); \ No newline at end of file diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 89da715..e21443a 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,6 +2,7 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] + const ElForm: typeof import('element-plus/es')['ElForm'] const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] const NEllipsis: typeof import('naive-ui')['NEllipsis'] @@ -271,6 +272,7 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef + readonly ElForm: UnwrapRef readonly ElMessage: UnwrapRef readonly ElMessageBox: UnwrapRef readonly NEllipsis: UnwrapRef diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 41572a7..43b6e11 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -34,6 +34,7 @@ declare module '@vue/runtime-core' { MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] + NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NIcon: typeof import('naive-ui')['NIcon'] NMenu: typeof import('naive-ui')['NMenu'] NModal: typeof import('naive-ui')['NModal'] diff --git a/src/views/login/index.scss b/src/views/login/index.scss index 0bc3928..a5ff9ef 100644 --- a/src/views/login/index.scss +++ b/src/views/login/index.scss @@ -5,32 +5,34 @@ align-items: center; width: 100%; height: 100%; - background: url('../../assets/images/login-bg.png'); - background-size: cover; overflow: hidden; .loginCard { - display: flex; - flex-direction: column; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; width: 420px; - height: auto; - padding: 20px 30px; + height: fit-content; + padding: 4rem; + margin: auto; border-radius: 20px; background: rgba(255, 255, 255, 0.1); - backdrop-filter: blur(30px); + backdrop-filter: blur(10px); border: 2px solid rgba(255, 255, 255, 0.1); box-shadow: 0 0 80px rgba(0, 0, 0, 0.25); + z-index: 99; overflow: hidden; .loginForm { width: 100%; .title { - padding: 1rem 0; + margin-bottom: 2rem; span { - font-size: 1.5rem; - // color: #fff; + font-size: 2rem; } } @@ -82,13 +84,22 @@ } } } - .captcha{ + + .captcha { line-height: normal; } } } } - .copyright{ + + .videoCover { + img { + z-index: 0; + position: absolute; + } + } + + .copyright { position: fixed; bottom: 0; width: 100%; @@ -101,3 +112,30 @@ letter-spacing: 1px; } } + +.picContainer { + background: url('../../assets/images/login-bg.png'); + background-size: cover; + + .loginForm { + .title { + + .switchLanguage, + span { + color: var(--el-text-color-regular); + } + } + } +} + +.videoContainer { + .loginForm { + .title { + + .switchLanguage, + span { + color: var(--el-color-white); + } + } + } +} \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 1a2d4d9..8cc211c 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,5 +1,5 @@ @@ -72,15 +56,22 @@ import router from '@/router'; import LangSelect from '@/components/LangSelect/index.vue'; import { useUserStore } from '@/store/modules/user'; import { LocationQuery, LocationQueryValue, useRoute } from 'vue-router'; -import { getCaptchaApi } from '@/api/auth'; +import { useSettingsStore } from '@/store/modules/settings'; +// import { getCaptchaApi } from '@/api/auth'; import { LoginData } from '@/api/auth/types'; +const settingsStore = useSettingsStore(); const userStore = useUserStore(); const route = useRoute(); const loginForm = ref(ElForm); +const isCapslock = ref(false);// 是否大写锁定 +const resizeStyle = ref()//视频背景自适应样式 +const videoCanPlay = ref(false) + const loginData = ref({ username: '', - password: '' + password: '', + // verifyCode: '' }); const loginRules = { @@ -100,9 +91,6 @@ function validatePassword(rule: any, value: any, callback: any) { } } -// 是否大写锁定 -const isCapslock = ref(false); - function checkCapslock(e: any) { const { key } = e; isCapslock.value = key && key.length === 1 && key >= 'A' && key <= 'Z'; @@ -110,19 +98,28 @@ function checkCapslock(e: any) { onMounted(() => { // getCaptcha(); + resizeFun() }); -/** - * 获取验证码 - */ -function getCaptcha() { - getCaptchaApi().then(({ data }) => { - const { verifyCodeBase64, verifyCodeKey } = data; - loginData.value.verifyCodeKey = verifyCodeKey; - captchaBase64.value = verifyCodeBase64; - }); +function onCanplay() { + //视频播放事件 + videoCanPlay.value = true } +window.addEventListener('resize', () => { + //监听窗口变化以改变视频背景大小自适应 + resizeFun() +}) + +//获取验证码 +// function getCaptcha() { +// getCaptchaApi().then(({ data }) => { +// const { verifyCodeBase64, verifyCodeKey } = data; +// loginData.value.verifyCodeKey = verifyCodeKey; +// captchaBase64.value = verifyCodeBase64; +// }); +// } + //登录 function loginClick() { loginForm.value.validate((valid: boolean) => { @@ -148,8 +145,36 @@ function loginClick() { } }); } + +function resizeFun() { + //视频背景自适应处理 + const windowWidth = document.body.clientWidth + const windowHeight = document.body.clientHeight + const windowAspectRatio = windowHeight / windowWidth + let videoWidth + let videoHeight + if (windowAspectRatio < 0.5625) { + videoWidth = windowWidth + videoHeight = videoWidth * 0.5625 + resizeStyle.value = { + height: windowWidth * 0.5625 + 'px', + width: windowWidth + 'px', + 'margin-bottom': (windowHeight - videoHeight) / 2 + 'px', + 'margin-left': 'initial' + } + } else { + videoHeight = windowHeight + videoWidth = videoHeight / 0.5625 + resizeStyle.value = { + height: windowHeight + 'px', + width: windowHeight / 0.5625 + 'px', + 'margin-left': (windowWidth - videoWidth) / 2 + 'px', + 'margin-bottom': 'initial' + } + } +} + \ No newline at end of file diff --git a/src/views/monitoring/screen/components/main.vue b/src/views/monitoring/screen/components/main.vue index fb532a6..f039247 100644 --- a/src/views/monitoring/screen/components/main.vue +++ b/src/views/monitoring/screen/components/main.vue @@ -106,8 +106,9 @@ const formRules = ref({ const userInfo = JSON.parse(localStorage.getItem('userInfo')); // const loginIp = userInfo.loginIp.split('.').join(''); -const api = "http://10.10.10.56:9000"//websocket链接地址,与项目接口地址一致。 -const apiUrl = api.replace(/https?:/, ''); +const baseApi = "http://10.10.10.56:9000"//websocket链接地址,与项目接口地址一致。 +// const baseApi = import.meta.env.VITE_APP_BASE_API +const apiUrl = baseApi.replace(/https?:/, ''); const wsUrl = `ws:${apiUrl}/websocket/${userInfo.userName}`; //websocket地址 // const wsData = ref(socket.data); diff --git a/src/views/monitoring/screen/components/showTree.vue b/src/views/monitoring/screen/components/showTree.vue index d1824c3..1d03d72 100644 --- a/src/views/monitoring/screen/components/showTree.vue +++ b/src/views/monitoring/screen/components/showTree.vue @@ -14,8 +14,8 @@
- 取消 - 确认 + 取消 + 确认
diff --git a/src/views/monitoring/screen/index.scss b/src/views/monitoring/screen/index.scss index d8178c5..9c3add0 100644 --- a/src/views/monitoring/screen/index.scss +++ b/src/views/monitoring/screen/index.scss @@ -301,7 +301,7 @@ } } -.cardClass { +// .cardClass { .showTree { .weight { display: flex; @@ -322,4 +322,4 @@ margin-left: 10px; } } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/views/monitoring/screen/index.vue b/src/views/monitoring/screen/index.vue index df1f3dd..b2dacea 100644 --- a/src/views/monitoring/screen/index.vue +++ b/src/views/monitoring/screen/index.vue @@ -51,9 +51,10 @@
- - + + + - - + + +
diff --git a/vite.config.ts b/vite.config.ts index b1b3632..72a8665 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -45,8 +45,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { hmr: true,//配置HMR proxy: { [env.VITE_APP_BASE_API]: { - target: 'http://172.1.2.29:9000/',//本地接口地址 - // target: 'http://10.10.10.56:9000/',//线上接口地址 + // target: 'http://172.1.2.29:9000/',//本地接口地址 + target: 'http://10.10.10.56:9000/',//线上接口地址 changeOrigin: true, rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')