Commit 6c7a45ca by YuleiLan

完善系统配置功能。

parent 09e1815a
......@@ -2,18 +2,19 @@
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" src="@/assets/logo/ferry_logo_white.png" class="sidebar-logo">
<h1 v-else class="sidebar-title">{{ title }} </h1>
<img v-if="sysInfo.logo" :src="sysInfo.logo" class="sidebar-logo">
<h1 v-else class="sidebar-title">{{ sysInfo.name }} </h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" src="@/assets/logo/ferry_logo_white.png" class="sidebar-logo">
<h1 class="sidebar-title">{{ title }} </h1>
<img v-if="sysInfo.logo" :src="sysInfo.logo" class="sidebar-logo">
<h1 class="sidebar-title">{{ sysInfo.name }} </h1>
</router-link>
</transition>
</div>
</template>
<script>
import { getSettings } from '@/api/system/settings'
export default {
name: 'SidebarLogo',
props: {
......@@ -24,9 +25,18 @@ export default {
},
data() {
return {
title: 'FERRY 管理平台',
logo: '@/assets/logo/ferry_logo_white.png'
sysInfo: {
name: '',
logo: ''
}
}
},
created() {
getSettings({
classify: 1
}).then(response => {
this.sysInfo = response.data[0].content
})
}
}
</script>
......
......@@ -121,7 +121,7 @@ aside {
//main-container全局样式
.app-container {
padding: 20px;
padding: 15px;
}
.components-container {
......
......@@ -114,6 +114,7 @@
<script>
import { getCodeImg } from '@/api/login'
import { getSettings } from '@/api/system/settings'
import moment from 'moment'
import SocialSign from './components/SocialSignin'
......@@ -171,6 +172,7 @@ export default {
this.getCode()
// window.addEventListener('storage', this.afterQRScan)
this.getCurrentTime()
this.getSystemSetting()
},
mounted() {
if (this.loginForm.username === '') {
......@@ -184,6 +186,13 @@ export default {
// window.removeEventListener('storage', this.afterQRScan)
},
methods: {
getSystemSetting() {
getSettings({
classify: 1
}).then(response => {
this.sysInfo = response.data[0].content
})
},
getCurrentTime() {
this.timer = setInterval(_ => {
this.currentTime = moment().format('YYYY-MM-DD HH时mm分ss秒')
......
......@@ -23,7 +23,7 @@
</el-upload>
</el-form-item>
<el-form-item style="margin-bottom: 0">
<el-button type="primary" @click="submitForm('ruleForm', 1)">确定</el-button>
<el-button v-permisaction="['system:settings:index:config']" type="primary" @click="submitForm('ruleForm', 1)">确定</el-button>
</el-form-item>
</el-form>
</div>
......@@ -46,12 +46,12 @@
<el-table-column
prop="local_field_name"
label="字段名称"
width="180"
width="150"
/>
<el-table-column
prop="local_field_nick"
label="字段昵称"
width="180"
width="150"
/>
<el-table-column
prop="ldap_field_name"
......@@ -66,7 +66,7 @@
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button type="primary" @click="submitForm('ruleForm', 2)">确定</el-button>
<el-button v-permisaction="['system:settings:index:ldap']" type="primary" @click="submitForm('ruleForm', 2)">确定</el-button>
</div>
</div>
</el-card>
......@@ -90,7 +90,7 @@ export default {
rules: {
name: [
{ required: true, message: '请输入系统名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 6 个字符', trigger: 'blur' }
{ min: 3, max: 15, message: '长度在 3 到 15 个字符', trigger: 'blur' }
],
logo: [
{ required: true, message: '请设置Logo', trigger: 'blur' }
......@@ -107,33 +107,49 @@ export default {
getSettings().then(response => {
for (var v of response.data) {
if (v.classify === 1) {
this.ruleForm = v.content
if (v.content === undefined || v.content === null) {
this.ruleForm = {
name: '',
logo: ''
}
} else {
this.ruleForm = v.content
}
} else if (v.classify === 2) {
this.tableData = v.content
if (v.content === undefined || v.content === null) {
this.tableData = []
} else {
this.tableData = v.content
}
}
}
})
},
// 提交配置信息
submitForm(formName, classify) {
this.$refs[formName].validate((valid) => {
if (valid) {
var jsonValue = {
classify: classify
}
if (classify === 1) {
var requestStatus = false
var jsonValue = {
classify: classify
}
if (classify === 1) {
this.$refs[formName].validate((valid) => {
if (valid) {
jsonValue.content = this.ruleForm
} else if (classify === 2) {
jsonValue.content = this.tableData
requestStatus = true
}
setSettings(jsonValue).then(response => {
this.$message({
message: '设置成功',
type: 'success'
})
})
} else if (classify === 2) {
jsonValue.content = this.tableData
requestStatus = true
}
if (requestStatus) {
setSettings(jsonValue).then(response => {
this.$message({
message: '设置成功',
type: 'success'
})
}
})
})
}
},
resetForm(formName) {
this.$refs[formName].resetFields()
......
......@@ -2,7 +2,7 @@
<div class="app-container">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<el-col :span="4" :xs="24" style="padding-right: 0;">
<el-card class="box-card">
<div class="head-container">
<el-input
......
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