Browse Source

battlePass

master
linquan 1 week ago
parent
commit
2c0a7925d3
  1. 3
      README.md
  2. 2585
      package-lock.json
  3. 4
      package.json
  4. 3930
      src/api/config/BattlePassConfigCategory.json
  5. 32
      src/api/game/gameConfig.ts
  6. 5
      src/utils/utils.ts
  7. 105
      src/views/gameLoginUrl/serverList/index.vue
  8. 19
      src/views/gameRole/role/index.vue
  9. 412
      src/views/serverBattlePass/update/index.vue

3
README.md

@ -65,6 +65,7 @@ cnpm run build
* 将数据保存在第一层
# 运行项目
* npm run build
* npm run test115
* npm run test246
* npm run test
* npm run test87

2585
package-lock.json generated

File diff suppressed because it is too large Load Diff

4
package.json

@ -22,7 +22,7 @@
"echarts": "^5.3.0",
"echarts-gl": "^2.0.9",
"echarts-wordcloud": "^2.0.0",
"element-plus": "^2.0.4",
"element-plus": "2.3.4",
"express-jwt": "^8.5.1",
"jsonwebtoken": "^9.0.2",
"jsplumb": "^2.15.6",
@ -33,7 +33,7 @@
"screenfull": "^6.0.1",
"sortablejs": "^1.14.0",
"splitpanes": "^3.1.1",
"vue": "^3.2.31",
"vue": "3.2.31",
"vue-clipboard3": "^1.0.1",
"vue-grid-layout": "^3.0.0-beta1",
"vue-i18n": "^9.14.4",

3930
src/api/config/BattlePassConfigCategory.json

File diff suppressed because it is too large Load Diff

32
src/api/game/gameConfig.ts

@ -193,3 +193,35 @@ export function gameGMDelModel(params: object) {
params: params,
});
}
export function gameGMCheckBattlePassCheck(params: object) {
return request({
url: '/api/v1/game/battlePass/check',
method: 'get',
params: params,
});
}
export function gameGMUpdateBattlePass(params: object) {
return request({
url: '/api/v1/game/battlePass/update',
method: 'get',
params: params,
});
}
export function gameGMInsertBattlePass(params: object) {
return request({
url: '/api/v1/game/battlePass/insert',
method: 'get',
params: params,
});
}
export function gameGMGetBattlePass(params: object) {
return request({
url: '/api/v1/game/battlePass/get',
method: 'get',
params: params,
});
}

5
src/utils/utils.ts

