zy-react-library 1.0.131 → 1.0.133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ import HeaderBack from "../../HeaderBack";
12
12
  import VideoIcon from "../../Icon/VideoIcon";
13
13
  import PreviewImg from "../../PreviewImg";
14
14
  import PreviewPdf from "../../PreviewPdf";
15
+ import Video from "../../Video";
15
16
 
16
17
  /**
17
18
  * 隐患查看组件(港务局版本)
@@ -42,6 +43,7 @@ function HiddenInfo(props) {
42
43
  const [acceptImageFiles, setAcceptImageFiles] = useState([]);
43
44
  const [inspectionAcceptImageFiles, setInspectionAcceptImageFiles] = useState([]);
44
45
  const [loading, setLoading] = useState(true);
46
+ const [videoModalOpen, setVideoModalOpen] = useState(true);
45
47
 
46
48
  const { getFile } = useGetFile();
47
49
  const query = useGetUrlQuery();
@@ -146,7 +148,14 @@ function HiddenInfo(props) {
146
148
  }),
147
149
  },
148
150
  { label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
149
- ...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: <VideoIcon /> }] : []),
151
+ ...(hiddenVideoFiles.length > 0
152
+ ? [{ label: "隐患视频", children: (
153
+ <VideoIcon onClick={() => {
154
+ setVideoModalOpen(true);
155
+ }}
156
+ />
157
+ ) }]
158
+ : []),
150
159
  ]}
151
160
  />
152
161
  {
@@ -420,6 +429,16 @@ function HiddenInfo(props) {
420
429
  }
421
430
  </div>
422
431
  </Spin>
432
+ {
433
+ videoModalOpen && (
434
+ <Video
435
+ visible={videoModalOpen}
436
+ source={hiddenVideoFiles[0].url}
437
+ onCancel={() => setVideoModalOpen(false)}
438
+ title="隐患视频"
439
+ />
440
+ )
441
+ }
423
442
  </div>
424
443
  );
425
444
  }
@@ -34,11 +34,8 @@ const MapSelector = (props) => {
34
34
 
35
35
  // 初始化地图
36
36
  const initMap = async () => {
37
- await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr");
38
-
39
37
  if (!window.BMapGL) {
40
- console.error("BMapGL is not loaded");
41
- return;
38
+ await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr");
42
39
  }
43
40
 
44
41
  setLoading(true);
@@ -44,8 +44,11 @@ const AliPlayer = forwardRef(({
44
44
  const onCreateAliPlayer = async () => {
45
45
  if (!containerRef.current)
46
46
  return;
47
- await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js");
48
- await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css");
47
+ if (!window.Aliplayer) {
48
+ await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js");
49
+ await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css");
50
+ }
51
+
49
52
  onDisposeAliPlayer();
50
53
 
51
54
  const skinLayout = [
@@ -79,51 +82,49 @@ const AliPlayer = forwardRef(({
79
82
  });
80
83
  }
81
84
 
82
- if (typeof window.Aliplayer !== "undefined") {
83
- playerRef.current = new window.Aliplayer(
84
- {
85
- id: className,
86
- ...(source
87
- ? { source }
88
- : {
89
- vid,
90
- playauth: playAuth,
91
- qualitySort: "asc",
92
- format: "m3u8",
93
- encryptType: 1,
94
- mediaType: "video",
95
- isLive: true,
96
- rePlay: false,
97
- playsinline: true,
98
- controlBarVisibility: "hover",
99
- }),
100
- cover,
101
- width,
102
- height,
103
- autoplay,
104
- isLive,
105
- useH5Prism: true,
106
- skinLayout,
107
- },
108
- (player) => {
109
- if (autoplay) {
110
- player.play();
111
- }
112
-
113
- player.on("ended", () => {
114
- onEnded && onEnded();
115
- });
116
-
117
- player.on("timeupdate", () => {
118
- onTimeupdate && onTimeupdate(player.getCurrentTime());
119
- });
120
-
121
- if (playTime > 0) {
122
- player.seek(playTime);
123
- }
124
- },
125
- );
126
- }
85
+ playerRef.current = new window.Aliplayer(
86
+ {
87
+ id: className,
88
+ ...(source
89
+ ? { source }
90
+ : {
91
+ vid,
92
+ playauth: playAuth,
93
+ qualitySort: "asc",
94
+ format: "m3u8",
95
+ encryptType: 1,
96
+ mediaType: "video",
97
+ isLive: true,
98
+ rePlay: false,
99
+ playsinline: true,
100
+ controlBarVisibility: "hover",
101
+ }),
102
+ cover,
103
+ width,
104
+ height,
105
+ autoplay,
106
+ isLive,
107
+ useH5Prism: true,
108
+ skinLayout,
109
+ },
110
+ (player) => {
111
+ if (autoplay) {
112
+ player.play();
113
+ }
114
+
115
+ player.on("ended", () => {
116
+ onEnded && onEnded();
117
+ });
118
+
119
+ player.on("timeupdate", () => {
120
+ onTimeupdate && onTimeupdate(player.getCurrentTime());
121
+ });
122
+
123
+ if (playTime > 0) {
124
+ player.seek(playTime);
125
+ }
126
+ },
127
+ );
127
128
  };
128
129
 
129
130
  useEffect(() => {
@@ -2,6 +2,8 @@ import type { ForwardRefExoticComponent, RefAttributes } from "react";
2
2
  import type { AliPlayerProps, AliPlayerRef } from "./AliPlayer";
3
3
 
4
4
  export interface VideoProps extends Omit<AliPlayerProps, "onEnded" | "onTimeupdate"> {
5
+ /** 弹窗标题,默认 “视频” */
6
+ title?: string;
5
7
  /** 是否显示弹窗 */
6
8
  visible?: boolean;
7
9
  /** 是否内联模式 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.131",
4
+ "version": "1.0.133",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",