ball_admin/src/pages/home/homeBottom/ec.tsx

95 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Modal } from "antd";
import { Store } from "antd/es/form/interface";
import { inject, observer } from "mobx-react";
import { useState } from "react";
import "./bot.less";
import { PhoneTwoTone } from "@ant-design/icons";
import { webRTC } from "@/util/webRtc";
const Ec = (props: Store) => {
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const { usrStore } = props;
const [userList, setUserList] = useState<any>([]);
const openDispatch = () => {
try {
usrStore.getlist().then(() => {
setUserList(usrStore.list);
webRTC.init();
setIsModalOpen(true);
});
} catch (error) {
console.log(error);
}
};
const callphone = (record: any) => {
webRTC.calls(record.identity);
};
return (
<>
<span onClick={openDispatch}> 线</span>
<Modal
title={"应急连线"}
className="owner_model"
width={800}
open={isModalOpen}
afterClose={() => {}}
onOk={() => {}}
footer={null}
onCancel={() => {
setIsModalOpen(false);
}}
>
<div className="ec_container">
<div className="ec_left">
<div className="ec_left_title">
<h3>线</h3>
</div>
<div className="u-item">
{userList.map((item: any) => {
return (
<div key={item.account}>
<div>{item.user_name} : 线</div>
<p></p>
<div>
<PhoneTwoTone
style={{ fontSize: "20px" }}
onClick={(items) => {
callphone(item);
}}
/>
</div>
</div>
);
})}
</div>
</div>
<div className="ec_right">
<div style={{ display: "flex" }}>
<video
id="rtcVideo"
style={{ width: "300px", height: "300px" }}
></video>
<video
id="remoteVideo"
style={{ width: "300px", height: "300px" }}
></video>
</div>
<p
className="ec_right_end"
onClick={() => {
webRTC.close();
}}
>
</p>
</div>
</div>
</Modal>
</>
);
};
export default inject("usrStore")(observer(Ec));