Commit 7ebafb3d by 黑潮

update: game

parent 9b5cd4cb
<template>
<div>
<el-input style="width:180px;" v-model="query.searchParam" prefix-icon="el-icon-search" placeholder="请输入游戏名称" @change="onSearch" clearable></el-input>
<el-table style="margin-top:20px" :data="list" @row-click="onRowClick">
<el-table-column width="50px">
<template slot-scope="scope">
<el-radio :value="seletedId" :label="scope.row.gameId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip label="游戏名称" prop="gameName"></el-table-column>
<el-table-column show-overflow-tooltip label="游戏ID" prop="gameId"></el-table-column>
<el-table-column label="游戏状态">
<template slot-scope="scope">
<template v-if="'gameStatusName' in scope.row">
<div v-if="scope.row.gameStatusName === '进行中'"><span class="dm-status--primary--flash"></span>{{ scope.row.gameStatusName }}</div>
<div v-else :class="scope.row.gameStatusName === '未开始' ? 'dm-status--warning' : 'dm-status--info'">{{ scope.row.gameStatusName }}</div>
</template>
<template v-else-if="'activityStatus' in scope.row">
<div v-if="scope.row.activityStatus === 1"><span class="dm-status--primary--flash"></span>进行中</div>
<div v-else :class="scope.row.activityStatus === 0 ? 'dm-status--warning' : 'dm-status--info'">
{{ scope.row.activityStatus === 0 ? '未开始' : '已结束' }}
</div>
</template>
</template>
</el-table-column>
<el-table-column label="开始时间">
<template slot-scope="scope">
<p>{{ formatDateTimeByType(scope.row.gameStartTime, 'yyyy-MM-dd') }}</p>
<p>{{ formatDateTimeByType(scope.row.gameStartTime, 'HH:mm:ss') }}</p>
</template>
</el-table-column>
<el-table-column label="结束时间">
<template slot-scope="scope">
<p>{{ formatDateTimeByType(scope.row.gameEndTime, 'yyyy-MM-dd') }}</p>
<p>{{ formatDateTimeByType(scope.row.gameEndTime, 'HH:mm:ss') }}</p>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:10px;text-align:right" small layout="prev, pager, next" :current-page="query.currentPage" :page-size="query.pageSize" :total="total" @current-change="onPageChange"> </el-pagination>
</div>
</template>
<script>
import qs from 'qs';
import { formatDateTimeByType } from '@/utils/index.js';
export default {
name: 'GamelinkList',
props: {
gameType: {
required: true,
type: String
},
gameId: {
type: String
}
},
data() {
return {
formatDateTimeByType,
list: [],
query: {
requestProject: 'gic-web',
searchParam: '',
currentPage: 1,
pageSize: 8,
gameStatus: 4
},
seletedItem: null,
seletedId: '',
total: 0
};
},
created() {
this.seletedId = this.gameId || '';
},
methods: {
onPageChange(val) {
this.query.currentPage = val;
this.getList(this.gameType);
this.seletedItem = null;
this.seletedId = '';
},
onRowClick(row) {
this.seletedItem = row;
this.seletedId = row.gameId;
},
onSearch() {
this.query.currentPage = 1;
this.seletedItem = null;
this.seletedId = '';
this.getList(this.gameType);
},
getList(gameType) {
const setResponse = (res, type) => {
//type 0 大转盘/刮刮卡 ----- 1 其他游戏
const { errorCode, message, result } = res.data || {};
if (errorCode != 0) {
return this.$message.error(message);
} else {
if (type === 0) {
this.list = result.page.result || [];
this.total = result.page.totalCount || 0;
} else {
this.list = (result.result || []).map(item => ({ ...item, gameId: item.gameActivityId }));
this.total = result.totalCount || 0;
}
}
};
switch (gameType) {
case 'GAME_LINK_DZP':
this.axios.post(`/api-marketing/page-lottery-game`, qs.stringify({ ...this.query, gameType: 1 })).then(res => {
setResponse(res, 0);
});
break;
case 'GAME_LINK_GGK':
this.axios.post(`/api-marketing/page-lottery-game`, qs.stringify({ ...this.query, gameType: 2 })).then(res => {
setResponse(res, 0);
});
break;
case 'GAME_LINK_PTYX':
this.axios.post(`/api-marketing/page-puzzle-game`, qs.stringify({ ...this.query })).then(res => {
setResponse(res, 1);
});
break;
case 'GAME_LINK_ZNM':
this.axios.post(`/api-marketing/page-znm-game`, qs.stringify({ ...this.query })).then(res => {
setResponse(res, 1);
});
break;
case 'GAME_LINK_KLFL':
this.axios.post(`/api-marketing/page-klfl-game`, qs.stringify({ ...this.query })).then(res => {
setResponse(res, 1);
});
break;
}
}
},
watch: {
gameType: {
handler() {
this.query.currentPage = 1;
this.query.searchParam = '';
this.getList(this.gameType);
},
immediate: true
},
gameId() {
this.seletedId = this.gameId || '';
},
seletedItem(val) {
this.$emit('select', val);
}
}
};
</script>
<template>
<el-dialog title="添加小程序链接" :visible.sync="show" width="600px" class="add-replay-content" :before-close="close">
<el-form label-position="right" ref="form" :model="form" label-width="100px" v-loading="loading">
<el-dialog title="添加小程序链接" :visible.sync="show" width="770px" class="add-replay-content" :before-close="close">
<el-form style="max-height: 550px;overflow: auto;" label-position="right" ref="form" :model="form" label-width="100px" v-loading="loading">
<el-form-item class="text-content" label="文本内容">
<el-input v-model="form.title" @keyup.native="toInput(form.title, $event)"></el-input>
<span class="text-num">{{ inputNum }}/{{ inputLength }}</span>
......@@ -29,6 +29,10 @@
<el-select v-show="preValue && preValue != 5" filterable clearable @change="changeNextValue" class="w200" v-model="nextValue" placeholder="请选择">
<el-option v-for="item in options2" :key="item.linkId" :label="item.name" :value="item.linkId"> </el-option>
</el-select>
<el-select class="w200" v-model="threeValue" placeholder="请选择" v-if="options3 && options3.length > 0" @change="changeThreeValue">
<el-option v-for="item in options3" :key="item.tagid" :label="item.tagname" :value="item.tagid"></el-option>
</el-select>
<game-list style="margin-top:20px" ref="gameList" v-if="gameLinkVisible" :game-id="gameProps.gameId" :game-type="gameProps.gameType" @select="onSelectGame"></game-list>
</div>
</el-form-item>
</div>
......@@ -44,8 +48,10 @@
<script>
import { getByteVal, getZhLen } from '../assets/utils.js';
import qs from 'qs';
import GameList from './game-list.vue';
export default {
name: 'lib-wxa',
components: { GameList },
props: {
show: {
type: Boolean,
......@@ -72,6 +78,7 @@ export default {
inputLength: 20, // 限制最大字数
preValue: '',
nextValue: '',
threeValue: '',
options1: [
{
value: 3,
......@@ -87,6 +94,10 @@ export default {
}
],
options2: [],
gameProps: {
gameType: '',
gameId: ''
},
wechatContent: {},
listParams: {
pageSize: 10,
......@@ -112,7 +123,25 @@ export default {
}
}
},
computed: {
options3() {
let obj = this.options2.find(el => {
return el.linkId === this.nextValue;
});
if (obj && obj.childList && obj.childList.length > 0) {
return obj.childList;
} else {
return [];
}
},
gameLinkVisible() {
return this.nextValue == 'GAME_LINK' && this.threeValue;
}
},
watch: {
options3() {
this.threeValue = '';
},
show(val) {
this.form = {
title: '',
......@@ -123,6 +152,8 @@ export default {
};
this.preValue = '';
this.nextValue = '';
this.threeValue = '';
this.selectedGame = null;
this.wechatContent = {};
if (val && this.item.ecmMarketingTypeRelationId) {
this.form = JSON.parse(JSON.stringify(this.item));
......@@ -141,6 +172,17 @@ export default {
} else {
this.getNextList(this.preValue).then(res => {
this.nextValue = pagePath.type;
if (this.nextValue == 'GAME_LINK') {
this.$nextTick(() => {
this.threeValue = pagePath.gameType;
this.gameProps.gameType = pagePath.gameType;
this.gameProps.gameId = pagePath.tagid;
});
} else {
this.$nextTick(() => {
this.threeValue = pagePath.tagid;
});
}
});
}
}
......@@ -248,6 +290,27 @@ export default {
this.wechatContent.pageType = this.preValue;
}
},
changeThreeValue(val) {
if (val.startsWith('GAME_LINK')) {
this.$nextTick(() => {
this.gameProps.gameType = val;
});
this.gameProps.gameId = '';
} else {
let option = this.options3.find(el => el.tagid === val);
this.wechatContent.tagid = option.tagid;
this.wechatContent.tagname = option.tagname;
}
},
onSelectGame(val) {
if (val) {
this.wechatContent.tagid = val.gameId || val.gameActivityId;
this.wechatContent.tagname = val.gameName;
this.wechatContent.gameType = this.threeValue;
this.wechatContent.gameName = val.gameName;
this.selectedGame = val;
}
},
// 获取自定义链接list
getCustonList() {
return new Promise((resolve, reject) => {
......@@ -329,6 +392,14 @@ export default {
this.$message({ type: 'warning', message: '链接选择' });
return;
}
if (this.options3 && this.options3.length > 0 && !this.threeValue) {
this.$message({ type: 'warning', message: '链接选择' });
return;
}
if (this.nextValue == 'GAME_LINK' && !this.selectedGame) {
this.$message({ type: 'warning', message: '请选择游戏' });
return;
}
// 自定义链接
if (this.preValue === 5) {
......@@ -350,6 +421,7 @@ export default {
this.listParams.search = '';
this.listParams.nomore = false;
this.options2 = [];
this.options3 = [];
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