@ -118,3 +118,8 @@ export function channelFill(val: any) {
export function getCompleteChannel(channel: any, subChannel: any) {
return channelFill(channel) + channelFill(subChannel);
}
export function uniquePeriodId(arr) {
return arr.filter(function(item, index) {
return arr.indexOf(arr.find(r=>r.PeriodId == item.PeriodId)) === index;
});
}

105
src/views/gameLoginUrl/serverList/index.vue

@ -1,69 +1,67 @@
<template>
<div>
<!-- <el-card shadow="hover" header="">-->
<!-- <div class="mb15">-->
<el-form class="flex-warp" label-position="right">
<el-form-item>
<el-button type="success" class="ml10" @click="countList">
刷新列表
</el-button>
<el-button type="success" class="ml10" @click="countList"> 刷新列表 </el-button>
</el-form-item>
<el-table :data="tableData.data" style="width: 100%" stripe border>
<el-table-column prop="id" label="ID" width="60"/>
<el-table-column prop="remark" label="备注" width="180"/>
<el-table-column prop="gameDbUrl" label="数据库地址" width="260"/>
<el-table-column prop="gameDbName" label="数据库名称" width="180"/>
<el-table-column prop="innerIp" label="machine内网Ip" width="180"/>
<el-table-column prop="id" label="ID" width="60" />
<el-table-column prop="remark" label="备注" width="180" />
<el-table-column prop="gameDbUrl" label="数据库地址" width="260" />
<el-table-column prop="gameDbName" label="数据库名称" width="180" />
<el-table-column prop="innerIp" label="machine内网Ip" width="180" />
<el-table-column prop="platform" label="平台" width="100">
<template #default="scope">
<div v-if="scope.row.platform===1">ios</div>
<div v-else-if="scope.row.platform===2">安卓</div>
<div v-else-if="scope.row.platform===3">先行服</div>
<div v-if="scope.row.platform === 1">ios</div>
<div v-else-if="scope.row.platform === 2">安卓</div>
<div v-else-if="scope.row.platform === 3">先行服</div>
</template>
</el-table-column>
<el-table-column prop="difficulty" label="难度" width="100">
<template #default="scope">
<div v-if="scope.row.difficulty===1">普通</div>
<div v-else-if="scope.row.difficulty===2">困难</div>
<div v-if="scope.row.difficulty === 1">普通</div>
<div v-else-if="scope.row.difficulty === 2">困难</div>
</template>
</el-table-column>
<el-table-column prop="createTime" label="开服时间" width="180"/>
<el-table-column prop="createTime" label="开服时间" width="180" />
<el-table-column>
<template #default="scope">
<el-button size="small" type="success" @click="onOpenEditDic(scope.row)">修改</el-button>
<!-- <el-button size="small" type="danger" @click="delLoginUrl(scope.row.id)">删除</el-button>-->
</template>
</el-table-column>
</el-table>
<el-row justify="space-evenly">
<el-pagination :hide-on-single-page="true" v-model:page-size="tableData.params.pageSize" :pager-count="5"
v-model:current-page="tableData.params.pageNum" layout="total, prev, pager, next"
:total="tableData.total" @current-change="handleCurrentChange"/>
<el-pagination
:hide-on-single-page="true"
v-model:page-size="tableData.params.pageSize"
:pager-count="5"
v-model:current-page="tableData.params.pageNum"
layout="total, prev, pager, next"
:total="tableData.total"
@current-change="handleCurrentChange"
/>
</el-row>
</el-form>
<!-- </div>-->
<!-- </el-card>-->
<EditConfig ref="editDicRef" @countList="countList"/>
<EditConfig ref="editDicRef" @countList="countList" />
</div>
</template>
<script lang="ts">
import {toRefs, reactive, onMounted, defineComponent, ref} from 'vue';
import EditConfig from '/@/views/gameLoginUrl/serverList/component/editConfig.vue';
import {gameReloadServer} from "/@/api/game";
import {gameGetLoginUrl, gameDelLoginUrl} from "/@/api/game/loginUrl";
import {PLATFORM} from "/@/api/common/consts";
import { toRefs, reactive, onMounted, defineComponent, ref } from 'vue';
import EditConfig from '/@/views/gameLoginUrl/serverList/component/editConfig.vue';
import { gameReloadServer } from '/@/api/game';
import { gameGetLoginUrl, gameDelLoginUrl } from '/@/api/game/loginUrl';
import { PLATFORM } from '/@/api/common/consts';
//
interface TableData{
//
interface TableData {
id: number;
ip: string;
}
}
interface TableDataState{
interface TableDataState {
tableData: {
data: Array<TableData>;
total: number;
@ -72,13 +70,13 @@
pageSize: number;
};
};
platform: Array<{label: string, value: string}>
}
platform: Array<{ label: string; value: string }>;
}
export default defineComponent({
export default defineComponent({
name: 'apiV1ServerConfig',
components: {EditConfig},
setup(){
components: { EditConfig },
setup() {
const editDicRef = ref();
const state = reactive<TableDataState>({
platform: PLATFORM,
@ -100,23 +98,22 @@
editDicRef.value.openDialog(row);
};
const countList = () => {
gameGetLoginUrl(state.tableData.params).then(res => {
console.log("countList:", res);
gameGetLoginUrl(state.tableData.params).then((res) => {
console.log('countList:', res);
state.tableData.total = res.data.total || 1;
state.tableData.data = res.data.loginUrlList ?? [];
console.log("countList:", state.tableData);
})
console.log('countList:', state.tableData);
});
};
const delLoginUrl = (id: number) => {
gameDelLoginUrl({id: id}).then(res => {
countList()
})
gameDelLoginUrl({ id: id }).then((res) => {
countList();
});
};
const reloadServer = () => {
gameReloadServer({}).then(res => {
})
gameReloadServer({}).then((res) => {});
};
const handleCurrentChange = (val: number) => {
state.tableData.params.pageNum = val;
@ -136,20 +133,20 @@
...toRefs(state),
};
},
});
});
</script>
<style scoped lang="scss">
.el-form-item {
.el-form-item {
display: -moz-flex;
vertical-align: middle;
margin-right: 32px;
}
}
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
background: #ffffd5;
}
}
::v-deep .el-table .el-table--enable-row-hover .el-table__body tr:hover > td {
::v-deep .el-table .el-table--enable-row-hover .el-table__body tr:hover > td {
background: inherit;
}
}
</style>

