Commit 4b3bb30c by crushh

Merge branch 'feature/游戏营销' into master

parents ea035487 b19ac04e
......@@ -9,7 +9,7 @@
<dm-sub-title type="line">展示信息配置</dm-sub-title>
<div class="mt20" style="margin-bottom: 32px">
<el-form-item label="游戏模板" prop="templateId">
<el-radio-group @change="handleTemplateChange" v-model="baseForm.templateId" :disabled="isDisabled">
<el-radio-group @change="handleTemplateChange" v-model="baseForm.templateId" :disabled="isDisabled" class="radioGroup">
<el-radio v-for="item in templateData" :label="item.templateId" :key="item.templateId">{{ item.templateName }}</el-radio>
</el-radio-group>
</el-form-item>
......@@ -171,7 +171,8 @@ export default {
linkData: {}
},
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy'
isCopy: this.$route.meta.type === 'copy',
isEdit: this.$route.meta.type === 'edit'
};
},
props: {
......@@ -211,9 +212,9 @@ export default {
},
watch: {
templateArr(val) {
this.templateData = val;
if (this.isAdd) {
const data = val[0];
if (this.isAdd || this.isCopy) {
this.templateData = val.filter(item => item.statusFlag == 1);
const data = this.templateData[0];
this.baseForm.templateId = data.templateId;
this.handleTemplateArr(data.gameTemplateMaterialList);
this.$emit('change', this.baseForm);
......@@ -221,25 +222,43 @@ export default {
},
echoData(val) {
let { gameExt } = val;
let initTemp = false;
this.baseForm = Object.assign(this.baseForm, val);
if (this.baseForm.adsFlag) {
this.adsImageUrl = { imgUrl: gameExt.adsImageUrl && gameExt.adsImageUrl.materialValue, code: gameExt.adsImageUrl && gameExt.adsImageUrl.materialValue };
}
const currentTemp = this.templateData.filter(item => item.templateId == this.baseForm.templateId)[0];
let currentTemp = this.templateArr.filter(item => item.templateId == this.baseForm.templateId)[0];
if (this.isEdit) {
this.templateData = this.templateArr.filter(item => item.statusFlag == 1 || item.templateId == this.baseForm.templateId);
}
if (this.isCopy && currentTemp.statusFlag == 0) {
currentTemp = this.templateArr.filter(item => item.statusFlag == 1)[0];
this.baseForm.templateId = currentTemp.templateId;
initTemp = true;
this.$message.info('原游戏模板已失效,已重置默认模板');
}
let obj = {};
// let arr = ['backMusicUrl'];
let arr = ['noticeImageUrl', 'shareCard', 'shareReport', 'prizeStyleJson', 'backImageUrl'];
let keys = Object.keys(gameExt);
console.log(keys);
currentTemp.gameTemplateMaterialList.forEach(item => {
if (item.materialKey == 'backMusicUrl') {
this.backMusicOptions.push(item);
} else if (!keys.includes(item.materialKey)) {
obj[item.materialKey] = item;
}
// if (!arr.includes(item.materialKey) && !keys.includes(item.materialKey)) {
// obj[item.materialKey] = item;
// }
});
if (initTemp) {
let currentTempObj = {};
currentTemp.gameTemplateMaterialList.forEach(item => {
currentTempObj[item.materialKey] = item;
});
keys.forEach(key => {
if (arr.includes(key)) {
gameExt[key] = currentTempObj[key];
}
});
}
obj = Object.assign(obj, gameExt); // 详情的素材库与模板接口的默认有值的素材库取交集
this.handleTemplateArr(Object.values(obj), 'echo');
this.selectLink.linkData = this.baseForm.mpUrlView ? JSON.parse(this.baseForm.mpUrlView) : {};
......@@ -251,18 +270,19 @@ export default {
},
methods: {
handleDateChange(val, type) {
console.log(val, type);
this.$emit('change', this.baseForm);
if (type == 'adsFlag') {
this.$nextTick(_ => {
const adsImg = document.getElementsByClassName('adsImg');
adsImg[0].scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: 'center',
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: 'smooth'
});
const formContent = document.getElementById('formContent');
formContent.scrollTop = formContent.scrollHeight + 500;
// adsImg[0].scrollIntoView({
// // 滚动到指定节点
// // 值有start,center,end,nearest,当前显示在视图区域中间
// block: 'center',
// // 值有auto、instant,smooth,缓动动画(当前是慢速的)
// behavior: 'smooth'
// });
});
} else if (type == 'gameTime' && this.baseForm.gameTime && this.baseForm.gameTime.length) {
this.baseForm.gameTime[1] = this.baseForm.gameTime[1] + 86399000;
......@@ -352,7 +372,6 @@ export default {
}
}
});
console.log(this.baseForm);
},
handleListen() {
this.isPlay = !this.isPlay;
......@@ -428,7 +447,6 @@ export default {
this.gameExt.forEach(item => {
gameExt[item.materialKey] = item;
});
console.log(gameExt);
Object.keys(data).forEach(key => {
if (gameExt[key]) {
gameExt[key].materialValue = data[key];
......@@ -555,4 +573,9 @@ img {
.footer {
width: calc(100% - 520px) !important;
}
.radioGroup {
.el-radio + .el-radio {
margin-left: 0;
}
}
</style>
......@@ -18,11 +18,15 @@
{{ el }}
</el-menu-item>
</el-menu>
<div class="iphone">
<span class="gameTitle">{{ gameName }}</span>
<img src="../../../assets/img/Navbar.png" class="braImg" alt="" />
<gameTemplate :ruleData="ruleData" :templateId="templateId" :basicData="previewData" v-show="menuActive == 0" />
<img :src="computedImg" v-show="menuActive != 0" style="min-height:724px;margin-top: 70px;" />
<div style="margin: 0 20px 0 13px;">
<div class="nav">
<span class="gameTitle">{{ gameName }}</span>
<img src="../../../assets/img/Navbar.png" class="braImg" alt="" />
</div>
<div class="iphone">
<gameTemplate :ruleData="ruleData" :templateId="templateId" :basicData="previewData" v-show="menuActive == 0" />
<img :src="computedImg" v-show="menuActive != 0" style="min-height:724px; " />
</div>
</div>
</div>
<div class="rightForm" v-show="!isInfo">
......@@ -31,7 +35,7 @@
<dm-step title="2.奖项配置"></dm-step>
<dm-step title="3.规则配置"></dm-step>
</dm-steps>
<div class="formContent">
<div class="formContent" id="formContent">
<baseConfig ref="baseConfig" :gameStatus="gameStatus" :templateArr="templateData" :echoData="baseForm" v-show="active == 0" @change="handleBaseConfigChange" @nextStep="nextStep" />
<prizeConfig ref="prizeConfig" :gameStatus="gameStatus" :invalidCard="invalidCard" :prizeMax="prizeMax" :echoData="prizeForm" :prizeMin="prizeMin" v-show="active == 1" @nextStep="nextStep" @prevStep="step => active--" />
<ruleConfig ref="ruleConfig" :gameStatus="gameStatus" :templateId="templateId" :gameTime="gameTime" :shareImgData="shareImgData" :echoData="ruleForm" v-show="active == 2" @nextStep="nextStep" @prevStep="step => active--" @submit="submitForm" :btnLoading="btnLoading" @change="handleRuleConfigChange" />
......@@ -105,6 +109,9 @@ export default {
},
computed: {
computedImg() {
if (!['1', '2', '3', '5'].includes(this.templateId)) {
return '';
}
const bcImg = {
1: require(`@/assets/img/template${this.templateId}/mould_rule_page.png`),
2: require(`@/assets/img/template${this.templateId}/mould_prize_page.png`),
......@@ -132,7 +139,6 @@ export default {
watch: {
templateId(val) {
const data = this.templateData.filter(item => item.templateId == val)[0];
console.log(data);
const { prizeMax, prizeMin } = data;
this.prizeMax = prizeMax;
this.prizeMin = prizeMin;
......@@ -259,7 +265,7 @@ export default {
this.templateData = res.result;
if (this.isAdd) {
this.$route.meta.refresh = false;
const { templateId } = res.result[0];
const { templateId } = this.templateData.filter(item => item.statusFlag == 1)[0];
this.templateId = templateId;
this.loading = false;
} else {
......@@ -487,13 +493,19 @@ export default {
}
}
}
.nav {
height: 83px;
img {
width: 375px;
border-radius: 8px 8px 0px 0px;
}
}
.iphone {
width: 375px;
border-radius: 8px 8px 0px 0px;
margin: 0 20px 0 13px;
position: relative;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
img {
width: 375px;
}
......@@ -504,7 +516,7 @@ export default {
color: #000000;
font-weight: 600;
z-index: 101;
top: 56px;
top: 82px;
width: 100%;
height: 20px;
display: flex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment