mac
6 days ago
10 changed files with 194 additions and 23 deletions
-
4.env
-
3env
-
6src/api/chat.ts
-
4src/app.css
-
21src/components/MyTable/index.tsx
-
14src/pages/chat/group-list/index.tsx
-
138src/pages/chat/group-member/index.tsx
-
8src/pages/chat/user-list/index.tsx
-
11src/route/routes.ts
-
8src/utils/index.ts
@ -1,2 +1,2 @@ |
|||||
REACT_APP_BASE_URL=http://162.254.37.253:8082/api/v1 |
|
||||
SKIP_PREFLIGHT_CHECK=true |
|
||||
|
SKIP_PREFLIGHT_CHECK=true |
||||
|
GENERATE_SOURCEMAP=false |
@ -1 +1,2 @@ |
|||||
REACT_APP_BASE_URL=http://14.29.101.215:30303/api/v1 |
|
||||
|
SKIP_PREFLIGHT_CHECK=true |
||||
|
GENERATE_SOURCEMAP=false |
@ -1,4 +1,8 @@ |
|||||
import $axios from '@/utils/axios' |
import $axios from '@/utils/axios' |
||||
|
|
||||
export const chat_userList = (params) => $axios.post('/admin/openImUserList', params) |
export const chat_userList = (params) => $axios.post('/admin/openImUserList', params) |
||||
export const chat_groupList = (params) => $axios.post('/admin/openImGroupList', params) |
|
||||
|
export const chat_groupList = (params) => $axios.post('/admin/openImGroupList', params) |
||||
|
export const chat_groupMemberList = (params) => $axios.post('/admin/openImGroupMemberList', params) |
||||
|
|
||||
|
export const chat_inviteUsetToGroup = (params) => $axios.post('/admin/openImInviteUserToGroup', params) |
||||
|
export const chat_kickGroup = (params) => $axios.post('/admin/openImKickGroup', params) |
@ -0,0 +1,138 @@ |
|||||
|
import { chat_groupMemberList, chat_inviteUsetToGroup, chat_userList } from "@/api/chat"; |
||||
|
import BuzzFaceURL from "@/components/buzzup/BuzzFaceURL"; |
||||
|
import MyTable from "@/components/MyTable"; |
||||
|
import { getTime, GRole, isPlatformId, joinGR } from "@/utils"; |
||||
|
import { Button, Modal, notification } from "antd"; |
||||
|
import React, { useRef, useState } from "react" |
||||
|
import { useParams, useHistory } from "react-router-dom" |
||||
|
|
||||
|
const GroupMember = () => { |
||||
|
|
||||
|
const hash = window.location.hash |
||||
|
const queryString = hash.split('?')[1]; |
||||
|
const queryParams = new URLSearchParams(queryString) |
||||
|
|
||||
|
const tableUserRef = useRef(null) |
||||
|
const tableMemberRef = useRef(null) |
||||
|
|
||||
|
const [visible, setVisible] = useState(false) |
||||
|
|
||||
|
const columns = [ |
||||
|
{ |
||||
|
title: '头像', |
||||
|
dataIndex: "", |
||||
|
width: 100, |
||||
|
render: (row) => ( |
||||
|
<div> |
||||
|
<BuzzFaceURL faceUrl={row.faceURL} name={row.nickname} /> |
||||
|
</div> |
||||
|
) |
||||
|
}, |
||||
|
{ |
||||
|
title: '用户ID', |
||||
|
dataIndex: "userID", |
||||
|
width: 150 |
||||
|
}, |
||||
|
{ |
||||
|
title: '群员角色', |
||||
|
dataIndex: "roleLevel", |
||||
|
width: 150, |
||||
|
render: (role) => <div>{GRole[role]}</div> |
||||
|
}, |
||||
|
{ |
||||
|
title: '群昵称', |
||||
|
dataIndex: "nickname", |
||||
|
width: 150 |
||||
|
}, |
||||
|
{ |
||||
|
title: '入群方式', |
||||
|
dataIndex: "joinSource", |
||||
|
width: 150, |
||||
|
render: (type) => <div>{joinGR[type]}</div> |
||||
|
}, |
||||
|
{ |
||||
|
title: '入群时间', |
||||
|
dataIndex: "joinTime", |
||||
|
render: (time) => <div>{getTime(time)}</div> |
||||
|
}, |
||||
|
{ |
||||
|
title: 'options', |
||||
|
fixed: 'right', |
||||
|
width: 200, |
||||
|
render: (item) => ( |
||||
|
<div className="" style={{ display: 'flex' }}> |
||||
|
<div style={{ fontSize: 12, color: '#1890ff', textWrap: 'nowrap', cursor: 'pointer' }} >设置群身份</div> |
||||
|
<div style={{ fontSize: 12, color: '#1890ff', marginLeft: 15, textWrap: 'nowrap', cursor: 'pointer' }}>禁言</div> |
||||
|
<div style={{ fontSize: 12, color: '#1890ff', marginLeft: 15, textWrap: 'nowrap', cursor: 'pointer' }}>移除</div> |
||||
|
</div> |
||||
|
) |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
const userColumnData = [ |
||||
|
{ |
||||
|
title: '头像', |
||||
|
dataIndex: "", |
||||
|
width: 100, |
||||
|
render: (row) => ( |
||||
|
<div> |
||||
|
<BuzzFaceURL size={30} faceUrl={row.faceURL} name={row.nickname} /> |
||||
|
</div> |
||||
|
) |
||||
|
}, |
||||
|
{ |
||||
|
title: '用户昵称', |
||||
|
dataIndex: "nickname", |
||||
|
width: 200 |
||||
|
}, |
||||
|
{ |
||||
|
title: '用户ID', |
||||
|
dataIndex: "userID", |
||||
|
}, |
||||
|
] |
||||
|
|
||||
|
const joinG = async () => { |
||||
|
const keys = tableUserRef.current.getSelectedKeys() |
||||
|
setVisible(false) |
||||
|
const res: any = await chat_inviteUsetToGroup({ |
||||
|
groupID: queryParams.get('id'), |
||||
|
reason: '', |
||||
|
invitedUserIDs: keys |
||||
|
}) |
||||
|
if (res.code === 0) { |
||||
|
tableMemberRef.current.update() |
||||
|
notification.success({ |
||||
|
message: '添加成功' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return ( |
||||
|
<> |
||||
|
<MyTable |
||||
|
header={ |
||||
|
<div style={{ marginBottom: 15, display: 'flex', justifyContent: 'flex-end' }}> |
||||
|
<Button type="primary" onClick={() => setVisible(true)}>添加群成员</Button> |
||||
|
</div> |
||||
|
} |
||||
|
ref={tableMemberRef} |
||||
|
apiFun={chat_groupMemberList} |
||||
|
columns={columns} |
||||
|
extraProps={{ |
||||
|
groupID: queryParams.get('id') |
||||
|
}} |
||||
|
/> |
||||
|
{visible && <Modal title="添加群成员" visible={visible} closable width="70%" onCancel={() => setVisible(false)} onOk={joinG}> |
||||
|
<MyTable |
||||
|
ref={tableUserRef} |
||||
|
rowKey={"userID"} |
||||
|
apiFun={chat_userList} |
||||
|
columns={userColumnData} |
||||
|
disableKeys={tableMemberRef.current && tableMemberRef.current.getTableData().map(v => v.userID)} |
||||
|
/> |
||||
|
</Modal>} |
||||
|
</> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
export default GroupMember |
Write
Preview
Loading…
Cancel
Save
Reference in new issue