Commit 014c6795 by crushh

update: dist

parent f931c36b
......@@ -183,3 +183,6 @@ export const cardView = params => requests(PREFIX + '/game-pro/card-view', param
// 停止游戏-拆盲盒
export const stopGame = params => requests(PREFIX + '/game-pro/stop-game', params, true, false, 'get');
// 转换成页面链接
export const getPageLink = params => requests('api-admin/get-page-link', params, true, false, 'get');
......@@ -106,6 +106,7 @@
<script>
import config from '@/config';
import { getPageLink } from '@/service/api/gameApi.js';
import dmUploadAvatar from '@/components/upload/avatar';
import dmUploadImg from '@/components/upload/img';
import Linktools from '@/components/linktools-fulls/index.vue';
......@@ -204,8 +205,8 @@ export default {
watch: {
templateArr(val) {
this.templateData = val;
const data = val[0];
if (this.isAdd) {
const data = val[0];
this.baseForm.templateId = data.templateId;
this.handleTemplateArr(data.gameTemplateMaterialList);
this.$emit('change', this.baseForm);
......@@ -215,14 +216,21 @@ export default {
console.log(val);
let { gameExt } = val;
this.baseForm = Object.assign(this.baseForm, val);
this.handleTemplateArr(Object.values(gameExt), true);
this.adsImageUrl = { imgUrl: this.baseForm.adsImageUrl, code: this.baseForm.adsImageUrl };
if (this.baseForm.adsFlag) {
this.adsImageUrl = { imgUrl: gameExt.adsImageUrl.materialValue, code: gameExt.adsImageUrl.materialValue };
}
const currentTemp = this.templateData.filter(item => item.templateId == this.baseForm.templateId)[0];
let obj = {};
currentTemp.gameTemplateMaterialList.forEach(item => {
if (item.materialKey == 'backMusicUrl') {
this.backMusicOptions.push(item);
}
if (item.materialKey != 'backMusicUrl' && item.materialValue) {
obj[item.materialKey] = item;
}
});
obj = Object.assign(obj, gameExt); // 详情的素材库与模板接口的默认有值的素材库取交集
this.handleTemplateArr(Object.values(obj), 'echo');
this.selectLink.linkData = this.baseForm.mpUrlView ? JSON.parse(this.baseForm.mpUrlView) : {};
if (this.isCopy) {
this.baseForm.gameTime = [];
......@@ -240,7 +248,7 @@ export default {
const data = this.templateArr.filter(item => item.templateId == val)[0].gameTemplateMaterialList;
this.customMusicOptions = [];
this.backMusicOptions = [];
this.handleTemplateArr(data);
this.handleTemplateArr(data, 'tempChange');
this.$emit('change', this.baseForm);
},
beforeAvatarUpload(file, key, size1 = 1) {
......@@ -284,7 +292,8 @@ export default {
});
return true;
},
handleTemplateArr(data, echo) {
handleTemplateArr(data, type) {
console.log(data);
this.gameExt = data;
const materialKeys = ['mpUrlView', 'adsLinkUrl', 'adsImageUrl'];
data.forEach(item => {
......@@ -297,12 +306,17 @@ export default {
this.prizeStyleJson = JSON.parse(item.materialValue);
this.baseForm['prizeStyleJson'] = JSON.parse(item.materialValue);
} else {
if (!materialKeys.includes(item.materialKey)) {
if (type == 'tempChange') {
if (!materialKeys.includes(item.materialKey)) {
this.baseForm[item.materialKey] = item.materialValue;
}
} else {
this.baseForm[item.materialKey] = item.materialValue;
}
}
if (item.materialKey == 'backMusicUrl') {
if (echo) {
if (type == 'echo') {
if (item.customFlag == 1) {
this.customMusicOptions.push(item);
this.baseForm.backMusicUrlObj = item;
......@@ -357,10 +371,13 @@ export default {
},
// 保存链接小工具返回的链接数据
onSaveLink(linkData) {
this.selectLink.linkData = linkData;
this.baseForm.mpUrlView = JSON.stringify(linkData);
this.baseForm.adsLinkUrl = linkData.url;
this.$refs.baseForm.validateField('link');
getPageLink({ requestProject: 'gic-web', pageLink: linkData }).then(res => {
const { link } = res.result;
this.selectLink.linkData = linkData;
this.baseForm.mpUrlView = JSON.stringify(linkData);
this.baseForm.adsLinkUrl = link;
this.$refs.baseForm.validateField('link');
});
},
handleNameChange(val) {
this.$emit('change', this.baseForm);
......@@ -370,18 +387,26 @@ export default {
this.$refs.baseForm.validate(val => {
if (val) {
const data = { ...this.baseForm };
let gameExt = [...this.gameExt];
let obj = {};
let gameExt = {};
this.gameExt.forEach(item => {
gameExt[item.materialKey] = item;
});
console.log(gameExt);
Object.keys(data).forEach(key => {
let val = gameExt.filter(item => item.materialKey == key)[0];
if (val) {
val.materialValue = data[key];
obj[key] = val;
if (gameExt[key]) {
gameExt[key].materialValue = data[key];
}
});
obj.backMusicUrl = data.backMusicUrlObj;
data.gameExt = obj;
data.gameExt.prizeStyleJson.materialValue = JSON.stringify(data.gameExt.prizeStyleJson.materialValue);
gameExt.backMusicUrl = data.backMusicUrlObj;
gameExt.prizeStyleJson.materialValue = JSON.stringify(gameExt.prizeStyleJson.materialValue);
if (!data.adsFlag) {
delete gameExt.adsImageUrl;
delete gameExt.adsLinkUrl;
delete gameExt.mpUrlView;
}
data.gameExt = gameExt;
resolve(true);
this.$emit('nextStep', data, noNext);
} else {
......@@ -401,7 +426,6 @@ img {
}
.lottery {
width: 600px;
height: 250px;
background: #ffffff;
border: 1px solid #dcdfe6;
padding: 14px 20px;
......
<template>
<div>
<div v-loading="loading">
<div class="navtop">
<div class="gameName">
<img src="../../../assets/img/幸运盲盒.png" alt="" />
......@@ -21,7 +21,7 @@
<div class="iphone" v-if="menuActive == 0">
<span class="gameTitle">{{ gameName }}</span>
<img src="../../../assets/img/Navbar.png" alt="" />
<gameTemplate :bgImg="bgImg" :tipsImg="tipsImg" :boxImg="boxImg" :adImg="adImg" />
<gameTemplate :bgImg="bgImg" :tipsImg="tipsImg" :boxImg="boxImg" :adImg="adImg" :ruleData="ruleData" :templateId="templateId" />
</div>
<div class="iphone" v-else>
<img :src="computedImg" />
......@@ -36,7 +36,7 @@
<div class="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" :gameTime="gameTime" :shareImgData="shareImgData" :echoData="ruleForm" v-show="active == 2" @nextStep="nextStep" @prevStep="step => active--" @submit="submitForm" :btnLoading="btnLoading" />
<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" />
</div>
</div>
<info :data="echoData" :invalidCard="invalidCard" v-if="isInfo" />
......@@ -89,7 +89,9 @@ export default {
invalidCard: {},
gameTime: [],
echoData: {},
shareImgData: {}
shareImgData: {},
loading: false,
ruleData: {}
};
},
computed: {
......@@ -128,73 +130,81 @@ export default {
},
methods: {
getGameDetail(id) {
getGameDetail({ gameId: id }).then(async res => {
const { result } = res;
if (this.isInfo) {
const templateData = this.templateData.filter(item => item.templateId == result.templateId)[0];
this.echoData = JSON.parse(JSON.stringify(result));
this.echoData.templateName = templateData.templateName;
}
let {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
gamePrizeList, //游戏奖品信息
gameExt,
prizeNoticeStock,
prizeNoticeFlag,
adsFlag,
bulletFlag,
backMusicFlag,
templateId,
gameRule,
startDate,
endDate,
gameName,
memberWeightView,
creatorId,
gameId,
status
} = result;
if (this.isEdit) {
this.gameId = gameId;
this.gameStatus = status;
}
const { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc } = gameRuleInfo;
if (playConditionFlag == 1) {
gameRuleConditionList.forEach(item => {
item.conditionJson = JSON.parse(item.conditionJson);
});
}
let cardIdArr = [];
gamePrizeList.forEach(item => {
if (item.prizeType == 2) {
cardIdArr.push(item.prizeRelationId);
this.loading = true;
getGameDetail({ gameId: id })
.then(async res => {
const { result } = res;
if (this.isInfo) {
const templateData = this.templateData.filter(item => item.templateId == result.templateId)[0];
this.echoData = JSON.parse(JSON.stringify(result));
this.echoData.templateName = templateData.templateName;
}
let {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
gamePrizeList, //游戏奖品信息
gameExt,
prizeNoticeStock,
prizeNoticeFlag,
adsFlag,
bulletFlag,
backMusicFlag,
templateId,
gameRule,
startDate,
endDate,
gameName,
memberWeightView,
creatorId,
gameId,
status
} = result;
if (this.isEdit) {
item.isOld = 1;
this.gameId = gameId;
this.gameStatus = status;
}
});
if (cardIdArr.length) {
const { result } = await cardView({ ids: cardIdArr.join(',') });
this.invalidCard = result; // 1删除 2失效
}
if (this.isCopy) {
let invalidCard = [];
const { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc } = gameRuleInfo;
if (playConditionFlag == 1) {
gameRuleConditionList.forEach(item => {
if (item.conditionType == 0) {
this.ruleData = { val: item.value, type: 0 };
}
item.conditionJson = JSON.parse(item.conditionJson);
});
}
let cardIdArr = [];
gamePrizeList.forEach(item => {
if (item.prizeType == 2 && this.invalidCard[item.prizeRelationId].invalid != 0) {
invalidCard.push(item.prizeRelationId);
if (item.prizeType == 2) {
cardIdArr.push(item.prizeRelationId);
}
if (this.isEdit) {
item.isOld = 1;
}
});
if (invalidCard.length) {
gamePrizeList = gamePrizeList.filter(item => item.prizeType != 2 || !invalidCard.includes(item.prizeRelationId));
this.$message.info('已过滤被删除奖项');
if (cardIdArr.length) {
const { result } = await cardView({ ids: cardIdArr.join(',') });
this.invalidCard = result; // 1删除 2失效
}
}
this.baseForm = { adsFlag, backMusicFlag, bulletFlag, templateId, gameTime: [startDate, endDate], gameName, gameRule, gameExt };
this.prizeForm = { winChance, prizeNoticeStock, gamePrizeList, prizeNoticeFlag };
this.ruleForm = { ruleId, filterJson, gameRuleConditionList, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView };
});
if (this.isCopy) {
let invalidCard = [];
gamePrizeList.forEach(item => {
if (item.prizeType == 2 && this.invalidCard[item.prizeRelationId].invalid != 0) {
invalidCard.push(item.prizeRelationId);
}
});
if (invalidCard.length) {
gamePrizeList = gamePrizeList.filter(item => item.prizeType != 2 || !invalidCard.includes(item.prizeRelationId));
this.$message.info('已过滤被删除奖项');
}
}
this.baseForm = { adsFlag, backMusicFlag, bulletFlag, templateId, gameTime: [startDate, endDate], gameName, gameRule, gameExt };
this.prizeForm = { winChance, prizeNoticeStock, gamePrizeList, prizeNoticeFlag };
this.ruleForm = { ruleId, filterJson, gameRuleConditionList, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView };
})
.finally(() => {
this.loading = false;
});
},
handleBaseConfigChange(data) {
console.log('handleBaseConfigChange----->');
......@@ -217,6 +227,9 @@ export default {
this.gameTime = gameTime;
},
handleRuleConfigChange(data) {
this.ruleData = data;
},
returnNext() {
this.$confirm('退出后,当前编辑没有保存的数据会丢失,确认要退出吗?', {
type: 'warning'
......@@ -236,14 +249,6 @@ export default {
this.$route.meta.refresh = false;
const { templateId } = res.result[0];
this.templateId = templateId;
// res.result[0].gameTemplateMaterialList.forEach(item => {
// if (item.materialKey == 'shareCard') {
// this.shareCard = item.materialValue;
// }
// if (item.materialKey == 'shareReport') {
// this.shareReport = item.materialValue;
// }
// });
} else {
const { id } = this.$route.params;
this.getGameDetail(id);
......@@ -349,7 +354,9 @@ export default {
this.$route.meta.refresh = true;
}
})
.finally((this.btnLoading = false));
.finally(_ => {
this.btnLoading = false;
});
});
},
validator() {
......
......@@ -5,24 +5,7 @@
<div class="right-btn rule">游戏规则</div>
<div class="right-btn award">我的奖品</div>
<div class="music-icon iconfont" :class="isPlay ? 'icon-yinfu' : 'icon-xingzhuangjiehe2x'"></div>
<div class="integral">100积分/次</div>
<!-- <swiper
class="swiper-class"
ref="mySwiper"
:options="swiperOptions"
:autoplay="swiperOptions.autoplay"
>
<swiper-slide v-for="item in list" :key="item">
<div class="swiper-item">
<img
src="https://pic01-10001430.cos.ap-shanghai.myqcloud.com/game/template1/tips_bg.png"
/>
<span>{{ item }}</span>
</div>
</swiper-slide>
</swiper> -->
<div class="integral" v-if="ruleData.type == 0">{{ ruleData.val }}积分/次</div>
<div class="box-box">
<img v-for="item in boxList" :key="item" :src="boxImg" :style="{ left: item.left, top: item.top }" @click="showOpenBoxDialog = true" />
......@@ -57,50 +40,76 @@
<script>
import img from '../../../components/upload/img.vue';
const box6 = [
{
left: '24%',
top: '202px'
},
{
left: '50%',
top: '266px'
},
{
left: '77%',
top: '202px'
},
{
left: '24%',
top: '338px'
},
{
left: '50%',
top: '393px'
},
{
left: '77%',
top: '338px'
}
];
const box9 = [
{
left: '51%',
top: '214px'
},
{
left: '33%',
top: '262px'
},
{
left: '66%',
top: '258px'
},
{
left: '16%',
top: '307px'
},
{
left: '52%',
top: '306px'
},
{
left: '84%',
top: '307px'
},
{
left: '35%',
top: '351px'
},
{
left: '68%',
top: '355px'
},
{
left: '53%',
top: '400px'
}
];
export default {
components: { img },
data() {
return {
list: ['刷卡拉拉卡', '阿拉卡萨卢克和史莱克', '刷卡拉拉卡', '阿拉卡萨卢克和史莱克'],
boxList: [
{
left: '51%',
top: '214px'
},
{
left: '33%',
top: '262px'
},
{
left: '66%',
top: '258px'
},
{
left: '16%',
top: '307px'
},
{
left: '52%',
top: '306px'
},
{
left: '84%',
top: '307px'
},
{
left: '35%',
top: '351px'
},
{
left: '68%',
top: '355px'
},
{
left: '53%',
top: '400px'
}
],
boxList: box9,
isPlay: true,
name: '猜盲盒'
};
......@@ -121,10 +130,25 @@ export default {
adImg: {
type: String,
default: ''
}
},
ruleData: {
type: Object,
default: () => {}
},
templateId: String
},
created() {
document.title = '猜盲盒';
},
watch: {
templateId(val) {
if (val == 1 || val == 2) {
this.boxList = box9;
}
if (val == 3) {
this.boxList = box6;
}
}
}
};
</script>
......@@ -258,7 +282,7 @@ img {
}
.box-box {
height: 531px;
height: 501px;
width: 100%;
position: relative;
}
......
......@@ -120,7 +120,7 @@
</div>
</div>
</div>
<p>总赠送: {{ item.conditionJson.value }}次游戏次数</p>
<p>{{ item.conditionJson.type == 21 ? '总赠送' : '每日赠送' }}: {{ item.conditionJson.value }}次游戏次数</p>
</div>
<div v-if="item.conditionType == 0" class="shareSection">
<div class="subTitle">
......
......@@ -46,10 +46,10 @@
</el-form-item>
</div>
<div v-if="index == 1">
<div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="0" :false-label="-1" /> <span class="ml10">消耗积分获得游戏次数</span></div>
<div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="0" :false-label="-1" @change="$emit('change', { val: item.conditionJson.value, type: item.conditionType })" /> <span class="ml10">消耗积分获得游戏次数</span></div>
<div v-show="item.conditionType == 0">
<el-form-item label="参与游戏每次消耗积分" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'value'">
<el-input placeholder="请输入积分" v-model="item.conditionJson.value" class="w140" />
<el-input placeholder="请输入积分" v-model="item.conditionJson.value" @change="$emit('change', { val: item.conditionJson.value, type: item.conditionType })" class="w140" />
<span class="ml10">积分 </span>
</el-form-item>
<el-form-item label="提示客户积分获取路径" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'mpUrlView'" :rules="rules.mpUrlView">
......@@ -71,7 +71,10 @@
<el-radio :label="12">首次关注服务号</el-radio>
</el-radio-group>
</el-form-item>
<div v-show="item.conditionJson.type == 11">
<div v-show="item.conditionJson.type == 12">
<el-form-item label="关注回复" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'subscribeMsg'" label-width="80px" :rules="rules.subscribeMsg"> <el-input maxlength="20" show-word-limit v-model="item.conditionJson.subscribeMsg" /> </el-form-item>
</div>
<div>
<div class="subTitle">
<div class="line"></div>
<div class="text">
......@@ -102,9 +105,6 @@
<div class="tips">图片建议尺寸{{ shareReportSize0 }},格式 jpg/png/gif,大小 {{ shareReportSize1 }} M以内。</div>
</el-form-item>
</div>
<div v-show="item.conditionJson.type == 12">
<el-form-item label="关注回复" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'subscribeMsg'" label-width="80px" :rules="rules.subscribeMsg"> <el-input maxlength="20" show-word-limit v-model="item.conditionJson.subscribeMsg" /> </el-form-item>
</div>
</div>
</div>
</div>
......@@ -115,7 +115,7 @@
<el-switch v-model="ruleForm.shareFlag" :active-value="1" :inactive-value="0" />
<div class="tips">关闭后用户无法分享小程序</div>
</el-form-item>
<linktools :linkVisible.sync="show" :linkData="ruleForm.gameRuleConditionList[1].conditionJson.mpUrlView" :can-save="true" :showType="0" @linkSelect="onSaveLink" />
<linktools :linkVisible.sync="show" :remove="[5, 35]" :linkData="ruleForm.gameRuleConditionList[1].conditionJson.mpUrlView" :can-save="true" @linkSelect="onSaveLink" />
<dm-form-bottom class="footer">
<el-button @click="prevStep">上一步</el-button>
<el-button type="primary" @click="submit" :loading="btnLoading">发布并预览</el-button>
......@@ -124,6 +124,7 @@
</template>
<script>
import { getPageLink } from '@/service/api/gameApi.js';
import Linktools from '@/components/linktools-fulls/index.vue';
import gicNewMemberGroup from '@/components/dm-new-member-group/index.vue';
export default {
......@@ -239,7 +240,7 @@ export default {
default: () => {}
},
gameStatus: 0,
btnLoading: false,
btnLoading: Boolean,
echoData: {
type: Object,
default: () => {}
......@@ -247,7 +248,8 @@ export default {
gameTime: {
type: Object,
default: () => []
}
},
templateId: String
},
watch: {
shareImgData(val) {
......@@ -334,14 +336,18 @@ export default {
this.ruleForm.hasSearchData = val;
},
downloadTmp() {
// window.location = downloadOImportSmsTemp;
let id = this.templateId == 3 ? 1 : this.templateId;
window.open(`https://pic01-10001430.cos.ap-shanghai.myqcloud.com/game/template${id}/海报.ai`);
},
// 保存链接小工具返回的链接数据
onSaveLink(linkData) {
this.selectLink.linkData = linkData;
this.ruleForm.gameRuleConditionList[1].conditionJson.dumpPath = linkData.url;
this.ruleForm.gameRuleConditionList[1].conditionJson.mpUrlView = linkData;
this.ruleForm.gameRuleConditionList = this.ruleForm.gameRuleConditionList.splice(0);
getPageLink({ requestProject: 'gic-web', pageLink: linkData }).then(res => {
const { link } = res.result;
this.selectLink.linkData = linkData;
this.ruleForm.gameRuleConditionList[1].conditionJson.dumpPath = link;
this.ruleForm.gameRuleConditionList[1].conditionJson.mpUrlView = linkData;
this.ruleForm.gameRuleConditionList = this.ruleForm.gameRuleConditionList.splice(0);
});
},
beforeAvatarUpload(file, key, size1 = 1) {
const arr = ['image/gif', 'image/jpeg', 'image/png'];
......
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