Commit 148c1eff by crushh

update: temp

parent 469723ba
......@@ -2,7 +2,7 @@ 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';
Vue.use(Router);
......@@ -32,25 +32,26 @@ router.beforeEach((to, from, next) => {
if (to.meta.hiddenLayout) {
store.dispatch('setShowLayout', false);
}
axios
.get(`/api-plug/rate-limit?requestPath=${path}&enterpriseId=${store.state.marketing.enterpriseId}`)
.then(limitRes => {
// 这个接口不规范 不用封装的request
// code: 0正常 1必填参数未填写 2限流
if (limitRes.data.resultCode == 1) {
store.commit('updateLimit', true); // 更新正在限流
next({ path: '/limit' });
} else {
store.commit('updateLimit', false);
if (to.path == '/limit') {
next('/');
}
next();
}
})
.catch(() => {
next();
});
// axios
// .get(`/api-plug/rate-limit?requestPath=${path}&enterpriseId=${store.state.marketing.enterpriseId}`)
// .then(limitRes => {
// // 这个接口不规范 不用封装的request
// // code: 0正常 1必填参数未填写 2限流
// if (limitRes.data.resultCode == 1) {
// store.commit('updateLimit', true); // 更新正在限流
// next({ path: '/limit' });
// } else {
// store.commit('updateLimit', false);
// if (to.path == '/limit') {
// next('/');
// }
// next();
// }
// })
// .catch(() => {
// next();
// });
next();
});
export default router;
......@@ -223,7 +223,11 @@ export default {
{
path: 'cmh',
name: '拆盲盒列表',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/index.vue')
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/index.vue'),
meta: {
path: '/game/cmh',
keepAlive: true
}
},
{
path: 'cmh/add',
......@@ -231,6 +235,7 @@ export default {
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'add',
path: '/game/cmh',
hiddenLayout: true
}
},
......@@ -239,7 +244,8 @@ export default {
name: '编辑拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'edit'
type: 'edit',
hiddenLayout: true
}
},
{
......@@ -255,7 +261,8 @@ export default {
name: '复制拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'copy'
type: 'copy',
hiddenLayout: true
}
},
{
......@@ -265,6 +272,22 @@ export default {
meta: {
type: 'statistics'
}
},
{
path: 'cmh/statistics/activityDetail/:id',
name: '拆盲盒数据统计-活动明细',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'statistics'
}
},
{
path: 'cmh/statistics/prizeDetail/:id',
name: '拆盲盒数据统计-奖品明细',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'statistics'
}
}
]
};
......@@ -149,13 +149,20 @@ export default {
selectLink: {
show: false,
linkData: {}
}
},
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy'
};
},
props: {
templateArr: {
type: Array,
default: () => []
},
echoData: {
type: Object,
default: () => {}
}
},
components: {
......@@ -177,11 +184,29 @@ export default {
templateArr(val) {
console.log(val);
this.templateData = val;
if (val && val.length) {
const data = val[0];
const data = val[0];
if (this.isAdd) {
this.baseForm.templateId = data.templateId;
this.gameExt = data.gameTemplateMaterialList;
this.handleTemplateArr(data);
this.handleTemplateArr(data.gameTemplateMaterialList);
this.$emit('change', this.baseForm);
}
},
echoData(val) {
console.log(val);
if (Object.keys(val).length) {
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 };
console.log(this.adsImageUrl);
const currentTemp = this.templateData.filter(item => item.templateId == this.baseForm.templateId)[0];
currentTemp.gameTemplateMaterialList.forEach(item => {
if (item.materialKey == 'backMusicUrl') {
this.backMusicOptions.push(item);
}
});
console.log(this.baseForm);
this.$emit('change', this.baseForm);
}
}
......@@ -190,7 +215,7 @@ export default {
handleTemplateChange(val) {
console.log(val);
this.baseForm.templateId = val;
const data = this.templateArr.filter(item => item.templateId == val)[0];
const data = this.templateArr.filter(item => item.templateId == val)[0].gameTemplateMaterialList;
this.handleTemplateArr(data);
this.$emit('change', this.baseForm);
},
......@@ -238,29 +263,57 @@ export default {
});
return true;
},
handleTemplateArr(data) {
Object.keys(data.materialMap).forEach(key => {
if (key.indexOf('Image') > -1) {
let obj = data.materialMap[key][0];
this.baseForm[key] = obj.materialValue;
if (obj.materialSize) {
const { width, height, size } = JSON.parse(obj.materialSize);
this.baseForm[key + 'Size0'] = width + '*' + height + 'px';
this.baseForm[key + 'Size1'] = size;
}
handleTemplateArr(data, echo) {
console.log(data);
this.gameExt = data;
data.forEach(item => {
console.log(item.materialKey);
if (item.materialSize) {
const { width, height, size } = JSON.parse(item.materialSize);
this.baseForm[item.materialKey + 'Size0'] = width + '*' + height + 'px';
this.baseForm[item.materialKey + 'Size1'] = size;
}
if (item.materialKey == 'prizeStyleJson') {
this.prizeStyleJson = JSON.parse(item.materialValue);
this.baseForm['prizeStyleJson'] = JSON.parse(item.materialValue);
} else {
this.backMusicOptions = data.materialMap['backMusicUrl'];
if (data.materialMap['backMusicUrl'] && data.materialMap['backMusicUrl'].length) {
this.baseForm.backMusicUrlObj = data.materialMap['backMusicUrl'][0];
this.baseForm[item.materialKey] = item.materialValue;
}
if (item.materialKey == 'backMusicUrl') {
if (echo) {
if (item.customFlag == 1) {
this.customMusicOptions.push(item);
this.baseForm.backMusicUrlObj = item;
} else {
this.baseForm.backMusicUrlObj = item;
}
} else {
this.backMusicOptions.push(item);
this.baseForm.backMusicUrlObj = this.backMusicOptions[0];
}
const prizeStyle = data.materialMap['prizeStyleJson'][0];
this.prizeStyleJson = JSON.parse(prizeStyle.materialValue);
this.baseForm['prizeStyleJson'] = JSON.parse(prizeStyle.materialValue);
this.baseForm['adsLinkUrl'] = data.materialMap['adsLinkUrl'][0].materialValue;
this.baseForm['shareCard'] = data.materialMap['shareCard'][0].materialValue;
this.baseForm['shareReport'] = data.materialMap['shareReport'][0].materialValue;
}
// if (key.indexOf('Image') > -1) {
// let obj = data.materialMap[key][0];
// this.baseForm[key] = obj.materialValue;
// if (obj.materialSize) {
// const { width, height, size } = JSON.parse(obj.materialSize);
// this.baseForm[key + 'Size0'] = width + '*' + height + 'px';
// this.baseForm[key + 'Size1'] = size;
// }
// } else {
// this.backMusicOptions = data.materialMap['backMusicUrl'];
// if (data.materialMap['backMusicUrl'] && data.materialMap['backMusicUrl'].length) {
// this.baseForm.backMusicUrlObj = data.materialMap['backMusicUrl'][0];
// }
// const prizeStyle = data.materialMap['prizeStyleJson'][0];
// this.prizeStyleJson = JSON.parse(prizeStyle.materialValue);
// this.baseForm['prizeStyleJson'] = JSON.parse(prizeStyle.materialValue);
// this.baseForm['adsLinkUrl'] = data.materialMap['adsLinkUrl'][0].materialValue;
// this.baseForm['shareCard'] = data.materialMap['shareCard'][0].materialValue;
// this.baseForm['shareReport'] = data.materialMap['shareReport'][0].materialValue;
// }
});
console.log(this.baseForm);
},
handleListen() {
......
......@@ -33,7 +33,7 @@
<dm-step title="3.规则配置" @click.native="active = 2"></dm-step>
</dm-steps>
<div class="formContent">
<baseConfig :templateArr="templateData" v-show="active == 0" @change="handleBaseConfigChange" @nextStep="data => nextStep(1, data)" />
<baseConfig :templateArr="templateData" :echoData="baseForm" v-show="active == 0" @change="handleBaseConfigChange" @nextStep="data => nextStep(1, data)" />
<prizeConfig :prizeMax="prizeMax" :prizeMin="prizeMin" v-show="active == 1" @nextStep="data => nextStep(2, data)" />
<ruleConfig :shareCard="shareCard" :shareReport="shareReport" v-show="active == 2" @nextStep="data => submit(3, data)" :btnLoading="btnLoading" />
</div>
......@@ -69,7 +69,8 @@ export default {
submitData: {},
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy'
isCopy: this.$route.meta.type === 'copy',
baseForm: {}
};
},
computed: {
......@@ -93,31 +94,26 @@ export default {
ruleConfig
},
mounted() {
const { id } = this.$route.params;
this.getGameTemplateByType();
if (this.isAdd) {
this.$route.meta.refresh = false;
} else {
this.getGameDetail(id);
}
},
destroyed() {
this.$store.dispatch('setShowLayout', true);
},
watch: {
templateId(val) {
console.log(val);
const data = this.templateData.filter(item => item.templateId == val)[0];
const { prizeMax, prizeMin, materialMap } = data;
console.log(data);
const { prizeMax, prizeMin } = data;
this.prizeMax = prizeMax;
this.prizeMin = prizeMin;
this.shareCard = materialMap.shareCard[0].materialValue;
this.shareReport = materialMap.shareReport[0].materialValue;
}
},
methods: {
getGameDetail(id) {
getGameDetail({ gameId: id }).then(res => {
console.log(res);
const { result } = res;
const {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
......@@ -133,7 +129,7 @@ export default {
startDate,
endDate,
gameName
} = res;
} = result;
const { winChance, filterJson, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc } = gameRuleInfo;
gameRuleConditionList.forEach(item => {
item.conditionJson = JSON.parse(item.conditionJson);
......@@ -146,13 +142,15 @@ export default {
handleBaseConfigChange(data) {
console.log('handleBaseConfigChange----->');
console.log(data);
const { backImageUrl, noticeImageUrl, adsImageUrl, gameName, templateId } = data;
const { backImageUrl, noticeImageUrl, adsImageUrl, gameName, templateId, shareCard, shareReport } = data;
this.bgImg = backImageUrl;
this.tipsImg = noticeImageUrl;
this.boxImg = data.prizeStyleJson[0].imageNoSelectUrl;
this.adImg = adsImageUrl;
this.gameName = gameName;
this.templateId = templateId;
this.shareCard = shareCard;
this.shareReport = shareReport;
},
returnNext() {
this.$store.dispatch('setShowLayout', true);
......@@ -161,31 +159,25 @@ export default {
handleMenuSelect(index) {
this.menuActive = index;
},
getGameTemplateByType() {
getGameTemplateByType({ templateType: 1 }).then(res => {
if (res.code == 0) {
if (res.result && res.result.length) {
res.result.forEach(item => {
const { gameTemplateMaterialList } = item;
let materialMap = {};
gameTemplateMaterialList &&
gameTemplateMaterialList.forEach(val => {
if (materialMap.hasOwnProperty(val.materialKey)) {
materialMap[val.materialKey].push(val);
} else {
materialMap[val.materialKey] = [val];
}
});
item.materialMap = materialMap;
});
this.templateData = res.result;
const { templateId } = res.result[0];
this.templateId = templateId;
async getGameTemplateByType() {
const res = await getGameTemplateByType({ templateType: 1 });
this.templateData = res.result;
if (this.isAdd) {
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;
}
console.log(this.templateData);
}
});
if (item.materialKey == 'shareReport') {
this.shareReport = item.materialValue;
}
});
} else {
const { id } = this.$route.params;
this.getGameDetail(id);
}
},
nextStep(step, data) {
this.active = step;
......
......@@ -151,7 +151,7 @@ export default {
return true;
return this.$getButtonLimit(this.$buttonCode.marketingCmhInfo);
},
handler: row => this.$router.push('/cmh/info/' + row.gameId)
handler: row => this.$router.push('/game/cmh/info/' + row.gameId)
},
{
text: '编辑',
......@@ -162,7 +162,7 @@ export default {
return true;
return (row.status === 1 || row.status === 0) && this.$getButtonLimit(this.$buttonCode.marketingCmhEdit);
},
handler: row => this.$router.push('/cmh/edit/' + row.gameId)
handler: row => this.$router.push(`/game/cmh/edit/${row.gameId}`)
},
{
text: '复制',
......@@ -173,7 +173,7 @@ export default {
return true;
return this.$getButtonLimit(this.$buttonCode.marketingCmhCopy);
},
handler: row => this.$router.push('/cmh/copy/' + row.gameId)
handler: row => this.$router.push('/game/cmh/copy/' + row.gameId)
},
{
text: '链接',
......@@ -228,8 +228,7 @@ export default {
this.getTableList();
},
addGame() {
this.$store.dispatch('setShowLayout', false);
this.$router.push('cmh/add');
this.$router.push('/game/cmh/add');
},
onView() {
let qrImg = 'https://pic01-10001430.cos.ap-shanghai.myqcloud.com/game/template1/bill_pic.png' + '?imageMogr2/thumbnail/800x800';
......
......@@ -148,7 +148,7 @@ export default {
gameRuleConditionList: [
{
index: 1,
conditionType: 2, // 赠与免费游戏次数
conditionType: 2, // 赠与免费游戏次数 zuo
conditionJson: {
type: 21,
value: ''
......
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