跳转接口
This commit is contained in:
parent
26b13bfcc3
commit
1bc8a1e4fb
@ -5,8 +5,8 @@ source /etc/profile
|
|||||||
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
|
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
|
||||||
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
|
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
|
||||||
|
|
||||||
npm run build:prod
|
#npm run build:prod
|
||||||
#npm run build:stage
|
npm run build:stage
|
||||||
|
|
||||||
cd ./dist/ && tar -zcvf pop-sys.tar.gz ./
|
cd ./dist/ && tar -zcvf pop-sys.tar.gz ./
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -1,8 +1,44 @@
|
|||||||
import requestMp from '@/utils/request-mp'
|
import requestMp from '@/utils/request-mp'
|
||||||
|
|
||||||
|
// 获取游戏列表
|
||||||
export function getGameList(params) {
|
export function getGameList(params) {
|
||||||
return requestMp({
|
return requestMp({
|
||||||
url: '/games/list',
|
url: '/games/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------- */
|
||||||
|
|
||||||
|
// 获取游戏关联列表
|
||||||
|
export function getJumpList(params) {
|
||||||
|
return requestMp({
|
||||||
|
url: '/jump',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 添加关联游戏
|
||||||
|
export function addJump(data) {
|
||||||
|
return requestMp({
|
||||||
|
url: '/jump',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 修改关联游戏
|
||||||
|
export function updateJump(data) {
|
||||||
|
return requestMp({
|
||||||
|
url: '/jump',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除关联游戏
|
||||||
|
export function delJump(data) {
|
||||||
|
return requestMp({
|
||||||
|
url: '/jump',
|
||||||
|
method: 'delete',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -35,6 +35,14 @@ const adminRouter = {
|
|||||||
title: '广告列表',
|
title: '广告列表',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'jump',
|
||||||
|
component: () => import('@/views/admin/jump'), // Parent router-view
|
||||||
|
name: 'adminAdJump',
|
||||||
|
meta: {
|
||||||
|
title: '跳转列表',
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,77 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="广告头像"
|
||||||
|
prop="ad_image"
|
||||||
|
class="uploader-box"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
class="uploader"
|
||||||
|
:action="uploadUrl"
|
||||||
|
name="image-file"
|
||||||
|
:on-success="uploadSuccess"
|
||||||
|
:on-error="uploadErr"
|
||||||
|
:disabled="true"
|
||||||
|
:show-file-list="false"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
v-if="adForm.ad_image"
|
||||||
|
:src="adForm.ad_image"
|
||||||
|
class="uploader-img"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
v-else
|
||||||
|
class="el-icon-plus uploader-icon"
|
||||||
|
/>
|
||||||
|
</el-upload>
|
||||||
|
<span
|
||||||
|
class="ipt-tip"
|
||||||
|
style="margin-top: 6px;"
|
||||||
|
>只能上传小于 600k 的图片</span>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
@click="openModal"
|
||||||
|
:disabled="!writeable"
|
||||||
|
>选择图片</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="是否跳转"
|
||||||
|
prop="jump_status"
|
||||||
|
>
|
||||||
|
<el-switch
|
||||||
|
v-model="adForm.jump_status"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="!writeable"
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="目标游戏"
|
||||||
|
prop="ad_property.appid"
|
||||||
|
v-if="adForm.jump_status === 1"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="adForm.ad_property.appid"
|
||||||
|
placeholder="请选择跳转游戏"
|
||||||
|
class="w100"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
:disabled="!writeable"
|
||||||
|
@change="changeTarget"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:label="item.t_game_name"
|
||||||
|
:value="item.t_appid"
|
||||||
|
v-for="(item, index) in targetList"
|
||||||
|
:key="index"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<span class="ipt-tip">选择游戏或输入APPID</span>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="广告特征码"
|
label="广告特征码"
|
||||||
prop="ad_property.jump_param"
|
prop="ad_property.jump_param"
|
||||||
@ -154,65 +225,7 @@
|
|||||||
:disabled="!writeable"
|
:disabled="!writeable"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
|
||||||
label="广告头像"
|
|
||||||
prop="ad_image"
|
|
||||||
class="uploader-box"
|
|
||||||
>
|
|
||||||
<el-upload
|
|
||||||
class="uploader"
|
|
||||||
:action="uploadUrl"
|
|
||||||
name="image-file"
|
|
||||||
:on-success="uploadSuccess"
|
|
||||||
:on-error="uploadErr"
|
|
||||||
:disabled="true"
|
|
||||||
:show-file-list="false"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
v-if="adForm.ad_image"
|
|
||||||
:src="adForm.ad_image"
|
|
||||||
class="uploader-img"
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
v-else
|
|
||||||
class="el-icon-plus uploader-icon"
|
|
||||||
/>
|
|
||||||
</el-upload>
|
|
||||||
<span
|
|
||||||
class="ipt-tip"
|
|
||||||
style="margin-top: 6px;"
|
|
||||||
>只能上传小于 600k 的图片</span>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
size="mini"
|
|
||||||
@click="openModal"
|
|
||||||
:disabled="!writeable"
|
|
||||||
>选择图片</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="是否跳转"
|
|
||||||
prop="jump_status"
|
|
||||||
>
|
|
||||||
<el-switch
|
|
||||||
v-model="adForm.jump_status"
|
|
||||||
:active-value="1"
|
|
||||||
:inactive-value="0"
|
|
||||||
:disabled="!writeable"
|
|
||||||
>
|
|
||||||
</el-switch>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="APPID"
|
|
||||||
prop="ad_property.appid"
|
|
||||||
v-if="adForm.jump_status === 1"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="adForm.ad_property.appid"
|
|
||||||
class="w100"
|
|
||||||
:disabled="!writeable"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="是否抖动"
|
label="是否抖动"
|
||||||
prop="ad_property.is_shake"
|
prop="ad_property.is_shake"
|
||||||
@ -321,7 +334,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getAdPos, getAd, addAd, updateAd, getAdAreaList} from '@/api/ad'
|
import {getAdPos, getAd, addAd, updateAd, getAdAreaList} from '@/api/ad'
|
||||||
import {getGameList} from '@/api/game'
|
import {getGameList, getJumpList} from '@/api/game'
|
||||||
import {typeList, modeList} from '@/utils/ad-data'
|
import {typeList, modeList} from '@/utils/ad-data'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import PicLib from '@/components/PicLib'
|
import PicLib from '@/components/PicLib'
|
||||||
@ -359,6 +372,7 @@ export default {
|
|||||||
typeList: {},
|
typeList: {},
|
||||||
modeList: {},
|
modeList: {},
|
||||||
uploadUrl: `${process.env.VUE_APP_UPLOAD}`,
|
uploadUrl: `${process.env.VUE_APP_UPLOAD}`,
|
||||||
|
targetList: [],
|
||||||
// form
|
// form
|
||||||
adForm: {
|
adForm: {
|
||||||
name: '',
|
name: '',
|
||||||
@ -505,6 +519,11 @@ export default {
|
|||||||
this.adForm.gameid = gameid
|
this.adForm.gameid = gameid
|
||||||
this.changeGame()
|
this.changeGame()
|
||||||
this.adForm.locationid = locationid
|
this.adForm.locationid = locationid
|
||||||
|
const targetList = await this.getJumpList({
|
||||||
|
game_id: this.adForm.gameid,
|
||||||
|
platform_id: this.adForm.channelid,
|
||||||
|
})
|
||||||
|
this.targetList = targetList.result
|
||||||
} else {
|
} else {
|
||||||
hasAd = false
|
hasAd = false
|
||||||
}
|
}
|
||||||
@ -550,6 +569,19 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getJumpList(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getJumpList(params)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
resetForm(formName) {
|
resetForm(formName) {
|
||||||
this.$refs[formName].resetFields()
|
this.$refs[formName].resetFields()
|
||||||
},
|
},
|
||||||
@ -628,6 +660,10 @@ export default {
|
|||||||
changePlatform(val) {
|
changePlatform(val) {
|
||||||
this.adForm.gameid = ''
|
this.adForm.gameid = ''
|
||||||
this.adForm.locationid = ''
|
this.adForm.locationid = ''
|
||||||
|
this.adForm.ad_property.appid = ''
|
||||||
|
this.adForm.ad_property.link = ''
|
||||||
|
this.adForm.ad_property.jump_param = ''
|
||||||
|
this.targetList = {}
|
||||||
this.gameList = this.allGame.filter(item => {
|
this.gameList = this.allGame.filter(item => {
|
||||||
return item.platform_id === val
|
return item.platform_id === val
|
||||||
})
|
})
|
||||||
@ -650,6 +686,32 @@ export default {
|
|||||||
label: `${JSON.parse(item.ld_property).title}`,
|
label: `${JSON.parse(item.ld_property).title}`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.adForm.ad_property.appid = ''
|
||||||
|
this.adForm.ad_property.link = ''
|
||||||
|
this.adForm.ad_property.jump_param = ''
|
||||||
|
this.targetList = {}
|
||||||
|
const targetList = await this.getJumpList({
|
||||||
|
game_id: this.adForm.gameid,
|
||||||
|
platform_id: this.adForm.channelid,
|
||||||
|
})
|
||||||
|
this.targetList = targetList.result
|
||||||
|
},
|
||||||
|
changeTarget(val) {
|
||||||
|
let target
|
||||||
|
for (let i = 0; i < this.targetList.length; i++) {
|
||||||
|
if (this.targetList[i].t_appid === val) {
|
||||||
|
target = this.targetList[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (target) {
|
||||||
|
if (target.link) this.adForm.ad_property.link = target.link
|
||||||
|
if (target.ad_uid) this.adForm.ad_property.jump_param = target.ad_uid
|
||||||
|
} else {
|
||||||
|
this.adForm.ad_property.link = ''
|
||||||
|
this.adForm.ad_property.jump_param = ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
const isLt600k = file.size / 1024 / 1024 < 0.6
|
const isLt600k = file.size / 1024 / 1024 < 0.6
|
||||||
|
518
src/views/admin/jump.vue
Normal file
518
src/views/admin/jump.vue
Normal file
@ -0,0 +1,518 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- filter -->
|
||||||
|
<el-form
|
||||||
|
ref="filterForm"
|
||||||
|
:inline="true"
|
||||||
|
:model="filterForm"
|
||||||
|
class="filter"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="平台"
|
||||||
|
prop="platform_id"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="filterForm.platform_id"
|
||||||
|
placeholder="请选择平台"
|
||||||
|
class="w100"
|
||||||
|
@change="changePlatform"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
label="所有"
|
||||||
|
:value="''"
|
||||||
|
/>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in platformList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.platform_name"
|
||||||
|
:value="item.platform_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="游戏"
|
||||||
|
prop="game_id"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="filterForm.game_id"
|
||||||
|
placeholder="请选择游戏"
|
||||||
|
class="w100"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
label="所有"
|
||||||
|
:value="''"
|
||||||
|
/>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in gameList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.game_name"
|
||||||
|
:value="item.game_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="search"
|
||||||
|
>查询</el-button>
|
||||||
|
<el-button @click="resetForm('filterForm')">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<!-- toolbar -->
|
||||||
|
<div class="toolbar clearfix">
|
||||||
|
<div class="l fl">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="addInfo"
|
||||||
|
>新增</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="r fr">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="refreshData"
|
||||||
|
>刷新</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- table -->
|
||||||
|
<el-table
|
||||||
|
v-loading="isLoaded"
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
class="table mgt-20 mgb-20"
|
||||||
|
@row-click="rowClick"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="game_id"
|
||||||
|
label="游戏"
|
||||||
|
show-overflow-tooltip
|
||||||
|
:formatter="formGame"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="platform_id"
|
||||||
|
label="平台ID"
|
||||||
|
show-overflow-tooltip
|
||||||
|
:formatter="formPlatform"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="t_game_name"
|
||||||
|
label="目标游戏"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="t_appid"
|
||||||
|
label="目标AppID"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="ad_uid"
|
||||||
|
label="特征码"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="link"
|
||||||
|
label="推广链接"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="editInfo(scope.row)"
|
||||||
|
>编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="delInfo(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- pagination -->
|
||||||
|
<el-pagination
|
||||||
|
:hide-on-single-page="true"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total"
|
||||||
|
class="al-r"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@current-change="pageChange"
|
||||||
|
/>
|
||||||
|
<!-- modal - edit -->
|
||||||
|
<el-dialog
|
||||||
|
title="编辑游戏信息"
|
||||||
|
:visible.sync="modalVisible"
|
||||||
|
:before-close="closeModal"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="modalForm"
|
||||||
|
:model="modalForm"
|
||||||
|
:rules="modalRules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="平台"
|
||||||
|
prop="platform_id"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="modalForm.platform_id"
|
||||||
|
placeholder="请选择平台"
|
||||||
|
class="w100"
|
||||||
|
@change="changeOpt"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in platformList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.platform_name"
|
||||||
|
:value="item.platform_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="游戏"
|
||||||
|
prop="game_id"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="modalForm.game_id"
|
||||||
|
placeholder="请选择游戏"
|
||||||
|
class="w100"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in modalOpt.game"
|
||||||
|
:key="index"
|
||||||
|
:label="item.game_name"
|
||||||
|
:value="item.game_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="目标游戏"
|
||||||
|
prop="t_game_name"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.t_game_name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="目标AppID"
|
||||||
|
prop="t_appid"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.t_appid" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="特征码"
|
||||||
|
prop="ad_uid"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.ad_uid" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="推广链接"
|
||||||
|
prop="link"
|
||||||
|
>
|
||||||
|
<el-input v-model="modalForm.link" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer">
|
||||||
|
<el-button @click="closeModal">取 消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="saveEdit"
|
||||||
|
>确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getGameList,
|
||||||
|
getJumpList,
|
||||||
|
addJump,
|
||||||
|
updateJump,
|
||||||
|
delJump,
|
||||||
|
} from '@/api/game'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'adminAdJump',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// common
|
||||||
|
isLoaded: false,
|
||||||
|
isNew: false,
|
||||||
|
gameList: [],
|
||||||
|
allGame: [],
|
||||||
|
platformList: [],
|
||||||
|
// filter
|
||||||
|
filterForm: {
|
||||||
|
game_id: '',
|
||||||
|
platform_id: '',
|
||||||
|
},
|
||||||
|
|
||||||
|
// table
|
||||||
|
tableData: [],
|
||||||
|
showName: {
|
||||||
|
game: {},
|
||||||
|
platform: {},
|
||||||
|
},
|
||||||
|
// page
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
|
||||||
|
//modal
|
||||||
|
modalVisible: false,
|
||||||
|
modalForm: {},
|
||||||
|
defaultInfo: {
|
||||||
|
game_id: '',
|
||||||
|
t_game_name: '',
|
||||||
|
t_appid: '',
|
||||||
|
ad_uid: '',
|
||||||
|
link: '',
|
||||||
|
},
|
||||||
|
modalOpt: {
|
||||||
|
game: {},
|
||||||
|
platform: {},
|
||||||
|
},
|
||||||
|
modalRules: {
|
||||||
|
platform_id: [{required: true, message: '请选择平台', trigger: 'blur'}],
|
||||||
|
game_id: [{required: true, message: '请选择游戏', trigger: 'blur'}],
|
||||||
|
t_game_name: [
|
||||||
|
{required: true, message: '请填写跳转游戏的名称', trigger: 'blur'},
|
||||||
|
],
|
||||||
|
t_appid: [
|
||||||
|
{required: true, message: '请填写跳转游戏的AppID', trigger: 'blur'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
const allGame = await this.getGameList()
|
||||||
|
this.allGame = allGame.gameList
|
||||||
|
|
||||||
|
// 获取所有平台
|
||||||
|
this.platformList = this.allGame.map(item => {
|
||||||
|
this.showName.game[item.game_id] = item.game_name
|
||||||
|
return `${item.platform_id}-${item.platform_name}`
|
||||||
|
})
|
||||||
|
this.platformList = [...new Set(this.platformList)]
|
||||||
|
this.platformList = this.platformList.map(item => {
|
||||||
|
const platform = item.split('-')
|
||||||
|
this.showName.platform[platform[0]] = platform[1]
|
||||||
|
return {
|
||||||
|
platform_id: parseInt(platform[0]),
|
||||||
|
platform_name: platform[1],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// common
|
||||||
|
getGameList(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getGameList(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)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addJump(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
addJump(data)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateJump(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
updateJump(data)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delJump(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
delJump(data)
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err)
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetForm(formName) {
|
||||||
|
this.$refs[formName].resetFields()
|
||||||
|
},
|
||||||
|
clearValidate(formName) {
|
||||||
|
this.$refs[formName].clearValidate()
|
||||||
|
},
|
||||||
|
validate(formName) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$refs[formName].validate(valid => {
|
||||||
|
resolve(valid)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// filter
|
||||||
|
search() {
|
||||||
|
this.currentPage = 1
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
changePlatform() {
|
||||||
|
this.filterForm.game_id = ''
|
||||||
|
this.gameList = this.allGame.filter(item => {
|
||||||
|
return item.platform_id === this.filterForm.platform_id
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// toolbar
|
||||||
|
refreshData() {
|
||||||
|
this.currentPage = 1
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
addInfo() {
|
||||||
|
this.isNew = true
|
||||||
|
this.modalForm = JSON.parse(JSON.stringify(this.defaultInfo))
|
||||||
|
this.openModal()
|
||||||
|
},
|
||||||
|
// table
|
||||||
|
async getData() {
|
||||||
|
try {
|
||||||
|
this.isLoaded = true
|
||||||
|
const params = {}
|
||||||
|
console.log(this.filterForm)
|
||||||
|
if (this.filterForm.game_id) params.game_id = this.filterForm.game_id
|
||||||
|
if (this.filterForm.platform_id)
|
||||||
|
params.platform_id = this.filterForm.platform_id
|
||||||
|
|
||||||
|
params.currentPage = this.currentPage
|
||||||
|
params.pageSize = this.pageSize
|
||||||
|
const data = await this.getJumpList(params)
|
||||||
|
this.tableData = data.result
|
||||||
|
this.total = data.total
|
||||||
|
this.isLoaded = false
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rowClick(row, column, event) {
|
||||||
|
this.viewInfo(row)
|
||||||
|
},
|
||||||
|
editInfo(row) {
|
||||||
|
this.rowClick(row)
|
||||||
|
},
|
||||||
|
delInfo(row) {
|
||||||
|
const self = this
|
||||||
|
this.$confirm(`是否删除选中的游戏跳转信息`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await self.delJump({jump_id: row._id})
|
||||||
|
this.$message.success('删除成功!')
|
||||||
|
this.getData()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
this.$message.info('已取消删除!')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formGame(row, column, cellValue, index) {
|
||||||
|
return `${this.showName.game[cellValue]}`
|
||||||
|
},
|
||||||
|
formPlatform(row, column, cellValue, index) {
|
||||||
|
return `${this.showName.platform[cellValue]}`
|
||||||
|
},
|
||||||
|
// pagination
|
||||||
|
sizeChange(val) {
|
||||||
|
this.pageSize = val
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
pageChange(val) {
|
||||||
|
this.currentPage = val
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
// modal
|
||||||
|
closeModal() {
|
||||||
|
this.modalVisible = false
|
||||||
|
this.clearValidate('modalForm')
|
||||||
|
},
|
||||||
|
openModal() {
|
||||||
|
this.modalVisible = true
|
||||||
|
},
|
||||||
|
viewInfo(data) {
|
||||||
|
this.isNew = false
|
||||||
|
this.modalForm = JSON.parse(JSON.stringify(data))
|
||||||
|
this.openModal()
|
||||||
|
},
|
||||||
|
async saveEdit() {
|
||||||
|
try {
|
||||||
|
const valid = await this.validate('modalForm')
|
||||||
|
if (!valid) {
|
||||||
|
this.$message.error('请按要求填写表单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.isNew) {
|
||||||
|
// 新增
|
||||||
|
const result = await this.addJump(this.modalForm)
|
||||||
|
} else {
|
||||||
|
// 修改
|
||||||
|
const result = await this.updateJump(this.modalForm)
|
||||||
|
}
|
||||||
|
this.$message.success('更新成功!')
|
||||||
|
this.closeModal()
|
||||||
|
this.getData()
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeOpt() {
|
||||||
|
this.modalForm.game_id = ''
|
||||||
|
this.modalOpt.game = this.allGame.filter(item => {
|
||||||
|
return item.platform_id === this.modalForm.platform_id
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user