diff --git a/src/views/data/Data.vue b/src/views/data/Data.vue index f49acbf..799ddca 100644 --- a/src/views/data/Data.vue +++ b/src/views/data/Data.vue @@ -23,7 +23,7 @@ import Introduce from './Introduce.vue'; export default { data() { return { - active: 'first', + active: this.$route.query.tab ? this.$route.query.tab : 'first', userId: this.$store.state.userId, tabs: { first: '产品管理', @@ -44,6 +44,7 @@ export default { methods: { tabChange(index){ this.active = index + this.$router.push(`/data?tab=${index}`) }, } }; diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index ed95737..a371e6b 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -34,7 +34,11 @@ - + + + diff --git a/src/views/data/Introduce.vue b/src/views/data/Introduce.vue index b10f048..66e5f3d 100644 --- a/src/views/data/Introduce.vue +++ b/src/views/data/Introduce.vue @@ -63,6 +63,7 @@ export default { }, defaultActive: [], editing: false, + edited: false, introduce: '', dataSource: '', introduceText: '', @@ -100,19 +101,21 @@ export default { this.typeList = res // 取首个的id和简介 - if(res[0].children.length){ - let item = res[0].children[0] - this.categoryId = item.id - this.dataSource = res[0].children[0].dataSource - this.defaultActive = [item.id] - this.introduceText = item.introduce - this.introduce = item.introduce - }else{ - this.categoryId = res[0].id - this.dataSource = res[0].dataSource - this.defaultActive = [res[0].id] - this.introduceText = res[0].introduce - this.introduce = res[0].introduce + if (!this.edited) { + if(res[0].children.length){ + let item = res[0].children[0] + this.categoryId = item.id + this.dataSource = res[0].children[0].dataSource + this.defaultActive = [item.id] + this.introduceText = item.introduce + this.introduce = item.introduce + }else{ + this.categoryId = res[0].id + this.dataSource = res[0].dataSource + this.defaultActive = [res[0].id] + this.introduceText = res[0].introduce + this.introduce = res[0].introduce + } } this.getKeyword() }).catch(res => {}) @@ -120,6 +123,7 @@ export default { 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) {