增加广告码显示比例
This commit is contained in:
parent
d974f503e5
commit
b92685537b
@ -103,4 +103,20 @@ export function delAdUid(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getUidRatio(params) {
|
||||
return request({
|
||||
url: '/games/ad/uid-ratio',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function updateUidRatio(data) {
|
||||
return request({
|
||||
url: '/games/ad/uid-ratio',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------- //
|
||||
|
@ -184,14 +184,14 @@
|
||||
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getGame } from '@/api/games'
|
||||
import { getAdPosList, addAdPos, modifyAdPos, delAdPos } from '@/api/ad'
|
||||
import { getAdAreaList } from '@/api/ad'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {getGame} from '@/api/games'
|
||||
import {getAdPosList, addAdPos, modifyAdPos, delAdPos} from '@/api/ad'
|
||||
import {getAdAreaList} from '@/api/ad'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import Coordinate from '@/components/Coordinate'
|
||||
import Placeholder from '@/components/Placeholder'
|
||||
import { reject, Promise } from 'q'
|
||||
import {reject, Promise} from 'q'
|
||||
|
||||
export default {
|
||||
name: 'GameDetailsAdPos',
|
||||
@ -210,26 +210,26 @@ export default {
|
||||
typeList: [
|
||||
{
|
||||
name: 'icon',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'banner',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: '浮窗',
|
||||
value: 0
|
||||
}
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
modeList: [
|
||||
{
|
||||
name: '单播',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: '轮播',
|
||||
value: 2
|
||||
}
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
perW: 0,
|
||||
perH: 0,
|
||||
@ -237,47 +237,47 @@ export default {
|
||||
adPos: {},
|
||||
adPosRules: {
|
||||
area: [
|
||||
{ required: true, message: '请选择广告投放区域', trigger: 'blur' }
|
||||
{required: true, message: '请选择广告投放区域', trigger: 'blur'},
|
||||
],
|
||||
type: [{ required: true, message: '请选择广告类型', trigger: 'blur' }],
|
||||
type: [{required: true, message: '请选择广告类型', trigger: 'blur'}],
|
||||
mode: [
|
||||
{ required: true, message: '请选择广告播放类型', trigger: 'blur' }
|
||||
{required: true, message: '请选择广告播放类型', trigger: 'blur'},
|
||||
],
|
||||
coorX: [
|
||||
{ required: true, message: '请填写广告中心坐标 X', trigger: 'blur' },
|
||||
{required: true, message: '请填写广告中心坐标 X', trigger: 'blur'},
|
||||
{
|
||||
type: 'number',
|
||||
min: 0,
|
||||
max: 15,
|
||||
message: '坐标取值 0~15',
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
coorY: [
|
||||
{ required: true, message: '请填写广告中心坐标 Y', trigger: 'blur' },
|
||||
{required: true, message: '请填写广告中心坐标 Y', trigger: 'blur'},
|
||||
{
|
||||
type: 'number',
|
||||
min: 0,
|
||||
max: 15,
|
||||
message: '坐标取值 0~15',
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
offsetX: [
|
||||
{
|
||||
type: 'number',
|
||||
|
||||
message: '偏移量必须是数值',
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
offsetY: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '偏移量必须是数值',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
activeNames: [],
|
||||
defaultPos: {
|
||||
@ -287,18 +287,18 @@ export default {
|
||||
coorX: 0,
|
||||
coorY: 0,
|
||||
offsetX: 0,
|
||||
offsetY: 0
|
||||
offsetY: 0,
|
||||
},
|
||||
allPos: [],
|
||||
posNumList: []
|
||||
posNumList: [],
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Coordinate,
|
||||
Placeholder
|
||||
Placeholder,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
...mapGetters(['userInfo']),
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
@ -315,9 +315,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getGameInfo(cb) {
|
||||
getGame({ uid: this.uid })
|
||||
getGame({uid: this.uid})
|
||||
.then(res => {
|
||||
const { data } = res
|
||||
const {data} = res
|
||||
if (data.errcode === 0) {
|
||||
this.gameInfo = data.gameInfo
|
||||
this.platformsArr = data.gameInfo.platforms
|
||||
@ -344,7 +344,7 @@ export default {
|
||||
getAdPosList({
|
||||
uid: this.uid,
|
||||
gameid: parseInt(this.gameInfo.game_id),
|
||||
channelid: parseInt(this.platform_id)
|
||||
channelid: parseInt(this.platform_id),
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
@ -361,11 +361,13 @@ export default {
|
||||
coorX: parseInt(posArr[1]),
|
||||
coorY: parseInt(posArr[2]),
|
||||
offsetX: parseInt(posArr[3]) || 0,
|
||||
offsetY: parseInt(posArr[4]) || 0
|
||||
offsetY: parseInt(posArr[4]) || 0,
|
||||
}
|
||||
})
|
||||
this.posNumList = this.allPos.map(item => {
|
||||
return `${item.area}${item.type}${item.mode}${item.coorX}${item.coorY}`
|
||||
return `${item.area}${item.type}${item.mode}${item.coorX}${
|
||||
item.coorY
|
||||
}`
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -376,7 +378,7 @@ export default {
|
||||
getAdAreaList() {
|
||||
getAdAreaList()
|
||||
.then(res => {
|
||||
const { data } = res
|
||||
const {data} = res
|
||||
if (data.errcode === 0) {
|
||||
this.areaList = data.adAreaList.map(item => {
|
||||
item.area_id = item.area_id.toString()
|
||||
@ -401,11 +403,12 @@ export default {
|
||||
this.$confirm('是否要删除该广告位?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
delAdPos({
|
||||
id: this.allPos[index].id
|
||||
uid: this.uid,
|
||||
id: this.allPos[index].id,
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
@ -426,8 +429,12 @@ export default {
|
||||
const valid = await this.validForm(`adPos${index}`)
|
||||
if (valid) {
|
||||
const posInfo = JSON.parse(JSON.stringify(this.allPos[index]))
|
||||
const adNum = `${posInfo.area}${posInfo.type}${posInfo.mode}${posInfo.coorX}${posInfo.coorY}`
|
||||
posInfo.area = `${posInfo.area},${posInfo.coorX},${posInfo.coorY},${posInfo.offsetX},${posInfo.offsetY}`
|
||||
const adNum = `${posInfo.area}${posInfo.type}${posInfo.mode}${
|
||||
posInfo.coorX
|
||||
}${posInfo.coorY}`
|
||||
posInfo.area = `${posInfo.area},${posInfo.coorX},${posInfo.coorY},${
|
||||
posInfo.offsetX
|
||||
},${posInfo.offsetY}`
|
||||
delete posInfo.coorX
|
||||
delete posInfo.coorY
|
||||
delete posInfo.offsetX
|
||||
@ -444,7 +451,7 @@ export default {
|
||||
id: posInfo.id,
|
||||
status: posInfo.status,
|
||||
gameid: parseInt(this.gameInfo.game_id),
|
||||
channelid: parseInt(this.platform_id)
|
||||
channelid: parseInt(this.platform_id),
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
@ -472,7 +479,7 @@ export default {
|
||||
type: posInfo.type,
|
||||
mode: posInfo.mode,
|
||||
gameid: parseInt(this.gameInfo.game_id),
|
||||
channelid: parseInt(this.platform_id)
|
||||
channelid: parseInt(this.platform_id),
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
@ -497,8 +504,8 @@ export default {
|
||||
valid ? resolve(true) : reject()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -14,6 +14,34 @@
|
||||
:value="item.platform.platform_id"
|
||||
/>
|
||||
</el-select>
|
||||
<h3>显示比例</h3>
|
||||
<el-form
|
||||
ref="ratioForm"
|
||||
:model="ratioForm"
|
||||
style="width: 100%"
|
||||
label-width="100px"
|
||||
class="mgt-20 mgb-20"
|
||||
>
|
||||
<el-form-item
|
||||
label="显示比例"
|
||||
prop="ratio"
|
||||
>
|
||||
<el-input
|
||||
v-model="ratioForm.ratio"
|
||||
type="textarea"
|
||||
/>
|
||||
<span class="ipt-tip">格式: 渠道-比例,如: wx-80</span>
|
||||
<span class="ipt-tip">多条使用回车换行</span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
@click="updateUidRatio"
|
||||
type="primary"
|
||||
>保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<h3>配置</h3>
|
||||
<el-collapse
|
||||
v-model="activeNames"
|
||||
v-if="allUid.length > 0"
|
||||
@ -87,6 +115,16 @@
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="显示比例"
|
||||
prop="ratio"
|
||||
>
|
||||
<el-input
|
||||
v-model="item.ratio"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
<span class="ipt-tip">不填则为默认比例</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="platform_id">
|
||||
<el-button
|
||||
type="primary"
|
||||
@ -127,7 +165,14 @@
|
||||
<script>
|
||||
import {mapGetters} from 'vuex'
|
||||
import {getGame} from '@/api/games'
|
||||
import {getAdUidList, saveAdUid, editAdUid, delAdUid} from '@/api/ad'
|
||||
import {
|
||||
getAdUidList,
|
||||
saveAdUid,
|
||||
editAdUid,
|
||||
delAdUid,
|
||||
getUidRatio,
|
||||
updateUidRatio,
|
||||
} from '@/api/ad'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import Coordinate from '@/components/Coordinate'
|
||||
import Placeholder from '@/components/Placeholder'
|
||||
@ -147,6 +192,9 @@ export default {
|
||||
permPublish: false,
|
||||
hasList: false,
|
||||
// form
|
||||
ratioForm: {
|
||||
ratio: '',
|
||||
},
|
||||
adUid: {},
|
||||
adUidRules: {
|
||||
game_name: [
|
||||
@ -168,6 +216,7 @@ export default {
|
||||
channel_id: '',
|
||||
path: '',
|
||||
appid: '',
|
||||
ratio: '',
|
||||
},
|
||||
allUid: [],
|
||||
}
|
||||
@ -212,6 +261,7 @@ export default {
|
||||
this.defaultUid.game_name = this.gameInfo.game_name
|
||||
this.defaultUid.platform_id = this.platform_id
|
||||
if (cb && cb instanceof Function) cb()
|
||||
this.getUidRatio()
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@ -234,6 +284,50 @@ export default {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
getUidRatio() {
|
||||
getUidRatio({
|
||||
uid: this.uid,
|
||||
game_id: this.gameInfo.game_id,
|
||||
platform_id: this.platform_id,
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
console.log('rrrr', data)
|
||||
if (data.errcode === 0) {
|
||||
this.ratioForm.ratio = data.result
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
updateUidRatio() {
|
||||
this.$confirm('保存后会覆盖所有同渠道显示比例?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
updateUidRatio({
|
||||
uid: this.uid,
|
||||
game_id: this.gameInfo.game_id,
|
||||
platform_id: this.platform_id,
|
||||
ratio: this.ratioForm.ratio,
|
||||
}).then(res => {
|
||||
const data = res.data
|
||||
if (data.errcode === 0) {
|
||||
this.$message.success('保存成功!')
|
||||
this.getAdUidList()
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除',
|
||||
})
|
||||
})
|
||||
},
|
||||
changePlatform() {
|
||||
this.getAdUidList()
|
||||
},
|
||||
@ -288,6 +382,7 @@ export default {
|
||||
channel_name: channelidInfo.channel_name,
|
||||
channel_id: channelidInfo.channel_id,
|
||||
appid: channelidInfo.appid,
|
||||
ratio: parseFloat(channelidInfo.ratio),
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
@ -302,9 +397,7 @@ export default {
|
||||
})
|
||||
} else {
|
||||
// 新增
|
||||
|
||||
const self = this
|
||||
|
||||
saveAdUid({
|
||||
uid: this.uid,
|
||||
game_name: channelidInfo.game_name,
|
||||
@ -314,6 +407,7 @@ export default {
|
||||
channel_name: channelidInfo.channel_name,
|
||||
channel_id: channelidInfo.channel_id,
|
||||
appid: channelidInfo.appid,
|
||||
ratio: parseFloat(channelidInfo.ratio),
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
|
@ -56,6 +56,13 @@
|
||||
></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="type"
|
||||
label="物品类型"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="formType"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="codes"
|
||||
label="总量"
|
||||
@ -157,6 +164,27 @@
|
||||
/>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="物品类型"
|
||||
prop="type"
|
||||
>
|
||||
|
||||
<el-select
|
||||
v-model="modalForm.type"
|
||||
placeholder="请选择物品类型"
|
||||
class="w100 mgb-20"
|
||||
>
|
||||
<el-option
|
||||
label="其他"
|
||||
:value="0"
|
||||
/>
|
||||
<el-option
|
||||
label="话费"
|
||||
:value="1"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="兑换券"
|
||||
prop="codes"
|
||||
@ -237,6 +265,13 @@
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
/>
|
||||
<el-table-column
|
||||
prop="used"
|
||||
label="已使用"
|
||||
show-overflow-tooltip
|
||||
sortable
|
||||
:formatter="fromCodeUsed"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="createdAt"
|
||||
label="兑换时间"
|
||||
@ -292,6 +327,7 @@ export default {
|
||||
gift_name: '',
|
||||
gift_url: '',
|
||||
game_id: '',
|
||||
type: 0,
|
||||
},
|
||||
modalRules: {
|
||||
gift_id: [{required: true, message: '请填写物品 ID', trigger: 'blur'}],
|
||||
@ -394,6 +430,9 @@ export default {
|
||||
formUsed(row, column, cellValue, index) {
|
||||
return cellValue.length || 0
|
||||
},
|
||||
fromCodeUsed(row, column, cellValue, index) {
|
||||
return cellValue ? '是' : '否'
|
||||
},
|
||||
delGift(row) {
|
||||
this.$confirm(`是否要删除物品:${row.gift_name}?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@ -413,6 +452,13 @@ export default {
|
||||
this.$message.info('已取消删除')
|
||||
})
|
||||
},
|
||||
formType(row, column, cellValue, index) {
|
||||
const typeList = {
|
||||
0: '其他',
|
||||
1: '话费',
|
||||
}
|
||||
return typeList[cellValue]
|
||||
},
|
||||
// modal
|
||||
openModal(isNew, data) {
|
||||
if (isNew) {
|
||||
@ -424,6 +470,7 @@ export default {
|
||||
gift_name: '',
|
||||
gift_url: '',
|
||||
game_id: this.gameInfo.game_id,
|
||||
type: 0,
|
||||
}
|
||||
this.codesStr = ''
|
||||
this.usedCodesStr = ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user