From 20c8b4d5d8a80a8cd638c5801bc4b660423fe5d9 Mon Sep 17 00:00:00 2001 From: yulixing Date: Thu, 6 Jun 2019 19:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=88=86=E4=BA=AB=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/games/details/share/edit.vue | 47 +++++++++++++++++++++---- src/views/games/details/share/index.vue | 2 +- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/views/games/details/share/edit.vue b/src/views/games/details/share/edit.vue index 1a49a81..29e1425 100644 --- a/src/views/games/details/share/edit.vue +++ b/src/views/games/details/share/edit.vue @@ -11,7 +11,12 @@ - + 添加分享语 -
@@ -112,7 +116,6 @@ 返回 - 新增 @@ -142,7 +145,7 @@ :visible.sync="modalShareTypeEditVisible" append-to-body :before-close="closeShareTypeEditModal" - width="35%" + width="35%" > - + 新增 @@ -269,7 +272,8 @@ import { delShareType, getShare, saveShare, - updateShare + updateShare, + getShareList } from '@/api/share' import { getGame } from '@/api/games' import { getRegions, saveArea, getAreas, delArea } from '@/api/common' @@ -289,6 +293,8 @@ export default { areas: [], token: '', onlyShare: false, + curShareType: '', + selectedShareType: [], // main shareForm: { default_share: false, @@ -417,6 +423,7 @@ export default { this.$route.meta.title = this.gameInfo.game_name if (this.$route.query.id && this.$route.query.id !== 'new') { this.getShare() + this.getShareList() } } }) @@ -476,6 +483,7 @@ export default { share_image: this.shareForm.share_images[i] }) } + this.curShareType = this.shareForm.share_type if (this.shareForm.type === 2) this.onlyShare = true } }) @@ -483,9 +491,32 @@ export default { console.log(err) }) }, + getShareList() { + getShareList({ + uid: this.uid, + gameId: this.gameInfo.game_id + }) + .then(res => { + const data = res.data + if (data.errcode === 0) { + this.selectedShareType = data.records.map(item => { + return item.share_type + }) + } + }) + .catch(err => { + console.log(err) + }) + }, changeType(val) { val === 2 ? (this.onlyShare = true) : (this.onlyShare = false) }, + changeShareType(val) { + if (this.selectedShareType.includes(val) && this.curShareType !== val) { + this.shareForm.share_type = '' + this.$message.error('已有此分享类型,请选择其他分享类型!') + } + }, submitForm(formName) { if (this.shareGroups.length > 0) { this.shareForm.share_word = this.shareGroups[0].share_word @@ -524,6 +555,8 @@ export default { if (data.errcode === 0) { this.$message.success('分享图更新成功!') this.$refs['shareForm'].clearValidate() + this.curShareType = this.shareForm.share_type + this.getShareList() } }) .catch(err => { diff --git a/src/views/games/details/share/index.vue b/src/views/games/details/share/index.vue index 676882d..6627911 100644 --- a/src/views/games/details/share/index.vue +++ b/src/views/games/details/share/index.vue @@ -62,7 +62,7 @@