hldy_app/unpackage/dist/build/app-plus/pages/fullcamera.js

33 lines
13 KiB
JavaScript

"use weex:vue";
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
};
if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
const global = uni.requireGlobal()
ArrayBuffer = global.ArrayBuffer
Int8Array = global.Int8Array
Uint8Array = global.Uint8Array
Uint8ClampedArray = global.Uint8ClampedArray
Int16Array = global.Int16Array
Uint16Array = global.Uint16Array
Int32Array = global.Int32Array
Uint32Array = global.Uint32Array
Float32Array = global.Float32Array
Float64Array = global.Float64Array
BigInt64Array = global.BigInt64Array
BigUint64Array = global.BigUint64Array
};
(()=>{var $=Object.create;var c=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var w=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of k(t))!v.call(e,s)&&s!==o&&c(e,s,{get:()=>t[s],enumerable:!(i=_(t,s))||i.enumerable});return e};var m=(e,t,o)=>(o=e!=null?$(T(e)):{},w(t||!e||!e.__esModule?c(o,"default",{value:e,enumerable:!0}):o,e));var u=R((b,p)=>{p.exports=Vue});var A=m(u());function h(e){return weex.requireModule(e)}function n(e,t,...o){uni.__log__?uni.__log__(e,t,...o):console[e].apply(console,[...o,t])}var d=(e,t)=>{let o=e.__vccOpts||e;for(let[i,s]of t)o[i]=s;return o};var r=m(u()),S={"center-column":{"":{width:900,height:600,overflow:"hidden"}}},q={data(){return{phoneNumber:"1234567890",initnumber:5,isAlarming:!1,isRecording:!1,isTalking:!1,_pendingRequests:{snapshot:[],record:[],talk:[]},suo:!0,isshow:!0,globalEvent:""}},onLoad(){n("log","at pages/fullcamera.nvue:29","???\u52A0\u8F7D"),this.globalEvent=h&&h("globalEvent"),this.globalEvent&&this.globalEvent.addEventListener&&this.globalEvent.addEventListener("myEvent",e=>{e.recordUrl&&uni.showToast({title:"\u5F55\u5C4F\u6210\u529F",icon:"success",duration:1500}),e.snapShotUrl&&uni.showToast({title:"\u622A\u5C4F\u6210\u529F",icon:"success",duration:1500}),this.suo&&e.onVolumeChange&&(e.onVolumeChange&&this.toggleVolume(),this.suo=!1)}),uni.setStorageSync("saveinit",5),uni.$on("fullmonitor:changeinit",e=>{this.$refs.monitor.initAutoPlay(e),uni.setStorageSync("saveinit",e),n("log","at pages/fullcamera.nvue:63","saveinit",e)}),uni.$on("fullmonitor:isshow",e=>this.isshow=e),uni.$on("fullmonitor:killView",this.killView),uni.$on("fullmonitor:doSnapshot",this.doSnapshot),uni.$on("fullmonitor:startRecord",this.doStartRecord),uni.$on("fullmonitor:stopRecord",this.doStopRecord),uni.$on("fullmonitor:openTalk",this.doOpenTalk),uni.$on("fullmonitor:stopTalk",this.doStopTalk),uni.$on("fullmonitor:switchDisplay",e=>this.switchDisplay(e)),uni.$on("fullmonitor:startAlarm",this.startAlarm),uni.$on("fullmonitor:stopAlarm",this.stopAlarm),uni.$on("fullmonitor:flipImage",e=>this.flipImage(e)),uni.$on("fullmonitor:resumeOrPause",this.resumeOrPause),uni.$on("fullmonitor:changeQuality",this.changeQuality),uni.$on("fullmonitor:toggleVolume",this.toggleVolume),uni.$on("fullmonitor:test",this.test)},onUnload(){n("log","at pages/fullcamera.nvue:84","fullcamera \u5378\u8F7D\uFF0C\u6E05\u7406\u4E8B\u4EF6"),this.globalEvent&&this.globalEvent.removeEventListener&&this.globalEvent.removeEventListener("myEvent"),["fullmonitor:killView","fullmonitor:changeinit","fullmonitor:isshow","fullmonitor:doSnapshot","fullmonitor:startRecord","fullmonitor:stopRecord","fullmonitor:openTalk","fullmonitor:stopTalk","fullmonitor:switchDisplay","fullmonitor:startAlarm","fullmonitor:stopAlarm","fullmonitor:flipImage","fullmonitor:resumeOrPause","fullmonitor:changeQuality","fullmonitor:toggleVolume","fullmonitor:test"].forEach(t=>uni.$off(t))},methods:{handleTelEvent(e){n("log","at pages/fullcamera.nvue:115","Tel event detail:",e.detail)},killView(){this.$refs.monitor.killView&&this.$refs.monitor.killView()},switchDisplay(e){n("log","at pages/fullcamera.nvue:123","zzzzz",e),this.$refs.monitor&&this.$refs.monitor.switchDisplayModeFragment(e)},startAlarm(){this.isAlarming=!0,this.$refs.monitor.startOrStopManualAlarm(this.isAlarming,e=>{n("log","at pages/fullcamera.nvue:130","startAlarm callback:",e)})},stopAlarm(){this.isAlarming=!1,this.$refs.monitor.startOrStopManualAlarm(this.isAlarming,e=>{n("log","at pages/fullcamera.nvue:136","stopAlarm callback:",e)})},flipImage(e){this.$refs.monitor.changeImageSwitch(e,t=>{n("log","at pages/fullcamera.nvue:142","flipImage callback:",t)})},resumeOrPause(){this.$refs.monitor.resumeOrPause&&this.$refs.monitor.resumeOrPause()},changeQuality(){this.$refs.monitor.changeQuality&&this.$refs.monitor.changeQuality()},toggleVolume(){this.$refs.monitor.toggleVolume&&this.$refs.monitor.toggleVolume()},test(){this.$refs.monitor&&this.$refs.monitor.test&&this.$refs.monitor.test()},doSnapshot(e={}){if(!this.$refs.monitor||!this.$refs.monitor.snapShot){uni.showToast({title:"\u7EC4\u4EF6\u4E0D\u652F\u6301 snapShot()",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"snapShot_not_supported"});return}e.reqId&&this._pendingRequests.snapshot.push(e.reqId);try{this.$refs.monitor.snapShot(t=>{n("log","at pages/fullcamera.nvue:188","snapShot callback:",t),this._handleSnapshotResultFromNative(t,e.reqId)}),uni.showToast({title:"\u6B63\u5728\u622A\u5C4F...",icon:"none",duration:800})}catch(t){n("error","at pages/fullcamera.nvue:197","snapShot \u8C03\u7528\u5931\u8D25",t),uni.showToast({title:"snapShot \u8C03\u7528\u5931\u8D25",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"snapShot_call_failed",detail:String(t)})}},doStartRecord(e={}){if(!this.$refs.monitor||!this.$refs.monitor.startRecord){uni.showToast({title:"\u7EC4\u4EF6\u4E0D\u652F\u6301 startRecord()",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"startRecord_not_supported"});return}try{this.$refs.monitor.startRecord(t=>{n("log","at pages/fullcamera.nvue:230","startRecord callback:",t),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!0,res:t})}),this.isRecording=!0,uni.showToast({title:"\u5F55\u5C4F\u5DF2\u5F00\u59CB",icon:"none"})}catch(t){n("error","at pages/fullcamera.nvue:245","startRecord \u8C03\u7528\u5931\u8D25",t),uni.showToast({title:"startRecord \u8C03\u7528\u5931\u8D25",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"startRecord_call_failed",detail:String(t)})}},doStopRecord(e={}){if(!this.$refs.monitor||!this.$refs.monitor.stopRecord){uni.showToast({title:"\u7EC4\u4EF6\u4E0D\u652F\u6301 stopRecord()",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"stopRecord_not_supported"});return}e.reqId&&this._pendingRequests.record.push(e.reqId);try{this.$refs.monitor.stopRecord(t=>{n("log","at pages/fullcamera.nvue:284","stopRecord callback:",t),this._handleRecordResultFromNative(t,e.reqId)})}catch(t){n("error","at pages/fullcamera.nvue:289","stopRecord \u8C03\u7528\u5931\u8D25",t),uni.showToast({title:"stopRecord \u8C03\u7528\u5931\u8D25",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"stopRecord_call_failed",detail:String(t)})}},doOpenTalk(e={}){if(!this.$refs.monitor||!this.$refs.monitor.openTalk){uni.showToast({title:"\u7EC4\u4EF6\u4E0D\u652F\u6301 openTalk()",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"openTalk_not_supported"});return}e.reqId&&this._pendingRequests.talk.push(e.reqId);try{this.$refs.monitor.openTalk(t=>{n("log","at pages/fullcamera.nvue:326","openTalk callback:",t),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!0,res:t})}),this.isTalking=!0,uni.showToast({title:"\u5C1D\u8BD5\u5EFA\u7ACB\u5BF9\u8BB2\u8FDE\u63A5...",icon:"none"})}catch(t){n("error","at pages/fullcamera.nvue:341","openTalk \u8C03\u7528\u5931\u8D25",t),uni.showToast({title:"openTalk \u8C03\u7528\u5931\u8D25",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"openTalk_call_failed",detail:String(t)})}},doStopTalk(e={}){if(!this.$refs.monitor||!this.$refs.monitor.stopTalk){uni.showToast({title:"\u7EC4\u4EF6\u4E0D\u652F\u6301 stopTalk()",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"stopTalk_not_supported"});return}try{this.$refs.monitor.stopTalk(t=>{n("log","at pages/fullcamera.nvue:374","stopTalk callback:",t),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!0,res:t})}),this.isTalking=!1}catch(t){n("error","at pages/fullcamera.nvue:384","stopTalk \u8C03\u7528\u5931\u8D25",t),uni.showToast({title:"stopTalk \u8C03\u7528\u5931\u8D25",icon:"none"}),e.reqId&&uni.$emit(`fullmonitor:response:${e.reqId}`,{ok:!1,error:"stopTalk_call_failed",detail:String(t)})}},handleSnapShotEvent(e){let t=e&&e.detail?e.detail:e;n("log","at pages/fullcamera.nvue:404","onSnapShot event:",t),this._handleSnapshotResultFromNative(t)},handleRecordEvent(e){let t=e&&e.detail?e.detail:e;n("log","at pages/fullcamera.nvue:412","onRecord event:",t),this._handleRecordResultFromNative(t)},handleTalkEvent(e){let t=e&&e.detail?e.detail:e;n("log","at pages/fullcamera.nvue:419","onTalkStatus event:",t);let o=t&&t.talkStatus,i=t&&t.tips;if(uni.$emit("fullmonitor:talk:status",t),this._pendingRequests.talk&&this._pendingRequests.talk.length)for(;this._pendingRequests.talk.length;){let s=this._pendingRequests.talk.shift();uni.$emit(`fullmonitor:response:${s}`,{ok:!0,payload:t})}switch((o||"").toLowerCase()){case"loading":uni.showToast({title:i||"\u5BF9\u8BB2\u8FDE\u63A5\u4E2D...",icon:"none"}),this.isTalking=!0;break;case"playing":uni.showToast({title:i||"\u5BF9\u8BB2\u5DF2\u8FDE\u63A5",icon:"none"}),this.isTalking=!0;break;case"stopped":uni.showToast({title:i||"\u5BF9\u8BB2\u5DF2\u505C\u6B62",icon:"none"}),this.isTalking=!1;break;case"failed":uni.showToast({title:i||"\u5BF9\u8BB2\u5931\u8D25",icon:"none"}),this.isTalking=!1;break;default:uni.showToast({title:i||"\u5BF9\u8BB2\u72B6\u6001: "+(o||"unknown"),icon:"none"});break}},_handleSnapshotResultFromNative(e,t=null){if(!e){uni.showToast({title:"\u622A\u56FE\u6CA1\u6709\u8FD4\u56DE\u6570\u636E",icon:"none"}),t&&uni.$emit(`fullmonitor:response:${t}`,{ok:!1,error:"no_data"});return}let o=e;if(e.detail&&(o=e.detail),n("log","at pages/fullcamera.nvue:496","snapshot payload normalized:",o),t&&uni.$emit(`fullmonitor:response:${t}`,{ok:!!o.snapShotResult,payload:o}),!t&&this._pendingRequests.snapshot&&this._pendingRequests.snapshot.length)for(;this._pendingRequests.snapshot.length;){let i=this._pendingRequests.snapshot.shift();uni.$emit(`fullmonitor:response:${i}`,{ok:!!o.snapShotResult,payload:o})}if(uni.$emit("fullmonitor:snapshot:done",o),o.snapShotResult===!0||o.snapShotResult==="true"){let i=o.snapShotUrl||o.snapShotPath||o.url;uni.showToast({title:"\u622A\u56FE\u6210\u529F",icon:"success",duration:1200}),i&&uni.previewImage({urls:[i]})}else{let i=o.snapShotErrorCode||o.error||"unknown";uni.showToast({title:"\u622A\u56FE\u5931\u8D25: "+i,icon:"none",duration:2e3}),n("warn","at pages/fullcamera.nvue:539","snapshot failed reason:",i,o)}},_handleRecordResultFromNative(e,t=null){if(!e){uni.showToast({title:"\u5F55\u5C4F\u6CA1\u6709\u8FD4\u56DE\u6570\u636E",icon:"none"}),this.isRecording=!1,t&&uni.$emit(`fullmonitor:response:${t}`,{ok:!1,error:"no_data"});return}let o=e;if(e.detail&&(o=e.detail),n("log","at pages/fullcamera.nvue:561","record payload normalized:",o),t&&uni.$emit(`fullmonitor:response:${t}`,{ok:!!(o.recordUrl||o.snapShotResult),payload:o}),!t&&this._pendingRequests.record&&this._pendingRequests.record.length)for(;this._pendingRequests.record.length;){let i=this._pendingRequests.record.shift();uni.$emit(`fullmonitor:response:${i}`,{ok:!!(o.recordUrl||o.snapShotResult),payload:o})}uni.$emit("fullmonitor:record:done",o),o.recordUrl?(uni.showToast({title:"\u5F55\u5C4F\u5B8C\u6210",icon:"success",duration:1400}),this.isRecording=!1,n("log","at pages/fullcamera.nvue:592","\u5F55\u5C4F\u5730\u5740\uFF1A",o.recordUrl)):o.recordFailedReason?(uni.showToast({title:"\u5F55\u5C4F\u5931\u8D25: "+o.recordFailedReason,icon:"none",duration:2e3}),this.isRecording=!1,n("warn","at pages/fullcamera.nvue:600","record failed reason:",o.recordFailedReason)):(o.snapShotResult===!0&&uni.showToast({title:"\u5F55\u5C4F\u64CD\u4F5C\u5DF2\u5B8C\u6210\uFF08\u8FD4\u56DE\u672A\u77E5\uFF09",icon:"none"}),this.isRecording=!1)}}};function I(e,t,o,i,s,l){let g=(0,r.resolveComponent)("MonitorView");return(0,r.openBlock)(),(0,r.createElementBlock)("scroll-view",{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true",style:{flexDirection:"column"}},[(0,r.createElementVNode)("div",{class:"center-column",style:(0,r.normalizeStyle)({height:s.isshow?"600px":"0px"})},[(0,r.createVNode)(g,{ref:"monitor",init:"5",style:{width:"900px",height:"600px"},onOnTel:l.handleTelEvent,onOnSnapShot:l.handleSnapShotEvent,onOnRecord:l.handleRecordEvent,onOnTalkStatus:l.handleTalkEvent},null,8,["onOnTel","onOnSnapShot","onOnRecord","onOnTalkStatus"])],4)])}var a=d(q,[["render",I],["styles",[S]]]);var f=plus.webview.currentWebview();if(f){let e=parseInt(f.id),t="pages/fullcamera",o={};try{o=JSON.parse(f.__query__)}catch(s){}a.mpType="page";let i=Vue.createPageApp(a,{$store:getApp({allowDefault:!0}).$store,__pageId:e,__pagePath:t,__pageQuery:o});i.provide("__globalStyles",Vue.useCssStyles([...__uniConfig.styles,...a.styles||[]])),i.mount("#root")}})();