| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <basic-container>
- <avue-tabs :option="tabOption" @change="(data)=>tabChange(data.prop)">
- </avue-tabs>
- <avue-form ref="form" v-model="form" :option="option" @submit="updateSetting">
- </avue-form>
- </basic-container>
- </template>
- <script>
- import {getPlatformSetting, updatePlatformValue} from "@/api/sing_desk/platformsetting";
- export default {
- data() {
- return {
- form: {},
- tabOption: {
- column: [{
- icon: 'el-icon-s-operation',
- label: '页面设置',
- prop: 'PAGE_INTERFACE_SHOW',
- }, {
- icon: 'iconfont iconicon_task',
- label: '活动设置',
- prop: 'ACTIVE_SETTING',
- }]
- },
- option: {
- submitText: '保存',
- labelWidth: 120,
- emptyBtn: false,
- column: []
- },
- key: "",
- }
- },
- created() {
- this.tabChange(this.tabOption.column[0].prop);
- },
- methods: {
- /**
- * 获取平台设置
- */
- getSetting(key) {
- getPlatformSetting(key).then(res => {
- this.form = JSON.parse(res.data.data);
- });
- },
- /**
- * 更新平台设置
- */
- updateSetting(row, loading) {
- const data = {};
- this.option.column.forEach(ele=>{
- data[ele.prop] = this.form[ele.prop];
- });
- updatePlatformValue({
- key: this.key,
- value: JSON.stringify(data)
- }).then(() => {
- this.$message.success("修改成功");
- }).finally(() => {
- loading();
- });
- },
- /**
- * 选项卡变化
- */
- tabChange(key) {
- this.key = key;
- //活动页面
- if (this.key === "PAGE_INTERFACE_SHOW") {
- this.option.column = [
- {
- label: "主页标题",
- prop: "indexTitle",
- span: 24,
- rules: [{
- required: true,
- message: "请输入主页标题",
- trigger: "blur"
- }],
- },
- {
- label: "移动授权标题",
- prop: "cmccAuthTitle",
- span: 24,
- rules: [{
- required: true,
- message: "请输入移动授权标题",
- trigger: "blur"
- }],
- },
- {
- label: "移动授权内容",
- prop: "cmccAuthContent",
- component: 'AvueUeditor',
- options: {
- action: '/api/blade-resource/oss/endpoint/put-file',
- propsHttp: {
- res: 'data',
- url: 'link'
- },
- },
- hide: true,
- minRows: 6,
- span: 24,
- rules: [{
- required: true,
- message: "请输入活动内容",
- trigger: "blur"
- }]
- },
- {
- label: "主页轮播图",
- prop: "indexImageList",
- type: 'dynamic',
- span: 24,
- children: {
- align: 'center',
- headerAlign: 'center',
- column: [{
- label: '轮播图',
- prop: "url",
- dataType: "string",
- type: 'upload',
- propsHttp: {
- res: 'data',
- url: 'link'
- },
- listType: 'picture-img',
- tip: '只能上传jpg/png文件,且不超过500kb',
- action: '/api/blade-resource/oss/endpoint/put-file',
- rules: [{
- required: true,
- message: "请输入类型",
- trigger: "blur"
- }]
- },{
- label: '类型',
- prop: "type",
- rules: [{
- required: true,
- message: "请输入类型",
- trigger: "blur"
- }],
- },{
- label: '地址',
- prop: "path",
- rules: [{
- required: true,
- message: "请输入地址",
- trigger: "blur"
- }],
- }]
- }
- }
- ]
- } else if(this.key === "ACTIVE_SETTING"){
- this.option.column = [
- {
- label: "默认活动",
- prop: "defaultActiveId",
- // type: "select",
- // dicUrl:"/api/sing_active/activerecord/list?current=1&size=999",
- // props: {
- // label: 'title',
- // value: 'id',
- // desc: 'content',
- // res: "data.records"
- // },
- span: 12,
- rules: [{
- required: true,
- message: "请选择默认活动",
- trigger: "blur"
- }],
- },
- {
- label: "热力值/票",
- prop: "voteAndHeatRate",
- type: "number",
- span: 12,
- rules: [{
- required: true,
- message: "请输入热力值/票",
- trigger: "blur"
- }],
- },
- {
- label: "普法积分值/票",
- prop: "voteAndPointRate",
- type: "number",
- span: 12,
- rules: [{
- required: true,
- message: "请输入普法积分值/票",
- trigger: "blur"
- }],
- },
- ]
- } else {
- this.option.column = [];
- }
- this.form = {};
- this.getSetting(this.key);
- }
- }
- };
- </script>
- <style>
- </style>
|