index.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from "react";
  2. import styles from "./index.module.scss";
  3. import classNames from "classnames";
  4. import { useSelector } from "react-redux";
  5. import store, { RootState } from "@/store";
  6. import { envUrl } from "@/utils/history";
  7. import closeImg from '@/assets/img/close.png'
  8. function VideoBox() {
  9. const { videoInfo } = useSelector((state: RootState) => state.A2Main);
  10. return (
  11. <div
  12. className={classNames(
  13. styles.VideoBox,
  14. videoInfo.id ? styles.videoBoxAc : ""
  15. )}
  16. >
  17. <div
  18. className="videoClose"
  19. onClick={() =>
  20. store.dispatch({
  21. type: "main/lookVideo",
  22. payload: {
  23. id: 0,
  24. title: "",
  25. txt: "",
  26. },
  27. })
  28. }
  29. >
  30. <img src={closeImg} alt="" />
  31. </div>
  32. {videoInfo.id ? (
  33. <div className="vidoMain">
  34. <div className="videobox">
  35. <video src={envUrl + "/swData/1/1.mp4"} autoPlay controls></video>
  36. </div>
  37. <div className="videoTxt myscroll">
  38. <h3>{videoInfo.title}</h3>
  39. <p dangerouslySetInnerHTML={{ __html: videoInfo.txt }}></p>
  40. </div>
  41. </div>
  42. ) : null}
  43. </div>
  44. );
  45. }
  46. const MemoVideoBox = React.memo(VideoBox);
  47. export default MemoVideoBox;