diff --git a/src/views/ad/edit.vue b/src/views/ad/edit.vue index b10c053..8434b80 100644 --- a/src/views/ad/edit.vue +++ b/src/views/ad/edit.vue @@ -102,6 +102,34 @@ /> + + + + + + + + @@ -175,34 +204,17 @@ :disabled="!writeable" /> - - - - - - - + @@ -211,7 +223,10 @@ @click="submit('adForm')" v-if="writeable" >提交 - 重置 + 重置 返回 @@ -265,7 +280,10 @@ export default { ad_sort: 0, status: 0, dateRange: [], - companyid: 0 + companyid: 0, + ad_property: { + is_shake: 0 + } //用于拓展属性 }, adFormRules: { name: [{ required: true, message: '请输入广告名称', trigger: 'blur' }], @@ -286,7 +304,10 @@ export default { { required: true, validator: validateJumpParams, trigger: 'blur' } ], ad_num: [ - { type: 'number', message: '计划书必须是数值', trigger: 'blur' } + { type: 'number', message: '计划数必须是数值', trigger: 'blur' } + ], + 'ad_property.is_shake': [ + { type: 'number', message: '该项必须是数值', trigger: 'blur' } ] } } @@ -296,10 +317,6 @@ export default { this.modeList = modeList this.typeList = typeList - - - - const areaListRes = await this.getAdAreaList() areaListRes.adAreaList.map(item => { this.areaList[item.area_id] = item.name @@ -336,6 +353,15 @@ export default { this.formDate(adData.end_time) ] this.adForm = adData + this.adForm.ad_property = this.adForm.ad_property + ? JSON.parse(this.adForm.ad_property) + : '' + + if (typeof this.adForm.ad_property !== 'object') { + this.adForm.ad_property = { + is_shake: 0 + } + } const gameid = this.adForm.gameid const locationid = this.adForm.locationid this.changePlatform(this.adForm.channelid) @@ -355,10 +381,9 @@ export default { this.changeGame() } - // 判断该条广告是否可编辑: 新增、未通过 - this.writeable = (this.adForm.status === 2 || !hasAd) ? true : false + this.writeable = this.adForm.status === 2 || !hasAd ? true : false }, methods: { // common @@ -513,6 +538,9 @@ export default { this.$message.error('请按要求填写表单') return } + + this.adForm.ad_property = JSON.stringify(this.adForm.ad_property) + this.adForm.begin_time = this.adForm.dateRange[0] this.adForm.end_time = this.adForm.dateRange[1] // delete this.adForm.dateRange