Commit 21f34e5b by crushh

update: dist

parent 46121356
<template> <template>
<div> <div>
<dm-layout :projectName="projectName" v-if="$store.getters.getShowLayout"> <dm-layout :projectName="projectName">
<keep-alive> <keep-alive>
<router-view v-if="$route.meta.keepAlive" /> <router-view v-if="$route.meta.keepAlive" />
</keep-alive> </keep-alive>
<router-view v-if="!this.$route.meta.keepAlive" /> <router-view v-if="!this.$route.meta.keepAlive" />
</dm-layout> </dm-layout>
<div v-else>
<keep-alive>
<router-view v-if="$route.meta.keepAlive" />
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive" />
</div>
</div> </div>
</template> </template>
<script> <script>
......
import Vue from 'vue'; import Vue from 'vue';
import Router from 'vue-router'; import Router from 'vue-router';
import routes from './routes'; import routes from './routes';
import store from '@/store';
// import axios from 'axios';
// import axios from 'axios';
console.log(routes);
Vue.use(Router); Vue.use(Router);
let router = new Router({ let router = new Router({
...@@ -29,9 +29,7 @@ router.beforeEach((to, from, next) => { ...@@ -29,9 +29,7 @@ router.beforeEach((to, from, next) => {
Object.keys(to.params).map(key => { Object.keys(to.params).map(key => {
path = path.replace(to.params[key], `:${key}`); path = path.replace(to.params[key], `:${key}`);
}); });
if (to.meta.hiddenLayout) {
store.dispatch('setShowLayout', false);
}
// axios // axios
// .get(`/api-plug/rate-limit?requestPath=${path}&enterpriseId=${store.state.marketing.enterpriseId}`) // .get(`/api-plug/rate-limit?requestPath=${path}&enterpriseId=${store.state.marketing.enterpriseId}`)
// .then(limitRes => { // .then(limitRes => {
......
...@@ -230,42 +230,6 @@ export default { ...@@ -230,42 +230,6 @@ export default {
} }
}, },
{ {
path: 'cmh/add',
name: '新建拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'add',
path: '/game/cmh',
hiddenLayout: true
}
},
{
path: 'cmh/edit/:id',
name: '编辑拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'edit',
hiddenLayout: true
}
},
{
path: 'cmh/info/:id',
name: '查看拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/info.vue'),
meta: {
type: 'info'
}
},
{
path: 'cmh/copy/:id',
name: '复制拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'copy',
hiddenLayout: true
}
},
{
path: 'cmh/statistics/:id', path: 'cmh/statistics/:id',
name: '拆盲盒数据统计', name: '拆盲盒数据统计',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'), component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
...@@ -291,3 +255,41 @@ export default { ...@@ -291,3 +255,41 @@ export default {
} }
] ]
}; };
export const cmhDetail = [
{
path: '/game/cmh/add',
name: '新建拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'add',
path: '/game/cmh',
hiddenLayout: true
}
},
{
path: '/game/cmh/edit/:id',
name: '编辑拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'edit',
hiddenLayout: true
}
},
{
path: '/game/cmh/info/:id',
name: '查看拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/info.vue'),
meta: {
type: 'info'
}
},
{
path: '/game/cmh/copy/:id',
name: '复制拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'copy',
hiddenLayout: true
}
}
];
...@@ -9,7 +9,7 @@ import activityCenter from '@/views/activityCenter'; ...@@ -9,7 +9,7 @@ import activityCenter from '@/views/activityCenter';
//微信营销 //微信营销
import wechat from './modules/wechat'; import wechat from './modules/wechat';
//游戏营销 //游戏营销
import game from './modules/game'; import game, { cmhDetail } from './modules/game';
//短信营销 //短信营销
import message from './modules/message'; import message from './modules/message';
//卡券营销 //卡券营销
...@@ -66,6 +66,7 @@ export default [ ...@@ -66,6 +66,7 @@ export default [
ai ai
] ]
}, },
...cmhDetail,
{ {
path: '/401', path: '/401',
name: '未授权', name: '未授权',
......
...@@ -175,5 +175,11 @@ export const getGameTemplateByType = params => requests(PREFIX + '/game-pro/get- ...@@ -175,5 +175,11 @@ export const getGameTemplateByType = params => requests(PREFIX + '/game-pro/get-
// 生成小程序游戏链接 // 生成小程序游戏链接
export const generateMiniProgramLink = params => requests('api-admin/get-page-link-game', params); export const generateMiniProgramLink = params => requests('api-admin/get-page-link-game', params);
// 生成小程序游戏链接-拆盲盒
export const getQrGame = params => requests(PREFIX + '/game-pro/get-qr-game', params, true, false, 'get');
//卡券回显 key 卡券ID ; value 卡券状态 0正常 1删除 2失效 //卡券回显 key 卡券ID ; value 卡券状态 0正常 1删除 2失效
export const cardView = params => requests(PREFIX + '/game-pro/card-view', params, true); export const cardView = params => requests(PREFIX + '/game-pro/card-view', params, true);
// 停止游戏-拆盲盒
export const stopGame = params => requests(PREFIX + '/game-pro/stop-game', params, true, false, 'get');
...@@ -59,9 +59,6 @@ const actions = { ...@@ -59,9 +59,6 @@ const actions = {
async getIsShowSelfData(state) { async getIsShowSelfData(state) {
let res = await getIsShowSelf(); let res = await getIsShowSelf();
this.commit('mutations_auth', res.result); this.commit('mutations_auth', res.result);
},
setShowLayout({ commit }, item) {
commit('mutations_Layout', item);
} }
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<dm-sub-title type="line">基本信息</dm-sub-title> <dm-sub-title type="line">基本信息</dm-sub-title>
<div class="mt20"> <div class="mt20">
<el-form-item label="游戏名称" prop="gameName"> <el-input maxlength="10" class="w382" @change="handleNameChange" v-model.trim="baseForm.gameName" show-word-limit :disabled="isDisabled" placeholder="请输入游戏名称" /> </el-form-item> <el-form-item label="游戏名称" prop="gameName"> <el-input maxlength="10" class="w382" @change="handleNameChange" v-model.trim="baseForm.gameName" show-word-limit :disabled="isDisabled" placeholder="请输入游戏名称" /> </el-form-item>
<el-form-item label="游戏时间" prop="gameTime"><el-date-picker class="w382" v-model="baseForm.gameTime" :disabled="isDisabled" :picker-options="pickerOptions" value-format="timestamp" @change="refresh" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker></el-form-item> <el-form-item label="游戏时间" prop="gameTime"><el-date-picker class="w382" v-model="baseForm.gameTime" :disabled="isDisabled" :picker-options="pickerOptions" value-format="timestamp" @change="handleDateChange" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker></el-form-item>
<el-form-item label="游戏说明" prop="gameRule"> <el-input maxlength="500" class="w382" v-model.trim="baseForm.gameRule" show-word-limit :autosize="{ minRows: 4 }" type="textarea" /> </el-form-item> <el-form-item label="游戏说明" prop="gameRule"> <el-input maxlength="500" class="w382" v-model.trim="baseForm.gameRule" show-word-limit :autosize="{ minRows: 4 }" type="textarea" /> </el-form-item>
</div> </div>
<dm-sub-title type="line">展示信息配置</dm-sub-title> <dm-sub-title type="line">展示信息配置</dm-sub-title>
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
baseForm: { baseForm: {
gameName: '', gameName: '',
gameTime: [], gameTime: [],
gameRule: '1、幸运盲盒大抽奖,惊喜好礼抽不停。</br>2、活动最终解释权归品牌方所有。', gameRule: '1、幸运盲盒大抽奖,惊喜好礼抽不停。2、活动最终解释权归品牌方所有。',
templateId: '', templateId: '',
backMusicFlag: 1, backMusicFlag: 1,
adsFlag: 1, adsFlag: 1,
...@@ -230,6 +230,10 @@ export default { ...@@ -230,6 +230,10 @@ export default {
} }
}, },
methods: { methods: {
handleDateChange(val) {
console.log(val);
this.$emit('change', this.baseForm);
},
handleTemplateChange(val) { handleTemplateChange(val) {
this.baseForm.templateId = val; this.baseForm.templateId = val;
const data = this.templateArr.filter(item => item.templateId == val)[0].gameTemplateMaterialList; const data = this.templateArr.filter(item => item.templateId == val)[0].gameTemplateMaterialList;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</div> </div>
<div class="rightBtn"> <div class="rightBtn">
<el-button @click="returnNext">退出</el-button> <el-button @click="returnNext">退出</el-button>
<el-button type="primary">发布并预览</el-button> <!-- <el-button type="primary">发布并预览</el-button> -->
</div> </div>
</div> </div>
<div class="content"> <div class="content">
...@@ -35,10 +35,14 @@ ...@@ -35,10 +35,14 @@
<div class="formContent"> <div class="formContent">
<baseConfig :gameStatus="gameStatus" :templateArr="templateData" :echoData="baseForm" v-show="active == 0" @change="handleBaseConfigChange" @nextStep="data => nextStep(1, data)" /> <baseConfig :gameStatus="gameStatus" :templateArr="templateData" :echoData="baseForm" v-show="active == 0" @change="handleBaseConfigChange" @nextStep="data => nextStep(1, data)" />
<prizeConfig :gameStatus="gameStatus" :invalidCard="invalidCard" :prizeMax="prizeMax" :echoData="prizeForm" :prizeMin="prizeMin" v-show="active == 1" @nextStep="data => nextStep(2, data)" @prevStep="step => (active = step)" /> <prizeConfig :gameStatus="gameStatus" :invalidCard="invalidCard" :prizeMax="prizeMax" :echoData="prizeForm" :prizeMin="prizeMin" v-show="active == 1" @nextStep="data => nextStep(2, data)" @prevStep="step => (active = step)" />
<ruleConfig :gameStatus="gameStatus" :shareCard="shareCard" :shareReport="shareReport" :echoData="ruleForm" v-show="active == 2" @nextStep="data => submit(3, data)" @prevStep="step => (active = step)" :btnLoading="btnLoading" /> <ruleConfig :gameStatus="gameStatus" :gameTime="gameTime" :shareCard="shareCard" :shareReport="shareReport" :echoData="ruleForm" v-show="active == 2" @nextStep="data => submit(3, data)" @prevStep="step => (active = step)" :btnLoading="btnLoading" />
</div> </div>
</div> </div>
</div> </div>
<links :show.sync="linkShow" :obj="linksObj" gameTypeName="幸运盲盒" :isNew="true" :showFooter="true">
<el-button @click="editRenew">重新编辑</el-button>
<el-button type="primary" @click="$router.push('/game/cmh')">进入游戏列表</el-button>
</links>
</div> </div>
</template> </template>
...@@ -50,9 +54,13 @@ import prizeConfig from './prize-config.vue'; ...@@ -50,9 +54,13 @@ import prizeConfig from './prize-config.vue';
import ruleConfig from './rule-config.vue'; import ruleConfig from './rule-config.vue';
import { getGameTemplateByType, initActivity, getGameDetail, cardView } from '@/service/api/gameApi.js'; import { getGameTemplateByType, initActivity, getGameDetail, cardView } from '@/service/api/gameApi.js';
import gameTemplate from './gameTemplate'; import gameTemplate from './gameTemplate';
import links from '../common/links';
export default { export default {
data() { data() {
return { return {
linkShow: false,
linksObj: {},
active: 0, active: 0,
menuActive: 0, menuActive: 0,
templateData: [], templateData: [],
...@@ -75,7 +83,8 @@ export default { ...@@ -75,7 +83,8 @@ export default {
ruleForm: {}, ruleForm: {},
gameId: '', gameId: '',
gameStatus: 0, gameStatus: 0,
invalidCard: {} invalidCard: {},
gameTime: []
}; };
}, },
computed: { computed: {
...@@ -96,14 +105,13 @@ export default { ...@@ -96,14 +105,13 @@ export default {
baseConfig, baseConfig,
gameTemplate, gameTemplate,
prizeConfig, prizeConfig,
ruleConfig ruleConfig,
links
}, },
mounted() { mounted() {
this.getGameTemplateByType(); this.getGameTemplateByType();
}, },
destroyed() {
this.$store.dispatch('setShowLayout', true);
},
watch: { watch: {
templateId(val) { templateId(val) {
const data = this.templateData.filter(item => item.templateId == val)[0]; const data = this.templateData.filter(item => item.templateId == val)[0];
...@@ -168,7 +176,7 @@ export default { ...@@ -168,7 +176,7 @@ export default {
handleBaseConfigChange(data) { handleBaseConfigChange(data) {
console.log('handleBaseConfigChange----->'); console.log('handleBaseConfigChange----->');
console.log(data); console.log(data);
const { backImageUrl, noticeImageUrl, adsImageUrl, gameName, templateId, shareCard, shareReport } = data; const { backImageUrl, noticeImageUrl, adsImageUrl, gameName, templateId, shareCard, shareReport, gameTime } = data;
this.bgImg = backImageUrl; this.bgImg = backImageUrl;
this.tipsImg = noticeImageUrl; this.tipsImg = noticeImageUrl;
this.boxImg = data.prizeStyleJson[0].imageNoSelectUrl; this.boxImg = data.prizeStyleJson[0].imageNoSelectUrl;
...@@ -177,10 +185,16 @@ export default { ...@@ -177,10 +185,16 @@ export default {
this.templateId = templateId; this.templateId = templateId;
this.shareCard = shareCard; this.shareCard = shareCard;
this.shareReport = shareReport; this.shareReport = shareReport;
this.gameTime = gameTime;
}, },
returnNext() { returnNext() {
this.$store.dispatch('setShowLayout', true); this.$confirm('退出后,当前编辑没有保存的数据会丢失,确认要退出吗?', {
this.$router.go(-1); type: 'warning'
})
.then(() => {
this.$router.push('/game/cmh');
})
.catch(() => {});
}, },
handleMenuSelect(index) { handleMenuSelect(index) {
this.menuActive = index; this.menuActive = index;
...@@ -246,36 +260,51 @@ export default { ...@@ -246,36 +260,51 @@ export default {
} }
}); });
} }
let submitData = { this.$confirm('确认发布游戏?', {
gameRuleInfo, // 游戏规则信息 type: 'warning'
gameRuleConditionList, // 游戏规则-参与门槛 }).then(() => {
gamePrizeList, //游戏奖品信息 let submitData = {
gameExt, gameRuleInfo, // 游戏规则信息
templateType: 1, // 1盲盒 gameRuleConditionList, // 游戏规则-参与门槛
prizeNoticeStock, gamePrizeList, //游戏奖品信息
prizeNoticeFlag, gameExt,
adsFlag, templateType: 1, // 1盲盒
bulletFlag, prizeNoticeStock,
backMusicFlag, prizeNoticeFlag,
templateId, adsFlag,
gameRule, bulletFlag,
startDate: gameTime[0], backMusicFlag,
endDate: gameTime[1], templateId,
gameName gameRule,
}; startDate: gameTime[0],
if (this.isEdit) { endDate: gameTime[1],
submitData.gameId = this.gameId; gameName
} };
this.btnLoading = true; if (this.isEdit) {
initActivity(submitData) submitData.gameId = this.gameId;
.then(res => { }
if (res) { this.btnLoading = true;
this.$message.success('保存成功'); initActivity(submitData)
this.$route.meta.refresh = true; .then(res => {
this.$router.go(-1); if (res) {
} const { result } = res;
}) this.$message.success('发布成功');
.finally((this.btnLoading = false)); this.getLink(result);
this.$route.meta.refresh = true;
}
})
.finally((this.btnLoading = false));
});
},
getLink(row) {
const { startDate, gameId, gameName } = row;
this.gameId = gameId;
this.linksObj = { gameName, gameId, gameStartTime: startDate };
this.linkShow = true;
},
editRenew() {
window.location.href = window.location.origin + `/marketing/#/game/cmh/edit/${this.gameId}`;
// this.$router.push(`/game/cmh/edit/${this.gameId}`);
} }
} }
}; };
......
...@@ -344,8 +344,6 @@ img { ...@@ -344,8 +344,6 @@ img {
width: 48px; width: 48px;
height: 16px; height: 16px;
} }
.game-name-box {
}
.ad-image { .ad-image {
margin: 39px 15px 15px; margin: 39px 15px 15px;
......
...@@ -80,24 +80,26 @@ ...@@ -80,24 +80,26 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<dm-pagination v-show="tableList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.pageNum" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination> <dm-pagination v-show="tableList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.pageNum" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination>
<links :show.sync="linkShow" :obj="linksObj" :gameTypeName="gameTypeName"></links> <links :show.sync="linkShow" :obj="linksObj" gameTypeName="幸运盲盒" :isNew="true"></links>
</section> </section>
</template> </template>
<script> <script>
import { api as viewerApi } from 'v-viewer'; import { api as viewerApi } from 'v-viewer';
import { cmhPage } from '@/service/api/gameApi.js'; import { cmhPage, stopGame } from '@/service/api/gameApi.js';
import linksMixin from '../common/linksMixin.js'; import links from '../common/links';
import { formatDateTimeByType } from '@/utils/index.js'; import { formatDateTimeByType } from '@/utils/index.js';
import dmDropdown from '@/components/dm-drop-down/dm-drop-down'; import dmDropdown from '@/components/dm-drop-down/dm-drop-down';
export default { export default {
mixins: [linksMixin],
components: { components: {
dmDropdown dmDropdown,
links
}, },
data() { data() {
return { return {
formatDateTimeByType, formatDateTimeByType,
linkShow: false,
linksObj: {},
listParams: { listParams: {
gameName: '', gameName: '',
status: '', status: '',
...@@ -107,6 +109,7 @@ export default { ...@@ -107,6 +109,7 @@ export default {
pageSize: 20 pageSize: 20
}, },
total: 0, total: 0,
gameId: '',
tableList: [], tableList: [],
gameStatusOptions: [ gameStatusOptions: [
{ {
...@@ -175,12 +178,12 @@ export default { ...@@ -175,12 +178,12 @@ export default {
{ {
text: '链接', text: '链接',
props: { props: {
limitCode: this.$buttonCode.marketingCmhUrl limitCode: this.$buttonCode.marketingCmhLink
}, },
visible: row => { visible: row => {
return (row.status === 1 || row.status === 0) && this.$getButtonLimit(this.$buttonCode.marketingCmhUrl); return (row.status === 1 || row.status === 0) && this.$getButtonLimit(this.$buttonCode.marketingCmhLink);
}, },
handler: row => this.setLinks(row, 6) handler: row => this.getLink(row)
}, },
{ {
text: '终止', text: '终止',
...@@ -190,7 +193,7 @@ export default { ...@@ -190,7 +193,7 @@ export default {
visible: row => { visible: row => {
return row.status === 1 && this.$getButtonLimit(this.$buttonCode.marketingCmhStop); return row.status === 1 && this.$getButtonLimit(this.$buttonCode.marketingCmhStop);
}, },
handler: row => this.stopPlan(row) handler: row => this.stopGame(row)
}, },
{ {
text: '数据', text: '数据',
...@@ -209,6 +212,27 @@ export default { ...@@ -209,6 +212,27 @@ export default {
this.getTableList(); this.getTableList();
}, },
methods: { methods: {
getLink(row) {
const { startDate, gameId, gameName } = row;
this.linksObj = { gameName, gameId, gameStartTime: startDate };
this.linkShow = true;
},
stopGame(row) {
const { gameId } = row;
this.$confirm('终止后游戏结束,用户无法继续参与。是否确认终止?', '终止提示', {
confirmButtonText: '终止',
cancelBUttonText: '取消',
type: 'warning'
})
.then(() => {
stopGame({ gameId }).then(res => {
console.log(res);
this.$message.success('终止成功');
this.getTableList();
});
})
.catch(() => {});
},
refresh() { refresh() {
this.listParams.pageNum = 1; this.listParams.pageNum = 1;
this.getTableList(); this.getTableList();
......
<template>
<div>
<keep-alive>
<router-view v-if="$route.meta.keepAlive" />
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive" />
</div>
</template>
<script>
export default {};
</script>
<style></style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div v-show="ruleForm.memberType == 0"> <div v-show="ruleForm.memberType == 0">
<vue-gic-people v-bind="storeParams" projectName="marketing" :triggerReset="true" :isAdd="isAdd" :hasSearchData="ruleForm.hasSearchData" :useId="ruleForm.memberWeightView.searchId" sceneValue="member" ref="peopleFilter" @findFilter="findFilter" @getBackData="getBackData" @editShow="toggleTag = true" @editHide="toggleTag = false" @hideBtn="toggleTag = false" /> <vue-gic-people v-bind="storeParams" projectName="marketing" :triggerReset="true" :isAdd="isAdd" :hasSearchData="ruleForm.hasSearchData" :useId="ruleForm.memberWeightView.searchId" sceneValue="member" ref="peopleFilter" @findFilter="findFilter" @getBackData="getBackData" @editShow="toggleTag = true" @editHide="toggleTag = false" @hideBtn="toggleTag = false" />
<div class="gic-people--button" v-show="toggleTag"> <div class="gic-people--button" v-show="toggleTag">
<el-button size="small" type="primary" @click="getData">确 定</el-button> <el-button size="small" type="primary" @click="getData" :disabled="isDisabled">确 定</el-button>
<el-button size="small" @click="cancelFilter">取 消</el-button> <el-button size="small" @click="cancelFilter">取 消</el-button>
</div> </div>
</div> </div>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<el-form-item> <el-form-item>
<div class="shareBox" v-show="ruleForm.playConditionFlag == 1"> <div class="shareBox" v-show="ruleForm.playConditionFlag == 1">
<div v-for="(item, index) in ruleForm.gameRuleConditionList" :key="item.conditionType"> <div v-for="(item, index) in ruleForm.gameRuleConditionList" :key="item.conditionType">
<div v-show="index == 0"> <div v-if="index == 0">
<div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="2" :false-label="-1" :disabled="isDisabled" /> <span class="ml10">赠与免费游戏次数</span></div> <div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="2" :false-label="-1" :disabled="isDisabled" /> <span class="ml10">赠与免费游戏次数</span></div>
<el-form-item :prop="'gameRuleConditionList.' + index + '.' + 'value'" v-show="item.conditionType == 2"> <el-form-item :prop="'gameRuleConditionList.' + index + '.' + 'value'" v-show="item.conditionType == 2">
<el-select class="w140" v-model="item.conditionJson.type" :disabled="isDisabled"> <el-select class="w140" v-model="item.conditionJson.type" :disabled="isDisabled">
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<span class="ml10">次游戏次数</span> <span class="ml10">次游戏次数</span>
</el-form-item> </el-form-item>
</div> </div>
<div v-show="index == 1"> <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" /> <span class="ml10">消耗积分获得游戏次数</span></div>
<div v-show="item.conditionType == 0"> <div v-show="item.conditionType == 0">
<el-form-item label="参与游戏每次消耗积分" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'value'"> <el-form-item label="参与游戏每次消耗积分" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'value'">
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<div v-show="index == 2"> <div v-if="index == 2">
<div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="1" :false-label="-1" /><span class="ml10"> 邀请好友助力获得游戏次数</span></div> <div class="flex mb10"><el-checkbox v-model="item.conditionType" :true-label="1" :false-label="-1" /><span class="ml10"> 邀请好友助力获得游戏次数</span></div>
<div v-show="item.conditionType == 1"> <div v-show="item.conditionType == 1">
<el-form-item label="邀请机制" label-width="80px"> 每成功邀请<el-input-number v-model="item.conditionJson.inviteNum" :min="1" class="w110 ml10 mr10" controls-position="right" />人可获得 <el-input-number v-model="item.conditionJson.value" :min="1" class="w110 ml10 mr10" controls-position="right" />次游戏</el-form-item> <el-form-item label="邀请机制" label-width="80px"> 每成功邀请<el-input-number v-model="item.conditionJson.inviteNum" :min="1" class="w110 ml10 mr10" controls-position="right" />人可获得 <el-input-number v-model="item.conditionJson.value" :min="1" class="w110 ml10 mr10" controls-position="right" />次游戏</el-form-item>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="每人最多可玩次数" prop="playTimes" :rules="rules.playTimes"> <el-input v-model="ruleForm.playTimes" class="w140" placeholder="上限1000" :disabled="isDisabled" />次游戏次数 </el-form-item> <el-form-item label="每人最多可玩次数" prop="playTimes" :rules="rules.playTimes"> <el-input v-model.number="ruleForm.playTimes" class="w140" placeholder="上限1000" :disabled="isDisabled" />次游戏次数 </el-form-item>
<el-form-item label="分享" prop="shareFlag"> <el-form-item label="分享" prop="shareFlag">
<el-switch v-model="ruleForm.shareFlag" :active-value="1" :inactive-value="0" /> <el-switch v-model="ruleForm.shareFlag" :active-value="1" :inactive-value="0" />
<div class="tips">关闭后用户无法分享小程序</div> <div class="tips">关闭后用户无法分享小程序</div>
...@@ -136,7 +136,6 @@ export default { ...@@ -136,7 +136,6 @@ export default {
callback(); callback();
}; };
const mpUrlViewVal = (rule, value, callback) => { const mpUrlViewVal = (rule, value, callback) => {
console.log(value);
if (this.ruleForm.gameRuleConditionList[1].conditionType != -1 && !this.ruleForm.gameRuleConditionList[1].conditionJson.dumpPath) { if (this.ruleForm.gameRuleConditionList[1].conditionType != -1 && !this.ruleForm.gameRuleConditionList[1].conditionJson.dumpPath) {
callback(new Error('请选择')); callback(new Error('请选择'));
return; return;
...@@ -144,7 +143,6 @@ export default { ...@@ -144,7 +143,6 @@ export default {
callback(); callback();
}; };
const shareTitleVal = (rule, value, callback) => { const shareTitleVal = (rule, value, callback) => {
console.log(value);
if (this.ruleForm.gameRuleConditionList[2].conditionType != -1 && this.ruleForm.gameRuleConditionList[2].conditionJson.type == 11 && !this.ruleForm.gameRuleConditionList[2].conditionJson.shareTitle) { if (this.ruleForm.gameRuleConditionList[2].conditionType != -1 && this.ruleForm.gameRuleConditionList[2].conditionJson.type == 11 && !this.ruleForm.gameRuleConditionList[2].conditionJson.shareTitle) {
callback(new Error('请输入')); callback(new Error('请输入'));
return; return;
...@@ -152,7 +150,6 @@ export default { ...@@ -152,7 +150,6 @@ export default {
callback(); callback();
}; };
const subscribeMsgVal = (rule, value, callback) => { const subscribeMsgVal = (rule, value, callback) => {
console.log(value);
if (this.ruleForm.gameRuleConditionList[2].conditionType != -1 && this.ruleForm.gameRuleConditionList[2].conditionJson.type == 12 && !this.ruleForm.gameRuleConditionList[2].conditionJson.subscribeMsg) { if (this.ruleForm.gameRuleConditionList[2].conditionType != -1 && this.ruleForm.gameRuleConditionList[2].conditionJson.type == 12 && !this.ruleForm.gameRuleConditionList[2].conditionJson.subscribeMsg) {
callback(new Error('请输入')); callback(new Error('请输入'));
return; return;
...@@ -219,14 +216,15 @@ export default { ...@@ -219,14 +216,15 @@ export default {
rules: { rules: {
memberType: { required: true, message: '请选择' }, memberType: { required: true, message: '请选择' },
memberDesc: { type: 'string', required: true, message: '未配置游戏说明', trigger: 'blur' }, memberDesc: { type: 'string', required: true, message: '未配置游戏说明', trigger: 'blur' },
// playTimes: { type: 'number', required: true, message: '请输入不超过1000的数字', max: 1000, min: 1 }, playTimes: { type: 'number', required: true, message: '请输入不超过1000的数字', max: 1000, min: 1 },
playConditionFlag: { required: true }, playConditionFlag: { required: true },
mpUrlView: { validator: mpUrlViewVal }, mpUrlView: { validator: mpUrlViewVal },
shareTitle: { validator: shareTitleVal }, shareTitle: { validator: shareTitleVal },
filterJson: { validator: filterJsonVal }, filterJson: { validator: filterJsonVal },
subscribeMsg: { validator: subscribeMsgVal } subscribeMsg: { validator: subscribeMsgVal }
}, },
isAdd: this.$route.meta.type === 'add' isAdd: this.$route.meta.type === 'add',
gameDays: 0
}; };
}, },
props: { props: {
...@@ -237,6 +235,10 @@ export default { ...@@ -237,6 +235,10 @@ export default {
echoData: { echoData: {
type: Object, type: Object,
default: () => {} default: () => {}
},
gameTime: {
type: Object,
default: () => []
} }
}, },
watch: { watch: {
...@@ -273,6 +275,14 @@ export default { ...@@ -273,6 +275,14 @@ export default {
} }
this.ruleForm = Object.assign(this.ruleForm, { ruleId, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView }); this.ruleForm = Object.assign(this.ruleForm, { ruleId, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView });
console.log(this.ruleForm); console.log(this.ruleForm);
},
gameTime(val) {
console.log(val);
if (val.length) {
console.log(val[1] - val[0]);
console.log((val[1] - val[0]) / (24 * 60 * 60 * 1000) + 1);
this.gameDays = (val[1] - val[0]) / (24 * 60 * 60 * 1000) + 1;
}
} }
}, },
components: { components: {
...@@ -374,6 +384,15 @@ export default { ...@@ -374,6 +384,15 @@ export default {
this.$message.error('请至少勾选一项'); this.$message.error('请至少勾选一项');
return; return;
} }
const conditionType2 = this.ruleForm.gameRuleConditionList.filter(item => item.conditionType == 2);
if (this.ruleForm.playConditionFlag == 1 && conditionType2.length && conditionType2[0].conditionJson.type == 21) {
const maxTimes = conditionType2[0].conditionJson.type == 21 ? conditionType2[0].conditionJson.value : conditionType2[0].conditionJson.value * this.gameDays;
if (maxTimes > this.ruleForm.playTimes) {
this.$message.error(`每人最多可玩次数需大于免费游戏次数${maxTimes}`);
return;
}
}
this.$refs.ruleForm.validate((val, obj) => { this.$refs.ruleForm.validate((val, obj) => {
if (val) { if (val) {
const data = { ...this.ruleForm }; const data = { ...this.ruleForm };
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<script> <script>
import VueQr from 'vue-qr'; import VueQr from 'vue-qr';
import { formatDateTimeByType } from '@/utils/index.js'; import { formatDateTimeByType } from '@/utils/index.js';
import { generateMiniProgramLink } from '@/service/api/gameApi.js'; import { generateMiniProgramLink, getQrGame } from '@/service/api/gameApi.js';
import { api as viewerApi } from 'v-viewer'; import { api as viewerApi } from 'v-viewer';
import 'viewerjs/dist/viewer.css'; import 'viewerjs/dist/viewer.css';
export default { export default {
...@@ -57,6 +57,10 @@ export default { ...@@ -57,6 +57,10 @@ export default {
showFooter: { showFooter: {
type: Boolean, type: Boolean,
default: false default: false
},
isNew: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -77,7 +81,11 @@ export default { ...@@ -77,7 +81,11 @@ export default {
url: '' url: ''
}; };
this.createQrImg(); this.createQrImg();
this.generateMiniProgramLink(); if (this.isNew) {
this.getQrGame();
} else {
this.generateMiniProgramLink();
}
} }
} }
}, },
...@@ -119,6 +127,16 @@ export default { ...@@ -119,6 +127,16 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
getQrGame() {
this.loading = true;
getQrGame({ id: this.obj.gameId })
.then(res => {
this.miniprogram = res.result;
})
.finally(() => {
this.loading = false;
});
},
close() { close() {
this.$emit('update:show', false); this.$emit('update:show', false);
}, },
......
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