You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.3 KiB
98 lines
2.3 KiB
<template>
|
|
<div class="app-container">
|
|
<el-row>
|
|
<el-col :span="4">
|
|
<div v-for="item in menuList" :key="item" @click="changeMenu(item)"
|
|
:class="{'active':item===currentMenu.configName,'inactive':item!==currentMenu.configName}">{{ item }}
|
|
</div>
|
|
</el-col>
|
|
<el-col :span="18" :offset="2">
|
|
<Editor v-model="currentMenu.configValue"/>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="text-center mt20">
|
|
<el-button type="primary" @click="update">保存</el-button>
|
|
<el-button>重置</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getConfig, updateConfig } from '@/api/system/config'
|
|
|
|
export default {
|
|
name: 'user_agreement',
|
|
mounted() {
|
|
this.changeMenu()
|
|
},
|
|
data() {
|
|
let form = {
|
|
userAgreement: {
|
|
'configId': 100,
|
|
'configName': '用户协议',
|
|
'configKey': 'platform.user.agreement',
|
|
'configValue': '',
|
|
'active': true
|
|
},
|
|
privacyPolicy: {
|
|
'configId': 101,
|
|
'configName': '隐私政策',
|
|
'configKey': 'platform.privacy.policy',
|
|
'configValue': '',
|
|
'active': false
|
|
}
|
|
}
|
|
let menuList = Object.keys(form).map(item => form[item].configName)
|
|
return {
|
|
form,
|
|
menuList
|
|
}
|
|
},
|
|
methods: {
|
|
update() {
|
|
updateConfig(this.currentMenu).then(response => {
|
|
this.$modal.msgSuccess(`${this.currentMenu.configName}更新${response.code === 200 ? '成功' : '失败'}`)
|
|
})
|
|
},
|
|
changeMenu(name) {
|
|
if (name === undefined) {
|
|
name = this.menuList[0]
|
|
}
|
|
for (let key in this.form) {
|
|
this.form[key].active = this.form[key].configName === name
|
|
}
|
|
getConfig(this.currentMenu.configId).then(response => {
|
|
this.currentMenu.configValue = response.data.configValue
|
|
})
|
|
}
|
|
},
|
|
computed: {
|
|
currentMenu() {
|
|
return Object.values(this.form).find(item => item.active)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.active, .inactive {
|
|
cursor: pointer;
|
|
height: 80px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 14px;
|
|
text-align: center;
|
|
font-family: Roboto;
|
|
}
|
|
|
|
.active {
|
|
background-color: rgba(22, 132, 252, 1);
|
|
color: rgba(255, 255, 255, 1);
|
|
}
|
|
|
|
.inactive {
|
|
background-color: rgba(239, 239, 239, 1);
|
|
color: rgba(51, 51, 51, 1);
|
|
}
|
|
</style>
|
|
|