19
src/views/gameRole/role/index.vue

@ -37,9 +37,6 @@
查询
</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="tableData.account.uid" type="primary" class="ml10" @click="noticePop"> 退出并选择删除排行榜 </el-button>
</el-form-item>
</el-form>
</div>
</el-card>
@ -58,7 +55,8 @@
</el-button>
</template>
<div v-show="item.listShow && tableData.data[0]">
<el-form :inline="true"> id{{ tableData.account.StringId }}</el-form>
<el-form :inline="true"> id{{ tableData.account.StringId }}
<el-button v-if="tableData.account.uid" size="small" style="margin-left: 100px" type="primary" @click="noticePop"> 退出并选择删除排行榜 </el-button></el-form>
<el-form :inline="true"> uid{{ tableData.account.uid }}</el-form>
<el-form :inline="true"> 账号{{ tableData.account.AccountName }}</el-form>
<el-form :inline="true"> 账号类型{{ tableData.account.AccountType }}</el-form>
@ -633,7 +631,7 @@
import { h, toRefs, reactive, onMounted, defineComponent } from 'vue';
import { deleteGameRank } from '/@/api/game/gameConfig';
import { gameLoginOut, gameLoginOutLog, gameItemRecord } from '/@/api/game';
import { gameRoleList, gameAccountList} from '/@/api/game/basicinfo';
import { gameRoleList, gameAccountList } from '/@/api/game/basicinfo';
import { gameOrderList } from '/@/api/game/order';
import { gameNoticePop } from '/@/api/game/notice';
import SeasonConfigCategory from '/@/api/config/SeasonConfigCategory.json';
@ -853,7 +851,7 @@ export default defineComponent({
state.tableData.data = roleList;
});
state.queryParams.orderAccount = list[0].AccountName;
state.queryParams.channel = getCompleteChannel(list[0].Channel, list[0].SubChannel);
state.queryParams.orderChannel = getCompleteChannel(list[0].Channel, list[0].SubChannel);
// console.log('gameRoleList: ', list[0],list[0].Channel, list[0].SubChannel, state.queryParams, getCompleteChannel(list[0].Channel+"", list[0].SubChannel+""));
orderList();
loginOut();
@ -865,7 +863,8 @@ export default defineComponent({
const orderList = () => {
state.tableData.orderData = [];
gameOrderList({
account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
id: state.tableData.account.StringId,
// account: getAccount(state.queryParams.orderAccount, state.queryParams.orderChannel),
pageNum: state.queryParams.orderPageNum,
pageSize: state.queryParams.orderPageSize,
}).then((res) => {
@ -898,7 +897,7 @@ export default defineComponent({
const loginOut = () => {
state.tableData.loginOutData = [];
gameLoginOut({
account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
account: getAccount(state.queryParams.orderAccount, state.queryParams.orderChannel),
serverId: state.queryParams.serverId,
id: state.queryParams.id,
pageSize: state.queryParams.loginOutPageSize,
@ -916,7 +915,7 @@ export default defineComponent({
const loginOutLog = () => {
state.tableData.loginOutLogData = [];
gameLoginOutLog({
account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
account: getAccount(state.queryParams.orderAccount, state.queryParams.orderChannel),
id: state.queryParams.id,
serverId: state.queryParams.serverId,
pageSize: state.queryParams.loginOutLogPageSize,
@ -934,7 +933,7 @@ export default defineComponent({
const itemRecord = () => {
state.tableData.itemRecordData = [];
gameItemRecord({
account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
account: getAccount(state.queryParams.orderAccount, state.queryParams.orderChannel),
id: state.queryParams.id,
serverId: state.queryParams.serverId,
pageSize: state.queryParams.itemPageSize,

412
src/views/serverBattlePass/update/index.vue

@ -0,0 +1,412 @@
<template>
<div class="system-edit-post-container">
<el-form size="default" label-width="80px">
<el-card shadow="hover" header="战令配置">
<template #header>
战令配置
<el-button v-show="item.show === false" @click="item.show = true" class="button-caret" type="text">
<el-icon>
<ele-CaretBottom />
</el-icon>
</el-button>
<el-button v-show="item.show === true" @click="item.show = false" class="button-caret" type="text">
<el-icon>
<ele-CaretTop />
</el-icon>
</el-button>
</template>
<div v-show="item.show">
<div class="flex-warp">
<el-form-item label="期数" prop="periodId">
<el-select class="m-2" placeholder="选择期数" filterable v-model="props.periodId">
<el-option v-for="item in unique(battlePassConfig)" :key="item.PeriodId" :label="item.PeriodId + '期'" :value="item.PeriodId" />
</el-select>
</el-form-item>
<el-form-item label="开始时间" prop="beginTime">
<el-date-picker type="date" size="default" v-model="props.beginTime" placeholder="开始时间" format="YYYY-MM-DD" value-format="x" />
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker type="date" size="default" v-model="props.endTime" placeholder="结束时间" format="YYYY-MM-DD" value-format="x" />
</el-form-item>
<el-button size="default" :type="checkTimeColor" :disabled="query.serverIds.length == 0" class="ml10" @click="onCheckTime">
<div v-if="checkTime === 1">
<el-icon>
<ele-Check />
</el-icon>
</div>
<div v-else-if="checkTime === 2">
<el-icon>
<ele-Close />
</el-icon>
</div>
检查时间
</el-button>
<el-button size="default" class="ml10" @click="onSubmit" :disabled="query.serverIds.length == 0 || checkTime != 1">
<div v-if="checkTime === 1">
<el-icon>
<ele-Check />
</el-icon>
</div>
<div v-else-if="checkTime === 2">
<el-icon>
<ele-Close />
</el-icon>
</div>
<el-icon>
<ele-Promotion />
</el-icon>
发布
</el-button>
</div>
<div class="flex-warp">
<el-form-item prop="periodId" label="显示期数">
<el-select size="default" placeholder="请选择显示期数" filterable v-model="query.periodId" @change="getProp">
<el-option label="全部" value="" />
<el-option v-for="item in unique(battlePassConfig)" :key="item.PeriodId" :label="item.PeriodId + '期'" :value="item.PeriodId" />
</el-select>
</el-form-item>
</div>
<div class="flex-warp">
<el-table
ref="tableRef"
:data="servers"
:span-method="objectSpanMethod"
style="width: 100%"
stripe
border
@selection-change="handleSelectionChange"
row-key="id"
>
<el-table-column prop="platform" label="平台" show-overflow-tooltip width="80">
<template #default="scope">
<div v-if="scope.row.sort == 0">其他</div>
<div v-else-if="scope.row.sort == 1">ios</div>
<div v-else-if="scope.row.sort == 2">官服</div>
<div v-else-if="scope.row.sort == 3">渠道</div>
<div v-else>其他</div>
</template>
</el-table-column>
<el-table-column prop="area" label="区服编号" width="85">
<template #default="scope"> {{ scope.row.area }}</template>
</el-table-column>
<el-table-column prop="name" label="服务器名称" show-overflow-tooltip width="200" />
<el-table-column prop="periodId" label="当前期数" show-overflow-tooltip width="85" />
<el-table-column prop="state" label="状态" show-overflow-tooltip width="100" />
<el-table-column prop="StartTime" label="开始时间" show-overflow-tooltip width="200" />
<el-table-column prop="EndTime" label="结束时间" show-overflow-tooltip width="200" />
<el-table-column type="selection" width="55" :selectable="selectable" />
<el-table-column prop="" label="开关" show-overflow-tooltip width="100" />
<el-table-column prop="" label="操作" width="100">
<template #default="scope">
<el-button size="default" class="ml10" @click="onUpdate(scope.row)"> 修改</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-card>
</el-form>
</div>
</template>
<script lang="ts">
import { defineComponent, onMounted, reactive, ref, toRefs, unref } from 'vue';
import { gameGMCheckBattlePassCheck, gameGMGetBattlePass, gameGMInsertBattlePass } from '/@/api/game/gameConfig';
import BattlePassConfigCategory from '/@/api/config/BattlePassConfigCategory.json';
import { ElLoading, ElMessage } from 'element-plus';
import type { TableInstance } from 'element-plus';
import { uniquePeriodId, zeroFill } from '/@/utils/utils';
import { serverList } from '/@/utils/game';
interface Props {
id: string;
periodId: string;
beginTime: number;
endTime: number;
}
interface TableDataState {
props: Props;
query: object;
battlePassList: object[];
centerDialogVisible: boolean;
checkTime: number;
checkTimeColor: string;
check: boolean;
lastDate: number;
curDate: number;
selectModel: string;
battlePassConfig: object;
servers: object;
}
interface SpanMethodProps {
row: object;
column: object;
rowIndex: number;
columnIndex: number;
}
export default defineComponent({
name: 'systemServerBattlePassUpdate',
setup: function () {
const formRef = ref<HTMLElement | null>(null);
const tableRef = ref();
let date = new Date();
let getBeginTime = (date: number) => {
return new Date(date).setHours(0, 0, 0);
};
let getEndTime = (date: number) => {
return new Date(date + 20 * 24 * 60 * 60 * 1000).setHours(0, 0, 0);
};
const state = reactive<TableDataState>({
lastDate: 0,
curDate: 0,
check: false,
item: { topShow: true, show: true, giftShow: true },
query: {
serverIds: [],
periodId: '',
},
props: {
id: '',
periodId: BattlePassConfigCategory[0].PeriodId,
beginTime: getBeginTime(date.getTime()),
endTime: getEndTime(date.getTime()),
},
battlePass: [],
battlePassConfig: BattlePassConfigCategory,
centerDialogVisible: false,
checkTime: 0,
checkTimeColor: 'primary',
selectModel: '',
servers: [],
});
const onCheckTime = () => {
if (!state.props.beginTime || !state.props.endTime) {
ElMessage.error('活动时间未填写完整');
return;
}
let now = new Date();
if (new Date(state.props.endTime) < now) {
ElMessage.error('结束时间小于当前时间,请检查!');
return;
}
if (new Date(state.props.endTime) < new Date(state.props.beginTime)) {
ElMessage.error('结束时间小于开始时间,请检查!');
return;
}
if (state.query.serverIds.length == 0) {
ElMessage.error('未选择服务器,请检查!');
return;
}
const loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
});
console.log(state.query.serverIds);
for (let i in state.query.serverIds) {
let data = {
BeginTime: state.props.beginTime,
EndTime: state.props.endTime,
Server: state.query.serverIds[i],
PeriodId: state.props.periodId,
};
onCheck(loading, data);
}
if (state.checkTime != 0) {
state.checkTime = 2;
}
};
const onCheck = (loading, data) => {
gameGMCheckBattlePassCheck(data)
.then((res) => {
console.log('onCheckTime:', res);
if (!res || Number(res.code) != 0 || !res.data || res.data.total > 0) {
loading.close();
// state.checkTime = 2;
state.checkTimeColor = 'danger';
ElMessage.error('活动时间重合');
console.log(tableRef.value);
var value = state.servers.find((r) => r.Id == data.Server);
tableRef.value.toggleRowSelection(value, false);
state.query.serverIds.splice(state.query.serverIds.indexOf(data.Server), 1);
return;
}
loading.close();
state.checkTime = 1;
state.checkTimeColor = 'primary';
ElMessage.success('验证通过');
})
.catch(() => {
loading.close();
state.checkTimeColor = 'danger';
console.log(tableRef);
var value = state.servers.find((r) => r.Id == data.Server);
tableRef.value.toggleRowSelection(value, false);
state.query.serverIds.splice(state.query.serverIds.indexOf(data.Server), 1);
});
};
const onSubmit = () => {
const loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
});
state.centerDialogVisible = false;
const formWrap = unref(formRef) as any;
if (!formWrap) return;
formWrap.validate((valid: boolean) => {
console.log('monthly:', valid, state.props);
if (!valid) {
ElMessage.error('有未配置完成的部分,请检查!');
return;
}
let monthly = onState();
console.log('monthly0:', monthly);
if (!monthly.BeginTime || !monthly.EndTime) {
ElMessage.error('有未配置完成的部分1,请检查!');
return;
}
console.log('monthly1:', monthly);
gameGMInsertBattlePass(monthly)
.then(() => {
ElMessage.success('活动更新成功');
state.check = false;
})
.finally(() => {
loading.close();
});
});
};
onMounted(() => {
state.props.id = '';
state.rows = {};
serverList().then((res) => {
state.servers = res;
for (let i in state.servers) {
let server = state.servers[i];
if (!state.rows[server.sort]) {
state.rows[server.sort] = { num: 0, id: server.id };
}
state.rows[server.sort].num++;
if (state.rows[server.sort].id > server.id) {
state.rows[server.sort].id = server.id;
}
}
console.log('serverList:', res);
});
getProp();
});
const onState = () => {
let data = {
BeginTime: state.props.beginTime,
EndTime: state.props.endTime,
serverIds: state.query.serverIds,
PeriodId: state.props.periodId,
};
console.log('data: ', data);
return data;
};
const getProp = () => {
const loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
});
gameGMGetBattlePass({ periodId: state.query.periodId })
.then((res) => {
console.log('gameGMGetBattlePass: ', res);
if (res.code == 0 && res.data && res.data.list) {
}
})
.finally(() => {
loading.close();
});
};
const unique = (arr) => {
return uniquePeriodId(arr);
};
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (columnIndex === 0) {
if (state.rows[row.sort].id == row.id) {
return {
rowspan: state.rows[row.sort].num,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}
};
const handleSelectionChange = (selection: any[]) => {
state.checkTime = 0;
state.query.serverIds = selection.map((item) => item.id);
console.log(state.query.serverId, selection);
};
// const getSelectionRows = (selection: any[]) => {
// state.checkTime = 0;
// state.query.serverIds = selection.map((item) => item.id);
// console.log(state.query.serverId, selection);
// };
const selectable = (row) => ![].includes(row.id);
return {
selectable,
handleSelectionChange,
objectSpanMethod,
onSubmit,
formRef,
unique,
onCheckTime,
getProp,
zeroFill,
...toRefs(state),
};
},
});
</script>
<style scoped lang="scss">
.table-item {
margin-top: 10px;
margin-bottom: -10px;
}
.box-card .el-card__header {
background-color: #409eff;
color: #fff;
}
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
background: #f0ffd5;
}
.warning-row {
background: #f0ffd5ff;
}
.white-row {
background: #ffffff;
}
::v-deep .warning-row .el-table__body tr {
background-color: #f0ffd5ff;
}
::v-deep .warning-row .el-table--enable-row-hover .el-table__body tr:hover > td {
background-color: inherit;
}
::v-deep .warning-row .el-table__cell {
background-color: #f0ffd5ff;
}
</style>
Loading…
Cancel
Save