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