游戏跳转批量添加
This commit is contained in:
parent
79db3f7635
commit
70a6ec7e86
@ -149,10 +149,15 @@
|
||||
/>
|
||||
<!-- modal - edit -->
|
||||
<el-dialog
|
||||
title="编辑游戏信息"
|
||||
title="编辑游戏跳转信息"
|
||||
:visible.sync="modalVisible"
|
||||
:before-close="closeModal"
|
||||
>
|
||||
<span class="dis-b ">提示一:若批量添加,目标游戏、目标AppID、特征码、推广链接需要按顺序一一对应,用“,”分隔。</span>
|
||||
<span
|
||||
class="dis-b mgb-20 "
|
||||
style="color: red; margin-top: 10px;"
|
||||
>提示二:修改单条信息时不可批量操作(只可选择一个目标游戏)。</span>
|
||||
<el-form
|
||||
ref="modalForm"
|
||||
:model="modalForm"
|
||||
@ -198,7 +203,21 @@
|
||||
label="目标游戏"
|
||||
prop="t_game_name"
|
||||
>
|
||||
<el-input v-model="modalForm.t_game_name" />
|
||||
<el-select
|
||||
v-model="modalForm.t_game_name"
|
||||
placeholder="请选择游戏"
|
||||
class="w100"
|
||||
multiple
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in modalOpt.game"
|
||||
:key="index"
|
||||
:label="item.game"
|
||||
:value="item.game"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="目标AppID"
|
||||
@ -238,6 +257,7 @@ import {
|
||||
updateJump,
|
||||
delJump,
|
||||
} from '@/api/game'
|
||||
import {Promise} from 'q'
|
||||
|
||||
export default {
|
||||
name: 'adminAdJump',
|
||||
@ -270,8 +290,9 @@ export default {
|
||||
modalVisible: false,
|
||||
modalForm: {},
|
||||
defaultInfo: {
|
||||
platform_id: '',
|
||||
game_id: '',
|
||||
t_game_name: '',
|
||||
t_game_name: [],
|
||||
t_appid: '',
|
||||
ad_uid: '',
|
||||
link: '',
|
||||
@ -427,7 +448,10 @@ export default {
|
||||
params.currentPage = this.currentPage
|
||||
params.pageSize = this.pageSize
|
||||
const data = await this.getJumpList(params)
|
||||
this.tableData = data.result
|
||||
this.tableData = data.result.map(item => {
|
||||
item.t_game_name = [item.t_game_name]
|
||||
return item
|
||||
})
|
||||
this.total = data.total
|
||||
this.isLoaded = false
|
||||
} catch (err) {
|
||||
@ -492,14 +516,40 @@ export default {
|
||||
this.$message.error('请按要求填写表单')
|
||||
return
|
||||
}
|
||||
|
||||
// 整理数据
|
||||
const info = JSON.parse(JSON.stringify(this.modalForm))
|
||||
const games = info.t_game_name
|
||||
const appids = info.t_appid.split(',')
|
||||
const ad_uids = info.ad_uid.split(',')
|
||||
const links = info.link.split(',')
|
||||
|
||||
if (this.isNew) {
|
||||
// 新增
|
||||
const result = await this.addJump(this.modalForm)
|
||||
const submitArr = []
|
||||
|
||||
games.map((item, index) => {
|
||||
submitArr.push(
|
||||
this.addJump({
|
||||
platform_id: info.platform_id,
|
||||
game_id: info.game_id,
|
||||
t_game_name: games[index],
|
||||
t_appid: appids[index],
|
||||
ad_uid: ad_uids[index],
|
||||
link: links[index],
|
||||
})
|
||||
)
|
||||
})
|
||||
const result = await Promise.all(submitArr)
|
||||
} else {
|
||||
// 修改
|
||||
const result = await this.updateJump(this.modalForm)
|
||||
info.t_game_name = games[0] || ''
|
||||
info.t_appid = appids[0] || ''
|
||||
info.ad_uid = ad_uids[0] || ''
|
||||
info.link = links[0] || ''
|
||||
const result = await this.updateJump(info)
|
||||
}
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success('操作成功!')
|
||||
this.closeModal()
|
||||
this.getData()
|
||||
} catch (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user