|
@@ -153,6 +153,7 @@
|
|
filterable
|
|
filterable
|
|
allow-create
|
|
allow-create
|
|
clearable
|
|
clearable
|
|
|
|
+ multiple
|
|
default-first-option
|
|
default-first-option
|
|
placeholder="请选择关联话题"
|
|
placeholder="请选择关联话题"
|
|
no-data-text="未搜索到关联话题"
|
|
no-data-text="未搜索到关联话题"
|
|
@@ -235,7 +236,7 @@ export default {
|
|
title: "", // 标题
|
|
title: "", // 标题
|
|
authorId: "", // 作者ID
|
|
authorId: "", // 作者ID
|
|
categoryId: "", // 类目ID
|
|
categoryId: "", // 类目ID
|
|
- tagList: "", // 话题,[{id:'',tagName: ''}],目前一个,之后会多个
|
|
|
|
|
|
+ tagList: [], // 话题,[{id:'',tagName: ''}],目前一个,之后会多个
|
|
status: 2 // 上架状态,默认下架
|
|
status: 2 // 上架状态,默认下架
|
|
},
|
|
},
|
|
// 表单校验规则
|
|
// 表单校验规则
|
|
@@ -306,17 +307,21 @@ export default {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
const formData = { ...this.formData };
|
|
const formData = { ...this.formData };
|
|
- this.tagArr.forEach(item => {
|
|
|
|
- if (item.id === formData.tagList) {
|
|
|
|
- formData.tagList = {
|
|
|
|
- id: item.id,
|
|
|
|
- tagName: item.tagName
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- formData.tagList = JSON.stringify(
|
|
|
|
- formData.tagList ? [formData.tagList] : []
|
|
|
|
- );
|
|
|
|
|
|
+
|
|
|
|
+ // this.tagArr.forEach(item => {
|
|
|
|
+ // if (item.id === formData.tagList) {
|
|
|
|
+ // formData.tagList = formData.tagList.concat({
|
|
|
|
+ // id: item.id,
|
|
|
|
+ // tagName: item.tagName
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ const tagList = this.tagArr
|
|
|
|
+ .filter(item => formData.tagList.indexOf(item.id) != -1)
|
|
|
|
+ .map(item => {
|
|
|
|
+ return { id: item.id, tagName: item.tagName };
|
|
|
|
+ });
|
|
|
|
+ formData.tagList = JSON.stringify(tagList);
|
|
Object.assign(params.data, formData);
|
|
Object.assign(params.data, formData);
|
|
params.data = this.$utils.removeEmptyProperty(params.data);
|
|
params.data = this.$utils.removeEmptyProperty(params.data);
|
|
this.$net.req(params).then(
|
|
this.$net.req(params).then(
|
|
@@ -555,12 +560,10 @@ export default {
|
|
title: obj.title || "",
|
|
title: obj.title || "",
|
|
authorId: obj.authorId || "",
|
|
authorId: obj.authorId || "",
|
|
categoryId: obj.categoryId || "",
|
|
categoryId: obj.categoryId || "",
|
|
- tagList: "",
|
|
|
|
|
|
+ tagList: [],
|
|
status: obj.status || 2
|
|
status: obj.status || 2
|
|
};
|
|
};
|
|
- if (Array.isArray(obj.tagList) && obj.tagList.length > 0) {
|
|
|
|
- formData.tagList = obj.tagList[0].id;
|
|
|
|
- }
|
|
|
|
|
|
+ formData.tagList = obj.tagList.map(item => item.id);
|
|
this.formData = Object.assign(this.formData, formData);
|
|
this.formData = Object.assign(this.formData, formData);
|
|
this.videoPosterDefault = this.formData.videoCoverImgUrl;
|
|
this.videoPosterDefault = this.formData.videoCoverImgUrl;
|
|
}
|
|
}
|