소스 검색

梳理并添加游戏配置

ssvfdn 3 달 전
부모
커밋
64b3133ba6

+ 22 - 0
apps/web-antd/src/api/game_control/game_config.ts

@@ -0,0 +1,22 @@
+import {requestClient} from "#/api/request";
+
+interface ApiResultListData {
+    data: Object;
+    status: number;
+    total: number;
+    list: Array<any>;
+}
+
+// interface ApiResultInfoData {
+//     data: Object;
+//     status: number;
+// }
+
+/**
+ * 获取玩家列表
+ */
+export async function getGameList(data:any) {
+    const params = new URLSearchParams(data); // 创建一个新的URLSearchParams对象
+    const queryString = params.toString(); // 转换为查询字符串
+    return requestClient.get<ApiResultListData>('/game/list?' + queryString);
+}

+ 1 - 1
apps/web-antd/src/api/player/player_list.ts

@@ -4,7 +4,7 @@ interface ApiResultListData {
     data: Object;
     status: number;
     total: number;
-    list: Array;
+    list: Array<any>;
 }
 
 interface ApiResultInfoData {

+ 4 - 0
apps/web-antd/src/locales/langs/zh-CN/common.json

@@ -0,0 +1,4 @@
+{
+    "placeholder": "请输入",
+    "placeholder_select": "请选择"
+}

+ 17 - 0
apps/web-antd/src/locales/langs/zh-CN/game_control.json

@@ -0,0 +1,17 @@
+{
+    "title": "游戏调控",
+    "game_config": "游戏配置",
+    "game": "游戏",
+    "game_list": {
+        "game_title": "游戏名称",
+        "game_en_title": "游戏英文名称",
+        "game_id": "游戏ID",
+        "game_rtp": "RTP设定",
+        "game_rtp_type": "RTP类型",
+        "buy_free": "购买免费游戏功能",
+        "max_gm": "倍数限制",
+        "bet_amount": "押注金额",
+        "game_status": "游戏维护开关",
+        "action": "操作"
+    }
+}

+ 0 - 0
apps/web-antd/src/locales/langs/zh-CN/playerdata.json → apps/web-antd/src/locales/langs/zh-CN/player_data.json


+ 1 - 1
apps/web-antd/src/router/routes/modules/dashboard.ts

@@ -5,7 +5,7 @@ import { $t } from '#/locales';
 const routes: RouteRecordRaw[] = [
   {
     meta: {
-      icon: 'lucide:layout-dashboard',
+      icon: 'solar:widget-5-linear',
       order: -1,
       title: $t('page.dashboard.title'),
     },

+ 29 - 0
apps/web-antd/src/router/routes/modules/game_control.ts

@@ -0,0 +1,29 @@
+import type { RouteRecordRaw } from 'vue-router';
+
+import { $t } from '#/locales';
+
+const routes: RouteRecordRaw[] = [
+    {
+        meta: {
+            icon: 'solar:gamepad-outline',
+            keepAlive: true,
+            order: 3,
+            title: $t('game_control.title'),
+        },
+        name: $t('game_control.game_config'),
+        path: '/game-control',
+        children: [
+            {
+                meta: {
+                    title: $t('game_control.game_config'),
+                    icon:'solar:gamepad-old-outline'
+                },
+                name: 'GameControlGameConfig',
+                path: '/game-control/game_config',
+                component: () => import('#/views/game_control/game_config/index.vue'),
+            },
+        ],
+    },
+];
+
+export default routes;

+ 7 - 6
apps/web-antd/src/router/routes/modules/playerdata.ts → apps/web-antd/src/router/routes/modules/player_data.ts

@@ -5,21 +5,22 @@ import { $t } from '#/locales';
 const routes: RouteRecordRaw[] = [
     {
         meta: {
-            icon: 'ic:baseline-view-in-ar',
+            icon: 'solar:user-broken',
             keepAlive: true,
             order: 2,
-            title: $t('playerdata.title'),
+            title: $t('player_data.title'),
         },
-        name: '玩家数据',
-        path: '/playerdata',
+        name: $t('player_data.player_list'),
+        path: '/player-data',
         children: [
             {
                 meta: {
-                    title: $t('playerdata.player_list'),
+                    title: $t('player_data.player_list'),
+                    icon:'solar:users-group-rounded-outline',
                 },
                 name: 'AntDesignPlayerList',
                 path: '/player-data/player-list',
-                component: () => import('#/views/playerdata/playerlist/index.vue'),
+                component: () => import('#/views/player_data/player_list/index.vue'),
             },
         ],
     },

+ 136 - 0
apps/web-antd/src/views/game_control/game_config/index.vue

@@ -0,0 +1,136 @@
+<script setup>
+import {Page} from "@vben/common-ui";
+import {Button, Card, Tag} from "ant-design-vue";
+import { useVbenForm } from '#/adapter/form';
+import {$t} from "@vben/locales";
+import { useVbenVxeGrid } from '#/adapter/vxe-table';
+import {getGameList} from "#/api/game_control/game_config.js";
+const [QueryForm] = useVbenForm({
+	// 默认展开
+	collapsed: false,
+	// 所有表单项共用,可单独在表单内覆盖
+	commonConfig: {
+		// 所有表单项
+		componentProps: {
+			class: 'w-full',
+		},
+	},
+	// 提交函数
+	handleSubmit: onSubmit,
+	// 垂直布局,label和input在不同行,值为vertical
+	// 水平布局,label和input在同一行
+	layout: 'horizontal',
+	schema: [
+		{
+			component: 'Select',
+			componentProps: {
+				allowClear: true,
+				filterOption: true,
+				options: [
+					{
+						label: '选项1',
+						value: '1',
+					},
+					{
+						label: '选项2',
+						value: '2',
+					},
+				],
+				placeholder: $t('common.placeholder_select'),
+				showSearch: true,
+			},
+			fieldName: 'options',
+			label: $t('game_control.game'),
+		},
+	],
+	// 是否可展开
+	showCollapseButton: true,
+	submitButtonOptions: {
+		content: '查询',
+	},
+	wrapperClass: 'grid-cols-1 md:grid-cols-2',
+});
+function onSubmit(values) {
+	// message.success({
+	// 	content: `form values: ${JSON.stringify(values)}`,
+	// });
+}
+
+const gridOptions = {
+	border: true,
+	stripe: true,
+	checkboxConfig: {
+		highlight: true,
+		// labelField: 'name',
+	},
+	columns: [
+		{ fixed: 'left',  title: '序号', type: 'seq', width: 50 },
+		{ field: 'title', title: $t('game_control.game_list.game_title'), width: 150 },
+		{ field: 'title_en', title:  $t('game_control.game_list.game_en_title'), width: 200},
+		{ field: 'game_id', title: $t('game_control.game_list.game_id'), width: 140 },
+		{ field: 'rtp', title: $t('game_control.game_list.game_rtp'), width: 140},
+		{ field: 'rtp_type_text', title: $t('game_control.game_list.game_rtp_type'), width: 140},
+		{ field: 'free_game_status', title: $t('game_control.game_list.buy_free'), width: 150},
+		{ field: 'max_multiple_count', title: $t('game_control.game_list.max_gm'), width: 150},
+		{ field: 'deposit_list', title: $t('game_control.game_list.bet_amount'), width: 120},
+		{ field: 'status_text', title: $t('game_control.game_list.game_status'), width: 120},
+		{ fixed: 'right', title: $t('game_control.game_list.action'), width: 100, slots: {default:'action'}},
+	],
+	exportConfig: {},
+	// height: 'auto', // 如果设置为 auto,则必须确保存在父节点且不允许存在相邻元素,否则会出现高度闪动问题
+	keepSource: true,
+	proxyConfig: {
+		ajax: {
+			query: async ({ page }) => {
+				let form = {
+					// ...filterData,
+					page: page.currentPage,
+					limit: page.pageSize,
+				};
+				const list = await getGameList(form);
+				return {
+					total: list.total,
+					items: list.list
+				}
+			},
+		},
+	},
+	rowConfig: {
+		isHover: true,
+	},
+	toolbarConfig: {
+		custom: true,
+		export: true,
+		// import: true,
+		refresh: true,
+		zoom: true,
+	},
+};
+
+const [Grid, gridApi] = useVbenVxeGrid({
+	gridOptions,
+});
+
+</script>
+
+<template>
+	<Page>
+		<Card class="mb-5">
+			<QueryForm />
+		</Card>
+		<Card>
+			<div class="vp-raw w-full">
+				<Grid>
+					<template #action="{ row }">
+						<Button type="link">查看配置</Button>
+						<Button type="link">编辑配置</Button>
+					</template>
+				</Grid>
+			</div>
+		</Card>
+	</Page>
+</template>
+
+<style scoped>
+
+</style>

+ 22 - 24
apps/web-antd/src/views/playerdata/playerlist/index.vue → apps/web-antd/src/views/player_data/player_list/index.vue

@@ -30,19 +30,19 @@ const gridOptions = {
 	},
 	columns: [
 		{ fixed: 'left',  title: '序号', type: 'seq', width: 50 },
-		{ field: 'user_id', title: $t('playerdata.playlist.user_id'), width: 100 },
-		{ field: 'uname', title:  $t('playerdata.playlist.uname'), width: 120, slots: {default:'uname'}},
-		{ field: 'nickname', title: $t('playerdata.playlist.nickname'), width: 140 },
-		{ field: 'status_text', title: $t('playerdata.playlist.status'), width: 100, slots: {default:'status'} },
-		{ field: 'today_win_amount', title: $t('playerdata.playlist.today_win'), width: 100, slots: { default: 'today-win-amount' },},
-		{ field: 'history_win_amount', title: $t('playerdata.playlist.history_win'), width: 100, slots: { default: 'history-win-amount' }},
-		{ field: 'today_bet_amount', title: $t('playerdata.playlist.today_bet'), width: 100},
-		{ field: 'balance', title: $t('playerdata.playlist.balance'), width: 120},
-		{ field: 'adjust_status_text', title: $t('playerdata.playlist.regulation_status'), width: 100, slots: {default: 'adjust-status'}},
-		{ field: 'today_login_count', title: $t('playerdata.playlist.today_login_count'), width: 100},
-		{ field: 'history_login_count', title: $t('playerdata.playlist.history_login_count'), width: 100},
-		{ field: 'login_ip', title: $t('playerdata.playlist.login_ip'), width: 140},
-		{ field: 'reg_ip', title: $t('playerdata.playlist.reg_ip'), width: 140},
+		{ field: 'user_id', title: $t('player_data.playlist.user_id'), width: 100 },
+		{ field: 'uname', title:  $t('player_data.playlist.uname'), width: 120, slots: {default:'uname'}},
+		{ field: 'nickname', title: $t('player_data.playlist.nickname'), width: 140 },
+		{ field: 'status_text', title: $t('player_data.playlist.status'), width: 100, slots: {default:'status'} },
+		{ field: 'today_win_amount', title: $t('player_data.playlist.today_win'), width: 100, slots: { default: 'today-win-amount' },},
+		{ field: 'history_win_amount', title: $t('player_data.playlist.history_win'), width: 100, slots: { default: 'history-win-amount' }},
+		{ field: 'today_bet_amount', title: $t('player_data.playlist.today_bet'), width: 100},
+		{ field: 'balance', title: $t('player_data.playlist.balance'), width: 120},
+		{ field: 'adjust_status_text', title: $t('player_data.playlist.regulation_status'), width: 100, slots: {default: 'adjust-status'}},
+		{ field: 'today_login_count', title: $t('player_data.playlist.today_login_count'), width: 100},
+		{ field: 'history_login_count', title: $t('player_data.playlist.history_login_count'), width: 100},
+		{ field: 'login_ip', title: $t('player_data.playlist.login_ip'), width: 140},
+		{ field: 'reg_ip', title: $t('player_data.playlist.reg_ip'), width: 140},
 		// { field: 'releaseDate', formatter: 'formatDateTime', title: 'DateTime' },
 	],
 	exportConfig: {},
@@ -156,11 +156,11 @@ const playerInfo = (row) => {
 							>
 								<Input-Group compact>
 									<Select name="search_type" v-model:value="formData.search_type"  style="width: 40%">
-										<Select-Option value="uname">{{$t('playerdata.search.uname')}}</Select-Option>
-										<Select-Option value="nickname">{{$t('playerdata.search.nickname')}}</Select-Option>
-										<Select-Option value="user_id">{{$t('playerdata.search.user_id')}}</Select-Option>
+										<Select-Option value="uname">{{$t('player_data.search.uname')}}</Select-Option>
+										<Select-Option value="nickname">{{$t('player_data.search.nickname')}}</Select-Option>
+										<Select-Option value="user_id">{{$t('player_data.search.user_id')}}</Select-Option>
 									</Select>
-									<Input name="search_text" allowClear :placeholder="$t('playerdata.placeholder') + '' + $t('playerdata.search[\''+formData.search_type+'\']')" v-model:value="formData.search_text" style="width:60%"></Input>
+									<Input name="search_text" allowClear :placeholder="$t('player_data.placeholder') + '' + $t('player_data.search[\''+formData.search_type+'\']')" v-model:value="formData.search_text" style="width:60%"></Input>
 								</Input-Group>
 							</Form-Item>
 						</Space>
@@ -172,10 +172,10 @@ const playerInfo = (row) => {
 						>
 							<Input-Group compact>
 								<Select name="ip_type" v-model:value="formData.ip_type"  style="width: 40%">
-									<Select-Option value="login_ip">{{$t('playerdata.search.login_ip')}}</Select-Option>
-									<Select-Option value="reg_ip">{{$t('playerdata.search.reg_ip')}}</Select-Option>
+									<Select-Option value="login_ip">{{$t('player_data.search.login_ip')}}</Select-Option>
+									<Select-Option value="reg_ip">{{$t('player_data.search.reg_ip')}}</Select-Option>
 								</Select>
-								<Input name="ip_text" allowClear :placeholder="$t('playerdata.placeholder') + '' + $t('playerdata.search[\''+formData.ip_type+'\']')" v-model:value="formData.ip_text" style="width:60%"></Input>
+								<Input name="ip_text" allowClear :placeholder="$t('player_data.placeholder') + '' + $t('player_data.search[\''+formData.ip_type+'\']')" v-model:value="formData.ip_text" style="width:60%"></Input>
 							</Input-Group>
 						</Form-Item>
 					</Space>
@@ -192,15 +192,13 @@ const playerInfo = (row) => {
 				</Row>
 				<Row>
 					<Col :span="24" style="text-align: right">
-						<Button style="margin: 0 8px" @click="onResetSearch">{{$t('playerdata.search.restart')}}</Button>
-						<Button type="primary" html-type="submit">{{$t('playerdata.search.subimt')}}</Button>
+						<Button style="margin: 0 8px" @click="onResetSearch">{{$t('player_data.search.restart')}}</Button>
+						<Button type="primary" html-type="submit">{{$t('player_data.search.subimt')}}</Button>
 					</Col>
 				</Row>
 			</Form>
 		</Card>
 		<Card>
-			{{playerInfoId}}
-
 			<div class="vp-raw w-full">
 				<Grid>
 					<template #uname="{ row }">

+ 0 - 0
apps/web-antd/src/views/playerdata/playerlist/player_info.vue → apps/web-antd/src/views/player_data/player_list/player_info.vue


+ 1 - 0
apps/web-antd/tsconfig.json

@@ -2,6 +2,7 @@
   "$schema": "https://json.schemastore.org/tsconfig",
   "extends": "@vben/tsconfig/web-app.json",
   "compilerOptions": {
+      "noImplicitAny": false,
     "baseUrl": ".",
     "paths": {
       "#/*": ["./src/*"]