功能变化: 新增前端获取系统配置功能

pull/57/head
李强 2022-05-14 00:10:15 +08:00
parent 177133726f
commit 9597addd61
3 changed files with 8 additions and 21 deletions

View File

@ -201,6 +201,10 @@ Vue.prototype.getDictionaryLabel = function (name, value) {
}
return store.state.d2admin.dictionary.data[name]
}
// 获取系统配置
Vue.prototype.systemConfig = function (name) {
return store.state.d2admin.settings.data[name]
}
// 默认Columns 结尾 showForm显示在form中showTable显示在table中
Vue.prototype.commonEndColumns = function (param = {}) {
/**

View File

@ -6,15 +6,7 @@ export const urlPrefix = '/api/init/settings/'
export default {
namespaced: true,
state: {
siteName: '', // 网站名称
siteLogo: '', // 网站logo地址
loginBackground: '', // 登录页背景图
copyright: '', // 版权
keepRecord: '', // 备案
helpUrl: '', // 帮助地址
privacyUrl: '', // 隐私
clauseUrl: '', // 条款
captchaState: true // 是否开启验证码
data: {}
},
actions: {
/**
@ -42,22 +34,13 @@ export default {
* @param {Object} context
*/
async load ({ state, dispatch, commit }) {
const res = await dispatch('d2admin/db/get', {
// store 赋值
state.data = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'settings.init',
defaultValue: {},
user: true
}, { root: true })
// store 赋值
state.siteName = res.site_name
state.siteLogo = res.site_logo
state.loginBackground = res.login_background
state.copyright = res.copyright
state.keepRecord = res.keep_record
state.helpUrl = res.help_url
state.privacyUrl = res.privacy_url
state.clauseUrl = res.clause_url
state.captchaState = res.captcha_state
}
},
mutations: {

View File

@ -5,7 +5,7 @@
<el-col :span="12">变量值</el-col>
<el-col :span="4" :offset="4">变量名</el-col>
</el-row>
<el-form ref="form" :model="form" label-width="100px" label-position="left" style="margin-top: 20px">
<el-form ref="form" :model="form" label-width="140px" label-position="left" style="margin-top: 20px">
<el-form-item :label="item.title" :prop="['array'].indexOf(item.form_item_type_label) >-1?'':item.key"
:key="index" :rules="item.rule"
v-for="(item,index) in formList"