限制分享类型选择
This commit is contained in:
parent
669519c38a
commit
20c8b4d5d8
@ -11,7 +11,12 @@
|
||||
<el-input v-model="gameInfo.game_name" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分享类型" prop="share_type">
|
||||
<el-select v-model="shareForm.share_type" placeholder="请选择分享类型" style="width: 100%">
|
||||
<el-select
|
||||
v-model="shareForm.share_type"
|
||||
placeholder="请选择分享类型"
|
||||
style="width: 100%"
|
||||
@change="changeShareType"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item,index) in shareTypes"
|
||||
:key="index"
|
||||
@ -88,7 +93,6 @@
|
||||
</el-row>
|
||||
<el-button v-if="permEdit" size="mini" @click="addShareGroup">添加分享语</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="!onlyShare">
|
||||
<el-form-item label="广告 ID" prop="ad_id">
|
||||
<el-input v-model="shareForm.ad_id"/>
|
||||
@ -112,7 +116,6 @@
|
||||
<el-button @click="goBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- Modal - 编辑分享类型 -->
|
||||
<el-dialog title="分享类型列表" :visible.sync="modalShareTypeVisible" width="35%">
|
||||
<el-button v-if="permEdit" type="primary" @click="addShareType">新增</el-button>
|
||||
@ -142,7 +145,7 @@
|
||||
:visible.sync="modalShareTypeEditVisible"
|
||||
append-to-body
|
||||
:before-close="closeShareTypeEditModal"
|
||||
width="35%"
|
||||
width="35%"
|
||||
>
|
||||
<el-form
|
||||
ref="shareTypeForm"
|
||||
@ -163,7 +166,7 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- Modal - 编辑地域 -->
|
||||
<el-dialog title="地域列表" :visible.sync="modalAreaVisible" width="35%">
|
||||
<el-dialog title="地域列表" :visible.sync="modalAreaVisible" width="35%">
|
||||
<el-button v-if="permEdit" type="primary" @click="addArea">新增</el-button>
|
||||
<el-table
|
||||
:data="areas"
|
||||
@ -190,7 +193,7 @@
|
||||
:visible.sync="modalAreaEditVisible"
|
||||
append-to-body
|
||||
:before-close="closeModalAreaEdit"
|
||||
width="35%"
|
||||
width="35%"
|
||||
>
|
||||
<el-form ref="areaForm" :model="areaForm" :rules="areaFormRules" label-width="50px">
|
||||
<el-form-item label="说明" prop="name">
|
||||
@ -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 => {
|
||||
|
@ -62,7 +62,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="ad_id" label="广告ID" show-overflow-tooltip sortable/>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
prop="default_share"
|
||||
label="默认分享"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
|
Loading…
x
Reference in New Issue
Block a user