权限优化

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';
import { Button, Input, message, Modal, Pagination, Progress, Table } from 'antd';
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 { useLocation } from 'react-router-dom';
import { storage } from '@/utils';
@ -21,10 +21,16 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({
getData: () => {
setIsSharedFilesModel(true)
GetRoomUserItem(state.channelId, user.uid).then((res: any) => {
if (res.code === 200) {
setRoomUserItem(res.data)
}
})
}
}))
const { state } = useLocation();
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [roomUserItem, setRoomUserItem] = useState<any>({})
const [showRowSelection, setShowRowSelection] = useState(false);
const [isUpFile, setIsUpFile] = 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)
}} style={{ color: showRowSelection ? '#5575F2' : 'white' }} />
}} style={{ color: showRowSelection ? '#5575F2' : 'white' }} /> : null}
{showRowSelection ? <DeleteOutlined title='删除' onClick={() => {
if (selectedRowKeys.length) {
DeleteRoomFile(selectedRowKeys).then(res => {

View File

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

View File

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

View File

@ -636,7 +636,13 @@ const Meeting: React.FC = () => {
stupWizardRef.current.changeModal()
break;
case '邀请人员':
invitingPersonnelRef.current.changeInvitingPersonnelModal()
await getUserRoomInfo().then(async (res) => {
if (res) {
invitingPersonnelRef.current.changeInvitingPersonnelModal()
} else {
message.error(msgTips)
}
})
break;
case '录制':
window.electron.getSources().then((sources: any) => {
@ -1297,7 +1303,15 @@ const Meeting: React.FC = () => {
)}
</div>
<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>
</div>