提交 6b8877ca authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 增加移动端背景替换

上级 a4c53488
...@@ -84,3 +84,6 @@ CREATE TABLE `de_engine` ( ...@@ -84,3 +84,6 @@ CREATE TABLE `de_engine` (
`status` varchar(45) DEFAULT NULL COMMENT '状态', `status` varchar(45) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.mobileBG', NULL, 'file', 0);
...@@ -1888,7 +1888,8 @@ export default { ...@@ -1888,7 +1888,8 @@ export default {
cmonth: 'This Month', cmonth: 'This Month',
cquarter: 'This Quarter', cquarter: 'This Quarter',
cyear: 'This Year', cyear: 'This Year',
openHomePage: 'Show Home Page' openHomePage: 'Show Home Page',
mobileBG: 'Mobile BG'
}, },
dynamic_year: { dynamic_year: {
fix: 'Fixed Year', fix: 'Fixed Year',
......
...@@ -1641,7 +1641,9 @@ export default { ...@@ -1641,7 +1641,9 @@ export default {
themeLight: '淺色', themeLight: '淺色',
themeDark: '深色', themeDark: '深色',
themeCustom: '自定義', themeCustom: '自定義',
openHomePage: '顯示首頁' openHomePage: '顯示首頁',
mobileBG: '移動端背景'
}, },
auth: { auth: {
......
...@@ -1650,7 +1650,8 @@ export default { ...@@ -1650,7 +1650,8 @@ export default {
themeLight: '浅色', themeLight: '浅色',
themeDark: '深色', themeDark: '深色',
themeCustom: '自定义', themeCustom: '自定义',
openHomePage: '显示首页' openHomePage: '显示首页',
mobileBG: '移动端背景'
}, },
auth: { auth: {
......
...@@ -43,3 +43,10 @@ export function validate(data) { ...@@ -43,3 +43,10 @@ export function validate(data) {
data data
}) })
} }
export function getUIinfo() {
return request({
url: '/system/ui/info',
method: 'get'
})
}
<template> <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-group" >
<view class="input-row"> <view class="input-row">
...@@ -28,7 +32,7 @@ ...@@ -28,7 +32,7 @@
mapMutations mapMutations
} from 'vuex' } from 'vuex'
import mInput from '../../components/m-input.vue' 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' import {encrypt, setLocalPK, getLocalPK, setToken, getToken, setUserInfo, getUserInfo } from '@/common/utils'
export default { export default {
...@@ -39,19 +43,25 @@ ...@@ -39,19 +43,25 @@
return { return {
username: '', username: '',
loginBtnLoading: false, loginBtnLoading: false,
password: '' password: '',
mobileBG: null,
axiosFinished: false
} }
}, },
computed: mapState(['forcedLogin', 'hasLogin', 'univerifyErrorMsg', 'hideUniverify']), computed: mapState(['forcedLogin', 'hasLogin', 'univerifyErrorMsg', 'hideUniverify']),
onLoad() { onLoad() {
uni.showLoading({
title: this.$t('commons.loading')
});
this.loadUiInfo()
this.loadPublicKey() this.loadPublicKey()
if(getToken() && getUserInfo()) { if(getToken() && getUserInfo()) {
this.toMain() this.toMain()
} }
}, },
methods: { methods: {
...mapMutations(['login']), ...mapMutations(['login']),
...@@ -106,6 +116,25 @@ ...@@ -106,6 +116,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() { loadPublicKey() {
if(!getLocalPK()) { if(!getLocalPK()) {
getPublicKey().then(res => { getPublicKey().then(res => {
...@@ -188,6 +217,18 @@ ...@@ -188,6 +217,18 @@
opacity: 0.75; 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 { .input-group {
background-color: #ffffff; background-color: #ffffff;
margin-top: 20px; margin-top: 20px;
......
...@@ -6,7 +6,9 @@ module.exports = { ...@@ -6,7 +6,9 @@ module.exports = {
title: 'DataEase', title: 'DataEase',
WHITE_LIST: [ WHITE_LIST: [
'/api/auth/login', '/api/auth/login',
'/api/auth/getPublicKey' '/api/auth/getPublicKey',
'/system/ui/info',
'/system/ui/image/'
], ],
RECENT_KEY: 'recently', RECENT_KEY: 'recently',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论