权限优化

This commit is contained in:
yj 2024-08-20 15:13:06 +08:00
parent d020a62464
commit 89cfe758f7
5 changed files with 41 additions and 13 deletions

View File

@ -8,7 +8,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { Button, Input, message, Modal, Pagination, Progress, Table } from 'antd'; import { Button, Input, message, Modal, Pagination, Progress, Table } from 'antd';
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { DeleteRoomFile, GetRoomFile, GetRoomFileDwUrl, GetRoomUpFileurl, PostRoomFile } from '@/api/Meeting'; import { DeleteRoomFile, GetRoomFile, GetRoomFileDwUrl, GetRoomUpFileurl, GetRoomUserItem, PostRoomFile } from '@/api/Meeting';
import axios from 'axios'; import axios from 'axios';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { storage } from '@/utils'; import { storage } from '@/utils';
@ -21,10 +21,16 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
getData: () => { getData: () => {
setIsSharedFilesModel(true) setIsSharedFilesModel(true)
GetRoomUserItem(state.channelId, user.uid).then((res: any) => {
if (res.code === 200) {
setRoomUserItem(res.data)
}
})
} }
})) }))
const { state } = useLocation(); const { state } = useLocation();
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [roomUserItem, setRoomUserItem] = useState<any>({})
const [showRowSelection, setShowRowSelection] = useState(false); const [showRowSelection, setShowRowSelection] = useState(false);
const [isUpFile, setIsUpFile] = useState(false); const [isUpFile, setIsUpFile] = useState(false);
const [isSharedFilesModel, setIsSharedFilesModel] = useState(false); const [isSharedFilesModel, setIsSharedFilesModel] = useState(false);
@ -120,9 +126,9 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
}) })
} }
}} /> }} />
<ProfileOutlined title={showRowSelection ? '取消框选' : '显示框选'} onClick={() => { {roomUserItem && roomUserItem.roleId === '1' || roomUserItem.isRoomManager ? <ProfileOutlined title={showRowSelection ? '取消框选' : '显示框选'} onClick={() => {
setShowRowSelection(!showRowSelection) setShowRowSelection(!showRowSelection)
}} style={{ color: showRowSelection ? '#5575F2' : 'white' }} /> }} style={{ color: showRowSelection ? '#5575F2' : 'white' }} /> : null}
{showRowSelection ? <DeleteOutlined title='删除' onClick={() => { {showRowSelection ? <DeleteOutlined title='删除' onClick={() => {
if (selectedRowKeys.length) { if (selectedRowKeys.length) {
DeleteRoomFile(selectedRowKeys).then(res => { DeleteRoomFile(selectedRowKeys).then(res => {

View File

@ -19,7 +19,6 @@
background-color: #3A1457; background-color: #3A1457;
box-shadow: none; box-shadow: none;
color: white; color: white;
margin-left: 22px;
&:hover { &:hover {
background-color: lighten(#3A1457, 5%) !important; background-color: lighten(#3A1457, 5%) !important;

View File

@ -6,6 +6,7 @@ import { GetRoom, PostRomm, GetCheckoutRoomNum } from '@/api/Home/Index';
import ImageUrl from '@/utils/package/ImageUrl' import ImageUrl from '@/utils/package/ImageUrl'
import { ReloadOutlined } from '@ant-design/icons'; import { ReloadOutlined } from '@ant-design/icons';
import JoinSetting from '@/components/JoinSetting'; import JoinSetting from '@/components/JoinSetting';
import { storage } from '@/utils';
const Index: React.FC = () => { const Index: React.FC = () => {
const [list, setList] = useState({ const [list, setList] = useState({
data: [], data: [],
@ -19,6 +20,11 @@ const Index: React.FC = () => {
roomNum: "" roomNum: ""
}) })
const joinSettingRef = useRef<any>(); const joinSettingRef = useRef<any>();
const [user, setUser] = useState<any>({});
const userInfo = JSON.parse(storage.getItem('user') as string)
useEffect(() => {
setUser(userInfo)
}, [])
useEffect(() => { useEffect(() => {
let time = null as any let time = null as any
if (time) { if (time) {
@ -68,7 +74,7 @@ const Index: React.FC = () => {
<Operation></Operation> <Operation></Operation>
</div> </div>
<div className={styles.indexBtns}> <div className={styles.indexBtns}>
<Button type="primary" {user.roleId === '1' ? <Button type="primary"
icon={<img src={ImageUrl.icon8} alt="" />} icon={<img src={ImageUrl.icon8} alt="" />}
className='m-ant-btn drag' className='m-ant-btn drag'
onClick={() => { onClick={() => {
@ -78,9 +84,10 @@ const Index: React.FC = () => {
}) })
setCreateRoomModal(true) setCreateRoomModal(true)
}} }}
style={{ marginRight: '22px' }}
> >
</Button> </Button> : null}
<Button type="primary" onClick={() => { <Button type="primary" onClick={() => {
joinSettingRef.current.changeModal() joinSettingRef.current.changeModal()
}} }}

View File

@ -16,9 +16,10 @@ type navListType = {
path: string; path: string;
isHover: boolean; isHover: boolean;
isActive: boolean; isActive: boolean;
isShow: boolean;
} }
const Home: React.FC = () => { const Home: React.FC = () => {
const user = JSON.parse(storage.getItem('user') as string);
const navigate = useNavigate(); const navigate = useNavigate();
const stupWizardRef = useRef<any>(); const stupWizardRef = useRef<any>();
const [navList, setNavList] = useState<navListType[]>([ const [navList, setNavList] = useState<navListType[]>([
@ -28,6 +29,7 @@ const Home: React.FC = () => {
iconActive: ImageUrl.icon12Active, iconActive: ImageUrl.icon12Active,
isHover: false, isHover: false,
isActive: true, isActive: true,
isShow: true,
path: '/home/index' path: '/home/index'
}, },
{ {
@ -36,6 +38,7 @@ const Home: React.FC = () => {
iconActive: ImageUrl.icon13Active, iconActive: ImageUrl.icon13Active,
isHover: false, isHover: false,
isActive: false, isActive: false,
isShow: user.roleId === '1' ? true : false,
path: '/home/user' path: '/home/user'
}, },
]); ]);
@ -50,7 +53,6 @@ const Home: React.FC = () => {
specific: '', specific: '',
}) })
useEffect(() => { useEffect(() => {
const user = JSON.parse(storage.getItem('user') as string);
setUserInfo(user) setUserInfo(user)
const updateTime = () => { const updateTime = () => {
setDateInfo({ setDateInfo({
@ -102,7 +104,7 @@ const Home: React.FC = () => {
<div> <div>
{navList.map((item: navListType, index: number) => { {navList.map((item: navListType, index: number) => {
return ( return (
<div item.isShow ? <div
key={index} key={index}
className={`${item.isActive ? styles.active : ''} drag`} className={`${item.isActive ? styles.active : ''} drag`}
title={item.title} title={item.title}
@ -115,7 +117,7 @@ const Home: React.FC = () => {
<img src={item.icon} alt="" />} <img src={item.icon} alt="" />}
</div> </div>
<span>{item.title}</span> <span>{item.title}</span>
</div> </div> : null
) )
})} })}
</div> </div>

View File

@ -636,7 +636,13 @@ const Meeting: React.FC = () => {
stupWizardRef.current.changeModal() stupWizardRef.current.changeModal()
break; break;
case '邀请人员': case '邀请人员':
await getUserRoomInfo().then(async (res) => {
if (res) {
invitingPersonnelRef.current.changeInvitingPersonnelModal() invitingPersonnelRef.current.changeInvitingPersonnelModal()
} else {
message.error(msgTips)
}
})
break; break;
case '录制': case '录制':
window.electron.getSources().then((sources: any) => { window.electron.getSources().then((sources: any) => {
@ -1297,7 +1303,15 @@ const Meeting: React.FC = () => {
)} )}
</div> </div>
<div className={`${styles.meetingUserListFooter} drag`}> <div className={`${styles.meetingUserListFooter} drag`}>
<div onClick={() => invitingPersonnelRef.current.changeInvitingPersonnelModal()}></div> <div onClick={async () => {
await getUserRoomInfo().then(async (res) => {
if (res) {
invitingPersonnelRef.current.changeInvitingPersonnelModal()
} else {
message.error(msgTips)
}
})
}}></div>
<div onClick={() => postOpenMicr(false, user.id, true)}></div> <div onClick={() => postOpenMicr(false, user.id, true)}></div>
</div> </div>
</div> </div>