Commit f341d80b authored by chenfenglei's avatar chenfenglei

系统配置

parent fe54bff4
<template>
<div>
<div style="margin-top:30px;">
</div>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="新用户跳转链接" name="news_user">
<el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm" style="width:600px;">
<el-form-item label="配置信息" prop="msg" :rules="[{ required: true, message: '配置信息不能为空'}, ]">
<el-input type="text" v-model.number="form.msg" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')" v-if="!$store.state.readonly">修改</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="分享商品ID" name="share_goods">
<el-form :model="form2" ref="form2" label-width="150px" class="demo-ruleForm" style="width:600px;">
<el-form-item label="分享商品ID" prop="msg" :rules="[{ required: true, message: '配置信息不能为空'},]" >
<el-input type="text" v-model.number="form2.msg" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form2')" v-if="!$store.state.readonly">修改</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { getConfigListApi ,updateConfigApi} from "../../service/api";
export default {
name: "entrance",
props: ["entranceObj"],
data() {
return {
activeName: "news_user",
form: {
msg: ""
},
form2: {
msg: ""
},
thisList:{},
thisList2:{},
};
},
mounted() {
this.first();
},
filters: {},
methods: {
handleClick(tab) {
this.activeName = tab.name;
if (tab.name === 'news_user') {
this.first();
} else {
this.second();
}
},
first() {
getConfigListApi({key: 'new_user_redirect'}).then(res => {
let thisList = res.list[0]
this.form.msg=thisList.desc;
this.thisList=thisList;
})
},
second() {
getConfigListApi({key: 'share_goods_id'}).then(res => {
let thisList2 = res.list[0]
this.form2.msg=thisList2.desc;
this.thisList2=thisList2;
})
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
if(formName= "form"){
this.$confirm('确认配置吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let json ={
key:this.thisList.key,
value:this.thisList.value,
desc:this.form.msg,
}
let id=this.thisList.id;
console.log(id,json)
updateConfigApi(id,json).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
});
});
}else{
this.$confirm('确认配置吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let json ={
key:this.thisList2.key,
value:this.thisList2.value,
desc:this.form2.msg
}
let id=this.thisList2.id;
updateConfigApi(id,json).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
});
});
}
} else {
console.log("error submit!!");
return false;
}
});
}
}
};
</script>
<style scoped lang="less">
</style>
......@@ -428,6 +428,17 @@ export default [{
component: e => require(['@/components/smsRecord'], e),
}
},
{
value: '系统配置',
routerName: 'config',
path: '/config',
cover: '10-3',
router: {
path: '/config',
name: 'config',
component: e => require(['@/components/config'], e),
}
},
]
},
{
......
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 to comment