From a65643bbb990ab51143c0852866c690e83bd65c4 Mon Sep 17 00:00:00 2001 From: Jo <479214531@qq.com> Date: Tue, 16 Nov 2021 00:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9B=B8=E5=85=B3bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/data/Data.vue | 3 ++- src/views/data/Framework.vue | 6 +++++- src/views/data/Introduce.vue | 35 +++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 16 deletions(-) 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) {