Commit 1f4d40c0 by YuleiLan

feat: 添加配置信息。

parent 82864649
module.exports = { module.exports = {
title: 'ferry', title: 'ferry 管理平台',
logo: 'https://www.fdevops.com/wp-content/uploads/2020/08/1597815294-ferry_logo_white.png',
isLdap: false,
/** /**
* @type {boolean} true | false * @type {boolean} true | false
......
...@@ -12,6 +12,9 @@ const getters = { ...@@ -12,6 +12,9 @@ const getters = {
roles: state => state.user.roles, roles: state => state.user.roles,
permisaction: state => state.user.permisaction, permisaction: state => state.user.permisaction,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
errorLogs: state => state.errorLog.logs errorLogs: state => state.errorLog.logs,
title: state => state.settings.title,
logo: state => state.settings.logo,
isLdap: state => state.settings.isLdap
} }
export default getters export default getters
import variables from '@/styles/element-variables.scss' import variables from '@/styles/element-variables.scss'
import defaultSettings from '@/settings' import defaultSettings from '@/settings'
import { getSettings } from '@/api/system/settings'
const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings const { title, logo, isLdap, showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings
const state = { const state = {
theme: variables.theme, theme: variables.theme,
showSettings: showSettings, showSettings: showSettings,
tagsView: tagsView, tagsView: tagsView,
fixedHeader: fixedHeader, fixedHeader: fixedHeader,
sidebarLogo: sidebarLogo sidebarLogo: sidebarLogo,
title: title,
logo: logo,
isLdap: isLdap
} }
const mutations = { const mutations = {
...@@ -16,12 +20,28 @@ const mutations = { ...@@ -16,12 +20,28 @@ const mutations = {
if (state.hasOwnProperty(key)) { if (state.hasOwnProperty(key)) {
state[key] = value state[key] = value
} }
},
CHANGE_SYSTEM_SETTING: (state, content) => {
state.title = content.name
state.logo = content.logo
state.isLdap = content.is_ldap
} }
} }
const actions = { const actions = {
changeSetting({ commit }, data) { changeSetting({ commit }, data) {
commit('CHANGE_SETTING', data) commit('CHANGE_SETTING', data)
},
// get user info
getSystemSettings({ commit }) {
return new Promise((resolve) => {
getSettings({
classify: 1
}).then(response => {
commit('CHANGE_SYSTEM_SETTING', response.data[0].content)
resolve(response)
})
})
} }
} }
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
<div class="login-weaper animated bounceInDown"> <div class="login-weaper animated bounceInDown">
<div class="login-left"> <div class="login-left">
<div class="login-time" v-text="currentTime" /> <div class="login-time" v-text="currentTime" />
<img :src="sysInfo.logo!==''?sysInfo.logo:'https://www.fdevops.com/wp-content/uploads/2020/08/1597815294-ferry_logo_white.png'" alt="" class="img"> <img :src="logo" alt="" class="img">
<p class="title" v-text="sysInfo.name!==''?sysInfo.name:'ferry 管理平台'" /> <p class="title" v-text="title" />
</div> </div>
<div class="login-border"> <div class="login-border">
<div class="login-main"> <div class="login-main">
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<img style="height: 48px;width: 100%;border: 1px solid rgba(0,0,0, 0.1);border-radius:5px;" :src="codeUrl" @click="getCode"> <img style="height: 48px;width: 100%;border: 1px solid rgba(0,0,0, 0.1);border-radius:5px;" :src="codeUrl" @click="getCode">
</div> </div>
<div prop="code" style="width: 100%;float: left;margin-bottom: 13px"> <div prop="code" style="width: 100%;float: left;margin-bottom: 13px">
<el-checkbox v-model="sysInfo.is_ldap">LDAP登陆</el-checkbox> <el-checkbox v-model="isLdap">LDAP登陆</el-checkbox>
</div> </div>
<el-button :loading="loading" type="primary" style="width:100%;padding:12px 20px;margin-bottom:30px;" @click.native.prevent="handleLogin"> <el-button :loading="loading" type="primary" style="width:100%;padding:12px 20px;margin-bottom:30px;" @click.native.prevent="handleLogin">
<span v-if="!loading">登 录</span> <span v-if="!loading">登 录</span>
...@@ -106,8 +106,8 @@ ...@@ -106,8 +106,8 @@
<script> <script>
import { getCodeImg } from '@/api/login' import { getCodeImg } from '@/api/login'
import { getSettings } from '@/api/system/settings'
import moment from 'moment' import moment from 'moment'
import { mapGetters } from 'vuex'
export default { export default {
name: 'Login', name: 'Login',
...@@ -137,14 +137,12 @@ export default { ...@@ -137,14 +137,12 @@ export default {
loading: false, loading: false,
redirect: undefined, redirect: undefined,
otherQuery: {}, otherQuery: {},
currentTime: null, currentTime: null
sysInfo: {
logo: '',
name: '',
is_ldap: false
}
} }
}, },
computed: {
...mapGetters(['title', 'logo', 'isLdap'])
},
watch: { watch: {
$route: { $route: {
handler: function(route) { handler: function(route) {
...@@ -161,7 +159,6 @@ export default { ...@@ -161,7 +159,6 @@ export default {
this.getCode() this.getCode()
// window.addEventListener('storage', this.afterQRScan) // window.addEventListener('storage', this.afterQRScan)
this.getCurrentTime() this.getCurrentTime()
this.getSystemSetting()
}, },
mounted() { mounted() {
if (this.loginForm.username === '') { if (this.loginForm.username === '') {
...@@ -169,18 +166,15 @@ export default { ...@@ -169,18 +166,15 @@ export default {
} else if (this.loginForm.password === '') { } else if (this.loginForm.password === '') {
this.$refs.password.focus() this.$refs.password.focus()
} }
this.getSystemSettings()
}, },
destroyed() { destroyed() {
clearInterval(this.timer) clearInterval(this.timer)
// window.removeEventListener('storage', this.afterQRScan) // window.removeEventListener('storage', this.afterQRScan)
}, },
methods: { methods: {
getSystemSetting() { getSystemSettings() {
getSettings({ this.$store.dispatch('settings/getSystemSettings')
classify: 1
}).then(response => {
this.sysInfo = response.data[0].content
})
}, },
getCurrentTime() { getCurrentTime() {
this.timer = setInterval(_ => { this.timer = setInterval(_ => {
...@@ -220,7 +214,7 @@ export default { ...@@ -220,7 +214,7 @@ export default {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
if (this.sysInfo.is_ldap) { if (this.isLdap) {
this.loginForm.loginType = 1 this.loginForm.loginType = 1
} else { } else {
this.loginForm.loginType = 0 this.loginForm.loginType = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment