diff --git a/packages/jianping/AppPublicizeInformation/Add.vue b/packages/jianping/AppPublicizeInformation/Add.vue index ea248e2f..75261eec 100644 --- a/packages/jianping/AppPublicizeInformation/Add.vue +++ b/packages/jianping/AppPublicizeInformation/Add.vue @@ -10,7 +10,7 @@ - + @@ -21,7 +21,7 @@ - + 最多上传1张图片,单张图片最大10MB
支持.png,.jpg,.jpeg格式
- + v && /0{3}$/g.test(v) ? cb('发布地区必须选到村级') : cb(), trigger: "blur"} + ], moduleId: [{required: true, message: "请选择文章类型"}], categoryId: [{required: true, message: "选择分类"}], } @@ -100,7 +103,7 @@ export default { form: { pictureUrlList: [], pictureUrl: '', - file: [] + files: [] }, miniTypeList: [], newTypeList: [] @@ -112,9 +115,9 @@ export default { const isLt10M = file.file.size / 1024 / 1024 < 10; if (!isLt10M) { this.$message.error("附件大小不超过10mb!"); - for (let i = 0; i < this.fileList.length; i++) { - if (this.fileList[i].uid == file.file.uid) { - this.fileList.splice(i, 1); + for (let i = 0; i < this.form.files.length; i++) { + if (this.form.files[i].uid == file.file.uid) { + this.form.files.splice(i, 1); } } return; @@ -124,33 +127,23 @@ export default { this.instance.post(`/admin/file/add`, formData, {withCredentials: false}).then(res => { if (res && res.code == 0) { let img = res.data[0].split(';'); - this.fileList.forEach((item, index) => { + this.form.files.forEach((item, index) => { if (item.uid == file.file.uid) { - this.fileList[index].id = img[1]; + this.form.files[index].id = img[1]; } }) } }); }, handleRemove(file, fileList) { - this.fileList = fileList; + this.form.files = fileList; }, handleChange(file, fileList) { - this.fileList = fileList; + this.form.files = fileList; }, back() { this.$router.push({}) }, - getDetail() { - let {id} = this.$route.query - id && this.instance.post("/app/apppreventionreturntopoverty/queryDetailById", null, { - params: {id} - }).then(res => { - if (res?.data) { - this.form = res.data - } - }) - }, submit() { this.$refs.ruleForm.validate(v => { if (v) { @@ -166,6 +159,23 @@ export default { } }) }, + getDetail() { + let {id} = this.$route.query + if(!id) { + return + } + id && this.instance.post("/app/apppreventionreturntopoverty/queryDetailById", null, { + params: {id} + }).then(res => { + if (res?.data) { + if(res.data.pictureUrl) { + res.data.pictureUrlList = [{url: res.data.pictureUrl}] + } + this.form = res.data + this.getNewTypeList() + } + }) + }, getTypeList() { let {parentId} = this.$route.query this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => { @@ -192,7 +202,7 @@ export default { }, created() { this.getTypeList() - // this.getDetail() + this.getDetail() } } diff --git a/packages/jianping/AppPublicizeInformation/List.vue b/packages/jianping/AppPublicizeInformation/List.vue index e9dce67e..2dbd9378 100644 --- a/packages/jianping/AppPublicizeInformation/List.vue +++ b/packages/jianping/AppPublicizeInformation/List.vue @@ -32,7 +32,7 @@
@@ -44,7 +44,7 @@ - +