2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
|
|
import{bG as z}from"./enterpriseApi-970b69b2.js";import{d as w,A as H,r as a,G as q,w as K,b as L,at as U,ak as D,e as G,f as Q,g as r,h as X,z as Y,y as h,aA as Z,aB as $,a as O,aC as j,E as ee,_ as te}from"./index-ccab2584.js";import{T as ne}from"./index-5b1885c2.js";const ae={class:"table-box"},le={style:{display:"flex",flex:"1"}},oe={class:"middle-video"},ie=w({name:"enterpriseVideo"}),se=w({...ie,setup(re){const C=H(),g=a(""),W=q(),y=a(),x=a(null);let u=a(""),d=a(""),_=a(""),o=a(0),n=a(null),i=a([]),l=a({appkey:"",ip:"",secret:"",port:18443,playMode:0,layout:"4x6"});const J=async t=>{i.value=[t.data.code],g.value=t.parent.data.title||t.data.title,t.data.code===null?(i.value=t.data.children.map(e=>e.code),i.value.forEach(e=>{S(e)})):(P(),S(t.data.code))};K(()=>W.editPassword,t=>{t?n.JS_HideWnd():n.JS_ShowWnd()});const m=async()=>{const{result:t}=await z({});return y.value.treeAllData=t,t},P=async()=>{await Z({cameraIndexCode:i.value})},T=async()=>{const t=await $({});l.value=O({appkey:t.result.appKey,ip:t.result.ip+":"+t.result.port,secret:t.result.appSecret,port:18443,playMode:0,layout:"4x6"}),l.value};L(async()=>{T();const t=j(),e=t==null?void 0:t.refs.playWndBox;u.value=e==null?void 0:e.clientHeight,d.value=e==null?void 0:e.clientWidth,window.addEventListener("scroll",()=>{n.value==null&&n.JS_Resize(e==null?void 0:e.clientWidth,e==null?void 0:e.clientHeight)}),window.addEventListener("resize",s=>{n.value==null&&n.JS_Resize(e==null?void 0:e.clientWidth,e==null?void 0:e.clientHeight)}),U(()=>{c()})}),D(()=>{n.value===void 0&&(n.JS_HideWnd(),n.JS_RequestInterface({funcName:"destroyWnd"}),n.JS_Disconnect())});const c=()=>{n=new WebControl({szPluginContainer:"playWnd",iServicePortStart:15900,iServicePortEnd:15900,szClassId:"23BF3B0A-2C56-4D97-9C03-0CB103AA8F11",cbConnectSuccess:()=>{n.JS_StartService("window",{dllPath:"./VideoPluginConnect.dll"}).then(function(){n.JS_SetWindowControlCallback({}),n.JS_CreateWnd("playWnd",1e3,600,{bEmbed:!0}).then(function(){b()})},function(){})},cbConnectError:function(){n.value=null,window.WebControl.JS_WakeUp("VideoWebPlugin://"),o.value++,o.value<3?setTimeout(function(){c()},3e3):setTimeout(function(){setTimeout(function(){C.push("/home")},4e3)},4e3),o.value<2?(n.value=null,ee.warning("\u63D2\u4EF6\u672A\u542F\u52A8\uFF0C\u6B63\u5728\u5C1D\u8BD5\u542F\u52A8\uFF0C\u8BF7\u7A0D\u5019..."),window.WebControl.JS_WakeUp("VideoWebPlugin://"),setTimeout(()=>{c()},3e3),o.value++):window.location.href=this.videoWebPluginUrl},cbConnectClose:()=>{n.value=null}})},b=t=>{B(()=>{let e=l.value.appkey,s=k(l.value.secret),p=l.value.ip,f=l.value.playMode,v=l.value.port,A="D:\\SnapDir",E="D:\\VideoDir",F=l.value.layout,I=1,M="secret",R=1,V=0,N="0,16,256,257,258,259,260,512,513,514,515,516,517,768,769";n==null||n.JS_RequestInterface({funcName:"init",argument:JSON.stringify({appkey:e,secret:s,ip:p,playMode:f,port:v,snapDir:A,videoDir:E,layout:F,enableHTTPS:I,encryptedFields:M,showToolbar:R,showSmart:V,buttonIDs:N})}).then(function(ue){n.JS_Resize(d.value,u.value),t&&t()})})};let k=t=>{let e=new window.JSEncrypt;return e.setPublicKey(_),e.encrypt(t)};const B=t=>{n.JS_RequestInterface({funcName:"getRSAPubKey",argument:JSON.stringify({keyLength:1024})}).then(function(e){e.responseMsg.data&&(_=e.responseMsg.data,t())})},S=t=>{let e=t,s=0,p=1,f=0,v=-1;n.JS_RequestInterface({funcName:"startPreview",argument:JSON.stringify({cameraIndexCode:e,streamMode:s,transMode:p,gpuMode:f,wndId:v})}).then(function(){n.JS_SetWindowControlCallback({})})};return(t,e)=>(G(),Q("div",ae,[r("div",le,[X(ne,{ref_key:"engTree",ref:y,label:"title",requestApi:m,onChange:J,class:"treefilter"},null,512),r("div",oe,[r("div",{ref_key:"playWndBox",ref:x,class:"main"},[r("div",{id:"playWnd",class:"playWnd",style:Y({height:h(u)+"px",width:h(d)+"px"})},null,4)],512)])])]))}});const fe=te(se,[["__scopeId","data-v-3fd60592"]]);export{fe as default};
|