Commit 21f34e5b by crushh

update: dist

parent 46121356
<template>
<div>
<dm-layout :projectName="projectName" v-if="$store.getters.getShowLayout">
<dm-layout :projectName="projectName">
<keep-alive>
<router-view v-if="$route.meta.keepAlive" />
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive" />
</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>
</template>
<script>
......
import Vue from 'vue';
import Router from 'vue-router';
import routes from './routes';
import store from '@/store';
// import axios from 'axios';
// import axios from 'axios';
console.log(routes);
Vue.use(Router);
let router = new Router({
......@@ -29,9 +29,7 @@ router.beforeEach((to, from, next) => {
Object.keys(to.params).map(key => {
path = path.replace(to.params[key], `:${key}`);
});
if (to.meta.hiddenLayout) {
store.dispatch('setShowLayout', false);
}
// axios
// .get(`/api-plug/rate-limit?requestPath=${path}&enterpriseId=${store.state.marketing.enterpriseId}`)
// .then(limitRes => {
......
......@@ -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',
name: '拆盲盒数据统计',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
......@@ -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';
//微信营销
import wechat from './modules/wechat';
//游戏营销
import game from './modules/game';
import game, { cmhDetail } from './modules/game';
//短信营销
import message from './modules/message';
//卡券营销
......@@ -66,6 +66,7 @@ export default [
ai
]
},
...cmhDetail,
{
path: '/401',
name: '未授权',
......
......@@ -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 getQrGame = params => requests(PREFIX + '/game-pro/get-qr-game', params, true, false, 'get');
//卡券回显 key 卡券ID ; value 卡券状态 0正常 1删除 2失效
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 = {
async getIsShowSelfData(state) {
let res = await getIsShowSelf();
this.commit('mutations_auth', res.result);
},
setShowLayout({ commit }, item) {
commit('mutations_Layout', item);
}
};
......
......@@ -3,7 +3,7 @@
<dm-sub-title type="line">基本信息</dm-sub-title>
<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="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>
</div>
<dm-sub-title type="line">展示信息配置</dm-sub-title>
......@@ -139,7 +139,7 @@ export default {
baseForm: {
gameName: '',
gameTime: [],
gameRule: '1、幸运盲盒大抽奖,惊喜好礼抽不停。</br>2、活动最终解释权归品牌方所有。',
gameRule: '1、幸运盲盒大抽奖,惊喜好礼抽不停。2、活动最终解释权归品牌方所有。',
templateId: '',
backMusicFlag: 1,
adsFlag: 1,
......@@ -230,6 +230,10 @@ export default {
}
},
methods: {
handleDateChange(val) {
console.log(val);
this.$emit('change', this.baseForm);
},
handleTemplateChange(val) {
this.baseForm.templateId = val;
const data = this.templateArr.filter(item => item.templateId == val)[0].gameTemplateMaterialList;
......
......@@ -7,7 +7,7 @@
</div>
<div class="rightBtn">
<el-button @click="returnNext">退出</el-button>
<el-button type="primary">发布并预览</el-button>
<!-- <el-button type="primary">发布并预览</el-button> -->
</div>
</div>
<div class="content">
......@@ -35,10 +35,14 @@
<div class="formContent">
<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)" />
<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>
<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>
</template>
......@@ -50,9 +54,13 @@ import prizeConfig from './prize-config.vue';
import ruleConfig from './rule-config.vue';
import { getGameTemplateByType, initActivity, getGameDetail, cardView } from '@/service/api/gameApi.js';
import gameTemplate from './gameTemplate';
import links from '../common/links';
export default {
data() {
return {
linkShow: false,
linksObj: {},
active: 0,
menuActive: 0,
templateData: [],
......@@ -75,7 +83,8 @@ export default {
ruleForm: {},
gameId: '',
gameStatus: 0,
invalidCard: {}
invalidCard: {},
gameTime: []
};
},
computed: {
......@@ -96,14 +105,13 @@ export default {
baseConfig,
gameTemplate,
prizeConfig,
ruleConfig
ruleConfig,
links
},
mounted() {
this.getGameTemplateByType();
},
destroyed() {
this.$store.dispatch('setShowLayout', true);
},
watch: {
templateId(val) {
const data = this.templateData.filter(item => item.templateId == val)[0];
......@@ -168,7 +176,7 @@ export default {
handleBaseConfigChange(data) {
console.log('handleBaseConfigChange----->');
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.tipsImg = noticeImageUrl;
this.boxImg = data.prizeStyleJson[0].imageNoSelectUrl;
......@@ -177,10 +185,16 @@ export default {
this.templateId = templateId;
this.shareCard = shareCard;
this.shareReport = shareReport;
this.gameTime = gameTime;
},
returnNext() {
this.$store.dispatch('setShowLayout', true);
this.$router.go(-1);
this.$confirm('退出后,当前编辑没有保存的数据会丢失,确认要退出吗?', {
type: 'warning'
})
.then(() => {
this.$router.push('/game/cmh');
})
.catch(() => {});
},
handleMenuSelect(index) {
this.menuActive = index;
......@@ -246,36 +260,51 @@ export default {
}
});
}
let submitData = {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
gamePrizeList, //游戏奖品信息
gameExt,
templateType: 1, // 1盲盒
prizeNoticeStock,
prizeNoticeFlag,
adsFlag,
bulletFlag,
backMusicFlag,
templateId,
gameRule,
startDate: gameTime[0],
endDate: gameTime[1],
gameName
};
if (this.isEdit) {
submitData.gameId = this.gameId;
}
this.btnLoading = true;
initActivity(submitData)
.then(res => {
if (res) {
this.$message.success('保存成功');
this.$route.meta.refresh = true;
this.$router.go(-1);
}
})
.finally((this.btnLoading = false));
this.$confirm('确认发布游戏?', {
type: 'warning'
}).then(() => {
let submitData = {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
gamePrizeList, //游戏奖品信息
gameExt,
templateType: 1, // 1盲盒
prizeNoticeStock,
prizeNoticeFlag,
adsFlag,
bulletFlag,
backMusicFlag,
templateId,
gameRule,
startDate: gameTime[0],
endDate: gameTime[1],
gameName
};
if (this.isEdit) {
submitData.gameId = this.gameId;
}
this.btnLoading = true;
initActivity(submitData)
.then(res => {
if (res) {
const { result } = res;
this.$message.success('发布成功');
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 {
width: 48px;
height: 16px;
}
.game-name-box {
}
.ad-image {
margin: 39px 15px 15px;
......
......@@ -80,24 +80,26 @@
</el-table-column>
</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>
<links :show.sync="linkShow" :obj="linksObj" :gameTypeName="gameTypeName"></links>
<links :show.sync="linkShow" :obj="linksObj" gameTypeName="幸运盲盒" :isNew="true"></links>
</section>
</template>
<script>
import { api as viewerApi } from 'v-viewer';
import { cmhPage } from '@/service/api/gameApi.js';
import linksMixin from '../common/linksMixin.js';
import { cmhPage, stopGame } from '@/service/api/gameApi.js';
import links from '../common/links';
import { formatDateTimeByType } from '@/utils/index.js';
import dmDropdown from '@/components/dm-drop-down/dm-drop-down';
export default {
mixins: [linksMixin],
components: {
dmDropdown
dmDropdown,
links
},
data() {
return {
formatDateTimeByType,
linkShow: false,
linksObj: {},
listParams: {
gameName: '',
status: '',
......@@ -107,6 +109,7 @@ export default {
pageSize: 20
},
total: 0,
gameId: '',
tableList: [],
gameStatusOptions: [
{
......@@ -175,12 +178,12 @@ export default {
{
text: '链接',
props: {
limitCode: this.$buttonCode.marketingCmhUrl
limitCode: this.$buttonCode.marketingCmhLink
},
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: '终止',
......@@ -190,7 +193,7 @@ export default {
visible: row => {
return row.status === 1 && this.$getButtonLimit(this.$buttonCode.marketingCmhStop);
},
handler: row => this.stopPlan(row)
handler: row => this.stopGame(row)
},
{
text: '数据',
......@@ -209,6 +212,27 @@ export default {
this.getTableList();
},
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() {
this.listParams.pageNum = 1;
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 @@
<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" />
<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>
</div>
</div>
......@@ -34,7 +34,7 @@
<el-form-item>
<div class="shareBox" v-show="ruleForm.playConditionFlag == 1">
<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>
<el-form-item :prop="'gameRuleConditionList.' + index + '.' + 'value'" v-show="item.conditionType == 2">
<el-select class="w140" v-model="item.conditionJson.type" :disabled="isDisabled">
......@@ -45,7 +45,7 @@
<span class="ml10">次游戏次数</span>
</el-form-item>
</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 v-show="item.conditionType == 0">
<el-form-item label="参与游戏每次消耗积分" :prop="'gameRuleConditionList.' + index + '.conditionJson.' + 'value'">
......@@ -61,7 +61,7 @@
</el-form-item>
</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 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>
......@@ -110,7 +110,7 @@
</div>
</div>
</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-switch v-model="ruleForm.shareFlag" :active-value="1" :inactive-value="0" />
<div class="tips">关闭后用户无法分享小程序</div>
......@@ -136,7 +136,6 @@ export default {
callback();
};
const mpUrlViewVal = (rule, value, callback) => {
console.log(value);
if (this.ruleForm.gameRuleConditionList[1].conditionType != -1 && !this.ruleForm.gameRuleConditionList[1].conditionJson.dumpPath) {
callback(new Error('请选择'));
return;
......@@ -144,7 +143,6 @@ export default {
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) {
callback(new Error('请输入'));
return;
......@@ -152,7 +150,6 @@ export default {
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) {
callback(new Error('请输入'));
return;
......@@ -219,14 +216,15 @@ export default {
rules: {
memberType: { required: true, message: '请选择' },
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 },
mpUrlView: { validator: mpUrlViewVal },
shareTitle: { validator: shareTitleVal },
filterJson: { validator: filterJsonVal },
subscribeMsg: { validator: subscribeMsgVal }
},
isAdd: this.$route.meta.type === 'add'
isAdd: this.$route.meta.type === 'add',
gameDays: 0
};
},
props: {
......@@ -237,6 +235,10 @@ export default {
echoData: {
type: Object,
default: () => {}
},
gameTime: {
type: Object,
default: () => []
}
},
watch: {
......@@ -273,6 +275,14 @@ export default {
}
this.ruleForm = Object.assign(this.ruleForm, { ruleId, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView });
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: {
......@@ -374,6 +384,15 @@ export default {
this.$message.error('请至少勾选一项');
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) => {
if (val) {
const data = { ...this.ruleForm };
......
......@@ -31,7 +31,7 @@
<script>
import VueQr from 'vue-qr';
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 'viewerjs/dist/viewer.css';
export default {
......@@ -57,6 +57,10 @@ export default {
showFooter: {
type: Boolean,
default: false
},
isNew: {
type: Boolean,
default: false
}
},
data() {
......@@ -77,7 +81,11 @@ export default {
url: ''
};
this.createQrImg();
this.generateMiniProgramLink();
if (this.isNew) {
this.getQrGame();
} else {
this.generateMiniProgramLink();
}
}
}
},
......@@ -119,6 +127,16 @@ export default {
this.loading = false;
});
},
getQrGame() {
this.loading = true;
getQrGame({ id: this.obj.gameId })
.then(res => {
this.miniprogram = res.result;
})
.finally(() => {
this.loading = false;
});
},
close() {
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