+ {list.data.map((item: any, index: number) => {
return (
-
+
-
奉节中学期末考分析总结会议
+
{item.roomName}

-
2人
+
{item.onlineUserCount}人
-
-
252535356565
+
copyRoomNum(item.roomNum)} title='复制房间号'>
+
{item.roomNum}
-
+
+ {/* */}
)
})}
-
-
+
+
+
:
+
+
+
+ }
+
+
{
+ setList({
+ ...list,
+ pageIndex: e
+ })
+ }} pageSize={list.pageSize} />
+
+
+
+
+
+
+ {
+ const regex = /^[0-9 ]*$/;
+ if (regex.test(e.target.value)) {
+ setJoinRoomFrom(e.target.value)
+ }
+ }}
+ />
+
+
+
+
+
+
+
>
)
}
diff --git a/src/page/Home/User/index.module.scss b/src/page/Home/User/index.module.scss
index 4631c29..48c9ab3 100644
--- a/src/page/Home/User/index.module.scss
+++ b/src/page/Home/User/index.module.scss
@@ -63,7 +63,23 @@
>span {
color: #8B8787;
+ font-size: 20px;
}
}
}
+}
+
+.addUserModal {
+ >div {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20px;
+
+ >span {
+ flex-shrink: 0;
+ color: #EEEEEE;
+ width: 120px;
+ text-align: right;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/page/Home/User/index.tsx b/src/page/Home/User/index.tsx
index af8ff85..334bac4 100644
--- a/src/page/Home/User/index.tsx
+++ b/src/page/Home/User/index.tsx
@@ -1,55 +1,76 @@
import styles from '@/page/Home/User/index.module.scss'
import { useEffect, useState } from "react";
import Operation from '@/components/Operation';
-import { Button, Input, Table, Pagination } from "antd";
+import { Button, Input, Table, Pagination, Modal, message, Select } from "antd";
import { SearchOutlined } from '@ant-design/icons';
-import type { TableColumnsType } from 'antd';
-const columns: TableColumnsType = [
- {
- title: '姓名',
- dataIndex: 'name',
- },
- {
- title: '账号',
- dataIndex: 'account',
- },
- {
- title: '角色',
- dataIndex: 'role',
- },
- {
- title: '账号状态',
- dataIndex: 'status',
- render: (text) => {
- return (
-
{text}
- )
- },
- },
-];
-
-const data = [] as any;
-for (let i = 0; i < 46; i++) {
- data.push({
- key: i,
- name: `潇潇`,
- account: 5256589545,
- role: `教师`,
- status: `在线`,
- });
-}
+import { GetUserList, PostUser, PutUser, DeleteUser, PutUserPwd, GetRoleDpList } from '@/api/Home/User';
+import { md5 } from 'js-md5';
+const { Column } = Table
const User: React.FC = () => {
const [selectedRowKeys, setSelectedRowKeys] = useState
([]);
- useEffect(() => {
+ const [isCreateUser, setIsCreateUser] = useState(false);
+ const [list, setList] = useState({
+ data: [],
+ searchKeywod: '',
+ total: 0,
+ pageIndex: 1,
+ pageSize: 6,
+ })
+ const [roleList, setRoleList] = useState([])
+ const [addUserModal, setAddUserModal] = useState(false)
+ const [addUserFrom, setAddUserFrom] = useState({
+ Id: "",
+ Account: "",
+ RoleId: null,
+ Pwd: "",
+ UserName: ""
+ })
+ const [changeUserPawModal, setChangeUserPawModal] = useState(false)
+ const [changeUserPawFrom, setChangeUserPawFrom] = useState({
+ Pwd: "",
+ newPwd: '',
+ })
+ const [deleteUserPawModal, setDeleteUserPawModal] = useState(false)
- }, []);
- const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
- setSelectedRowKeys(newSelectedRowKeys);
- };
- const rowSelection = {
- selectedRowKeys,
- onChange: onSelectChange,
- };
+ useEffect(() => {
+ getUserList()
+ }, [list.pageIndex]);
+
+ const getUserList = async (): Promise => {
+ await GetUserList({
+ pageIndex: list.pageIndex,
+ pageSize: list.pageSize,
+ searchKeywod: list.searchKeywod,
+ }).then(res => {
+ if (res.code === 200) {
+ setList({
+ ...list,
+ total: res.data.total,
+ data: res.data.items.map((item: any) => {
+ return {
+ ...item,
+ key: item.id,
+ }
+ }),
+ })
+ }
+ })
+ }
+
+ const getRoleDpList = async (callBack: Function): Promise => {
+ await GetRoleDpList().then(res => {
+ if (res.code === 200) {
+ setRoleList(res.data.map((item: any) => {
+ return {
+ ...item,
+ value: item.id,
+ label: item.roleName
+ }
+ }))
+ callBack(true)
+ }
+ })
+ }
return (
<>
@@ -59,36 +80,313 @@ const User: React.FC = () => {
{
+ setSelectedRowKeys(newSelectedRowKeys);
+ }
+ }}
+ dataSource={list.data}
pagination={false}
- scroll={{ y: '64vh' }}
- style={{ width: '77.6vw', flexGrow: 1 }}
- />
+ scroll={{ y: '70vh' }}
+ style={{ width: '81.4vw', flexGrow: 1 }}
+ >
+
+
+
+ (
+ <>
+ {item.account}
+ >
+ )} />
+ (
+ <>
+
+
+ >
+ )} />
+
-
共653项数据
-
+
共{list.total}项数据
+
{
+ setList({
+ ...list,
+ pageIndex: e
+ })
+ }} pageSize={list.pageSize} current={list.pageIndex} hideOnSinglePage={true} />
+
+
+
+
+ 账号:
+ {
+ setAddUserFrom({
+ ...addUserFrom,
+ Account: e.target.value,
+ });
+ }}
+ />
+
+
+ 角色:
+
+ {isCreateUser ?
+ 密码:
+ {
+ setAddUserFrom({
+ ...addUserFrom,
+ Pwd: e.target.value,
+ });
+ }}
+ />
+
: null}
+
+ 用户名称:
+ {
+ setAddUserFrom({
+ ...addUserFrom,
+ UserName: e.target.value,
+ });
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+ 新密码:
+ {
+ setChangeUserPawFrom({
+ ...changeUserPawFrom,
+ Pwd: e.target.value,
+ });
+ }}
+ />
+
+
+ 确认密码:
+ {
+ setChangeUserPawFrom({
+ ...changeUserPawFrom,
+ newPwd: e.target.value,
+ });
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+ 是否确认删除该用户?
+
+
+
+
+
+
+
>
)
}
diff --git a/src/page/Home/index.tsx b/src/page/Home/index.tsx
index d20404c..74a693b 100644
--- a/src/page/Home/index.tsx
+++ b/src/page/Home/index.tsx
@@ -4,6 +4,7 @@ import { Outlet, useNavigate } from 'react-router-dom';
import { Popconfirm } from 'antd';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn'
+import { storage } from '@/utils';
dayjs.locale('zh-cn');
type navListType = {
title: string;
@@ -31,6 +32,7 @@ const Home: React.FC = () => {
path: '/home/user'
},
]);
+ const [userInfo, setUserInfo] = useState({})
const [dateInfo, setDateInfo] = useState<{
work: string;
time: string;
@@ -41,6 +43,10 @@ const Home: React.FC = () => {
specific: '',
})
useEffect(() => {
+ const user = JSON.parse(storage.getItem('user') as string);
+ if (user) {
+ setUserInfo(user)
+ }
const updateTime = () => {
setDateInfo({
work: dayjs().format('ddd'),
@@ -76,7 +82,7 @@ const Home: React.FC = () => {
- 欢迎您,u0001
+ 欢迎您,{userInfo?.userName}

diff --git a/src/page/Login/index.tsx b/src/page/Login/index.tsx
index 3fb736c..67f059b 100644
--- a/src/page/Login/index.tsx
+++ b/src/page/Login/index.tsx
@@ -2,13 +2,15 @@
import styles from '@/page/Login/index.module.scss'
import { useEffect, useState } from "react";
import { useNavigate } from 'react-router-dom';
-import { Input, Button, Checkbox } from "antd"
+import { Input, Button, Checkbox, message } from "antd"
import { storage } from '@/utils'
-import { GetCheckUser } from '@/api/Login'
+import { GetCheckUser, PostLogin } from '@/api/Login'
+import { md5 } from 'js-md5';
const Login: React.FC = () => {
const navigate = useNavigate();
const [accountPasswordStatus, setAccountPasswordStatus] = useState
(false);
+ const [accountStatus, setAccountStatus] = useState(false);
const [operation, setOperation] = useState<{
isRememberPassword: boolean;
isAutoLogin: boolean;
@@ -29,6 +31,11 @@ const Login: React.FC = () => {
});
useEffect(() => {
+ window.electron.setMainWindowSize({
+ width: 752,
+ height: 520,
+ key: 'login'
+ })
if (storage.getItem('login')) {
const login = JSON.parse(storage.getItem('login') as string);
const data = {
@@ -49,6 +56,11 @@ const Login: React.FC = () => {
...data,
})
}
+ GetCheckUser(login.account).then(res => {
+ if (res.code === 200) {
+ setAccountStatus(res.data)
+ }
+ })
}
}, []);
@@ -88,18 +100,27 @@ const Login: React.FC = () => {
// 登录
const loginClick = (): void => {
- storage.setItem('login', JSON.stringify({
- isRememberPassword: operation.optionsValue.includes('isRememberPassword'),
- isAutoLogin: operation.optionsValue.includes('isAutoLogin'),
+ PostLogin({
account: operation.account,
- password: operation.password,
- optionsValue: operation.optionsValue,
- }))
- window.electron.setMainWindowSize({
- width: 1200,
- height: 800,
+ pwd: md5(operation.password)
+ }).then(res => {
+ if (res.code === 200) {
+ message.success('登录成功!')
+ storage.setItem('login', JSON.stringify({
+ isRememberPassword: operation.optionsValue.includes('isRememberPassword'),
+ isAutoLogin: operation.optionsValue.includes('isAutoLogin'),
+ account: operation.account,
+ password: operation.password,
+ optionsValue: operation.optionsValue,
+ }))
+ storage.setItem('user', JSON.stringify(res.data))
+ window.electron.setMainWindowSize({
+ width: 1200,
+ height: 800,
+ })
+ navigate('/home')
+ }
})
- navigate('/home')
}
return (
@@ -126,9 +147,13 @@ const Login: React.FC = () => {
...operation,
account: e.target.value
})
- // GetCheckUser(e.target.value).then(res => {
- // console.log(res);
- // })
+ if (e.target.value) {
+ GetCheckUser(e.target.value).then(res => {
+ if (res.code === 200) {
+ setAccountStatus(res.data)
+ }
+ })
+ }
}}
className={`${styles.loginInputIcon} drag`}
style={{ marginBottom: '12px' }}
@@ -143,7 +168,7 @@ const Login: React.FC = () => {
}
/>
- {operation.account && !accountPasswordStatus ?
+ {operation.account && !accountPasswordStatus && accountStatus ?