新增游戏管理后台
This commit is contained in:
20
src/api/gameAdmin/gameAdmin.js
Normal file
20
src/api/gameAdmin/gameAdmin.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import request from '@/utils/request';
|
||||
import { genQueryParam } from '@/utils/maintainer';
|
||||
|
||||
// 获取游戏列表
|
||||
export const mgList = query => {
|
||||
return request({
|
||||
url: '/admin/miniGame/statis/mgList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 游戏编辑
|
||||
export const save = query => {
|
||||
return request({
|
||||
url: '/admin/miniGame/save',
|
||||
headers:{"Content-Type": 'application/x-www-form-urlencoded'},
|
||||
method: 'post',
|
||||
data: query
|
||||
});
|
||||
};
|
@@ -3,16 +3,17 @@
|
||||
<!-- 查询 -->
|
||||
<div class="inquire" style="display: inline-block; margin-right: 20px">
|
||||
<span class="demonstration">地区:</span>
|
||||
<el-select v-model="inquire.value" placeholder="请选择">
|
||||
<el-select v-model="inquire.partitionFlag" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:key="item.partitionFlag"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:value="item.partitionFlag"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<!-- 查询按钮 -->
|
||||
<el-button class="primary" type="primary" @click="getData()"
|
||||
>查询</el-button
|
||||
@@ -25,21 +26,64 @@
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="familyName" align="center" label="游戏ID" />
|
||||
<el-table-column prop="erbanNo" align="center" label="游戏名称" />
|
||||
<el-table-column prop="nick" align="center" label="所属地区" />
|
||||
<el-table-column prop="goldIncome" align="center" label="是否展示" />
|
||||
<el-table-column
|
||||
prop="diamondRemain"
|
||||
align="center"
|
||||
label="展示房间类型"
|
||||
/>
|
||||
<el-table-column prop="micRemainTime" align="center" label="是否限制" />
|
||||
<el-table-column prop="micRemainTime" align="center" label="可开启角色" />
|
||||
<el-table-column prop="mgId" align="center" label="游戏ID" />
|
||||
|
||||
<el-table-column prop="name" align="center" label="游戏名称" />
|
||||
|
||||
<el-table-column prop="partitionFlag" align="center" label="所属地区">
|
||||
<template v-slot="scope">{{
|
||||
scope.row.partitionFlag == 1
|
||||
? "英语区"
|
||||
: scope.row.partitionFlag == 2
|
||||
? "阿拉伯语区"
|
||||
: scope.row.partitionFlag == 4
|
||||
? "华语区"
|
||||
: "全部"
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="isShow" align="center" label="是否展示">
|
||||
<template v-slot="scope">{{
|
||||
scope.row.isShow == 0 ? "否" : scope.row.isShow == 1 ? "是" : "/"
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column prop="roomFlag" align="center" label="展示房间类型">
|
||||
<template v-slot="scope">{{
|
||||
(scope.row.roomFlag & 1) != 0
|
||||
? "游戏房"
|
||||
: (scope.row.roomFlag & 2) != 0
|
||||
? "牌照房"
|
||||
: (scope.row.roomFlag & 4) != 0
|
||||
? "普通房"
|
||||
: "/"
|
||||
}}</template>
|
||||
</el-table-column> -->
|
||||
|
||||
<el-table-column prop="isAuthority" align="center" label="是否限制">
|
||||
<template v-slot="scope">{{
|
||||
scope.row.isAuthority == 0
|
||||
? "否"
|
||||
: scope.row.isAuthority == 1
|
||||
? "是"
|
||||
: "/"
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="roleFlag" align="center" label="可开启角色">
|
||||
<template v-slot="scope">{{
|
||||
(scope.row.roleFlag & 1) != 0
|
||||
? "房主"
|
||||
: (scope.row.roleFlag & 2) != 0
|
||||
? "管理员"
|
||||
: "/"
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="edi(scope.row)"
|
||||
@click="ediClick(scope)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
@@ -48,6 +92,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog v-model="editDialog" title="编辑" width="28%" center>
|
||||
<!-- 游戏ID -->
|
||||
@@ -69,7 +114,7 @@
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px"
|
||||
class="col-sm-2 control-label"
|
||||
>游戏昵称</span
|
||||
>游戏昵称(中文)</span
|
||||
>
|
||||
<el-input
|
||||
v-model="ediObj.gameNick"
|
||||
@@ -98,7 +143,7 @@
|
||||
class="col-sm-2 control-label"
|
||||
>是否展示</span
|
||||
>
|
||||
<el-select v-model="ediObj.value" placeholder="请选择">
|
||||
<el-select v-model="ediObj.value1" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in ediObj.options"
|
||||
:key="item.value"
|
||||
@@ -109,7 +154,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<!-- 是否限制 -->
|
||||
<div v-show="ediObj.value" style="margin-bottom: 25px; margin-top: 10px">
|
||||
<div v-show="ediObj.value1" style="margin-bottom: 25px; margin-top: 10px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px"
|
||||
class="col-sm-2 control-label"
|
||||
@@ -126,7 +171,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<!-- 可开启角色 -->
|
||||
<div v-show="ediObj.value2" style="margin-bottom: 25px; margin-top: 10px">
|
||||
<div v-show="ediObj.value1" style="margin-bottom: 25px; margin-top: 10px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px"
|
||||
class="col-sm-2 control-label"
|
||||
@@ -146,9 +191,10 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
style="margin-top: 10px; display: none"
|
||||
class="paginationClass"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
@@ -161,7 +207,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import {} from "@/api/nobleman/nobleman";
|
||||
import { mgList, save } from "@/api/gameAdmin/gameAdmin";
|
||||
// @ts-ignore
|
||||
import { dateFormat } from "@/utils/system-helper";
|
||||
// @ts-ignore
|
||||
@@ -173,51 +219,56 @@ export default {
|
||||
loading: false,
|
||||
//查询所需条件对象
|
||||
inquire: {
|
||||
value: "",
|
||||
partitionFlag: "",
|
||||
time: "",
|
||||
},
|
||||
// 选择器
|
||||
options: [
|
||||
{
|
||||
value: "1",
|
||||
label: "华语区",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
partitionFlag: 1,
|
||||
label: "英语区",
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
partitionFlag: 2,
|
||||
label: "阿拉伯语区",
|
||||
},
|
||||
{
|
||||
partitionFlag: 4,
|
||||
label: "华语区",
|
||||
},
|
||||
{
|
||||
partitionFlag: "",
|
||||
label: "全部",
|
||||
},
|
||||
],
|
||||
// 表格
|
||||
tableData: [],
|
||||
// 控制编辑弹窗
|
||||
editDialog: true,
|
||||
editDialog: false,
|
||||
editDiaData: {},
|
||||
ediObj: {
|
||||
gameId: "",
|
||||
gameNick: "",
|
||||
checkList: [],
|
||||
value: false,
|
||||
value1: 0,
|
||||
options: [
|
||||
{
|
||||
value: true,
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
{
|
||||
value: false,
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
],
|
||||
value2: false,
|
||||
value2: 0,
|
||||
options2: [
|
||||
{
|
||||
value: true,
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
{
|
||||
value: false,
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
],
|
||||
@@ -244,11 +295,101 @@ export default {
|
||||
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
console.log(this.inquire);
|
||||
this.loading = false;
|
||||
mgList({ partitionFlag: this.inquire.partitionFlag }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.loading = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 编辑按钮
|
||||
ediClick(scope) {
|
||||
this.editDialog = true;
|
||||
this.editDiaData = scope.row;
|
||||
var obj = this.editDiaData;
|
||||
this.ediObj.gameId = obj.mgId;
|
||||
this.ediObj.gameNick = JSON.parse(obj.name).zh;
|
||||
this.ediObj.checkList =
|
||||
obj.partitionFlag == 0 || obj.partitionFlag == ""
|
||||
? ["华语区", "英语区", "阿拉伯语区"]
|
||||
: obj.partitionFlag == 1
|
||||
? ["英语区"]
|
||||
: obj.partitionFlag == 2
|
||||
? ["阿拉伯区"]
|
||||
: ["华语区"];
|
||||
this.ediObj.value1 = obj.isShow == false ? 0 : 1;
|
||||
this.ediObj.value2 = obj.isAuthority;
|
||||
this.ediObj.checkList2 =
|
||||
(obj.roleFlag & 1) != 0
|
||||
? ["房主"]
|
||||
: (obj.roleFlag & 2) != 0
|
||||
? ["管理员"]
|
||||
: [];
|
||||
},
|
||||
// 确认编辑按钮
|
||||
editDialogClick() {
|
||||
console.log(this.ediObj);
|
||||
var obj = {
|
||||
mgId: this.ediObj.gameId,
|
||||
name: this.ediObj.gameNick,
|
||||
partitionFlag: this.districtFun(1),
|
||||
isShow: this.ediObj.value1,
|
||||
isAuthority: this.ediObj.value2,
|
||||
roleFlag: this.districtFun(2),
|
||||
};
|
||||
console.log(obj);
|
||||
save(obj).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.editDialog = false;
|
||||
this.getData();
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 计算数值
|
||||
districtFun(type) {
|
||||
var num = 0;
|
||||
var district;
|
||||
if (type == 1) {
|
||||
district = {
|
||||
华语区: 4,
|
||||
英语区: 1,
|
||||
阿拉伯语区: 2,
|
||||
};
|
||||
this.ediObj.checkList.forEach((res, i) => {
|
||||
num += district[res];
|
||||
});
|
||||
} else {
|
||||
district = {
|
||||
房主: 1,
|
||||
管理员: 2,
|
||||
};
|
||||
this.ediObj.checkList2.forEach((res, i) => {
|
||||
num += district[res];
|
||||
});
|
||||
}
|
||||
return num;
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange() {
|
||||
|
Reference in New Issue
Block a user