feat(): 海康播放器更新
parent
d9f7feca0f
commit
789e732cc9
File diff suppressed because one or more lines are too long
|
|
@ -17,10 +17,10 @@
|
|||
const PLAYM4_NEED_NEET_LOOP = 35; //丢帧需要下个循环
|
||||
const PLAYM4_SYS_NOT_SUPPORT = 16; // 不支持
|
||||
|
||||
importScripts('Decoder.js');
|
||||
Module.addOnPostRun(function () {
|
||||
postMessage({ 'function': "loaded" });
|
||||
});
|
||||
// importScripts('Decoder.js');
|
||||
// Module.addOnPostRun(function () {
|
||||
// postMessage({ 'function': "loaded" });
|
||||
// });
|
||||
|
||||
var iStreamMode = 0; // 流模式
|
||||
|
||||
|
|
@ -48,10 +48,32 @@
|
|||
postMessage({ 'function': "RunTimeInfoCallBack", 'nRunTimeModule': nRunTimeModule, 'nStrVersion': nStrVersion, 'nFrameTimeStamp': nFrameTimeStamp, 'nFrameNum': nFrameNum, 'nErrorCode': nErrorCode });
|
||||
}
|
||||
|
||||
self.JSPlayM4_StreamInfoCallBack = function (nPort, pstStreamInfo, pUser)
|
||||
{
|
||||
let port = nPort;
|
||||
let user = pUser;
|
||||
let nSystemformat = Module.HEAP16[pstStreamInfo >> 1]; //封装类型
|
||||
let nVideoformat = Module.HEAP16[pstStreamInfo + 2 >> 1];//视频编码类型
|
||||
let nAudioformat = Module.HEAP16[pstStreamInfo + 4 >> 1];//音频编码类型
|
||||
let nAudiochannels = Module.HEAP16[pstStreamInfo + 6 >> 1]; //音频通道数
|
||||
let nAudiobitspersample = Module.HEAP32[pstStreamInfo + 8 >> 2];//音频样位率
|
||||
let nAudiosamplesrate = Module.HEAP32[pstStreamInfo + 12 >> 2];//音频采样率
|
||||
let nAudiobitrate = Module.HEAP32[pstStreamInfo + 16 >> 2];//音频比特率,单位:bit
|
||||
//console.log("nSystemformat:" + nSystemformat + ",nVideoformat:" + nVideoformat + ",nAudioformat:" + nAudioformat + ",nAudiochannels:" + nAudiochannels + ",nAudiobitspersample:" + nAudiobitspersample + ",nAudiosamplesrate:" + nAudiosamplesrate + ",nAudiobitrate:" + nAudiobitrate);
|
||||
postMessage({ 'function': "StreamInfoCallBack", 'nSystemformat': nSystemformat, 'nVideoformat': nVideoformat, 'nAudioformat': nAudioformat, 'nAudiochannels': nAudiochannels, 'nAudiobitspersample': nAudiobitspersample, 'nAudiosamplesrate': nAudiosamplesrate, 'nAudiobitrate': nAudiobitrate});
|
||||
}
|
||||
|
||||
onmessage = function (event) {
|
||||
var eventData = event.data;
|
||||
var res = 0;
|
||||
switch (eventData.command) {
|
||||
case "importScripts":
|
||||
const decodebase = eventData.data + "Decoder.js"
|
||||
importScripts(decodebase);
|
||||
Module.addOnPostRun(function () {
|
||||
postMessage({ 'function': "loaded" });
|
||||
});
|
||||
break;
|
||||
case "printLog":
|
||||
let downloadFlag = eventData.data;
|
||||
if (downloadFlag === true) {
|
||||
|
|
@ -206,7 +228,7 @@
|
|||
var nBMPHeight = eventData.height;
|
||||
var pYUVData = eventData.data;
|
||||
var nYUVSize = nBMPWidth * nBMPHeight * 3 / 2;
|
||||
var oJpegCropRect = {
|
||||
var oBMPCropRect = {
|
||||
left: eventData.left,
|
||||
top: eventData.top,
|
||||
right: eventData.right,
|
||||
|
|
@ -453,7 +475,7 @@
|
|||
Module._SetLostFrameMode(g_nPort, eventData.data, 0);
|
||||
break;
|
||||
case "SetDemuxModel":
|
||||
Module._SetDemuxModel(g_nPort, eventData.nIdemuxType, eventData.bTrue);
|
||||
let resSDM = Module._SetDemuxModel(g_nPort, eventData.nIdemuxType, eventData.bTrue);
|
||||
break;
|
||||
case "SkipErrorData":
|
||||
Module._SkipErrorData(g_nPort, eventData.bSkip);
|
||||
|
|
@ -476,6 +498,12 @@
|
|||
break;
|
||||
case "SetRunTimeInfoCB":
|
||||
Module._SetRunTimeInfoCallBackEx(g_nPort, eventData.nModuleType, 0);
|
||||
break;
|
||||
case "SetStreamInfoCB":
|
||||
Module._SetStreamInfoCallBack(g_nPort, eventData.nType, 0);
|
||||
break;
|
||||
case "ResetBuffer":
|
||||
Module._JSPlayM4_ResetBuffer(g_nPort, eventData.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -489,6 +517,7 @@
|
|||
var iHour = oFrameInfo.hour;
|
||||
var iMinute = oFrameInfo.minute;
|
||||
var iSecond = oFrameInfo.second;
|
||||
var iMiSecond = oFrameInfo.misecond
|
||||
|
||||
if (iMonth < 10) {
|
||||
iMonth = "0" + iMonth;
|
||||
|
|
@ -505,8 +534,18 @@
|
|||
if (iSecond < 10) {
|
||||
iSecond = "0" + iSecond;
|
||||
}
|
||||
let osdTime = {};
|
||||
|
||||
return iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
|
||||
osdTime.year = iYear;
|
||||
osdTime.month = iMonth;
|
||||
osdTime.week = 0;
|
||||
osdTime.day = iDay;
|
||||
osdTime.hour = iHour;
|
||||
osdTime.minute = iMinute;
|
||||
osdTime.second = iSecond;
|
||||
osdTime.milliseconds = iMiSecond;
|
||||
return osdTime;
|
||||
//return iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
|
||||
}
|
||||
// 获取帧数据
|
||||
function getFrameData() {
|
||||
|
|
@ -515,7 +554,31 @@
|
|||
var res = Module._GetFrameData();
|
||||
//var res = fun();
|
||||
if (res === PLAYM4_OK) {
|
||||
var oFrameInfo = Module._GetFrameInfo();
|
||||
var iFrameInfo = Module._GetFrameInfo();
|
||||
let oFrameInfo = {};
|
||||
oFrameInfo.frameType = Module.HEAP32[iFrameInfo >> 2];
|
||||
oFrameInfo.frameSize = Module.HEAP32[iFrameInfo + 4 >> 2];
|
||||
oFrameInfo.width = Module.HEAP32[iFrameInfo + 8 >> 2];
|
||||
oFrameInfo.height = Module.HEAP32[iFrameInfo + 12 >> 2];
|
||||
oFrameInfo.timeStamp = Module.HEAP32[iFrameInfo + 16 >> 2];
|
||||
oFrameInfo.frameRate = Module.HEAP32[iFrameInfo + 20 >> 2];
|
||||
oFrameInfo.bitsPerSample = Module.HEAP32[iFrameInfo + 24 >> 2];
|
||||
oFrameInfo.samplesPerSec = Module.HEAP32[iFrameInfo + 28 >> 2];
|
||||
oFrameInfo.channels = Module.HEAP32[iFrameInfo + 32 >> 2];
|
||||
oFrameInfo.frameNum = Module.HEAP32[iFrameInfo + 36 >> 2];
|
||||
|
||||
oFrameInfo.cropLeft = Module.HEAP32[iFrameInfo + 40 >> 2];
|
||||
oFrameInfo.cropRight = Module.HEAP32[iFrameInfo + 44 >> 2];
|
||||
oFrameInfo.cropTop = Module.HEAP32[iFrameInfo + 48 >> 2];
|
||||
oFrameInfo.cropBottom = Module.HEAP32[iFrameInfo + 52 >> 2];
|
||||
|
||||
oFrameInfo.year = Module.HEAP16[iFrameInfo + 64 >> 1];
|
||||
oFrameInfo.month = Module.HEAP16[iFrameInfo + 66 >> 1];
|
||||
oFrameInfo.day = Module.HEAP16[iFrameInfo + 68 >> 1];
|
||||
oFrameInfo.hour = Module.HEAP16[iFrameInfo + 70 >> 1];
|
||||
oFrameInfo.minute = Module.HEAP16[iFrameInfo + 72 >> 1];
|
||||
oFrameInfo.second = Module.HEAP16[iFrameInfo + 74 >> 1];
|
||||
oFrameInfo.misecond = Module.HEAP16[iFrameInfo + 76 >> 1];
|
||||
switch (oFrameInfo.frameType) {
|
||||
case AUDIO_TYPE:
|
||||
var iSize = oFrameInfo.frameSize;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,10 +17,10 @@
|
|||
const PLAYM4_NEED_NEET_LOOP = 35; //丢帧需要下个循环
|
||||
const PLAYM4_SYS_NOT_SUPPORT = 16; // 不支持
|
||||
|
||||
importScripts('Decoder.js');
|
||||
Module.addOnPostRun(function () {
|
||||
postMessage({ 'function': "loaded" });
|
||||
});
|
||||
// importScripts('Decoder.js');
|
||||
// Module.addOnPostRun(function () {
|
||||
// postMessage({ 'function': "loaded" });
|
||||
// });
|
||||
|
||||
var iStreamMode = 0; // 流模式
|
||||
|
||||
|
|
@ -48,10 +48,32 @@
|
|||
postMessage({ 'function': "RunTimeInfoCallBack", 'nRunTimeModule': nRunTimeModule, 'nStrVersion': nStrVersion, 'nFrameTimeStamp': nFrameTimeStamp, 'nFrameNum': nFrameNum, 'nErrorCode': nErrorCode });
|
||||
}
|
||||
|
||||
self.JSPlayM4_StreamInfoCallBack = function (nPort, pstStreamInfo, pUser)
|
||||
{
|
||||
let port = nPort;
|
||||
let user = pUser;
|
||||
let nSystemformat = Module.HEAP16[pstStreamInfo >> 1]; //封装类型
|
||||
let nVideoformat = Module.HEAP16[pstStreamInfo + 2 >> 1];//视频编码类型
|
||||
let nAudioformat = Module.HEAP16[pstStreamInfo + 4 >> 1];//音频编码类型
|
||||
let nAudiochannels = Module.HEAP16[pstStreamInfo + 6 >> 1]; //音频通道数
|
||||
let nAudiobitspersample = Module.HEAP32[pstStreamInfo + 8 >> 2];//音频样位率
|
||||
let nAudiosamplesrate = Module.HEAP32[pstStreamInfo + 12 >> 2];//音频采样率
|
||||
let nAudiobitrate = Module.HEAP32[pstStreamInfo + 16 >> 2];//音频比特率,单位:bit
|
||||
//console.log("nSystemformat:" + nSystemformat + ",nVideoformat:" + nVideoformat + ",nAudioformat:" + nAudioformat + ",nAudiochannels:" + nAudiochannels + ",nAudiobitspersample:" + nAudiobitspersample + ",nAudiosamplesrate:" + nAudiosamplesrate + ",nAudiobitrate:" + nAudiobitrate);
|
||||
postMessage({ 'function': "StreamInfoCallBack", 'nSystemformat': nSystemformat, 'nVideoformat': nVideoformat, 'nAudioformat': nAudioformat, 'nAudiochannels': nAudiochannels, 'nAudiobitspersample': nAudiobitspersample, 'nAudiosamplesrate': nAudiosamplesrate, 'nAudiobitrate': nAudiobitrate});
|
||||
}
|
||||
|
||||
onmessage = function (event) {
|
||||
var eventData = event.data;
|
||||
var res = 0;
|
||||
switch (eventData.command) {
|
||||
case "importScripts":
|
||||
const decodebase = eventData.data + "Decoder.js"
|
||||
importScripts(decodebase);
|
||||
Module.addOnPostRun(function () {
|
||||
postMessage({ 'function': "loaded" });
|
||||
});
|
||||
break;
|
||||
case "printLog":
|
||||
let downloadFlag = eventData.data;
|
||||
if (downloadFlag === true) {
|
||||
|
|
@ -206,7 +228,7 @@
|
|||
var nBMPHeight = eventData.height;
|
||||
var pYUVData = eventData.data;
|
||||
var nYUVSize = nBMPWidth * nBMPHeight * 3 / 2;
|
||||
var oJpegCropRect = {
|
||||
var oBMPCropRect = {
|
||||
left: eventData.left,
|
||||
top: eventData.top,
|
||||
right: eventData.right,
|
||||
|
|
@ -453,7 +475,7 @@
|
|||
Module._SetLostFrameMode(g_nPort, eventData.data, 0);
|
||||
break;
|
||||
case "SetDemuxModel":
|
||||
Module._SetDemuxModel(g_nPort, eventData.nIdemuxType, eventData.bTrue);
|
||||
let resSDM = Module._SetDemuxModel(g_nPort, eventData.nIdemuxType, eventData.bTrue);
|
||||
break;
|
||||
case "SkipErrorData":
|
||||
Module._SkipErrorData(g_nPort, eventData.bSkip);
|
||||
|
|
@ -476,6 +498,12 @@
|
|||
break;
|
||||
case "SetRunTimeInfoCB":
|
||||
Module._SetRunTimeInfoCallBackEx(g_nPort, eventData.nModuleType, 0);
|
||||
break;
|
||||
case "SetStreamInfoCB":
|
||||
Module._SetStreamInfoCallBack(g_nPort, eventData.nType, 0);
|
||||
break;
|
||||
case "ResetBuffer":
|
||||
Module._JSPlayM4_ResetBuffer(g_nPort, eventData.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -489,6 +517,7 @@
|
|||
var iHour = oFrameInfo.hour;
|
||||
var iMinute = oFrameInfo.minute;
|
||||
var iSecond = oFrameInfo.second;
|
||||
var iMiSecond = oFrameInfo.misecond
|
||||
|
||||
if (iMonth < 10) {
|
||||
iMonth = "0" + iMonth;
|
||||
|
|
@ -505,8 +534,18 @@
|
|||
if (iSecond < 10) {
|
||||
iSecond = "0" + iSecond;
|
||||
}
|
||||
let osdTime = {};
|
||||
|
||||
return iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
|
||||
osdTime.year = iYear;
|
||||
osdTime.month = iMonth;
|
||||
osdTime.week = 0;
|
||||
osdTime.day = iDay;
|
||||
osdTime.hour = iHour;
|
||||
osdTime.minute = iMinute;
|
||||
osdTime.second = iSecond;
|
||||
osdTime.milliseconds = iMiSecond;
|
||||
return osdTime;
|
||||
//return iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
|
||||
}
|
||||
// 获取帧数据
|
||||
function getFrameData() {
|
||||
|
|
@ -515,7 +554,31 @@
|
|||
var res = Module._GetFrameData();
|
||||
//var res = fun();
|
||||
if (res === PLAYM4_OK) {
|
||||
var oFrameInfo = Module._GetFrameInfo();
|
||||
var iFrameInfo = Module._GetFrameInfo();
|
||||
let oFrameInfo = {};
|
||||
oFrameInfo.frameType = Module.HEAP32[iFrameInfo >> 2];
|
||||
oFrameInfo.frameSize = Module.HEAP32[iFrameInfo + 4 >> 2];
|
||||
oFrameInfo.width = Module.HEAP32[iFrameInfo + 8 >> 2];
|
||||
oFrameInfo.height = Module.HEAP32[iFrameInfo + 12 >> 2];
|
||||
oFrameInfo.timeStamp = Module.HEAP32[iFrameInfo + 16 >> 2];
|
||||
oFrameInfo.frameRate = Module.HEAP32[iFrameInfo + 20 >> 2];
|
||||
oFrameInfo.bitsPerSample = Module.HEAP32[iFrameInfo + 24 >> 2];
|
||||
oFrameInfo.samplesPerSec = Module.HEAP32[iFrameInfo + 28 >> 2];
|
||||
oFrameInfo.channels = Module.HEAP32[iFrameInfo + 32 >> 2];
|
||||
oFrameInfo.frameNum = Module.HEAP32[iFrameInfo + 36 >> 2];
|
||||
|
||||
oFrameInfo.cropLeft = Module.HEAP32[iFrameInfo + 40 >> 2];
|
||||
oFrameInfo.cropRight = Module.HEAP32[iFrameInfo + 44 >> 2];
|
||||
oFrameInfo.cropTop = Module.HEAP32[iFrameInfo + 48 >> 2];
|
||||
oFrameInfo.cropBottom = Module.HEAP32[iFrameInfo + 52 >> 2];
|
||||
|
||||
oFrameInfo.year = Module.HEAP16[iFrameInfo + 64 >> 1];
|
||||
oFrameInfo.month = Module.HEAP16[iFrameInfo + 66 >> 1];
|
||||
oFrameInfo.day = Module.HEAP16[iFrameInfo + 68 >> 1];
|
||||
oFrameInfo.hour = Module.HEAP16[iFrameInfo + 70 >> 1];
|
||||
oFrameInfo.minute = Module.HEAP16[iFrameInfo + 72 >> 1];
|
||||
oFrameInfo.second = Module.HEAP16[iFrameInfo + 74 >> 1];
|
||||
oFrameInfo.misecond = Module.HEAP16[iFrameInfo + 76 >> 1];
|
||||
switch (oFrameInfo.frameType) {
|
||||
case AUDIO_TYPE:
|
||||
var iSize = oFrameInfo.frameSize;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}JSPlayerModule(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{Module["__emscripten_thread_exit"](-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}postMessage({"cmd":"cancelDone"})}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var module=Module["wasmModule"];Module["wasmModule"]=null;var instance=new WebAssembly.Instance(module,info);return receiveInstance(instance)};self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=(...args)=>{postMessage({cmd:"callHandler",handler:handler,args:args})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}JSPlayerModule(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["__emscripten_thread_mailbox_await"](e.data.pthread_ptr);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){Module["__embind_initialize_bindings"]();initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="checkMailbox"){if(initializedJS){Module["checkMailbox"]()}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}}self.onmessage=handleMessage;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}JSPlayerModule(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{Module["__emscripten_thread_exit"](-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}postMessage({"cmd":"cancelDone"})}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var module=Module["wasmModule"];Module["wasmModule"]=null;var instance=new WebAssembly.Instance(module,info);return receiveInstance(instance)};self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=(...args)=>{postMessage({cmd:"callHandler",handler:handler,args:args})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}JSPlayerModule(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["__emscripten_thread_mailbox_await"](e.data.pthread_ptr);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){Module["__embind_initialize_bindings"]();initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="checkMailbox"){if(initializedJS){Module["checkMailbox"]()}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}}self.onmessage=handleMessage;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -718,8 +718,8 @@ var wasmMemory;
|
|||
// In the wasm backend, we polyfill the WebAssembly object,
|
||||
// so this creates a (non-native-wasm) table for us.
|
||||
var wasmTable = new WebAssembly.Table({
|
||||
'initial': 275,
|
||||
'maximum': 275 + 0,
|
||||
'initial': 283,
|
||||
'maximum': 283 + 0,
|
||||
'element': 'anyfunc'
|
||||
});
|
||||
|
||||
|
|
@ -1346,11 +1346,11 @@ function updateGlobalBufferAndViews(buf) {
|
|||
}
|
||||
|
||||
var STATIC_BASE = 1024,
|
||||
STACK_BASE = 5534128,
|
||||
STACK_BASE = 5535520,
|
||||
STACKTOP = STACK_BASE,
|
||||
STACK_MAX = 291248,
|
||||
DYNAMIC_BASE = 5534128,
|
||||
DYNAMICTOP_PTR = 291072;
|
||||
STACK_MAX = 292640,
|
||||
DYNAMIC_BASE = 5535520,
|
||||
DYNAMICTOP_PTR = 292464;
|
||||
|
||||
assert(STACK_BASE % 16 === 0, 'stack must start aligned');
|
||||
assert(DYNAMIC_BASE % 16 === 0, 'heap must start aligned');
|
||||
|
|
@ -1360,7 +1360,7 @@ assert(DYNAMIC_BASE % 16 === 0, 'heap must start aligned');
|
|||
var TOTAL_STACK = 5242880;
|
||||
if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the stack size can no longer be determined at runtime')
|
||||
|
||||
var INITIAL_INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;if (!Object.getOwnPropertyDescriptor(Module, 'INITIAL_MEMORY')) Object.defineProperty(Module, 'INITIAL_MEMORY', { configurable: true, get: function() { abort('Module.INITIAL_MEMORY has been replaced with plain INITIAL_INITIAL_MEMORY') } });
|
||||
var INITIAL_INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 134217728;if (!Object.getOwnPropertyDescriptor(Module, 'INITIAL_MEMORY')) Object.defineProperty(Module, 'INITIAL_MEMORY', { configurable: true, get: function() { abort('Module.INITIAL_MEMORY has been replaced with plain INITIAL_INITIAL_MEMORY') } });
|
||||
|
||||
assert(INITIAL_INITIAL_MEMORY >= TOTAL_STACK, 'INITIAL_MEMORY should be larger than TOTAL_STACK, was ' + INITIAL_INITIAL_MEMORY + '! (TOTAL_STACK=' + TOTAL_STACK + ')');
|
||||
|
||||
|
|
@ -1935,7 +1935,7 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
|
||||
|
||||
|
||||
// STATICTOP = STATIC_BASE + 290224;
|
||||
// STATICTOP = STATIC_BASE + 291616;
|
||||
/* global initializers */ __ATINIT__.push({ func: function() { ___wasm_call_ctors() } });
|
||||
|
||||
|
||||
|
|
@ -2000,6 +2000,43 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
return _atexit(a0,a1);
|
||||
}
|
||||
|
||||
function ___cxa_find_matching_catch_2() {
|
||||
var thrown = ___exception_last;
|
||||
if (!thrown) {
|
||||
// just pass through the null ptr
|
||||
return ((setTempRet0(0),0)|0);
|
||||
}
|
||||
var info = ___exception_infos[thrown];
|
||||
var throwntype = info.type;
|
||||
if (!throwntype) {
|
||||
// just pass through the thrown ptr
|
||||
return ((setTempRet0(0),thrown)|0);
|
||||
}
|
||||
var typeArray = Array.prototype.slice.call(arguments);
|
||||
|
||||
var pointer = ___cxa_is_pointer_type(throwntype);
|
||||
// can_catch receives a **, add indirection
|
||||
var buffer = 292624;
|
||||
HEAP32[((buffer)>>2)]=thrown;
|
||||
thrown = buffer;
|
||||
// The different catch blocks are denoted by different types.
|
||||
// Due to inheritance, those types may not precisely match the
|
||||
// type of the thrown object. Find one which matches, and
|
||||
// return the type of the catch block which should be called.
|
||||
for (var i = 0; i < typeArray.length; i++) {
|
||||
if (typeArray[i] && ___cxa_can_catch(typeArray[i], throwntype, thrown)) {
|
||||
thrown = HEAP32[((thrown)>>2)]; // undo indirection
|
||||
info.adjusted.push(thrown);
|
||||
return ((setTempRet0(typeArray[i]),thrown)|0);
|
||||
}
|
||||
}
|
||||
// Shouldn't happen unless we have bogus data in typeArray
|
||||
// or encounter a type for which emscripten doesn't have suitable
|
||||
// typeinfo defined. Best-efforts match just in case.
|
||||
thrown = HEAP32[((thrown)>>2)]; // undo indirection
|
||||
return ((setTempRet0(throwntype),thrown)|0);
|
||||
}
|
||||
|
||||
|
||||
var ___exception_infos={};
|
||||
|
||||
|
|
@ -2030,6 +2067,11 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
abort('stack overflow')
|
||||
}
|
||||
|
||||
function ___resumeException(ptr) {
|
||||
if (!___exception_last) { ___exception_last = ptr; }
|
||||
throw ptr;
|
||||
}
|
||||
|
||||
|
||||
function setErrNo(value) {
|
||||
HEAP32[((___errno_location())>>2)]=value;
|
||||
|
|
@ -5500,7 +5542,7 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
}
|
||||
|
||||
function _emscripten_get_sbrk_ptr() {
|
||||
return 291072;
|
||||
return 292464;
|
||||
}
|
||||
|
||||
function _emscripten_memcpy_big(dest, src, num) {
|
||||
|
|
@ -5578,6 +5620,10 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
}
|
||||
}
|
||||
|
||||
function _getTempRet0() {
|
||||
return (getTempRet0() | 0);
|
||||
}
|
||||
|
||||
function _gettimeofday(ptr) {
|
||||
var now = Date.now();
|
||||
HEAP32[((ptr)>>2)]=(now/1000)|0; // seconds
|
||||
|
|
@ -5586,10 +5632,10 @@ function _emscripten_asm_const_iii(code, sigPtr, argbuf) {
|
|||
}
|
||||
|
||||
|
||||
var ___tm_current=291088;
|
||||
var ___tm_current=292480;
|
||||
|
||||
|
||||
var ___tm_timezone=(stringToUTF8("GMT", 291136, 4), 291136);
|
||||
var ___tm_timezone=(stringToUTF8("GMT", 292528, 4), 292528);
|
||||
|
||||
function _tzset() {
|
||||
// TODO: Use (malleable) environment variables instead of system settings.
|
||||
|
|
@ -5840,7 +5886,7 @@ function intArrayToString(array) {
|
|||
|
||||
|
||||
var asmGlobalArg = {};
|
||||
var asmLibraryArg = { "__assert_fail": ___assert_fail, "__cxa_allocate_exception": ___cxa_allocate_exception, "__cxa_atexit": ___cxa_atexit, "__cxa_throw": ___cxa_throw, "__handle_stack_overflow": ___handle_stack_overflow, "__sys_fcntl64": ___sys_fcntl64, "__sys_ioctl": ___sys_ioctl, "__sys_open": ___sys_open, "_embind_finalize_value_object": __embind_finalize_value_object, "_embind_register_bool": __embind_register_bool, "_embind_register_emval": __embind_register_emval, "_embind_register_float": __embind_register_float, "_embind_register_function": __embind_register_function, "_embind_register_integer": __embind_register_integer, "_embind_register_memory_view": __embind_register_memory_view, "_embind_register_std_string": __embind_register_std_string, "_embind_register_std_wstring": __embind_register_std_wstring, "_embind_register_value_object": __embind_register_value_object, "_embind_register_value_object_field": __embind_register_value_object_field, "_embind_register_void": __embind_register_void, "emscripten_asm_const_iii": _emscripten_asm_const_iii, "emscripten_get_sbrk_ptr": _emscripten_get_sbrk_ptr, "emscripten_memcpy_big": _emscripten_memcpy_big, "emscripten_resize_heap": _emscripten_resize_heap, "fd_close": _fd_close, "fd_read": _fd_read, "fd_seek": _fd_seek, "fd_write": _fd_write, "gettimeofday": _gettimeofday, "localtime": _localtime, "localtime_r": _localtime_r, "memory": wasmMemory, "mktime": _mktime, "pthread_create": _pthread_create, "pthread_join": _pthread_join, "pthread_mutexattr_init": _pthread_mutexattr_init, "pthread_mutexattr_settype": _pthread_mutexattr_settype, "setTempRet0": _setTempRet0, "table": wasmTable, "time": _time, "usleep": _usleep };
|
||||
var asmLibraryArg = { "__assert_fail": ___assert_fail, "__cxa_allocate_exception": ___cxa_allocate_exception, "__cxa_atexit": ___cxa_atexit, "__cxa_find_matching_catch_2": ___cxa_find_matching_catch_2, "__cxa_throw": ___cxa_throw, "__handle_stack_overflow": ___handle_stack_overflow, "__resumeException": ___resumeException, "__sys_fcntl64": ___sys_fcntl64, "__sys_ioctl": ___sys_ioctl, "__sys_open": ___sys_open, "_embind_finalize_value_object": __embind_finalize_value_object, "_embind_register_bool": __embind_register_bool, "_embind_register_emval": __embind_register_emval, "_embind_register_float": __embind_register_float, "_embind_register_function": __embind_register_function, "_embind_register_integer": __embind_register_integer, "_embind_register_memory_view": __embind_register_memory_view, "_embind_register_std_string": __embind_register_std_string, "_embind_register_std_wstring": __embind_register_std_wstring, "_embind_register_value_object": __embind_register_value_object, "_embind_register_value_object_field": __embind_register_value_object_field, "_embind_register_void": __embind_register_void, "emscripten_asm_const_iii": _emscripten_asm_const_iii, "emscripten_get_sbrk_ptr": _emscripten_get_sbrk_ptr, "emscripten_memcpy_big": _emscripten_memcpy_big, "emscripten_resize_heap": _emscripten_resize_heap, "fd_close": _fd_close, "fd_read": _fd_read, "fd_seek": _fd_seek, "fd_write": _fd_write, "getTempRet0": _getTempRet0, "gettimeofday": _gettimeofday, "invoke_iii": invoke_iii, "localtime": _localtime, "localtime_r": _localtime_r, "memory": wasmMemory, "mktime": _mktime, "pthread_create": _pthread_create, "pthread_join": _pthread_join, "pthread_mutexattr_init": _pthread_mutexattr_init, "pthread_mutexattr_settype": _pthread_mutexattr_settype, "setTempRet0": _setTempRet0, "table": wasmTable, "time": _time, "usleep": _usleep };
|
||||
var asm = createWasm();
|
||||
Module["asm"] = asm;
|
||||
/** @type {function(...*):?} */
|
||||
|
|
@ -5913,6 +5959,13 @@ var _SysTransSetGlobalTime = Module["_SysTransSetGlobalTime"] = function() {
|
|||
return Module["asm"]["SysTransSetGlobalTime"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var _SysTransEnableCapacity = Module["_SysTransEnableCapacity"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
|
||||
return Module["asm"]["SysTransEnableCapacity"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var _malloc = Module["_malloc"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
|
|
@ -5990,6 +6043,13 @@ var _emscripten_main_thread_process_queued_calls = Module["_emscripten_main_thre
|
|||
return Module["asm"]["emscripten_main_thread_process_queued_calls"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var dynCall_iii = Module["dynCall_iii"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
|
||||
return Module["asm"]["dynCall_iii"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var ___set_stack_limit = Module["___set_stack_limit"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
|
|
@ -6060,13 +6120,6 @@ var dynCall_viii = Module["dynCall_viii"] = function() {
|
|||
return Module["asm"]["dynCall_viii"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var dynCall_iii = Module["dynCall_iii"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
|
||||
return Module["asm"]["dynCall_iii"].apply(null, arguments)
|
||||
};
|
||||
|
||||
/** @type {function(...*):?} */
|
||||
var dynCall_iiii = Module["dynCall_iiii"] = function() {
|
||||
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
|
||||
|
|
@ -6117,6 +6170,17 @@ var dynCall_iiiii = Module["dynCall_iiiii"] = function() {
|
|||
};
|
||||
|
||||
|
||||
function invoke_iii(index,a1,a2) {
|
||||
var sp = stackSave();
|
||||
try {
|
||||
return dynCall_iii(index,a1,a2);
|
||||
} catch(e) {
|
||||
stackRestore(sp);
|
||||
if (e !== e+0 && e !== 'longjmp') throw e;
|
||||
_setThrew(1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @license
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -67,7 +67,13 @@ importScripts('libSystemTransform.js');
|
|||
{
|
||||
console.log("_SysTransRegisterDataCallBack Failed:" + iRet);
|
||||
}
|
||||
|
||||
if (iTransType === 5) {//转mp4支持私有帧打入
|
||||
iRet = Module._SysTransEnableCapacity(7)
|
||||
if(iRet != 0)
|
||||
{
|
||||
console.log("_SysTransSetGlobalTime Failed:" + iRet);
|
||||
}
|
||||
}
|
||||
iRet = Module._SysTransStart(null, null);
|
||||
if(iRet != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
const [width, setWidth] = useState(null);
|
||||
const [height, setHeight] = useState(null);
|
||||
const [type, setType] = useState(false);
|
||||
const lastErrorKeyRef = useRef(null);
|
||||
|
||||
|
||||
|
||||
|
|
@ -86,12 +87,14 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
// wholeFullScreen()
|
||||
},
|
||||
pluginErrorHandler(iWindIndex, iErrorCode, oError) {
|
||||
// 插件错误回调
|
||||
// console.error(`window-${iWindIndex}, errorCode: ${iErrorCode}`, oError)
|
||||
// message.error('播放失败1:' + VideoPlayerException[iErrorCode])
|
||||
setIsLoading(false)
|
||||
//重新播放
|
||||
// initPlayer()
|
||||
const key = `${playerID}-${iWindIndex}-${iErrorCode}`
|
||||
if (lastErrorKeyRef.current !== key) {
|
||||
lastErrorKeyRef.current = key
|
||||
const msgText = VideoPlayerException?.[iErrorCode] || `错误码:${iErrorCode}`
|
||||
message.error(`window-${iWindIndex} 播放失败:${msgText}`)
|
||||
}
|
||||
console.error(`window-${iWindIndex} pluginErrorHandler`, iErrorCode, oError)
|
||||
},
|
||||
windowEventOver(iWindIndex) {
|
||||
// 鼠标移过回调
|
||||
|
|
@ -135,11 +138,16 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
* 播放
|
||||
*/
|
||||
const play = () => {
|
||||
console.log(wsUrl?.src, '6543');
|
||||
// if(!wsUrl?.src) return
|
||||
if (wsUrl?.src) {
|
||||
const src = typeof wsUrl === 'string' ? wsUrl : wsUrl?.src
|
||||
console.log(src, '6543');
|
||||
if (src) {
|
||||
if (window.location?.protocol === 'https:' && src.startsWith('ws://')) {
|
||||
setIsLoading(false)
|
||||
message.error('当前页面为https,浏览器会阻止ws://取流,请使用wss://地址或改为http访问')
|
||||
return
|
||||
}
|
||||
setIsLoading(true) //开始加载
|
||||
let preUrl = wsUrl?.src // 播放地址
|
||||
let preUrl = src // 播放地址
|
||||
// 支持回放时间范围(海康取流地址若后端支持时间参数则追加)
|
||||
if (wsUrl?.beginTime && wsUrl?.endTime) {
|
||||
const begin = moment(wsUrl.beginTime).subtract(1,'hours').format('YYYY-MM-DD HH:mm:ss');
|
||||
|
|
@ -159,10 +167,14 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
// 播放成功回调
|
||||
// console.log('播放成功')
|
||||
}, (err) => {
|
||||
// console.log('播放失败')
|
||||
// console.info('JS_Play failed:', err)
|
||||
setIsLoading(false)
|
||||
message.error('视频离线,播放失败')
|
||||
const errorCode = err?.errorCode ?? err?.code
|
||||
const msgText =
|
||||
VideoPlayerException?.[errorCode] ||
|
||||
VideoPlayerException?.[String(errorCode)] ||
|
||||
(errorCode ? `错误码:${errorCode}` : '')
|
||||
message.error(msgText ? `播放失败:${msgText}` : '播放失败')
|
||||
console.error('JS_Play failed:', err)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -170,15 +182,44 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (wsUrl) {
|
||||
if (wsUrl?.relType == 'ysy') {
|
||||
if (!wsUrl) return
|
||||
|
||||
if (wsUrl?.relType === 'ysy') {
|
||||
initVideo()
|
||||
} else {
|
||||
initPlayer()
|
||||
}
|
||||
|
||||
}
|
||||
return () => {
|
||||
setIsLoading(false)
|
||||
|
||||
try {
|
||||
player.current?.JS_StopRealPlayAll?.()
|
||||
} catch (e) {}
|
||||
try {
|
||||
player.current?.JS_Stop?.(0)
|
||||
} catch (e) {}
|
||||
try {
|
||||
player.current?.JS_StopTalk?.()
|
||||
} catch (e) {}
|
||||
try {
|
||||
player.current?.JS_CloseSound?.(0)
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
const el = document.getElementById('player' + playerID)
|
||||
if (el) el.innerHTML = ''
|
||||
} catch (e) {}
|
||||
player.current = {}
|
||||
|
||||
try {
|
||||
playerYsy.current?.stop?.()
|
||||
} catch (e) {}
|
||||
try {
|
||||
playerYsy.current?.destroy?.()
|
||||
} catch (e) {}
|
||||
playerYsy.current = {}
|
||||
}
|
||||
}, [wsUrl])
|
||||
useEffect(() => {
|
||||
handleWindowResize()
|
||||
|
|
@ -188,7 +229,7 @@ const HFivePlayer = ({ wsUrl, playerID, size }) => {
|
|||
return (
|
||||
<div ref={parentRef} style={{ height: '100%', width: '100%' }}>
|
||||
<Spin tip="Loading" spinning={isLoading} size="small">
|
||||
<div style={{ width: width, height: height }} onDoubleClick={() => playerYsy.current.fullScreen()}>
|
||||
<div style={{ width: width, height: height }} onDoubleClick={() => playerYsy.current?.fullScreen?.()}>
|
||||
<div id={'player' + playerID} style={{ width: width, height: height}} >
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ module.exports = function (app) {
|
|||
// target: 'http://192.168.66.199:24105/',//正式
|
||||
// target: 'http://36.139.207.50:18083/',//移动云
|
||||
// target: 'http://192.168.66.49:24105/',//移动云
|
||||
// target: 'http://192.168.66.32:24105/',//ls
|
||||
// target: 'http://192.168.66.32:24105/', //ls
|
||||
// target: 'http://192.168.66.43:24105/',//ls
|
||||
// target: 'http://192.168.66.23:24105/', //ls
|
||||
changeOrigin: true,
|
||||
})
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,102 +1,339 @@
|
|||
import pieMonth from "./pieMonth";
|
||||
export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
||||
// debugger
|
||||
console.log("data", data);
|
||||
// data.rz = 112
|
||||
// 根据断面类型确定y轴刻度以及最大和最小
|
||||
const yMin = type == "3" ? 70 : type == "2" ? 67 :
|
||||
type == '1' ? 59 : 99;
|
||||
const yMax = type == "3" ? 129 : type == "2" ? 117
|
||||
: type == "1" ? 118 : 116;
|
||||
|
||||
// 断面上的渗压管
|
||||
const type1 = ["UPD1", "UPD4", "UPD7", "UPD16"];
|
||||
const type2 = ["UPD10", "UPD13"];
|
||||
const type3 = ["UPD2", "UPD5", "UPD8", "UPD17"];
|
||||
const type4 = ["UPD11", "UPD14"];
|
||||
const type5 = ["UPD3", "UPD6", "UPD12"];
|
||||
const type6 = ["UPD9", "UPD15"];
|
||||
const type7 = ["UPD24", "UPD26", "UPD28"]; //UPD24:109.87,UPD26:109.75,UPD28:109.43
|
||||
const type8 = ["UPD25", "UPD27", "UPD29"]; //UPD25:109.87,UPD27:109.75,UPD29:109.43
|
||||
/**
|
||||
* 生成通用的测值图 ECharts 配置项
|
||||
* @param {Object} data - 数据对象
|
||||
* @param {Object} config - 配置对象,包含所有项目相关的具体参数
|
||||
* @returns {Object} ECharts option
|
||||
*/
|
||||
export const getJrxChartOption = (data, config) => {
|
||||
const {
|
||||
yAxis, // { min, max }
|
||||
xAxis, // { min, max } (optional, default 0-100)
|
||||
backgroundImage, // { url, width, height }
|
||||
damLines, // { rz: [], rz1: [] } - 大坝轮廓线
|
||||
waterLevel, // { value, x, label } - 水位标注信息
|
||||
pipes, // Array<{ x, bottomY, topY, value }> - 渗压管列表
|
||||
connectionLine, // Array<Point> - 连接线点集
|
||||
toolbox, // (optional)
|
||||
} = config;
|
||||
|
||||
// 管底高程
|
||||
const alltype = typeName == "1" ? type1 :
|
||||
typeName == "2" ? type2 :
|
||||
typeName == "3" ? type3 :
|
||||
typeName == "4" ? type4 :
|
||||
typeName == "5" ? type5 :
|
||||
typeName == "6" ? type6 :
|
||||
typeName == "7" ? type7 :
|
||||
typeName == "8" ? type8 :
|
||||
[];
|
||||
// 字体颜色
|
||||
const textColor = '#666'
|
||||
const imageUrl370 = `${process.env.PUBLIC_URL}/assets/images/zb370.png `
|
||||
const imageUrl250 = `${process.env.PUBLIC_URL}/assets/images/zb250.png `
|
||||
const imageUrl130 = `${process.env.PUBLIC_URL}/assets/images/zb130.png `
|
||||
const imageUrl010 = `${process.env.PUBLIC_URL}/assets/images/fb010.png `
|
||||
const textColor = '#666';
|
||||
|
||||
// 构造渗压管的 Series 数据
|
||||
// 蓝色段 (gz): 从底到测值
|
||||
const gzSeries = pipes.map((pipe, index) => {
|
||||
const dataPoints = (pipe.value !== undefined && pipe.value !== null)
|
||||
? [[pipe.x, pipe.bottomY], [pipe.x, pipe.value]]
|
||||
: [];
|
||||
return {
|
||||
type: 'line',
|
||||
name: `pipe-gz-${index}`,
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: '#5487FF' },
|
||||
lineStyle: { color: '#5487FF', width: 6 },
|
||||
data: dataPoints
|
||||
};
|
||||
});
|
||||
|
||||
// 灰色段 (gk): 从测值(或底)到管口
|
||||
const gkSeries = pipes.map((pipe, index) => {
|
||||
// 只有当管口高程存在时才绘制
|
||||
const dataPoints = (pipe.topY !== undefined && pipe.topY !== null)
|
||||
? [[pipe.x, pipe.bottomY], [pipe.x, pipe.topY]]
|
||||
: [];
|
||||
return {
|
||||
type: 'line',
|
||||
name: `pipe-gk-${index}`,
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: 'rgba(154, 160, 166,.4)' },
|
||||
lineStyle: { color: 'rgba(154, 160, 166,.4)', width: 6 },
|
||||
data: dataPoints
|
||||
};
|
||||
});
|
||||
|
||||
// 过滤连接线中的空点
|
||||
const filteredConnectionLine = connectionLine.filter(subArray => {
|
||||
return subArray && subArray.every(item => item !== null && item !== undefined);
|
||||
});
|
||||
|
||||
return {
|
||||
toolbox: toolbox || {
|
||||
show: true,
|
||||
feature: {
|
||||
saveAsImage: {
|
||||
show: true,
|
||||
excludeComponents: ['toolbox'],
|
||||
pixelRatio: 2,
|
||||
name: "测值图"
|
||||
},
|
||||
},
|
||||
right: "10%",
|
||||
top: "4%"
|
||||
},
|
||||
graphic: [
|
||||
{
|
||||
type: 'image',
|
||||
left: 'center',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
z: 1,
|
||||
bounding: 'all',
|
||||
style: {
|
||||
image: backgroundImage.url,
|
||||
width: backgroundImage.width || 1100,
|
||||
height: backgroundImage.height || 380
|
||||
}
|
||||
},
|
||||
// 标尺图片,这里假设是通用的,如果需要配置也可以放入 config
|
||||
{
|
||||
type: 'image',
|
||||
left: '7%',
|
||||
bottom: "5%",
|
||||
z: 1,
|
||||
bounding: 'all',
|
||||
style: {
|
||||
image: `${process.env.PUBLIC_URL}/assets/images/ruler.png`,
|
||||
width: 10,
|
||||
height: 450
|
||||
}
|
||||
}
|
||||
],
|
||||
grid: {
|
||||
top: '0%',
|
||||
left: '2%',
|
||||
right: '5%',
|
||||
bottom: '0%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
min: xAxis?.min ?? 0,
|
||||
max: xAxis?.max ?? 100,
|
||||
axisLabel: { show: false, color: textColor, fontSize: 18 },
|
||||
axisLine: { show: false, lineStyle: { color: textColor } },
|
||||
axisTick: { show: false },
|
||||
splitLine: { show: false },
|
||||
boundaryGap: false
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: yAxis.min,
|
||||
max: yAxis.max,
|
||||
interval: yAxis.interval || 5,
|
||||
nameTextStyle: {
|
||||
color: '#333',
|
||||
fontSize: 18,
|
||||
padding: [0, 0, 0, 80]
|
||||
},
|
||||
axisLabel: {
|
||||
color: textColor,
|
||||
fontSize: 18,
|
||||
formatter: function (value, index) {
|
||||
// 隐藏第一个和最后一个刻度
|
||||
if (value === yAxis.min || value === yAxis.max) {
|
||||
return '';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
axisLine: { show: false },
|
||||
axisTick: { show: false },
|
||||
splitLine: {
|
||||
show: false,
|
||||
lineStyle: { color: '#CCCCCC', type: 'dashed' }
|
||||
}
|
||||
},
|
||||
series: [
|
||||
// 1. 大坝坡面填充
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: '#fff' },
|
||||
lineStyle: { color: '#fff' },
|
||||
areaStyle: {
|
||||
origin: "end",
|
||||
color: 'rgba(0, 128, 255, 0.3)'
|
||||
},
|
||||
data: [...damLines.rz, ...damLines.rz1]
|
||||
},
|
||||
// 2. 库水位线 (带标注)
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: '#5487FF' },
|
||||
lineStyle: { color: '#5487FF' },
|
||||
markPoint: {
|
||||
data: waterLevel.value ? [{
|
||||
type: 'max',
|
||||
x: "20%",
|
||||
coord: [waterLevel.x, waterLevel.value]
|
||||
}] : [],
|
||||
symbol: 'pin',
|
||||
symbolSize: [30, 10],
|
||||
itemStyle: {
|
||||
color: '#fff',
|
||||
borderColor: '#ffa500',
|
||||
borderWidth: 0
|
||||
},
|
||||
label: {
|
||||
show: !!waterLevel.value,
|
||||
formatter: waterLevel.label || ("库水位" + waterLevel.value + "m"),
|
||||
color: '#5487FF',
|
||||
fontSize: 12,
|
||||
}
|
||||
},
|
||||
data: damLines.rz
|
||||
},
|
||||
// 3. 另一条大坝线 (rz1)
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: '#5487FF' },
|
||||
lineStyle: { color: '#5487FF' },
|
||||
data: damLines.rz1
|
||||
},
|
||||
// 4. 管口/管身灰色段
|
||||
...gkSeries,
|
||||
// 5. 管身蓝色段
|
||||
...gzSeries,
|
||||
// 6. 连线
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: '#5487FF' },
|
||||
lineStyle: { color: '#5487FF', width: 2 },
|
||||
data: filteredConnectionLine
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前项目的特定配置(为了兼容旧逻辑)
|
||||
* 这里将原有的 hardcoded 逻辑提取出来,作为"配置生成器"的一个示例
|
||||
*/
|
||||
export const getCurrentProjectConfig = (data = {}, type = "1", typeName = '1') => {
|
||||
// 1. Y轴范围
|
||||
const yMin = type == "3" ? 70 : type == "2" ? 67 : type == '1' ? 59 : 99;
|
||||
const yMax = type == "3" ? 129 : type == "2" ? 117 : type == "1" ? 118 : 116;
|
||||
|
||||
// 2. 背景图
|
||||
const imageUrl370 = `${process.env.PUBLIC_URL}/assets/images/zb370.png `;
|
||||
const imageUrl250 = `${process.env.PUBLIC_URL}/assets/images/zb250.png `;
|
||||
const imageUrl130 = `${process.env.PUBLIC_URL}/assets/images/zb130.png `;
|
||||
const imageUrl010 = `${process.env.PUBLIC_URL}/assets/images/fb010.png `;
|
||||
const imageUrl = type == "1" ? imageUrl130 :
|
||||
type == "2" ? imageUrl250 :
|
||||
type == "3" ? imageUrl370 : imageUrl010
|
||||
;
|
||||
const rule = `${process.env.PUBLIC_URL}/assets/images/ruler.png `
|
||||
type == "3" ? imageUrl370 : imageUrl010;
|
||||
|
||||
// rz 是最上面那条线 rz1是那条贴近坝面的线 xValue求解的是最上面那条线的末尾横坐标
|
||||
// 3. 渗压管类型定义
|
||||
const typeMap = {
|
||||
"1": ["UPD1", "UPD4", "UPD7", "UPD16"],
|
||||
"2": ["UPD10", "UPD13"],
|
||||
"3": ["UPD2", "UPD5", "UPD8", "UPD17"],
|
||||
"4": ["UPD11", "UPD14"],
|
||||
"5": ["UPD3", "UPD6", "UPD12"],
|
||||
"6": ["UPD9", "UPD15"],
|
||||
"7": ["UPD24", "UPD26", "UPD28"],
|
||||
"8": ["UPD25", "UPD27", "UPD29"]
|
||||
};
|
||||
const alltype = typeMap[typeName] || [];
|
||||
|
||||
// 4. 大坝轮廓计算
|
||||
const xValue = type == "3" ? (((data?.rz - 86) + 0.6 * 5) / 0.6) :
|
||||
type == "2" ? (((data?.rz - 87) + 0.63 * 7) / 0.63) :
|
||||
type == "1" ? (((data?.rz - 88) + 0.7 * 10) / 0.7) :
|
||||
(((data?.rz - 102) + 0.25 * 4) / 0.25)
|
||||
const rz = data?.rz ?
|
||||
[[xValue, data?.rz], [0, data?.rz]] :
|
||||
[]
|
||||
const rz1 = data?.rz ?
|
||||
type == "3" ?
|
||||
[[0, 86], [5, 86], [xValue, data?.rz]] :
|
||||
type == "2" ?
|
||||
[[0, 87], [7, 87], [xValue, data?.rz]]
|
||||
:
|
||||
type == "1" ?
|
||||
[[0, 88], [10, 88], [xValue, data?.rz]]
|
||||
:
|
||||
[[0, 102], [4, 102], [xValue, data?.rz]]
|
||||
: [];
|
||||
// gz1、gz2、gz3、gz4分别为渗压管
|
||||
(((data?.rz - 102) + 0.25 * 4) / 0.25);
|
||||
|
||||
// const gz1 = data[alltype[0]] ?
|
||||
// type == "3" ? [[typeName == '5' ? 47 : 51, typeName == '5' ? 90.50 : 81.85], [typeName == '5' ? 47 : 51, data[alltype[0]]]] :
|
||||
// type == "2" ? [[typeName == '3' ? 45.5 : 50, typeName == '3' ? 84.41 : 83.78], [typeName == '3' ? 45.5 : 50, data[alltype[0]]]] :
|
||||
// type == "1" ? [[typeName == '1' ? 44 : 51.5, typeName == '1' ? 80.11 : 78.64], [typeName == '1' ? 44 : 51.5, data[alltype[0]]]] :
|
||||
// [[55, typeName == '7' ? 109.08 : 108.77], [55, data[alltype[0]]]]
|
||||
// : [];
|
||||
const rz = data?.rz ? [[xValue, data?.rz], [0, data?.rz]] : [];
|
||||
|
||||
let rz1 = [];
|
||||
if (data?.rz) {
|
||||
if (type == "3") rz1 = [[0, 86], [5, 86], [xValue, data?.rz]];
|
||||
else if (type == "2") rz1 = [[0, 87], [7, 87], [xValue, data?.rz]];
|
||||
else if (type == "1") rz1 = [[0, 88], [10, 88], [xValue, data?.rz]];
|
||||
else rz1 = [[0, 102], [4, 102], [xValue, data?.rz]];
|
||||
}
|
||||
|
||||
// const gz2 = data[alltype[1]] ?
|
||||
// type == "3" ? [[typeName == '5' ? 51 : 62, typeName == '5' ? 90.94 : 84.85], [typeName == '5' ? 51 : 62, data[alltype[1]]]] :
|
||||
// type == "2" ? [[typeName == '3' ? 50 : 61, typeName == '3' ? 84.04 : 81.05], [typeName == '3' ? 50 : 61, data[alltype[1]]]] :
|
||||
// type == "1" ? [[typeName == '1' ? 51.5 : 58, typeName == '1' ? 78.61 : 82.75], [typeName == '1' ? 51.5 : 58, data[alltype[1]]]] :
|
||||
// [[65, typeName == '7' ? 109.32 : 109.36], [65, data[alltype[1]]]] :
|
||||
// [];
|
||||
// 5. 坐标和高程计算 (Pipe Configs)
|
||||
const baseY1 = type == "3" ? (typeName == '5' ? 90.50 : 81.85)
|
||||
: type == "2" ? (typeName == '3' ? 84.41 : 83.78)
|
||||
: type == "1" ? (typeName == '1' ? 80.11 : 78.64)
|
||||
: (typeName == '7' ? 109.08 : 108.77);
|
||||
|
||||
// const gz3 = data[alltype[2]] ?
|
||||
// type == "3" ? [[62, 92.65], [62, data[alltype[2]]]] :
|
||||
// type == "2" ? [[61, 83.93], [61, data[alltype[2]]]] :
|
||||
// type == "1" ? [[58, 81.38], [58, data[alltype[2]]]] :
|
||||
// [[77, typeName == '7' ? 109.01 : 108.87], [77, data[alltype[2]]]] : [];
|
||||
const baseY2 = type == "3" ? (typeName == '5' ? 90.94 : 84.85)
|
||||
: type == "2" ? (typeName == '3' ? 84.04 : 81.05)
|
||||
: type == "1" ? (typeName == '1' ? 78.61 : 82.75)
|
||||
: (typeName == '7' ? 109.32 : 109.36);
|
||||
|
||||
const baseY3 = type == "3" ? 92.65
|
||||
: type == "2" ? 83.93
|
||||
: type == "1" ? 81.38
|
||||
: (typeName == '7' ? 109.01 : 108.87);
|
||||
|
||||
// const gz4 = data[alltype[3]] ?
|
||||
// type == "3" ? [] :
|
||||
// type == "2" ? [[79, 79.57], [79, data[alltype[3]]]] :
|
||||
// type == "1" ? [[79, 79.09], [79, data[alltype[3]]]] :
|
||||
// [[85, 166], [85, data[alltype[3]]]] : [];
|
||||
const baseY4 = type == "3" ? null
|
||||
: type == "2" ? 79.57
|
||||
: type == "1" ? 79.09
|
||||
: 166;
|
||||
|
||||
// 心墙中心两点(插入到连线中)
|
||||
const x1 = type == "3" ? (typeName == '5' ? 47 : 51)
|
||||
: type == "2" ? (typeName == '3' ? 45.5 : 50)
|
||||
: type == "1" ? (typeName == '1' ? 44 : 51.5)
|
||||
: 53.5;
|
||||
|
||||
const x2 = type == "3" ? (typeName == '5' ? 51 : 63)
|
||||
: type == "2" ? (typeName == '3' ? 50 : 61)
|
||||
: type == "1" ? (typeName == '1' ? 51.5 : 61)
|
||||
: 66;
|
||||
|
||||
const x3 = type == "3" ? 63
|
||||
: type == "2" ? 61
|
||||
: type == "1" ? 61
|
||||
: 77;
|
||||
|
||||
const x4 = type == "3" ? null
|
||||
: type == "2" ? 79
|
||||
: type == "1" ? 81
|
||||
: 85;
|
||||
|
||||
// 构建 Pipes 数组
|
||||
const pipes = [];
|
||||
const coords = [
|
||||
{ x: x1, y: baseY1 },
|
||||
{ x: x2, y: baseY2 },
|
||||
{ x: x3, y: baseY3 },
|
||||
{ x: x4, y: baseY4 }
|
||||
];
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (alltype[i] && coords[i].x !== null && coords[i].y !== null) {
|
||||
pipes.push({
|
||||
x: coords[i].x,
|
||||
bottomY: coords[i].y,
|
||||
topY: pieMonth[alltype[i]],
|
||||
value: data[alltype[i]]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 连接线逻辑 (Connection Line)
|
||||
const xCenter = type === "3" ? 49 : (type === "2" ? 47.5 : (type === "1" ? 47.5 : 60));
|
||||
// 简化规则:typeName 为 2/4/6 → 渗压管都在右侧;FB0+010/FB0+030(typeName 为 7/8)不绘制心墙连线
|
||||
const rightSideOnly = ['2', '4', '6'].includes(typeName);
|
||||
const skipCenterLine = ['7', '8'].includes(typeName);
|
||||
|
||||
// 左/右管取值(右侧优先 alltype[0],无则 alltype[1])
|
||||
// 左/右管取值
|
||||
const leftSyg = rightSideOnly ? undefined : data[alltype[0]];
|
||||
const rightSyg = rightSideOnly ? (data[alltype[0]] ?? data[alltype[1]]) : data[alltype[1]];
|
||||
|
||||
|
|
@ -113,85 +350,24 @@ export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
|||
}
|
||||
}
|
||||
} else if (rightSyg !== undefined && rightSyg !== null) {
|
||||
// 左边无渗压管:第一个点为(X, 水位-1),第二个点为(X, 右管+0.5)
|
||||
midPts = [[xCenter, data.rz - 1], [xCenter, rightSyg + 0.5]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const baseY1 = type == "3" ? (typeName =='5' ?90.50:81.85)
|
||||
: type == "2" ? (typeName =='3' ?84.41:83.78)
|
||||
: type == "1" ? (typeName =='1' ?80.11:78.64)
|
||||
: (typeName =='7'?109.08:108.77);
|
||||
|
||||
const baseY2 = type == "3" ? (typeName =='5' ?90.94:84.85)
|
||||
: type == "2" ? (typeName =='3' ?84.04:81.05)
|
||||
: type == "1" ? (typeName =='1' ?78.61:82.75)
|
||||
: (typeName =='7'?109.32:109.36);
|
||||
|
||||
const baseY3 = type == "3" ? 92.65
|
||||
: type == "2" ? 83.93
|
||||
: type == "1" ? 81.38
|
||||
: (typeName =='7'?109.01:108.87);
|
||||
|
||||
const baseY4 = type == "3" ? null
|
||||
: type == "2" ? 79.57
|
||||
: type == "1" ? 79.09
|
||||
: 166;
|
||||
|
||||
// 各管的 X(取你原来的 X)
|
||||
const x1 = type == "3" ? (typeName =='5' ?47:51)
|
||||
: type == "2" ? (typeName =='3' ? 45.5:50)
|
||||
: type == "1" ? (typeName =='1' ?44:51.5)
|
||||
: 53.5;
|
||||
|
||||
const x2 = type == "3" ? (typeName =='5' ?51:63)
|
||||
: type == "2" ? (typeName =='3' ?50:61)
|
||||
: type == "1" ? (typeName =='1' ?51.5:61)
|
||||
: 66;
|
||||
|
||||
const x3 = type == "3" ? 63
|
||||
: type == "2" ? 61
|
||||
: type == "1" ? 61
|
||||
: 77;
|
||||
|
||||
const x4 = type == "3" ? null
|
||||
: type == "2" ? 79
|
||||
: type == "1" ? 81
|
||||
: 85;
|
||||
|
||||
|
||||
// 管口高程(可能为空)
|
||||
const mouth1 = pieMonth[alltype[0]];
|
||||
const mouth2 = pieMonth[alltype[1]];
|
||||
const mouth3 = pieMonth[alltype[2]];
|
||||
const mouth4 = pieMonth[alltype[3]];
|
||||
|
||||
// 蓝色段:从“管口(若有)/管底”到 UPD 值
|
||||
const gz1 = data[alltype[0]] ? [[x1, baseY1], [x1, data[alltype[0]]]] : [];
|
||||
const gz2 = data[alltype[1]] ? [[x2, baseY2], [x2, data[alltype[1]]]] : [];
|
||||
const gz3 = data[alltype[2]] ? [[x3, baseY3], [x3, data[alltype[2]]]] : [];
|
||||
const gz4 = data[alltype[3]] && x4 !== null ? [[x4, baseY4], [x4, data[alltype[3]]]] : [];
|
||||
|
||||
// 灰色段:从“管底”到“管口”(仅当 mouth 存在)
|
||||
const gk1 = (mouth1 !== null && mouth1 !== undefined) ? [[x1, baseY1], [x1, mouth1]] : [];
|
||||
const gk2 = (mouth2 !== null && mouth2 !== undefined) ? [[x2, baseY2], [x2, mouth2]] : [];
|
||||
const gk3 = (mouth3 !== null && mouth3 !== undefined) ? [[x3, baseY3], [x3, mouth3]] : [];
|
||||
const gk4 = (mouth4 !== null && mouth4 !== undefined && x4 !== null) ? [[x4, baseY4], [x4, mouth4]] : [];
|
||||
|
||||
// 将渗压管连起来的线(插入 midPts)
|
||||
const line = data?.rz ?
|
||||
type == "3" ?
|
||||
[
|
||||
// 生成连接线点集
|
||||
let connectionLine = [];
|
||||
if (data?.rz) {
|
||||
if (type == "3") {
|
||||
connectionLine = [
|
||||
[xValue, data?.rz],
|
||||
...(rightSideOnly ? midPts : []),
|
||||
[typeName == '5' ? 47 : 51, data[alltype[0]]],
|
||||
...(!rightSideOnly ? midPts : []),
|
||||
[typeName == '5' ? 51 : 63, data[alltype[1]]],
|
||||
[63, data[alltype[2]]],
|
||||
] :
|
||||
type == "2" ?
|
||||
[
|
||||
];
|
||||
} else if (type == "2") {
|
||||
connectionLine = [
|
||||
[xValue, data?.rz],
|
||||
...(rightSideOnly ? midPts : []),
|
||||
[typeName == '3' ? 45.5 : 50, data[alltype[0]]],
|
||||
|
|
@ -199,9 +375,9 @@ export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
|||
[typeName == '3' ? 50 : 61, data[alltype[1]]],
|
||||
[61, data[alltype[2]]],
|
||||
[79, data[alltype[3]]]
|
||||
] :
|
||||
type == "1" ?
|
||||
[
|
||||
];
|
||||
} else if (type == "1") {
|
||||
connectionLine = [
|
||||
[xValue, data?.rz],
|
||||
...(rightSideOnly ? midPts : []),
|
||||
[typeName == '1' ? 44 : 51.5, data[alltype[0]]],
|
||||
|
|
@ -209,8 +385,9 @@ export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
|||
[typeName == '1' ? 51.5 : 61, data[alltype[1]]],
|
||||
[61, data[alltype[2]]],
|
||||
[81, data[alltype[3]]]
|
||||
] :
|
||||
[
|
||||
];
|
||||
} else {
|
||||
connectionLine = [
|
||||
[xValue, data?.rz],
|
||||
...(rightSideOnly ? midPts : []),
|
||||
[53.5, data[alltype[0]]],
|
||||
|
|
@ -218,318 +395,23 @@ export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
|||
[66, data[alltype[1]]],
|
||||
[77, data[alltype[2]]],
|
||||
[85, data[alltype[3]]]
|
||||
]
|
||||
: []
|
||||
const filteredArray = line.filter(subArray => {
|
||||
return subArray.every(item => item !== null && item !== undefined);
|
||||
});
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
saveAsImage: {
|
||||
show: true,
|
||||
excludeComponents: ['toolbox'],
|
||||
pixelRatio: 2,
|
||||
name: "测值图"
|
||||
},
|
||||
},
|
||||
right: "10%",
|
||||
top: "4%"
|
||||
},
|
||||
// title: {
|
||||
// show: true,
|
||||
// text: "断面名称",
|
||||
// left: 'center',
|
||||
// bottom: '-5%',
|
||||
// // textStyle: {
|
||||
// },
|
||||
graphic: [
|
||||
{
|
||||
type: 'image',
|
||||
// id: 'background',
|
||||
left: 'center',
|
||||
// top: '11%',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
z: 1,
|
||||
bounding: 'all',
|
||||
style: {
|
||||
image: imageUrl,
|
||||
width: 1100,
|
||||
height: 380
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'image',
|
||||
// id: 'background',
|
||||
left: '7%',
|
||||
bottom: "5%",
|
||||
z: 1,
|
||||
bounding: 'all',
|
||||
style: {
|
||||
image: rule,
|
||||
width: 10,
|
||||
height: 450
|
||||
}
|
||||
}
|
||||
],
|
||||
grid: {
|
||||
// top: '10%',
|
||||
// left: '2%',
|
||||
// right: '5%',
|
||||
// bottom: '10%',
|
||||
// containLabel: true
|
||||
top: '0%',
|
||||
left: '2%',
|
||||
right: '5%',
|
||||
bottom: '0%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
axisLabel: {
|
||||
show: false,
|
||||
// 坐标轴字体颜色
|
||||
color: textColor,
|
||||
fontSize: 18
|
||||
},
|
||||
axisLine: {
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: textColor
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
// y轴刻度线
|
||||
show: false
|
||||
},
|
||||
splitLine: {
|
||||
// 网格
|
||||
show: false
|
||||
},
|
||||
boundaryGap: false
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: yMin,
|
||||
max: yMax,
|
||||
interval: 5,
|
||||
// data:[155,160,180,190,210],
|
||||
nameTextStyle: {
|
||||
color: '#333',
|
||||
fontSize: 18,
|
||||
padding: [0, 0, 0, 80]
|
||||
},
|
||||
axisLabel: {
|
||||
// 坐标轴字体颜色
|
||||
color: textColor,
|
||||
fontSize: 18,
|
||||
formatter: function (value, index, i) {
|
||||
if (index === 0 || value === yMax) {
|
||||
return ''; // 隐藏第一个刻度和最后一个刻度
|
||||
} else {
|
||||
return value; // 显示其他刻度
|
||||
}
|
||||
}
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
// y轴刻度线
|
||||
show: false
|
||||
},
|
||||
splitLine: {
|
||||
// 网格
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: '#CCCCCC',
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
series: [
|
||||
// 和大坝坡面重合的线 斜率为0.75
|
||||
{
|
||||
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
areaStyle: {
|
||||
origin: "end",
|
||||
color: 'rgba(0, 128, 255, 0.3)' // 设置区域填充颜色
|
||||
},
|
||||
data: [...rz, ...rz1]
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
markPoint: {
|
||||
data: [{ type: 'max', x: "20%", coord: [xValue, data?.rz] }],
|
||||
symbol: 'pin',
|
||||
symbolSize: [30, 10],
|
||||
itemStyle: {
|
||||
color: '#fff', // 标注点颜色
|
||||
borderColor: '#ffa500', // 标注点边框颜色
|
||||
borderWidth: 0 // 标注点边框宽度
|
||||
},
|
||||
label: {
|
||||
show: data?.rz ? true : false, // 是否显示标签
|
||||
formatter: "库水位" + data?.rz + "m", // 标签格式
|
||||
color: '#5487FF', // 标签文字颜色
|
||||
fontSize: 12, // 标签文字大小
|
||||
}
|
||||
},
|
||||
data: rz
|
||||
},
|
||||
{
|
||||
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
data: rz1
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: 'rgba(154, 160, 166,.4)' },
|
||||
lineStyle: { color: 'rgba(154, 160, 166,.4)', width: 6 },
|
||||
data: gk1
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: 'rgba(154, 160, 166,.4)' },
|
||||
lineStyle: { color: 'rgba(154, 160, 166,.4)', width: 6 },
|
||||
data: gk2
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: 'rgba(154, 160, 166,.4)' },
|
||||
lineStyle: { color: 'rgba(154, 160, 166,.4)', width: 6 },
|
||||
data: gk3
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: { color: 'rgba(154, 160, 166,.4)' },
|
||||
lineStyle: { color: 'rgba(154, 160, 166,.4)', width: 6 },
|
||||
data: gk4
|
||||
},
|
||||
// 管位
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF',
|
||||
width: 6
|
||||
},
|
||||
data: gz1
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF',
|
||||
width: 6
|
||||
},
|
||||
data: gz2
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF',
|
||||
width: 6
|
||||
},
|
||||
data: gz3
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF',
|
||||
width: 6
|
||||
},
|
||||
data: gz4
|
||||
},
|
||||
// 管位连接线
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
symbolSize: 10,
|
||||
z: 1,
|
||||
// smooth: 0.6, // 设置平滑度
|
||||
// smoothMonotone: 'x', // 保持 x 方向的单调性
|
||||
itemStyle: {
|
||||
color: '#5487FF'
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#5487FF',
|
||||
width: 2,
|
||||
// curveness: 0.5 // 增加曲线程度
|
||||
},
|
||||
data: filteredArray
|
||||
},
|
||||
]
|
||||
yAxis: { min: yMin, max: yMax },
|
||||
backgroundImage: { url: imageUrl, width: 1100, height: 380 },
|
||||
damLines: { rz, rz1 },
|
||||
waterLevel: { value: data?.rz, x: xValue },
|
||||
pipes,
|
||||
connectionLine
|
||||
};
|
||||
};
|
||||
|
||||
// 默认导出保持向后兼容,或者作为入口
|
||||
export default function jrxOptions(data = {}, type = "1", typeName = '1') {
|
||||
console.log("data", data);
|
||||
const config = getCurrentProjectConfig(data, type, typeName);
|
||||
return getJrxChartOption(data, config);
|
||||
}
|
||||
|
|
@ -76,18 +76,19 @@ const SplitScreen: React.FC = (props: any) => {
|
|||
{/* {props.videoArr} */}
|
||||
<div className={['flex', 'flexwarp', 'borderF'].join(' ')} style={{ position: 'relative' }}>
|
||||
{list.map((item: any, index: any) => {
|
||||
return <div onClick={() => clickVideo(index,item)}
|
||||
const videoItem = videoList[index]
|
||||
return <div key={index} onClick={() => clickVideo(index,item)}
|
||||
// onClick={()=>clickVideo(index)}
|
||||
className={[getNum() == index ? 'videoBorder' : null,
|
||||
size == 1 ? 'videoBorder1' : null, size == 4 ? 'videoBorder4' : null,
|
||||
size == 9 ? 'videoBorder9' : null,'borderFa'].join(' ')}>
|
||||
{props.videoArr[index]&&<div style={{height:'100%',width:'100%'}}>
|
||||
{videoItem?.src && <div style={{height:'100%',width:'100%'}}>
|
||||
<div style={{ height: 'calc(100% - 20px)',width:'100%' }}>
|
||||
{videoList.length&&<HFivePlayer size={size} wsUrl={videoList[index]} playerID={index} />}
|
||||
<HFivePlayer size={size} wsUrl={videoItem} playerID={index} />
|
||||
</div>
|
||||
<div style={{ textAlign: 'center' }}>{videoList[index]?.name}</div>
|
||||
<div style={{ textAlign: 'center' }}>{videoItem?.name}</div>
|
||||
</div>}
|
||||
{!props.videoArr[index]&&<div className='borderType'>
|
||||
{!videoItem?.src && <div className='borderType'>
|
||||
<img src={require('../../assets/images/no-video.png')}/>
|
||||
<div className='text'>暂无视频数据</div>
|
||||
</div>}
|
||||
|
|
|
|||
Loading…
Reference in New Issue