feat: 增加移动端背景替换

This commit is contained in:
fit2cloud-chenyw 2022-03-21 18:40:16 +08:00
parent a4c53488f5
commit 6b8877ca0e
7 changed files with 65 additions and 8 deletions

View File

@ -84,3 +84,6 @@ CREATE TABLE `de_engine` (
`status` varchar(45) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.mobileBG', NULL, 'file', 0);

View File

@ -1888,7 +1888,8 @@ export default {
cmonth: 'This Month',
cquarter: 'This Quarter',
cyear: 'This Year',
openHomePage: 'Show Home Page'
openHomePage: 'Show Home Page',
mobileBG: 'Mobile BG'
},
dynamic_year: {
fix: 'Fixed Year',

View File

@ -1641,7 +1641,9 @@ export default {
themeLight: '淺色',
themeDark: '深色',
themeCustom: '自定義',
openHomePage: '顯示首頁'
openHomePage: '顯示首頁',
mobileBG: '移動端背景'
},
auth: {

View File

@ -1650,7 +1650,8 @@ export default {
themeLight: '浅色',
themeDark: '深色',
themeCustom: '自定义',
openHomePage: '显示首页'
openHomePage: '显示首页',
mobileBG: '移动端背景'
},
auth: {

View File

@ -43,3 +43,10 @@ export function validate(data) {
data
})
}
export function getUIinfo() {
return request({
url: '/system/ui/info',
method: 'get'
})
}

View File

@ -1,5 +1,9 @@
<template>
<view class="content">
<view
v-if="axiosFinished"
:class="mobileBG ? 'content-de' : 'content'"
:style="mobileBG ? {background:'url(' + mobileBG + ') no-repeat', 'backgroundSize':'cover'} : ''"
>
<view class="input-group" >
<view class="input-row">
@ -28,7 +32,7 @@
mapMutations
} from 'vuex'
import mInput from '../../components/m-input.vue'
import {login, getInfo, getPublicKey } from '@/api/auth'
import {login, getInfo, getPublicKey, getUIinfo } from '@/api/auth'
import {encrypt, setLocalPK, getLocalPK, setToken, getToken, setUserInfo, getUserInfo } from '@/common/utils'
export default {
@ -39,19 +43,25 @@
return {
username: '',
loginBtnLoading: false,
password: ''
password: '',
mobileBG: null,
axiosFinished: false
}
},
computed: mapState(['forcedLogin', 'hasLogin', 'univerifyErrorMsg', 'hideUniverify']),
onLoad() {
uni.showLoading({
title: this.$t('commons.loading')
});
this.loadUiInfo()
this.loadPublicKey()
if(getToken() && getUserInfo()) {
this.toMain()
}
},
methods: {
...mapMutations(['login']),
@ -105,6 +115,25 @@
})
},
loadUiInfo() {
getUIinfo().then(res => {
const list = res.data
list.forEach(item => {
if(item.paramKey === 'ui.mobileBG' && item.paramValue) {
this.mobileBG = '/system/ui/image/' + item.paramValue
return false
}
})
setTimeout(() => {
uni.hideLoading()
this.axiosFinished = true
}, 1500)
})
},
loadPublicKey() {
if(!getLocalPK()) {
@ -187,6 +216,18 @@
background-size: 100% 100%;
opacity: 0.75;
}
.content-de {
display: flex;
flex: 1;
flex-direction: column;
background-color: #000000;
padding: 10px;
justify-content: center;
background-repeat: no-repeat;
background-size: 100% 100%;
opacity: 0.75;
}
.input-group {
background-color: #ffffff;

View File

@ -6,7 +6,9 @@ module.exports = {
title: 'DataEase',
WHITE_LIST: [
'/api/auth/login',
'/api/auth/getPublicKey'
'/api/auth/getPublicKey',
'/system/ui/info',
'/system/ui/image/'
],
RECENT_KEY: 'recently',