增加广告码显示比例
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------- //
|
// ---------------------------------------------- //
|
||||||
|
@ -210,26 +210,26 @@ export default {
|
|||||||
typeList: [
|
typeList: [
|
||||||
{
|
{
|
||||||
name: 'icon',
|
name: 'icon',
|
||||||
value: 1
|
value: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'banner',
|
name: 'banner',
|
||||||
value: 2
|
value: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '浮窗',
|
name: '浮窗',
|
||||||
value: 0
|
value: 0,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
modeList: [
|
modeList: [
|
||||||
{
|
{
|
||||||
name: '单播',
|
name: '单播',
|
||||||
value: 1
|
value: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '轮播',
|
name: '轮播',
|
||||||
value: 2
|
value: 2,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
perW: 0,
|
perW: 0,
|
||||||
perH: 0,
|
perH: 0,
|
||||||
@ -237,11 +237,11 @@ export default {
|
|||||||
adPos: {},
|
adPos: {},
|
||||||
adPosRules: {
|
adPosRules: {
|
||||||
area: [
|
area: [
|
||||||
{ required: true, message: '请选择广告投放区域', trigger: 'blur' }
|
{required: true, message: '请选择广告投放区域', trigger: 'blur'},
|
||||||
],
|
],
|
||||||
type: [{required: true, message: '请选择广告类型', trigger: 'blur'}],
|
type: [{required: true, message: '请选择广告类型', trigger: 'blur'}],
|
||||||
mode: [
|
mode: [
|
||||||
{ required: true, message: '请选择广告播放类型', trigger: 'blur' }
|
{required: true, message: '请选择广告播放类型', trigger: 'blur'},
|
||||||
],
|
],
|
||||||
coorX: [
|
coorX: [
|
||||||
{required: true, message: '请填写广告中心坐标 X', trigger: 'blur'},
|
{required: true, message: '请填写广告中心坐标 X', trigger: 'blur'},
|
||||||
@ -250,8 +250,8 @@ export default {
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 15,
|
max: 15,
|
||||||
message: '坐标取值 0~15',
|
message: '坐标取值 0~15',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
coorY: [
|
coorY: [
|
||||||
{required: true, message: '请填写广告中心坐标 Y', trigger: 'blur'},
|
{required: true, message: '请填写广告中心坐标 Y', trigger: 'blur'},
|
||||||
@ -260,24 +260,24 @@ export default {
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 15,
|
max: 15,
|
||||||
message: '坐标取值 0~15',
|
message: '坐标取值 0~15',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
offsetX: [
|
offsetX: [
|
||||||
{
|
{
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|
||||||
message: '偏移量必须是数值',
|
message: '偏移量必须是数值',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
offsetY: [
|
offsetY: [
|
||||||
{
|
{
|
||||||
type: 'number',
|
type: 'number',
|
||||||
message: '偏移量必须是数值',
|
message: '偏移量必须是数值',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
activeNames: [],
|
activeNames: [],
|
||||||
defaultPos: {
|
defaultPos: {
|
||||||
@ -287,18 +287,18 @@ export default {
|
|||||||
coorX: 0,
|
coorX: 0,
|
||||||
coorY: 0,
|
coorY: 0,
|
||||||
offsetX: 0,
|
offsetX: 0,
|
||||||
offsetY: 0
|
offsetY: 0,
|
||||||
},
|
},
|
||||||
allPos: [],
|
allPos: [],
|
||||||
posNumList: []
|
posNumList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Coordinate,
|
Coordinate,
|
||||||
Placeholder
|
Placeholder,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['userInfo'])
|
...mapGetters(['userInfo']),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.uid = this.$route.params.uid
|
this.uid = this.$route.params.uid
|
||||||
@ -344,7 +344,7 @@ export default {
|
|||||||
getAdPosList({
|
getAdPosList({
|
||||||
uid: this.uid,
|
uid: this.uid,
|
||||||
gameid: parseInt(this.gameInfo.game_id),
|
gameid: parseInt(this.gameInfo.game_id),
|
||||||
channelid: parseInt(this.platform_id)
|
channelid: parseInt(this.platform_id),
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@ -361,11 +361,13 @@ export default {
|
|||||||
coorX: parseInt(posArr[1]),
|
coorX: parseInt(posArr[1]),
|
||||||
coorY: parseInt(posArr[2]),
|
coorY: parseInt(posArr[2]),
|
||||||
offsetX: parseInt(posArr[3]) || 0,
|
offsetX: parseInt(posArr[3]) || 0,
|
||||||
offsetY: parseInt(posArr[4]) || 0
|
offsetY: parseInt(posArr[4]) || 0,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.posNumList = this.allPos.map(item => {
|
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
|
||||||
|
}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -401,11 +403,12 @@ export default {
|
|||||||
this.$confirm('是否要删除该广告位?', '提示', {
|
this.$confirm('是否要删除该广告位?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
delAdPos({
|
delAdPos({
|
||||||
id: this.allPos[index].id
|
uid: this.uid,
|
||||||
|
id: this.allPos[index].id,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@ -426,8 +429,12 @@ export default {
|
|||||||
const valid = await this.validForm(`adPos${index}`)
|
const valid = await this.validForm(`adPos${index}`)
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const posInfo = JSON.parse(JSON.stringify(this.allPos[index]))
|
const posInfo = JSON.parse(JSON.stringify(this.allPos[index]))
|
||||||
const adNum = `${posInfo.area}${posInfo.type}${posInfo.mode}${posInfo.coorX}${posInfo.coorY}`
|
const adNum = `${posInfo.area}${posInfo.type}${posInfo.mode}${
|
||||||
posInfo.area = `${posInfo.area},${posInfo.coorX},${posInfo.coorY},${posInfo.offsetX},${posInfo.offsetY}`
|
posInfo.coorX
|
||||||
|
}${posInfo.coorY}`
|
||||||
|
posInfo.area = `${posInfo.area},${posInfo.coorX},${posInfo.coorY},${
|
||||||
|
posInfo.offsetX
|
||||||
|
},${posInfo.offsetY}`
|
||||||
delete posInfo.coorX
|
delete posInfo.coorX
|
||||||
delete posInfo.coorY
|
delete posInfo.coorY
|
||||||
delete posInfo.offsetX
|
delete posInfo.offsetX
|
||||||
@ -444,7 +451,7 @@ export default {
|
|||||||
id: posInfo.id,
|
id: posInfo.id,
|
||||||
status: posInfo.status,
|
status: posInfo.status,
|
||||||
gameid: parseInt(this.gameInfo.game_id),
|
gameid: parseInt(this.gameInfo.game_id),
|
||||||
channelid: parseInt(this.platform_id)
|
channelid: parseInt(this.platform_id),
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@ -472,7 +479,7 @@ export default {
|
|||||||
type: posInfo.type,
|
type: posInfo.type,
|
||||||
mode: posInfo.mode,
|
mode: posInfo.mode,
|
||||||
gameid: parseInt(this.gameInfo.game_id),
|
gameid: parseInt(this.gameInfo.game_id),
|
||||||
channelid: parseInt(this.platform_id)
|
channelid: parseInt(this.platform_id),
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@ -497,8 +504,8 @@ export default {
|
|||||||
valid ? resolve(true) : reject()
|
valid ? resolve(true) : reject()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -14,6 +14,34 @@
|
|||||||
:value="item.platform.platform_id"
|
:value="item.platform.platform_id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</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
|
<el-collapse
|
||||||
v-model="activeNames"
|
v-model="activeNames"
|
||||||
v-if="allUid.length > 0"
|
v-if="allUid.length > 0"
|
||||||
@ -87,6 +115,16 @@
|
|||||||
style="width: 70%"
|
style="width: 70%"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</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-form-item v-if="platform_id">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -127,7 +165,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {getGame} from '@/api/games'
|
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 getPageTitle from '@/utils/get-page-title'
|
||||||
import Coordinate from '@/components/Coordinate'
|
import Coordinate from '@/components/Coordinate'
|
||||||
import Placeholder from '@/components/Placeholder'
|
import Placeholder from '@/components/Placeholder'
|
||||||
@ -147,6 +192,9 @@ export default {
|
|||||||
permPublish: false,
|
permPublish: false,
|
||||||
hasList: false,
|
hasList: false,
|
||||||
// form
|
// form
|
||||||
|
ratioForm: {
|
||||||
|
ratio: '',
|
||||||
|
},
|
||||||
adUid: {},
|
adUid: {},
|
||||||
adUidRules: {
|
adUidRules: {
|
||||||
game_name: [
|
game_name: [
|
||||||
@ -168,6 +216,7 @@ export default {
|
|||||||
channel_id: '',
|
channel_id: '',
|
||||||
path: '',
|
path: '',
|
||||||
appid: '',
|
appid: '',
|
||||||
|
ratio: '',
|
||||||
},
|
},
|
||||||
allUid: [],
|
allUid: [],
|
||||||
}
|
}
|
||||||
@ -212,6 +261,7 @@ export default {
|
|||||||
this.defaultUid.game_name = this.gameInfo.game_name
|
this.defaultUid.game_name = this.gameInfo.game_name
|
||||||
this.defaultUid.platform_id = this.platform_id
|
this.defaultUid.platform_id = this.platform_id
|
||||||
if (cb && cb instanceof Function) cb()
|
if (cb && cb instanceof Function) cb()
|
||||||
|
this.getUidRatio()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -234,6 +284,50 @@ export default {
|
|||||||
console.log(err)
|
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() {
|
changePlatform() {
|
||||||
this.getAdUidList()
|
this.getAdUidList()
|
||||||
},
|
},
|
||||||
@ -288,6 +382,7 @@ export default {
|
|||||||
channel_name: channelidInfo.channel_name,
|
channel_name: channelidInfo.channel_name,
|
||||||
channel_id: channelidInfo.channel_id,
|
channel_id: channelidInfo.channel_id,
|
||||||
appid: channelidInfo.appid,
|
appid: channelidInfo.appid,
|
||||||
|
ratio: parseFloat(channelidInfo.ratio),
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@ -302,9 +397,7 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// 新增
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
|
|
||||||
saveAdUid({
|
saveAdUid({
|
||||||
uid: this.uid,
|
uid: this.uid,
|
||||||
game_name: channelidInfo.game_name,
|
game_name: channelidInfo.game_name,
|
||||||
@ -314,6 +407,7 @@ export default {
|
|||||||
channel_name: channelidInfo.channel_name,
|
channel_name: channelidInfo.channel_name,
|
||||||
channel_id: channelidInfo.channel_id,
|
channel_id: channelidInfo.channel_id,
|
||||||
appid: channelidInfo.appid,
|
appid: channelidInfo.appid,
|
||||||
|
ratio: parseFloat(channelidInfo.ratio),
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
|
@ -56,6 +56,13 @@
|
|||||||
></el-image>
|
></el-image>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="type"
|
||||||
|
label="物品类型"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
:formatter="formType"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="codes"
|
prop="codes"
|
||||||
label="总量"
|
label="总量"
|
||||||
@ -157,6 +164,27 @@
|
|||||||
/>
|
/>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</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
|
<el-form-item
|
||||||
label="兑换券"
|
label="兑换券"
|
||||||
prop="codes"
|
prop="codes"
|
||||||
@ -237,6 +265,13 @@
|
|||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
sortable
|
sortable
|
||||||
/>
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="used"
|
||||||
|
label="已使用"
|
||||||
|
show-overflow-tooltip
|
||||||
|
sortable
|
||||||
|
:formatter="fromCodeUsed"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="createdAt"
|
prop="createdAt"
|
||||||
label="兑换时间"
|
label="兑换时间"
|
||||||
@ -292,6 +327,7 @@ export default {
|
|||||||
gift_name: '',
|
gift_name: '',
|
||||||
gift_url: '',
|
gift_url: '',
|
||||||
game_id: '',
|
game_id: '',
|
||||||
|
type: 0,
|
||||||
},
|
},
|
||||||
modalRules: {
|
modalRules: {
|
||||||
gift_id: [{required: true, message: '请填写物品 ID', trigger: 'blur'}],
|
gift_id: [{required: true, message: '请填写物品 ID', trigger: 'blur'}],
|
||||||
@ -394,6 +430,9 @@ export default {
|
|||||||
formUsed(row, column, cellValue, index) {
|
formUsed(row, column, cellValue, index) {
|
||||||
return cellValue.length || 0
|
return cellValue.length || 0
|
||||||
},
|
},
|
||||||
|
fromCodeUsed(row, column, cellValue, index) {
|
||||||
|
return cellValue ? '是' : '否'
|
||||||
|
},
|
||||||
delGift(row) {
|
delGift(row) {
|
||||||
this.$confirm(`是否要删除物品:${row.gift_name}?`, '提示', {
|
this.$confirm(`是否要删除物品:${row.gift_name}?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@ -413,6 +452,13 @@ export default {
|
|||||||
this.$message.info('已取消删除')
|
this.$message.info('已取消删除')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
formType(row, column, cellValue, index) {
|
||||||
|
const typeList = {
|
||||||
|
0: '其他',
|
||||||
|
1: '话费',
|
||||||
|
}
|
||||||
|
return typeList[cellValue]
|
||||||
|
},
|
||||||
// modal
|
// modal
|
||||||
openModal(isNew, data) {
|
openModal(isNew, data) {
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
@ -424,6 +470,7 @@ export default {
|
|||||||
gift_name: '',
|
gift_name: '',
|
||||||
gift_url: '',
|
gift_url: '',
|
||||||
game_id: this.gameInfo.game_id,
|
game_id: this.gameInfo.game_id,
|
||||||
|
type: 0,
|
||||||
}
|
}
|
||||||
this.codesStr = ''
|
this.codesStr = ''
|
||||||
this.usedCodesStr = ''
|
this.usedCodesStr = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user