Commit 8b1c2715 by crushh

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

parents f15a5ae0 41e94930
......@@ -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>
......@@ -35,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" />
......@@ -139,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;
......@@ -266,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 {
......
......@@ -270,9 +270,9 @@ export default {
adsFlag: 0,
rightBtn: {
5: 'background: #0CC6DA;box-shadow: inset 2px 1px 1px 0px rgba(255, 255, 255, 0.5);',
3: 'background: #27292B;opacity: 0.5;',
2: 'background: #27292B;opacity: 0.75;',
1: 'background: ##27292B;opacity: 0.5;'
3: 'background: rgba(39, 41, 43,0.5);',
2: 'background: rgba(39, 41, 43,0.75);',
1: 'background:rgba(39, 41, 43,0.5);'
},
textColor: {
1: 'color:#38BCCC',
......
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