diff --git a/src/views/games/details/adPos.vue b/src/views/games/details/adPos.vue index c0191ed..69991ee 100644 --- a/src/views/games/details/adPos.vue +++ b/src/views/games/details/adPos.vue @@ -31,7 +31,7 @@ icon-class="del" @click.stop="delPos(index)" /> - {{ `[${index+1}]广告位:${item.area}${item.type}${item.mode}${item.coorX}${item.coorY}`}} + {{ `[${index+1}]广告位:${item.ld_property.title}`}} + + + + 广告位中心点坐标x (取值:0~15) 广告位中心点坐标y (取值:0~15) @@ -120,7 +131,7 @@ prop="offsetX" > @@ -129,12 +140,87 @@ prop="offsetY" > - x: {{perW * item.coorX + item.offsetX}},y: {{perH * item.coorY + item.offsetY}} + x: {{perW * item.x + item.x_offset}},y: {{perH * item.y + item.y_offset}} + + + + + + + + + + + + + + + + + + + + + + 正常 + 退出时播放 + + { const data = res.data if (data.errcode === 0) { - this.allPos = data.message.map(item => { - const posArr = item.area.split(',') - return { - area: posArr[0], - channelid: item.channelid, - gameid: item.gameid, - id: item.id, - mode: item.mode, - type: item.type, - coorX: parseInt(posArr[1]), - coorY: parseInt(posArr[2]), - offsetX: parseInt(posArr[3]) || 0, - offsetY: parseInt(posArr[4]) || 0, - } - }) - this.posNumList = this.allPos.map(item => { - return `${item.area}${item.type}${item.mode}${item.coorX}${ - item.coorY - }` + this.allPos = data.message || [] + this.allPos.map(item => { + item.area = JSON.parse(item.area) + item.ld_property = item.ld_property + ? JSON.parse(item.ld_property) + : { + title: '', + show_name: '', + bg_img: '', + has_dot: false, + is_shake: false, + is_hide: true, + status: 0, + } }) + + // TODO: + // this.posNumList = this.allPos.map(item => { + // return `${item.area}${item.type}${item.mode}${item.coorX}${ + // item.coorY + // }` + // }) } }) .catch(err => { @@ -394,6 +522,12 @@ export default { changePlatform() { this.getAdPosList() }, + uploadSuccess(res, file, fileList, index) { + this.allPos[index].ld_property.bg_img = res.url + }, + uploadErr() { + this.$message.error('图片上传失败!') + }, addPos() { const defaultPos = JSON.parse(JSON.stringify(this.defaultPos)) this.activeNames.push(this.allPos.length) @@ -428,30 +562,25 @@ export default { async savePos(index) { const valid = await this.validForm(`adPos${index}`) if (valid) { + // TODO: form 每条广告格式 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}` - delete posInfo.coorX - delete posInfo.coorY - delete posInfo.offsetX - delete posInfo.offsetY if (this.allPos[index].id) { // 更新 const self = this modifyAdPos({ uid: this.uid, - area: posInfo.area, - type: posInfo.type, - mode: posInfo.mode, - id: posInfo.id, - status: posInfo.status, + area: JSON.stringify(posInfo.area), gameid: parseInt(this.gameInfo.game_id), channelid: parseInt(this.platform_id), + id: parseInt(posInfo.id), + ld_property: JSON.stringify(posInfo.ld_property), + mode: parseInt(posInfo.mode), + type: parseInt(posInfo.type), + x: parseInt(posInfo.x), + y: parseInt(posInfo.x), + x_offset: parseInt(posInfo.x_offset), + y_offset: parseInt(posInfo.y_offset), }) .then(res => { const data = res.data @@ -466,20 +595,26 @@ export default { }) } else { // 新增 - if (this.posNumList.includes(adNum)) { - this.$message.error('已存在相同广告位!') - return - } + // TODO: 判断是否重复 + // if (this.posNumList.includes(adNum)) { + // this.$message.error('已存在相同广告位!') + // return + // } const self = this addAdPos({ uid: this.uid, - area: posInfo.area, - type: posInfo.type, - mode: posInfo.mode, + area: JSON.stringify(posInfo.area), gameid: parseInt(this.gameInfo.game_id), channelid: parseInt(this.platform_id), + ld_property: JSON.stringify(posInfo.ld_property), + mode: parseInt(posInfo.mode), + type: parseInt(posInfo.type), + x: parseInt(posInfo.x), + y: parseInt(posInfo.x), + x_offset: parseInt(posInfo.x_offset), + y_offset: parseInt(posInfo.y_offset), }) .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 e9e77c8..8ec0023 100644 --- a/src/views/games/details/gift/store.vue +++ b/src/views/games/details/gift/store.vue @@ -185,6 +185,13 @@ + + + 如:1元话费券,则填写: 1 + { const {data} = res this.tableData = data.result + this.tableData.map(item => { + item.extraData = item.extraData || { + price: 0, + } + }) + console.log(this.tableData) this.isLoaded = false }) .catch(err => { @@ -471,6 +487,9 @@ export default { gift_url: '', game_id: this.gameInfo.game_id, type: 0, + extraData: { + price: 0, + }, } this.codesStr = '' this.usedCodesStr = ''