优化普通用户不需要弹窗
This commit is contained in:
parent
852a65b817
commit
2791d94a31
|
|
@ -3,7 +3,7 @@ import { storage } from '@/utils';
|
|||
import ImageUrl from '@/utils/package/imageUrl';
|
||||
import { GetCheckoutRoomNum, GetRoomRtcToken, GetRoomInfo } from '@/api/Home/Index';
|
||||
import { Button, Modal, message } from 'antd';
|
||||
import { useState, useImperativeHandle, forwardRef, useEffect } from "react";
|
||||
import { useState, useImperativeHandle, forwardRef } from "react";
|
||||
import { PostRefresh } from '@/api/Login';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ import styles from '@/page/Home/Index/index.module.scss'
|
|||
import { useEffect, useState, useRef } from "react";
|
||||
import Operation from '@/components/Operation';
|
||||
import { Button, Input, Modal, Pagination, Empty, message } from "antd";
|
||||
import { GetRoom, PostRomm, GetCheckoutRoomNum } from '@/api/Home/Index';
|
||||
import { GetRoom, PostRomm, GetCheckoutRoomNum, GetRoomRtcToken } 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';
|
||||
import { PostRefresh } from '@/api/Login';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
const Index: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const [list, setList] = useState({
|
||||
data: [],
|
||||
total: 0,
|
||||
|
|
@ -66,7 +69,16 @@ const Index: React.FC = () => {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getRoomRtcToken = async (roomNum: string, callBack: Function): Promise<void> => {
|
||||
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + '1')]).then(res => {
|
||||
if (res[0].code === 200 && res[1].code === 200) {
|
||||
callBack({
|
||||
token: res[0].data,
|
||||
tokenA: res[1].data,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className={styles.index}>
|
||||
|
|
@ -131,8 +143,27 @@ const Index: React.FC = () => {
|
|||
{/* <Button type="primary" danger>设置</Button> */}
|
||||
<Button type="primary"
|
||||
iconPosition={'end'}
|
||||
onClick={() => {
|
||||
joinSettingRef.current.changeModal(item.roomNum)
|
||||
onClick={async () => {
|
||||
if (userInfo.roleId === '1') {
|
||||
joinSettingRef.current.changeModal(item.roomNum)
|
||||
} else {
|
||||
await PostRefresh(userInfo.refresh_token)
|
||||
getRoomRtcToken(item.roomNum, (options: any) => {
|
||||
if (options) {
|
||||
navigate(`/meeting`, {
|
||||
state: {
|
||||
channelId: item.roomNum,
|
||||
token: options.token,
|
||||
tokenA: options.tokenA,
|
||||
roomId: item.id,
|
||||
roomName: item.roomName,
|
||||
enableMicr: false,
|
||||
enableCamera: false,
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}}
|
||||
icon={<img src={ImageUrl.icon9} alt="" />}
|
||||
className='m-ant-btn'>
|
||||
|
|
|
|||
Loading…
Reference in New Issue