+bannerid
This commit is contained in:
parent
866bc5f3fe
commit
294a8d796f
@ -454,12 +454,18 @@ export default {
|
|||||||
title: '插屏广告开关',
|
title: '插屏广告开关',
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
value: 1
|
value: 1
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
key: 'video_count',
|
||||||
|
title: '每日视频广告限额',
|
||||||
|
type: 'num',
|
||||||
|
value: 10
|
||||||
|
},
|
||||||
]
|
]
|
||||||
this.showTip = true
|
this.showTip = true
|
||||||
this.settingsForm.settings = [...defaultSettings]
|
this.settingsForm.settings = [...defaultSettings]
|
||||||
this.selectedSettings = [...defaultSettings]
|
this.selectedSettings = [...defaultSettings]
|
||||||
this.settingKeys = ['openAD', 'blackTech', 'isTestMode', 'openAdBanner', 'openADInsert']
|
this.settingKeys = ['openAD', 'blackTech', 'isTestMode', 'openAdBanner', 'openADInsert', 'video_count']
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.published === false) {
|
if (data.published === false) {
|
||||||
|
@ -35,6 +35,32 @@
|
|||||||
:value="item.platform.platform_id"
|
:value="item.platform.platform_id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<h3>广告 ID 组</h3>
|
||||||
|
<el-form
|
||||||
|
ref="adIdForm"
|
||||||
|
:model="adIdForm"
|
||||||
|
:rules="adIdFormRules"
|
||||||
|
style="width: 100%"
|
||||||
|
label-width="140px"
|
||||||
|
class="mgt-20 mgb-20"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="默认Banner广告ID"
|
||||||
|
prop="ids"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
v-model="adIdForm.ids"
|
||||||
|
style="width: 70%;"
|
||||||
|
:rows="5"
|
||||||
|
placeholder="默认Banner广告ID"
|
||||||
|
/>
|
||||||
|
<span class="ipt-tip">多条广告 ID 则用回车分隔</span>
|
||||||
|
<span class="ipt-tip">配置 banner 时,若选择随机 ID,则从中抽取</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<h3>banner 配置</h3>
|
||||||
<el-collapse
|
<el-collapse
|
||||||
v-model="activeNames"
|
v-model="activeNames"
|
||||||
v-if="allBanner.length > 0"
|
v-if="allBanner.length > 0"
|
||||||
@ -57,7 +83,7 @@
|
|||||||
:model="item"
|
:model="item"
|
||||||
:rules="bannerFormRules"
|
:rules="bannerFormRules"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
label-width="120px"
|
label-width="140px"
|
||||||
class="mgt-20 mgb-20"
|
class="mgt-20 mgb-20"
|
||||||
>
|
>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -188,6 +214,7 @@ export default {
|
|||||||
permEdit: false,
|
permEdit: false,
|
||||||
permPublish: false,
|
permPublish: false,
|
||||||
hasList: false,
|
hasList: false,
|
||||||
|
hasIds: false,
|
||||||
areaList: {},
|
areaList: {},
|
||||||
// form
|
// form
|
||||||
bannerForm: {},
|
bannerForm: {},
|
||||||
@ -209,6 +236,12 @@ export default {
|
|||||||
{ required: true, message: '请填写刷新间隔时间', trigger: 'blur' }
|
{ required: true, message: '请填写刷新间隔时间', trigger: 'blur' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
adIdForm: {
|
||||||
|
ids: ''
|
||||||
|
},
|
||||||
|
adIdFormRules: {
|
||||||
|
ids: [{ required: true, message: '请填写广告 ID', trigger: 'blur' }]
|
||||||
|
},
|
||||||
activeNames: [],
|
activeNames: [],
|
||||||
defaultSetting: {
|
defaultSetting: {
|
||||||
id: '',
|
id: '',
|
||||||
@ -280,7 +313,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.cfgs = data.records
|
this.cfgs = data.records
|
||||||
this.hasList = false
|
this.hasList = false
|
||||||
|
this.hasIds = false
|
||||||
this.resolveBanner(this.cfgs)
|
this.resolveBanner(this.cfgs)
|
||||||
|
this.resolveAdId(this.cfgs)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAdAreaList() {
|
getAdAreaList() {
|
||||||
@ -312,6 +347,18 @@ export default {
|
|||||||
|
|
||||||
if (!this.hasList) this.allBanner = []
|
if (!this.hasList) this.allBanner = []
|
||||||
},
|
},
|
||||||
|
resolveAdId(settings) {
|
||||||
|
for (let i = 0; i < settings.length; i++) {
|
||||||
|
const setting = settings[i]
|
||||||
|
if (setting.key === 'wxBannerAdId') {
|
||||||
|
this.adIdForm.ids = setting.value.replace(/\|/g, '\n')
|
||||||
|
this.hasIds = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.hasIds) this.adIdForm.ids = ''
|
||||||
|
},
|
||||||
changePlatform() {
|
changePlatform() {
|
||||||
this.getGameSettings()
|
this.getGameSettings()
|
||||||
},
|
},
|
||||||
@ -363,6 +410,27 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateIds() {
|
||||||
|
let ids = this.adIdForm.ids.replace(/\n/g, '|')
|
||||||
|
while (ids.endsWith('|')) {
|
||||||
|
ids = ids.substr(0, ids.length - 1)
|
||||||
|
}
|
||||||
|
if (!this.hasIds) {
|
||||||
|
this.cfgs.push({
|
||||||
|
key: 'wxBannerAdId',
|
||||||
|
title: '默认Banner广告ID',
|
||||||
|
type: 'string',
|
||||||
|
value: ids
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.cfgs.length; i++) {
|
||||||
|
if (this.cfgs[i].key === 'wxBannerAdId') {
|
||||||
|
this.cfgs[i].value = ids
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
saveAllBanner() {
|
saveAllBanner() {
|
||||||
if (this.allBanner.length === 0) {
|
if (this.allBanner.length === 0) {
|
||||||
this.$confirm('当前无配置,是否清空?', '提示', {
|
this.$confirm('当前无配置,是否清空?', '提示', {
|
||||||
@ -372,6 +440,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.updateBannerList()
|
this.updateBannerList()
|
||||||
|
this.updateIds()
|
||||||
this.saveSettings()
|
this.saveSettings()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@ -384,9 +453,11 @@ export default {
|
|||||||
for (let i = 0; i < this.allBanner.length; i++) {
|
for (let i = 0; i < this.allBanner.length; i++) {
|
||||||
validArr.push(this.validForm(`bannerForm${i}`))
|
validArr.push(this.validForm(`bannerForm${i}`))
|
||||||
}
|
}
|
||||||
|
validArr.push(this.validForm(`adIdForm`, true))
|
||||||
Promise.all(validArr)
|
Promise.all(validArr)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.updateBannerList()
|
this.updateBannerList()
|
||||||
|
this.updateIds()
|
||||||
this.saveSettings()
|
this.saveSettings()
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -394,11 +465,17 @@ export default {
|
|||||||
this.$message.error('请按要求填写表单')
|
this.$message.error('请按要求填写表单')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
validForm(formName) {
|
validForm(formName, isSingle) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.$refs[formName][0].validate(valid => {
|
if (isSingle) {
|
||||||
valid ? resolve() : reject()
|
this.$refs[formName].validate(valid => {
|
||||||
})
|
valid ? resolve() : reject()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$refs[formName][0].validate(valid => {
|
||||||
|
valid ? resolve() : reject()
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveSettings() {
|
saveSettings() {
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="resetForm.reset_time"
|
v-model="resetForm.reset_time"
|
||||||
placeholder="重置时间"
|
placeholder="重置时间"
|
||||||
|
style="width: 70%"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user