wjx 5 giorni fa
parent
commit
a3cabf2178

+ 37 - 6
src/pages/gameDataStatistics/player/chatList/index.tsx

@@ -1,6 +1,6 @@
 import Tables from '@/components/Tables';
 import { useAjax } from '@/Hook/useAjax';
-import { getChatGameListApi, getChatListApi } from '@/services/gameData/player';
+import { getChatGameListApi, getChatListApi, getServerListApi } from '@/services/gameData/player';
 import { Button, Card, Col, DatePicker, Form, Input, Row, Select, Space } from 'antd';
 import React, { useEffect, useState } from 'react';
 import style from '../../components/TableData/index.less'
@@ -12,10 +12,14 @@ const ChatList: React.FC = () => {
 
     /*********************************/
     const [form] = Form.useForm()
+    const supperGameId = Form.useWatch('supperGameId', form)
     const [queryFrom, setQueryFrom] = React.useState<{ supperGameId: number, pageNum: number, pageSize: number, roleId?: string, roleName?: string, chatStart?: string, chatEnd?: string }>({ supperGameId: 0, pageNum: 1, pageSize: 20 })
     const [gameList, setGameList] = useState<DefaultOptionType[]>([])
+    const [serverList, setServerList] = useState<DefaultOptionType[]>([])
+
     const getChatGameList = useAjax(() => getChatGameListApi())
     const getChatList = useAjax((params) => getChatListApi(params))
+    const getServerList = useAjax((params) => getServerListApi(params))
     /*********************************/
 
     useEffect(() => {
@@ -29,12 +33,24 @@ const ChatList: React.FC = () => {
         })
     }, [])
 
+
+
     useEffect(() => {
         if (queryFrom.supperGameId) {
             getChatList.run(queryFrom)
         }
     }, [queryFrom])
 
+    useEffect(() => {
+        if (supperGameId) {
+            getServerList.run({ supperGameId }).then(res => {
+                if (res) {
+                    setServerList(Object.keys(res).map(key => ({ label: res[key], value: key })))
+                }
+            })
+        }
+    }, [supperGameId])
+
     const onFinish = (data: any) => {
         const oldQueryFrom = JSON.parse(JSON.stringify(queryFrom))
         const { chatTime, ...params } = { ...oldQueryFrom, ...data, pageNum: 1 }
@@ -58,11 +74,11 @@ const ChatList: React.FC = () => {
         </div>
 
         <Space style={{ width: '100%' }} direction="vertical" size={10}>
-            <Form 
-                layout="inline" 
-                className='queryForm' 
-                name="basicGameChat" 
-                form={form} 
+            <Form
+                layout="inline"
+                className='queryForm'
+                name="basicGameChat"
+                form={form}
                 onFinish={onFinish}
             >
                 <Row gutter={[0, 6]}>
@@ -80,6 +96,21 @@ const ChatList: React.FC = () => {
                             options={gameList}
                         />
                     </Form.Item></Col>
+                    {supperGameId && <Col><Form.Item name='serverId'>
+                        <Select
+                            showSearch
+                            style={{ minWidth: 140 }}
+                            placeholder={'请选择区服'}
+                            filterOption={(input, option) =>
+                                (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                            }
+                            onChange={() => {
+                                form.setFieldsValue({ codeType: undefined })
+                            }}
+                            loading={getServerList?.loading}
+                            options={serverList}
+                        />
+                    </Form.Item></Col>}
                     <Col><Form.Item name='roleName'>
                         <Input placeholder="角色名称" allowClear style={{ width: 140 }} />
                     </Form.Item></Col>

+ 2 - 5
src/pages/user/login/index.tsx

@@ -181,7 +181,6 @@ const Login: React.FC<{}> = () => {
 	const logOut = () => {
 		setInitialState({ ...initialState, currentUser: undefined });
 		loginOut();
-
 	}
 	// 获取手机钉钉验证码
 	const getPhoneCode = () => {
@@ -245,18 +244,16 @@ const Login: React.FC<{}> = () => {
 							message.error('登录失败,请用趣程运营平台账号登录')
 							return
 						} else if (companyInfo?.length === 1) {
-							setCompanyHandle(res?.data?.companyRelationInfo[0].companyId)
+							setCompanyHandle(companyInfo[0].companyId)
 						} else {
 							setCompanyList(companyInfo)
 						}
-						// message.success('登录成功!');
 						return;
 					} else {
 						setIsLogin(false)
-						// codeRes.run()
 					}
-					// 如果失败去设置用户错误信息
 				} catch (error) {
+					// 如果失败去设置用户错误信息
 					setIsLogin(false)
 					message.error('登录失败,请重试!');
 				}

+ 12 - 0
src/services/gameData/player.ts

@@ -362,4 +362,16 @@ export async function getChatListApi(data: { pageNum: number, pageSize: number,
         method: 'POST',
         data
     });
+}
+
+/**
+ * 区服
+ * @param params 
+ * @returns 
+ */
+export async function getServerListApi(params: { supperGameId: number }) {
+    return request(api + `/manage/game/chat/game/server/list`, {
+        method: 'GET',
+        params
+    });
 }

+ 1 - 1
src/services/login.ts

@@ -68,7 +68,7 @@ export async function getNoteCode(phone: string) {
 }
 // 手机登录
 export async function phoneLogin(params: { phone: string, code: string }) {
-  return request(erpApi + `/erp/user/dCodeLogin `, {
+  return request(erpApi + `/erp/user/dCodeLogin`, {
     method: 'POST',
     data: params
   })