|
|
@ -35,9 +35,9 @@ |
|
|
|
<!-- 表单内容 --> |
|
|
|
<!-- 表单内容 --> |
|
|
|
<div class="form-box fl-r"> |
|
|
|
<div class="form-box fl-r"> |
|
|
|
<a-form :form="form" @submit="handleSubmit"> |
|
|
|
<a-form :form="form" @submit="handleSubmit"> |
|
|
|
<a-form-item label="分类页样式" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="页面风格" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group |
|
|
|
v-decorator="['style']" |
|
|
|
v-decorator="['style', { rules: [{ required: true, message: '请选择页面风格' }]}]" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-radio |
|
|
|
<a-radio |
|
|
|
v-for="(item, index) in pageStyle" |
|
|
|
v-for="(item, index) in pageStyle" |
|
|
@ -58,7 +58,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import pick from 'lodash.pick' |
|
|
|
import pick from 'lodash.pick' |
|
|
|
import * as Api from '@/api/setting/wxApp' |
|
|
|
import * as Api from '@/api/client/wxapp/setting' |
|
|
|
import { SettingEnum } from '@/common/enum/store' |
|
|
|
import { SettingEnum } from '@/common/enum/store' |
|
|
|
import constants from '@/common/enum/store/page/wxAppStyle/constants' |
|
|
|
import constants from '@/common/enum/store/page/wxAppStyle/constants' |
|
|
|
|
|
|
|
|
|
|
@ -67,8 +67,6 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
// 当前设置项的key |
|
|
|
|
|
|
|
key: SettingEnum.PAGE_CATEGORY_TEMPLATE.value, |
|
|
|
|
|
|
|
// 标签布局属性 |
|
|
|
// 标签布局属性 |
|
|
|
labelCol: { span: 5 }, |
|
|
|
labelCol: { span: 5 }, |
|
|
|
// 输入框布局属性 |
|
|
|
// 输入框布局属性 |
|
|
@ -85,18 +83,17 @@ export default { |
|
|
|
// 初始化数据 |
|
|
|
// 初始化数据 |
|
|
|
created () { |
|
|
|
created () { |
|
|
|
// 获取当前详情记录 |
|
|
|
// 获取当前详情记录 |
|
|
|
this.getDetail() |
|
|
|
this.getPageStyle() |
|
|
|
console.log(this.pageStyle) |
|
|
|
console.log(this.pageStyle, this.form) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前详情记录 |
|
|
|
// 获取当前详情记录 |
|
|
|
getDetail () { |
|
|
|
getPageStyle () { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
Api.detail(this.key) |
|
|
|
Api.getPageStyle() |
|
|
|
.then(result => { |
|
|
|
.then(result => { |
|
|
|
// 当前记录 |
|
|
|
// 当前记录 |
|
|
|
this.record = result.data.values |
|
|
|
this.record = result.data.detail || '' |
|
|
|
// 设置默认值 |
|
|
|
// 设置默认值 |
|
|
|
this.setFieldsValue() |
|
|
|
this.setFieldsValue() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -110,7 +107,7 @@ export default { |
|
|
|
const { record, form: { setFieldsValue } } = this |
|
|
|
const { record, form: { setFieldsValue } } = this |
|
|
|
// 表单内容 |
|
|
|
// 表单内容 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
setFieldsValue(pick(record, ['style', 'shareTitle', 'showAddCart', 'cartStyle'])) |
|
|
|
setFieldsValue(pick(record, ['style'])) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -120,6 +117,7 @@ export default { |
|
|
|
// 表单验证 |
|
|
|
// 表单验证 |
|
|
|
const { form: { validateFields } } = this |
|
|
|
const { form: { validateFields } } = this |
|
|
|
validateFields((errors, values) => { |
|
|
|
validateFields((errors, values) => { |
|
|
|
|
|
|
|
console.log(errors, values) |
|
|
|
// 提交到后端api |
|
|
|
// 提交到后端api |
|
|
|
!errors && this.onFormSubmit(values) |
|
|
|
!errors && this.onFormSubmit(values) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -129,9 +127,11 @@ export default { |
|
|
|
onFormSubmit (values) { |
|
|
|
onFormSubmit (values) { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
console.log(values) |
|
|
|
console.log(values) |
|
|
|
// Api.update(this.key, { form: values }) |
|
|
|
Api.setPageStyle({ form: values }) |
|
|
|
// .then(result => this.$message.success(result.message, 1.5)) |
|
|
|
.then(result => this.$message.success(result.message, 1.5)) |
|
|
|
// .finally(() => this.isLoading = false) |
|
|
|
.finally(() => { |
|
|
|
|
|
|
|
this.isLoading = false |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|