"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 __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // vue-ns:vue var require_vue = __commonJS({ "vue-ns:vue"(exports, module) { module.exports = Vue; } }); // ../../../../hldy_app/unpackage/dist/dev/.nvue/_plugin-vue_export-helper.js var import_vue = __toESM(require_vue()); function requireNativePlugin(name) { return weex.requireModule(name); } function formatAppLog(type, filename, ...args) { if (uni.__log__) { uni.__log__(type, filename, ...args); } else { console[type].apply(console, [...args, filename]); } } var _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; // ../../../../hldy_app/unpackage/dist/dev/.nvue/pages/fullcamera.js var import_vue2 = __toESM(require_vue()); var _style_0 = { "center-column": { "": { "width": 900, "height": 600, "overflow": "hidden" } } }; var _sfc_main = { data() { return { phoneNumber: "1234567890", initnumber: 5, isAlarming: false, isRecording: false, // 录屏状态 isTalking: false, // 对讲状态 _pendingRequests: { snapshot: [], record: [], talk: [] }, suo: true, isshow: true, globalEvent: "" }; }, onLoad() { formatAppLog("log", "at pages/fullcamera.nvue:29", "???\u52A0\u8F7D"); this.globalEvent = requireNativePlugin && requireNativePlugin("globalEvent"); if (this.globalEvent && this.globalEvent.addEventListener) { this.globalEvent.addEventListener("myEvent", (e) => { if (e.recordUrl) { uni.showToast({ title: "\u5F55\u5C4F\u6210\u529F", icon: "success", // 'success' | 'loading' | 'none' duration: 1500 }); } if (e.snapShotUrl) { uni.showToast({ title: "\u622A\u5C4F\u6210\u529F", icon: "success", // 'success' | 'loading' | 'none' duration: 1500 }); } if (this.suo && e.onVolumeChange) { if (e.onVolumeChange) { this.toggleVolume(); } this.suo = false; } }); } uni.setStorageSync("saveinit", 5); uni.$on("fullmonitor:changeinit", (number) => { this.$refs.monitor.initAutoPlay(number); uni.setStorageSync("saveinit", number); formatAppLog("log", "at pages/fullcamera.nvue:63", "saveinit", number); }); uni.$on("fullmonitor:isshow", (bool) => this.isshow = bool); 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", (payload) => this.switchDisplay(payload)); uni.$on("fullmonitor:startAlarm", this.startAlarm); uni.$on("fullmonitor:stopAlarm", this.stopAlarm); uni.$on("fullmonitor:flipImage", (payload) => this.flipImage(payload)); 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() { formatAppLog("log", "at pages/fullcamera.nvue:84", "fullcamera \u5378\u8F7D\uFF0C\u6E05\u7406\u4E8B\u4EF6"); if (this.globalEvent && this.globalEvent.removeEventListener) { this.globalEvent.removeEventListener("myEvent"); } const events = [ "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" ]; events.forEach((ev) => uni.$off(ev)); }, methods: { /* ------------------ 原有功能 ------------------ */ handleTelEvent(event) { formatAppLog("log", "at pages/fullcamera.nvue:115", "Tel event detail:", event.detail); }, killView() { this.$refs.monitor.killView && this.$refs.monitor.killView(); }, switchDisplay(mode) { formatAppLog("log", "at pages/fullcamera.nvue:123", "zzzzz", mode); this.$refs.monitor && this.$refs.monitor.switchDisplayModeFragment(mode); }, startAlarm() { this.isAlarming = true; this.$refs.monitor.startOrStopManualAlarm(this.isAlarming, (res) => { formatAppLog("log", "at pages/fullcamera.nvue:130", "startAlarm callback:", res); }); }, stopAlarm() { this.isAlarming = false; this.$refs.monitor.startOrStopManualAlarm(this.isAlarming, (res) => { formatAppLog("log", "at pages/fullcamera.nvue:136", "stopAlarm callback:", res); }); }, flipImage(type) { this.$refs.monitor.changeImageSwitch(type, (res) => { formatAppLog("log", "at pages/fullcamera.nvue:142", "flipImage callback:", res); }); }, 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(); }, /* ------------------ 新增:截图/录屏/对讲 调用方法(支持 payload.reqId) ------------------ */ // 1. 截图(调用) // payload 可选:{ reqId: number } doSnapshot(payload = {}) { if (!this.$refs.monitor || !this.$refs.monitor.snapShot) { uni.showToast({ title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 snapShot()", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "snapShot_not_supported" }); } return; } if (payload.reqId) { this._pendingRequests.snapshot.push(payload.reqId); } try { this.$refs.monitor.snapShot((res) => { formatAppLog("log", "at pages/fullcamera.nvue:188", "snapShot callback:", res); this._handleSnapshotResultFromNative(res, payload.reqId); }); uni.showToast({ title: "\u6B63\u5728\u622A\u5C4F...", icon: "none", duration: 800 }); } catch (err) { formatAppLog("error", "at pages/fullcamera.nvue:197", "snapShot \u8C03\u7528\u5931\u8D25", err); uni.showToast({ title: "snapShot \u8C03\u7528\u5931\u8D25", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "snapShot_call_failed", detail: String(err) }); } } }, // 2. 开始录屏(调用) // payload 可选:{ reqId: number } doStartRecord(payload = {}) { if (!this.$refs.monitor || !this.$refs.monitor.startRecord) { uni.showToast({ title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 startRecord()", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "startRecord_not_supported" }); } return; } try { this.$refs.monitor.startRecord((res) => { formatAppLog("log", "at pages/fullcamera.nvue:230", "startRecord callback:", res); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: true, res }); } }); this.isRecording = true; uni.showToast({ title: "\u5F55\u5C4F\u5DF2\u5F00\u59CB", icon: "none" }); } catch (err) { formatAppLog("error", "at pages/fullcamera.nvue:245", "startRecord \u8C03\u7528\u5931\u8D25", err); uni.showToast({ title: "startRecord \u8C03\u7528\u5931\u8D25", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "startRecord_call_failed", detail: String(err) }); } } }, // 3. 停止录屏(调用) // payload 可选:{ reqId: number } doStopRecord(payload = {}) { if (!this.$refs.monitor || !this.$refs.monitor.stopRecord) { uni.showToast({ title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 stopRecord()", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "stopRecord_not_supported" }); } return; } if (payload.reqId) { this._pendingRequests.record.push(payload.reqId); } try { this.$refs.monitor.stopRecord((res) => { formatAppLog("log", "at pages/fullcamera.nvue:284", "stopRecord callback:", res); this._handleRecordResultFromNative(res, payload.reqId); }); } catch (err) { formatAppLog("error", "at pages/fullcamera.nvue:289", "stopRecord \u8C03\u7528\u5931\u8D25", err); uni.showToast({ title: "stopRecord \u8C03\u7528\u5931\u8D25", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "stopRecord_call_failed", detail: String(err) }); } } }, // 4. 开始对讲(调用) // payload 可选:{ reqId: number } doOpenTalk(payload = {}) { if (!this.$refs.monitor || !this.$refs.monitor.openTalk) { uni.showToast({ title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 openTalk()", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "openTalk_not_supported" }); } return; } if (payload.reqId) { this._pendingRequests.talk.push(payload.reqId); } try { this.$refs.monitor.openTalk((res) => { formatAppLog("log", "at pages/fullcamera.nvue:326", "openTalk callback:", res); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: true, res }); } }); this.isTalking = true; uni.showToast({ title: "\u5C1D\u8BD5\u5EFA\u7ACB\u5BF9\u8BB2\u8FDE\u63A5...", icon: "none" }); } catch (err) { formatAppLog("error", "at pages/fullcamera.nvue:341", "openTalk \u8C03\u7528\u5931\u8D25", err); uni.showToast({ title: "openTalk \u8C03\u7528\u5931\u8D25", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "openTalk_call_failed", detail: String(err) }); } } }, // 5. 停止对讲(调用) // payload 可选:{ reqId: number } doStopTalk(payload = {}) { if (!this.$refs.monitor || !this.$refs.monitor.stopTalk) { uni.showToast({ title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 stopTalk()", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "stopTalk_not_supported" }); } return; } try { this.$refs.monitor.stopTalk((res) => { formatAppLog("log", "at pages/fullcamera.nvue:374", "stopTalk callback:", res); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: true, res }); } }); this.isTalking = false; } catch (err) { formatAppLog("error", "at pages/fullcamera.nvue:384", "stopTalk \u8C03\u7528\u5931\u8D25", err); uni.showToast({ title: "stopTalk \u8C03\u7528\u5931\u8D25", icon: "none" }); if (payload.reqId) { uni.$emit(`fullmonitor:response:${payload.reqId}`, { ok: false, error: "stopTalk_call_failed", detail: String(err) }); } } }, /* ------------------ 事件回调处理(来自原生推送的事件) ------------------ */ // 处理来自模板 @onSnapShot 的事件(event.detail) handleSnapShotEvent(event) { const payload = event && event.detail ? event.detail : event; formatAppLog("log", "at pages/fullcamera.nvue:404", "onSnapShot event:", payload); this._handleSnapshotResultFromNative(payload); }, // 处理来自模板 @onRecord 的事件(event.detail) handleRecordEvent(event) { const payload = event && event.detail ? event.detail : event; formatAppLog("log", "at pages/fullcamera.nvue:412", "onRecord event:", payload); this._handleRecordResultFromNative(payload); }, // 处理来自模板 @onTalkStatus 的事件 handleTalkEvent(event) { const payload = event && event.detail ? event.detail : event; formatAppLog("log", "at pages/fullcamera.nvue:419", "onTalkStatus event:", payload); const status = payload && payload.talkStatus; const tips = payload && payload.tips; uni.$emit("fullmonitor:talk:status", payload); if (this._pendingRequests.talk && this._pendingRequests.talk.length) { while (this._pendingRequests.talk.length) { const reqId = this._pendingRequests.talk.shift(); uni.$emit(`fullmonitor:response:${reqId}`, { ok: true, payload }); } } switch ((status || "").toLowerCase()) { case "loading": uni.showToast({ title: tips || "\u5BF9\u8BB2\u8FDE\u63A5\u4E2D...", icon: "none" }); this.isTalking = true; break; case "playing": uni.showToast({ title: tips || "\u5BF9\u8BB2\u5DF2\u8FDE\u63A5", icon: "none" }); this.isTalking = true; break; case "stopped": uni.showToast({ title: tips || "\u5BF9\u8BB2\u5DF2\u505C\u6B62", icon: "none" }); this.isTalking = false; break; case "failed": uni.showToast({ title: tips || "\u5BF9\u8BB2\u5931\u8D25", icon: "none" }); this.isTalking = false; break; default: uni.showToast({ title: tips || "\u5BF9\u8BB2\u72B6\u6001: " + (status || "unknown"), icon: "none" }); break; } }, /* ------------------ 原生结果的内部处理函数(统一处理 callback / event) ------------------ */ _handleSnapshotResultFromNative(res, reqIdFromCallback = null) { if (!res) { uni.showToast({ title: "\u622A\u56FE\u6CA1\u6709\u8FD4\u56DE\u6570\u636E", icon: "none" }); if (reqIdFromCallback) { uni.$emit(`fullmonitor:response:${reqIdFromCallback}`, { ok: false, error: "no_data" }); } return; } let payload = res; if (res.detail) payload = res.detail; formatAppLog("log", "at pages/fullcamera.nvue:496", "snapshot payload normalized:", payload); if (reqIdFromCallback) { uni.$emit(`fullmonitor:response:${reqIdFromCallback}`, { ok: !!payload.snapShotResult, payload }); } if (!reqIdFromCallback && this._pendingRequests.snapshot && this._pendingRequests.snapshot.length) { while (this._pendingRequests.snapshot.length) { const rid = this._pendingRequests.snapshot.shift(); uni.$emit(`fullmonitor:response:${rid}`, { ok: !!payload.snapShotResult, payload }); } } uni.$emit("fullmonitor:snapshot:done", payload); if (payload.snapShotResult === true || payload.snapShotResult === "true") { const url = payload.snapShotUrl || payload.snapShotPath || payload.url; uni.showToast({ title: "\u622A\u56FE\u6210\u529F", icon: "success", duration: 1200 }); if (url) { uni.previewImage({ urls: [url] }); } } else { const err = payload.snapShotErrorCode || payload.error || "unknown"; uni.showToast({ title: "\u622A\u56FE\u5931\u8D25: " + err, icon: "none", duration: 2e3 }); formatAppLog("warn", "at pages/fullcamera.nvue:539", "snapshot failed reason:", err, payload); } }, _handleRecordResultFromNative(res, reqIdFromCallback = null) { if (!res) { uni.showToast({ title: "\u5F55\u5C4F\u6CA1\u6709\u8FD4\u56DE\u6570\u636E", icon: "none" }); this.isRecording = false; if (reqIdFromCallback) { uni.$emit(`fullmonitor:response:${reqIdFromCallback}`, { ok: false, error: "no_data" }); } return; } let payload = res; if (res.detail) payload = res.detail; formatAppLog("log", "at pages/fullcamera.nvue:561", "record payload normalized:", payload); if (reqIdFromCallback) { uni.$emit(`fullmonitor:response:${reqIdFromCallback}`, { ok: !!(payload.recordUrl || payload.snapShotResult), payload }); } if (!reqIdFromCallback && this._pendingRequests.record && this._pendingRequests.record.length) { while (this._pendingRequests.record.length) { const rid = this._pendingRequests.record.shift(); uni.$emit(`fullmonitor:response:${rid}`, { ok: !!(payload.recordUrl || payload.snapShotResult), payload }); } } uni.$emit("fullmonitor:record:done", payload); if (payload.recordUrl) { uni.showToast({ title: "\u5F55\u5C4F\u5B8C\u6210", icon: "success", duration: 1400 }); this.isRecording = false; formatAppLog("log", "at pages/fullcamera.nvue:592", "\u5F55\u5C4F\u5730\u5740\uFF1A", payload.recordUrl); } else if (payload.recordFailedReason) { uni.showToast({ title: "\u5F55\u5C4F\u5931\u8D25: " + payload.recordFailedReason, icon: "none", duration: 2e3 }); this.isRecording = false; formatAppLog("warn", "at pages/fullcamera.nvue:600", "record failed reason:", payload.recordFailedReason); } else { if (payload.snapShotResult === true) { uni.showToast({ title: "\u5F55\u5C4F\u64CD\u4F5C\u5DF2\u5B8C\u6210\uFF08\u8FD4\u56DE\u672A\u77E5\uFF09", icon: "none" }); } this.isRecording = false; } } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_MonitorView = (0, import_vue2.resolveComponent)("MonitorView"); return (0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)("scroll-view", { scrollY: true, showScrollbar: true, enableBackToTop: true, bubble: "true", style: { flexDirection: "column" } }, [ (0, import_vue2.createElementVNode)( "div", { class: "center-column", style: (0, import_vue2.normalizeStyle)({ height: $data.isshow ? "600px" : "0px" }) }, [ (0, import_vue2.createCommentVNode)(" \u89C6\u9891\u64AD\u653E\u7EC4\u4EF6 "), (0, import_vue2.createVNode)(_component_MonitorView, { ref: "monitor", init: "5", style: { "width": "900px", "height": "600px" }, onOnTel: $options.handleTelEvent, onOnSnapShot: $options.handleSnapShotEvent, onOnRecord: $options.handleRecordEvent, onOnTalkStatus: $options.handleTalkEvent }, null, 8, ["onOnTel", "onOnSnapShot", "onOnRecord", "onOnTalkStatus"]) ], 4 /* STYLE */ ) ]); } var fullcamera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/hldy_app/pages/fullcamera.nvue"]]); // var webview = plus.webview.currentWebview(); if (webview) { const __pageId = parseInt(webview.id); const __pagePath = "pages/fullcamera"; let __pageQuery = {}; try { __pageQuery = JSON.parse(webview.__query__); } catch (e) { } fullcamera.mpType = "page"; const app = Vue.createPageApp(fullcamera, { $store: getApp({ allowDefault: true }).$store, __pageId, __pagePath, __pageQuery }); app.provide("__globalStyles", Vue.useCssStyles([...__uniConfig.styles, ...fullcamera.styles || []])); app.mount("#root"); } })();