From b92685537b8371edf55cda5d37b936e596810a85 Mon Sep 17 00:00:00 2001 From: yulixing Date: Fri, 6 Sep 2019 18:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B9=BF=E5=91=8A=E7=A0=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ad.js | 16 ++++ src/views/games/details/adPos.vue | 95 ++++++++++++----------- src/views/games/details/adUid.vue | 100 ++++++++++++++++++++++++- src/views/games/details/gift/store.vue | 47 ++++++++++++ 4 files changed, 211 insertions(+), 47 deletions(-) diff --git a/src/api/ad.js b/src/api/ad.js index 1ba3a45..688d7e6 100644 --- a/src/api/ad.js +++ b/src/api/ad.js @@ -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, + }) +} + // ---------------------------------------------- // diff --git a/src/views/games/details/adPos.vue b/src/views/games/details/adPos.vue index c99147b..c0191ed 100644 --- a/src/views/games/details/adPos.vue +++ b/src/views/games/details/adPos.vue @@ -184,14 +184,14 @@ diff --git a/src/views/games/details/adUid.vue b/src/views/games/details/adUid.vue index c177152..abf8e27 100644 --- a/src/views/games/details/adUid.vue +++ b/src/views/games/details/adUid.vue @@ -14,6 +14,34 @@ :value="item.platform.platform_id" /> +

显示比例

+ + + + 格式: 渠道-比例,如: wx-80 + 多条使用回车换行 + + + 保存 + + + +

配置

+ + + 不填则为默认比例 + 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 diff --git a/src/views/games/details/gift/store.vue b/src/views/games/details/gift/store.vue index 621ada9..e9e77c8 100644 --- a/src/views/games/details/gift/store.vue +++ b/src/views/games/details/gift/store.vue @@ -56,6 +56,13 @@ > + + + + + + + + + +