游戏跳转批量添加

This commit is contained in:
yulixing 2019-09-26 17:23:43 +08:00
parent 79db3f7635
commit 70a6ec7e86

View File

@ -149,10 +149,15 @@
/> />
<!-- modal - edit --> <!-- modal - edit -->
<el-dialog <el-dialog
title="编辑游戏信息" title="编辑游戏跳转信息"
:visible.sync="modalVisible" :visible.sync="modalVisible"
:before-close="closeModal" :before-close="closeModal"
> >
<span class="dis-b ">提示一若批量添加目标游戏目标AppID特征码推广链接需要按顺序一一对应,分隔</span>
<span
class="dis-b mgb-20 "
style="color: red; margin-top: 10px;"
>提示二修改单条信息时不可批量操作只可选择一个目标游戏</span>
<el-form <el-form
ref="modalForm" ref="modalForm"
:model="modalForm" :model="modalForm"
@ -198,7 +203,21 @@
label="目标游戏" label="目标游戏"
prop="t_game_name" 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>
<el-form-item <el-form-item
label="目标AppID" label="目标AppID"
@ -238,6 +257,7 @@ import {
updateJump, updateJump,
delJump, delJump,
} from '@/api/game' } from '@/api/game'
import {Promise} from 'q'
export default { export default {
name: 'adminAdJump', name: 'adminAdJump',
@ -270,8 +290,9 @@ export default {
modalVisible: false, modalVisible: false,
modalForm: {}, modalForm: {},
defaultInfo: { defaultInfo: {
platform_id: '',
game_id: '', game_id: '',
t_game_name: '', t_game_name: [],
t_appid: '', t_appid: '',
ad_uid: '', ad_uid: '',
link: '', link: '',
@ -427,7 +448,10 @@ export default {
params.currentPage = this.currentPage params.currentPage = this.currentPage
params.pageSize = this.pageSize params.pageSize = this.pageSize
const data = await this.getJumpList(params) 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.total = data.total
this.isLoaded = false this.isLoaded = false
} catch (err) { } catch (err) {
@ -492,14 +516,40 @@ export default {
this.$message.error('请按要求填写表单') this.$message.error('请按要求填写表单')
return 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) { 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 { } 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.closeModal()
this.getData() this.getData()
} catch (err) { } catch (err) {