diff --git a/src/api/game.js b/src/api/game.js index 52692f9..dd99061 100644 --- a/src/api/game.js +++ b/src/api/game.js @@ -42,3 +42,37 @@ export function delJump(data) { data }) } + +/* -------------------------------------- */ +// 获取游戏列表 +export function getallGame(params) { + return requestMp({ + url: '/game-list', + method: 'get', + params + }) +} +// 添加游戏 +export function addGame(data) { + return requestMp({ + url: '/game-list', + method: 'post', + data + }) +} +// 修改游戏 +export function updateGame(data) { + return requestMp({ + url: '/game-list', + method: 'put', + data + }) +} +// 删除游戏 +export function delGame(data) { + return requestMp({ + url: '/game-list', + method: 'delete', + data + }) +} \ No newline at end of file diff --git a/src/router/admin.js b/src/router/admin.js index 00162d8..c6abde2 100644 --- a/src/router/admin.js +++ b/src/router/admin.js @@ -43,6 +43,14 @@ const adminRouter = { title: '跳转列表', }, }, + { + path: 'game-list', + component: () => import('@/views/admin/game-list'), // Parent router-view + name: 'adminGameList', + meta: { + title: '游戏列表', + }, + }, ], } diff --git a/src/views/ad/edit.vue b/src/views/ad/edit.vue index 72d3145..a02203e 100644 --- a/src/views/ad/edit.vue +++ b/src/views/ad/edit.vue @@ -536,8 +536,8 @@ export default { } if (!hasAd) { - // 默认选择第一个平台 - this.adForm.channelid = this.platformList[0].platform_id + // 默认选择微信6001 + this.adForm.channelid = 6001 this.changePlatform(this.adForm.channelid) // 默认选择第一个游戏 this.adForm.gameid = this.gameList[0] ? this.gameList[0].game_id : '' @@ -686,6 +686,7 @@ export default { }) if (!location.message || location.message.length === 0) { this.locationList = [] + this.targetList = {} return } diff --git a/src/views/admin/game-list.vue b/src/views/admin/game-list.vue new file mode 100644 index 0000000..8aaaeb1 --- /dev/null +++ b/src/views/admin/game-list.vue @@ -0,0 +1,430 @@ + + + diff --git a/src/views/admin/jump.vue b/src/views/admin/jump.vue index 44525f7..3e9fb45 100644 --- a/src/views/admin/jump.vue +++ b/src/views/admin/jump.vue @@ -209,22 +209,15 @@ class="w100" multiple filterable - allow-create > - - - { + getallGame(params) + .then(res => { + const data = res.data + resolve(data) + }) + .catch(err => { + reject(err) + console.log(err) + }) + }) + }, getJumpList(params) { return new Promise((resolve, reject) => { getJumpList(params) @@ -503,6 +508,17 @@ export default { }, openModal() { this.modalVisible = true + + this.modalOpt.game = this.allGame.filter(item => { + return item.platform_id === this.modalForm.platform_id + }) + this.getTargetList() + }, + async getTargetList() { + const data = await this.getallGame({ + platform_id: this.modalForm.platform_id, + }) + this.modalOpt.target = data.result }, viewInfo(data) { this.isNew = false @@ -520,10 +536,20 @@ export default { // 整理数据 const info = JSON.parse(JSON.stringify(this.modalForm)) const games = info.t_game_name - const appids = info.t_appid.split(',') + const appids = [] const ad_uids = info.ad_uid.split(',') const links = info.link.split(',') + const tempAppIdList = {} + this.modalOpt.target.map(item => { + tempAppIdList[item.game_name] = item.appid + }) + + games.map(item => { + appids.push(tempAppIdList[item]) + }) + + if (this.isNew) { // 新增 const submitArr = [] @@ -558,9 +584,11 @@ export default { }, changeOpt() { this.modalForm.game_id = '' + this.modalForm.t_game_name = '' this.modalOpt.game = this.allGame.filter(item => { return item.platform_id === this.modalForm.platform_id }) + this.getTargetList() }, }, }