分享图 分平台
This commit is contained in:
parent
c668ad1358
commit
6a4e106475
@ -24,6 +24,24 @@
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="平台"
|
||||
prop="platform_id"
|
||||
>
|
||||
<el-select
|
||||
v-model="shareForm.platform_id"
|
||||
placeholder="请选择平台"
|
||||
style="width: 100%"
|
||||
@change="changePlatform"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in platformsArr"
|
||||
:key="item.platform.platform_id"
|
||||
:label="item.platform.name"
|
||||
:value="item.platform.platform_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="分享类型"
|
||||
prop="share_type"
|
||||
@ -536,8 +554,10 @@ export default {
|
||||
onlyAd: false,
|
||||
curShareType: '',
|
||||
selectedShareType: [],
|
||||
platformsArr: [],
|
||||
// main
|
||||
shareForm: {
|
||||
platform_id: '',
|
||||
default_share: false,
|
||||
share_images: [],
|
||||
share_words: [],
|
||||
@ -555,6 +575,9 @@ export default {
|
||||
ad_id: ''
|
||||
},
|
||||
shareFormRules: {
|
||||
platform_id: [
|
||||
{ required: true, message: '请选择平台', trigger: 'blur' }
|
||||
],
|
||||
default_share: [
|
||||
{ required: true, message: '请选择是否默认分享', trigger: 'blur' }
|
||||
],
|
||||
@ -644,7 +667,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.isDev = this.$route.query.data_type === 'dev' ? true : false
|
||||
this.isDev = this.$route.query.data_type === 'dev' || this.$route.query.id === 'new' ? true : false
|
||||
if (!this.uid || this.uid === 'new') {
|
||||
this.$router.push('/games/details/new/info')
|
||||
} else {
|
||||
@ -670,6 +693,7 @@ export default {
|
||||
const { data } = res
|
||||
if (data.errcode === 0) {
|
||||
this.gameInfo = data.gameInfo
|
||||
this.platformsArr = data.gameInfo.platforms
|
||||
this.shareForm.game_id = this.gameInfo.game_id
|
||||
this.$route.meta.title = this.gameInfo.game_name
|
||||
document.title = getPageTitle(this.gameInfo.game_name)
|
||||
@ -755,7 +779,10 @@ export default {
|
||||
const data = res.data
|
||||
if (data.errcode === 0) {
|
||||
this.selectedShareType = data.records.map(item => {
|
||||
return item.share_type
|
||||
return {
|
||||
share_type: item.share_type,
|
||||
platform_id: item.platform_id
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -779,11 +806,22 @@ export default {
|
||||
}
|
||||
},
|
||||
changeShareType(val) {
|
||||
if (this.selectedShareType.includes(val) && this.curShareType !== val) {
|
||||
this.shareForm.share_type = ''
|
||||
this.$message.error('已有此分享类型,请选择其他分享类型!')
|
||||
for (let i = 0; i < this.selectedShareType.length; i++) {
|
||||
const shareType = this.selectedShareType[i]
|
||||
if (
|
||||
shareType.share_type === val &&
|
||||
shareType.platform_id === this.shareForm.platform_id &&
|
||||
this.curShareType !== val
|
||||
) {
|
||||
this.shareForm.share_type = ''
|
||||
this.$message.error('该平台已有此分享类型,请选择其他分享类型!')
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
changePlatform() {
|
||||
this.changeShareType(this.shareForm.share_type)
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
|
@ -7,6 +7,22 @@
|
||||
:model="filterForm"
|
||||
class="filter"
|
||||
>
|
||||
<el-form-item
|
||||
label="平台"
|
||||
prop="platform_id"
|
||||
>
|
||||
<el-select
|
||||
v-model="filterForm.platform_id"
|
||||
placeholder="请选择分享类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in platformsArr"
|
||||
:key="item.platform.platform_id"
|
||||
:label="item.platform.name"
|
||||
:value="item.platform.platform_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="分享类型"
|
||||
prop="shareType"
|
||||
@ -121,25 +137,27 @@
|
||||
prop="gameName"
|
||||
label="游戏"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
/>
|
||||
<el-table-column
|
||||
prop="platform_id"
|
||||
label="平台"
|
||||
show-overflow-tooltip
|
||||
:formatter="formatPlatform"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="typeName"
|
||||
label="分享类型"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
/>
|
||||
<el-table-column
|
||||
prop="type"
|
||||
label="类型"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formatType"
|
||||
/>
|
||||
<el-table-column
|
||||
label="分享图"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
width="260"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
@ -159,34 +177,29 @@
|
||||
prop="ad_id"
|
||||
label="广告ID"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
/>
|
||||
<el-table-column
|
||||
prop="default_share"
|
||||
label="默认分享"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formatDefault"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="areaName"
|
||||
label="地域"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formatArea"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="sex"
|
||||
label="性别"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formatSex"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="published"
|
||||
label="已发布"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formPublished"
|
||||
/>
|
||||
<el-table-column
|
||||
@ -250,9 +263,11 @@ export default {
|
||||
permPublish: false,
|
||||
gameInfo: {},
|
||||
isDev: true,
|
||||
platformsArr: [],
|
||||
// filter
|
||||
shareTypes: [],
|
||||
filterForm: {
|
||||
platform_id: '',
|
||||
shareType: '',
|
||||
type: ''
|
||||
},
|
||||
@ -304,6 +319,7 @@ export default {
|
||||
const { data } = res
|
||||
if (data.errcode === 0) {
|
||||
this.gameInfo = data.gameInfo
|
||||
this.platformsArr = data.gameInfo.platforms
|
||||
this.$route.meta.title = this.gameInfo.game_name
|
||||
document.title = getPageTitle(this.gameInfo.game_name)
|
||||
if (cb && cb instanceof Function) cb()
|
||||
@ -483,6 +499,16 @@ export default {
|
||||
formPublished(row, column, cellValue, index) {
|
||||
return cellValue === true ? '是' : '否'
|
||||
},
|
||||
formatPlatform(row, column, cellValue, index) {
|
||||
let platform = ''
|
||||
for (let i = 0; i < this.platformsArr.length; i++) {
|
||||
if (this.platformsArr[i].platform.platform_id === cellValue) {
|
||||
platform = this.platformsArr[i].platform.name
|
||||
break
|
||||
}
|
||||
}
|
||||
return platform ? platform : '暂无'
|
||||
},
|
||||
delShare(row) {
|
||||
this.$confirm('是否删除该分享图?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@ -553,17 +579,13 @@ export default {
|
||||
editShare(row) {
|
||||
const dataType = this.isDev ? 'dev' : 'pro'
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/share/edit?id=${
|
||||
row._id
|
||||
}&data_type=${dataType}`
|
||||
`/games/details/${this.uid}/share/edit?id=${row._id}&data_type=${dataType}`
|
||||
)
|
||||
},
|
||||
rowClick(row, column, event) {
|
||||
const dataType = this.isDev ? 'dev' : 'pro'
|
||||
this.$router.push(
|
||||
`/games/details/${this.uid}/share/edit?id=${
|
||||
row._id
|
||||
}&data_type=${dataType}`
|
||||
`/games/details/${this.uid}/share/edit?id=${row._id}&data_type=${dataType}`
|
||||
)
|
||||
},
|
||||
// pagination
|
||||
|
Loading…
x
Reference in New Issue
Block a user