Merge pull request #11691 from dataease/pr@dev-v2_st

feat(xpack): 支持移动端外观的配置
This commit is contained in:
dataeaseShu 2024-08-22 15:30:30 +08:00 committed by GitHub
commit ae4de7377d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 2 deletions

View File

@ -12,6 +12,8 @@ interface AppearanceState {
customColor?: string customColor?: string
navigateBg?: string navigateBg?: string
navigate?: string navigate?: string
mobileLogin?: string
mobileLoginBg?: string
help?: string help?: string
showAi?: string showAi?: string
showDoc?: string showDoc?: string
@ -36,6 +38,8 @@ export const useAppearanceStore = defineStore('appearanceStore', {
customColor: '', customColor: '',
navigateBg: '', navigateBg: '',
navigate: '', navigate: '',
mobileLogin: '',
mobileLoginBg: '',
help: '', help: '',
showDoc: '0', showDoc: '0',
showAi: '0', showAi: '0',
@ -60,6 +64,18 @@ export const useAppearanceStore = defineStore('appearanceStore', {
} }
return null return null
}, },
getMobileLogin(): string {
if (this.mobileLogin) {
return baseUrl + this.mobileLogin
}
return null
},
getMobileLoginBg(): string {
if (this.mobileLoginBg) {
return baseUrl + this.mobileLoginBg
}
return null
},
getHelp(): string { getHelp(): string {
return this.help return this.help
}, },
@ -128,6 +144,12 @@ export const useAppearanceStore = defineStore('appearanceStore', {
setNavigate(data: string) { setNavigate(data: string) {
this.navigate = data this.navigate = data
}, },
setMobileLogin(data: string) {
this.mobileLogin = data
},
setMobileLoginBg(data: string) {
this.mobileLoginBg = data
},
setHelp(data: string) { setHelp(data: string) {
this.help = data this.help = data
}, },
@ -177,6 +199,8 @@ export const useAppearanceStore = defineStore('appearanceStore', {
return return
} }
this.navigate = data.navigate this.navigate = data.navigate
this.mobileLogin = data.mobileLogin
this.mobileLoginBg = data.mobileLoginBg
this.help = data.help this.help = data.help
this.showAi = data.showAi this.showAi = data.showAi
this.showDoc = data.showDoc this.showDoc = data.showDoc

View File

@ -1,7 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import VanCellGroup from 'vant/es/cell-group' import VanCellGroup from 'vant/es/cell-group'
import mobileWholeBg from '@/assets/img/bg-mobile.png'
import mobileDeTop from '@/assets/img/mobile-de-top.png' import mobileDeTop from '@/assets/img/mobile-de-top.png'
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
import { showToast } from 'vant' import { showToast } from 'vant'
import { loginApi, queryDekey } from '@/api/login' import { loginApi, queryDekey } from '@/api/login'
import { useAppStoreWithOut } from '@/store/modules/app' import { useAppStoreWithOut } from '@/store/modules/app'
@ -22,6 +24,7 @@ const { wsCache } = useCache()
const appStore = useAppStoreWithOut() const appStore = useAppStoreWithOut()
const userStore = useUserStoreWithOut() const userStore = useUserStoreWithOut()
const router = useRouter() const router = useRouter()
const appearanceStore = useAppearanceStoreWithOut()
const username = ref('') const username = ref('')
const password = ref('') const password = ref('')
@ -55,7 +58,18 @@ const inputFocus = ref('')
const handleFocus = val => { const handleFocus = val => {
inputFocus.value = val inputFocus.value = val
} }
const mobileLogin = ref('')
const mobileLoginBg = ref('')
const loadAppearance = () => {
if (appearanceStore.getMobileLogin) {
mobileLogin.value = appearanceStore.getMobileLogin
}
if (appearanceStore.getMobileLoginBg) {
mobileLoginBg.value = appearanceStore.getMobileLoginBg
}
}
loadAppearance()
const handleBlur = () => { const handleBlur = () => {
inputFocus.value = '' inputFocus.value = ''
} }
@ -101,8 +115,9 @@ const usernameEndValidate = ({ status, message }) => {
<template> <template>
<div class="de-mobile-login" v-loading="duringLogin"> <div class="de-mobile-login" v-loading="duringLogin">
<img class="mobile-login_bg" :src="mobileLoginBg ? mobileLoginBg : mobileWholeBg" alt="" />
<div class="mobile-login-content"> <div class="mobile-login-content">
<img width="120" height="31" :src="mobileDeTop" alt="" /> <img width="120" height="31" :src="mobileLogin ? mobileLogin : mobileDeTop" alt="" />
<div class="mobile-login-welcome">用户登录</div> <div class="mobile-login-welcome">用户登录</div>
<van-form @submit="onSubmit"> <van-form @submit="onSubmit">
<van-cell-group inset> <van-cell-group inset>
@ -157,7 +172,13 @@ const usernameEndValidate = ({ status, message }) => {
position: relative; position: relative;
background-size: contain; background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url(../../../assets/img/bg-mobile.png);
.mobile-login_bg {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
}
.mobile-login-content { .mobile-login-content {
background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, #ffffff 58.86%); background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, #ffffff 58.86%);
@ -170,6 +191,7 @@ const usernameEndValidate = ({ status, message }) => {
width: 100%; width: 100%;
height: 70%; height: 70%;
padding: 24px 16px; padding: 24px 16px;
z-index: 10;
--van-cell-group-inset-padding: 0; --van-cell-group-inset-padding: 0;
--van-cell-group-inset-radius: 0; --van-cell-group-inset-radius: 0;
--van-cell-group-background: transparent; --van-cell-group-background: transparent;