|
|
|
@ -63,6 +63,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
defaultActive: [], |
|
|
|
|
editing: false, |
|
|
|
|
edited: false, |
|
|
|
|
introduce: '', |
|
|
|
|
dataSource: '', |
|
|
|
|
introduceText: '', |
|
|
|
@ -100,6 +101,7 @@ export default { |
|
|
|
|
|
|
|
|
|
this.typeList = res |
|
|
|
|
// 取首个的id和简介 |
|
|
|
|
if (!this.edited) { |
|
|
|
|
if(res[0].children.length){ |
|
|
|
|
let item = res[0].children[0] |
|
|
|
|
this.categoryId = item.id |
|
|
|
@ -114,12 +116,14 @@ export default { |
|
|
|
|
this.introduceText = res[0].introduce |
|
|
|
|
this.introduce = res[0].introduce |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.getKeyword() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
typeClick(data,node){ |
|
|
|
|
this.editing = false |
|
|
|
|
this.categoryId = data.id |
|
|
|
|
this.defaultActive = [data.id] |
|
|
|
|
this.introduceText = data.introduce |
|
|
|
|
this.introduce = data.introduce |
|
|
|
|
this.dataSource = data.dataSource |
|
|
|
@ -137,14 +141,17 @@ export default { |
|
|
|
|
this.introduce = this.introduceText |
|
|
|
|
}, |
|
|
|
|
confirmEdit(){ |
|
|
|
|
const id = this.categoryId |
|
|
|
|
this.$post(this.api.updateCategory,{ |
|
|
|
|
id: this.categoryId, |
|
|
|
|
id, |
|
|
|
|
introduce: this.introduce, |
|
|
|
|
dataSource: this.dataSource |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success(this.introduceText ? '编辑成功' : '新增成功') |
|
|
|
|
this.introduceText = this.introduce |
|
|
|
|
this.editing = false |
|
|
|
|
this.edited = true |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
delKeyword(item) { |
|
|
|
|