Merge branch 'release_electronic_bid_evaluation_room' into 'release_20230210'
2.10 电子评标室 See merge request eshop/fe_service_ebtp_frontend!152
This commit is contained in:
@ -15,6 +15,7 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
const { videoRef, cameraParams, status } = props;
|
||||
const playWnd = useRef<any>(null);
|
||||
let oWebControl: any = null;
|
||||
let scale = window.innerHeight / 1080;
|
||||
let initCount = 0;
|
||||
let pubKey = '';
|
||||
|
||||
@ -42,7 +43,7 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
// cbIntegrationCallBack: cbIntegrationCallBack
|
||||
// });
|
||||
|
||||
oWebControl.JS_CreateWnd("playWnd", playWnd.current.clientWidth, playWnd.current.clientHeight).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
|
||||
oWebControl.JS_CreateWnd("playWnd", playWnd.current.clientWidth * scale, playWnd.current.clientHeight * scale).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
|
||||
init(); // 创建播放实例成功后初始化
|
||||
});
|
||||
}, function () { // 启动插件服务失败
|
||||
@ -108,7 +109,7 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
buttonIDs: buttonIDs //自定义工具条按钮
|
||||
})
|
||||
}).then(function (oData: any) {
|
||||
oWebControl.JS_Resize(playWnd.current.clientWidth, playWnd.current.clientHeight); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
|
||||
oWebControl.JS_Resize(playWnd.current.clientWidth * scale, playWnd.current.clientHeight * scale); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -140,6 +141,7 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
function setWndCover() {
|
||||
var iWidth = window.innerWidth;
|
||||
var iHeight = window.innerHeight;
|
||||
let scale = window.innerHeight / 1080;
|
||||
var oDivRect = playWnd.current.getBoundingClientRect();
|
||||
|
||||
var iCoverLeft = (oDivRect.left < 0) ? Math.abs(oDivRect.left) : 0;
|
||||
@ -147,23 +149,23 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
var iCoverRight = (oDivRect.right - iWidth > 0) ? Math.round(oDivRect.right - iWidth) : 0;
|
||||
var iCoverBottom = (oDivRect.bottom - iHeight > 0) ? Math.round(oDivRect.bottom - iHeight) : 0;
|
||||
|
||||
iCoverLeft = (iCoverLeft > playWnd.current.clientWidth) ? playWnd.current.clientWidth : iCoverLeft;
|
||||
iCoverTop = (iCoverTop > playWnd.current.clientHeight) ? playWnd.current.clientHeight : iCoverTop;
|
||||
iCoverRight = (iCoverRight > playWnd.current.clientWidth) ? playWnd.current.clientWidth : iCoverRight;
|
||||
iCoverBottom = (iCoverBottom > playWnd.current.clientHeight) ? playWnd.current.clientHeight : iCoverBottom;
|
||||
iCoverLeft = (iCoverLeft > playWnd.current.clientWidth * scale) ? playWnd.current.clientWidth * scale : iCoverLeft;
|
||||
iCoverTop = (iCoverTop > playWnd.current.clientHeight * scale) ? playWnd.current.clientHeight * scale : iCoverTop;
|
||||
iCoverRight = (iCoverRight > playWnd.current.clientWidth * scale) ? playWnd.current.clientWidth * scale : iCoverRight;
|
||||
iCoverBottom = (iCoverBottom > playWnd.current.clientHeight * scale) ? playWnd.current.clientHeight * scale : iCoverBottom;
|
||||
|
||||
oWebControl.JS_RepairPartWindow(0, 0, playWnd.current.clientWidth + 1, playWnd.current.clientHeight); // 多1个像素点防止还原后边界缺失一个像素条
|
||||
oWebControl.JS_RepairPartWindow(0, 0, playWnd.current.clientWidth * scale + 1, playWnd.current.clientHeight * scale); // 多1个像素点防止还原后边界缺失一个像素条
|
||||
if (iCoverLeft != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, playWnd.current.clientHeight);
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, playWnd.current.clientHeight * scale);
|
||||
}
|
||||
if (iCoverTop != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, playWnd.current.clientWidth + 1, iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, playWnd.current.clientWidth * scale + 1, iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
|
||||
}
|
||||
if (iCoverRight != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(playWnd.current.clientWidth - iCoverRight, 0, iCoverRight, playWnd.current.clientHeight);
|
||||
oWebControl.JS_CuttingPartWindow(playWnd.current.clientWidth * scale - iCoverRight, 0, iCoverRight, playWnd.current.clientHeight * scale);
|
||||
}
|
||||
if (iCoverBottom != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, playWnd.current.clientHeight - iCoverBottom, playWnd.current.clientWidth, iCoverBottom);
|
||||
oWebControl.JS_CuttingPartWindow(0, playWnd.current.clientHeight * scale - iCoverBottom, playWnd.current.clientWidth * scale, iCoverBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,8 +177,8 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
|
||||
var wndId = -1; //播放窗口序号(在2x2以上布局下可指定播放窗口)
|
||||
|
||||
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
|
||||
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
|
||||
cameraIndexCode = cameraIndexCode?.replace(/(^\s*)/g, "");
|
||||
cameraIndexCode = cameraIndexCode?.replace(/(\s*$)/g, "");
|
||||
if (oWebControl != null) {
|
||||
oWebControl?.JS_RequestInterface({
|
||||
funcName: "startPreview",
|
||||
@ -221,15 +223,16 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
||||
// 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
|
||||
const resize = () => {
|
||||
if (oWebControl != null) {
|
||||
oWebControl.JS_Resize(playWnd.current.clientWidth, playWnd.current.clientHeight);
|
||||
let scale = window.innerHeight / 1080;
|
||||
oWebControl.JS_Resize(playWnd.current.clientWidth * scale, playWnd.current.clientHeight * scale);
|
||||
setWndCover();
|
||||
}
|
||||
};
|
||||
window.addEventListener("resize", debounce(() => resize(), 100));
|
||||
window.addEventListener("scroll", debounce(() => resize(), 100));
|
||||
window.addEventListener("resize", debounce(() => resize(), 1000));
|
||||
window.addEventListener("scroll", debounce(() => resize(), 1000));
|
||||
return () => {
|
||||
window.removeEventListener("resize", debounce(() => resize(), 100));
|
||||
window.removeEventListener("scroll", debounce(() => resize(), 100));
|
||||
window.removeEventListener("resize", debounce(() => resize(), 1000));
|
||||
window.removeEventListener("scroll", debounce(() => resize(), 1000));
|
||||
if (oWebControl != null) {
|
||||
oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
|
||||
oWebControl.JS_Disconnect().then(function () { // 断开与插件服务连接成功
|
||||
|
Reference in New Issue
Block a user