hldy_app/unpackage/dist/dev/app-plus/pages/camera.js

678 lines
24 KiB
JavaScript
Raw Normal View History

2025-08-29 17:33:30 +08:00
"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;
}
});
2025-10-22 17:28:42 +08:00
// ../../../../项目/hldy_app/unpackage/dist/dev/.nvue/pages/camera.js
2025-08-29 17:33:30 +08:00
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 _style_0 = { "center-column": { "": { "width": 680, "height": 520, "borderRadius": 30, "overflow": "hidden" } } };
2025-08-29 17:33:30 +08:00
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
var _sfc_main = {
data() {
return {
phoneNumber: "1234567890",
2025-10-09 17:04:26 +08:00
initnumber: 5,
2025-08-29 17:33:30 +08:00
isAlarming: false,
isRecording: false,
// 录屏状态
isTalking: false,
// 对讲状态
// 内部 pending 请求队列,用于在 native 事件到达时把结果返回给特定 reqId
// 结构: { snapshot: [reqId,...], record: [reqId,...], talk: [reqId,...] }
// 注意:这仅用于在 native 事件没有直接 callback 时仍能把结果回传给请求方。
_pendingRequests: {
snapshot: [],
record: [],
talk: []
2025-09-09 17:44:16 +08:00
},
2025-09-30 14:56:53 +08:00
suo: true,
isshow: true
2025-08-29 17:33:30 +08:00
};
},
onLoad() {
const globalEvent = requireNativePlugin && requireNativePlugin("globalEvent");
if (globalEvent && globalEvent.addEventListener) {
globalEvent.addEventListener("myEvent", (e) => {
2025-10-09 17:04:26 +08:00
formatAppLog("log", "at pages/camera.nvue:35", e);
2025-09-09 17:44:16 +08:00
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;
}
2025-08-29 17:33:30 +08:00
});
}
2025-10-09 17:04:26 +08:00
uni.setStorageSync("saveinit", 5);
uni.$on(
"monitor:changeinit",
(number) => {
2025-10-11 15:16:38 +08:00
this.$refs.monitor.initAutoPlay(number);
2025-10-09 17:04:26 +08:00
uni.setStorageSync("saveinit", number);
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:66", "?????", number);
2025-10-09 17:04:26 +08:00
}
);
2025-09-30 14:56:53 +08:00
uni.$on("monitor:isshow", (bool) => this.isshow = bool);
2025-10-11 15:16:38 +08:00
uni.$on("monitor:killView", this.killView);
2025-08-29 17:33:30 +08:00
uni.$on("monitor:doSnapshot", this.doSnapshot);
uni.$on("monitor:startRecord", this.doStartRecord);
uni.$on("monitor:stopRecord", this.doStopRecord);
uni.$on("monitor:openTalk", this.doOpenTalk);
uni.$on("monitor:stopTalk", this.doStopTalk);
uni.$on("monitor:switchDisplay", (payload) => this.switchDisplay(payload));
uni.$on("monitor:startAlarm", this.startAlarm);
uni.$on("monitor:stopAlarm", this.stopAlarm);
uni.$on("monitor:flipImage", (payload) => this.flipImage(payload));
uni.$on("monitor:resumeOrPause", this.resumeOrPause);
uni.$on("monitor:changeQuality", this.changeQuality);
2025-09-02 16:48:59 +08:00
uni.$on("monitor:toggleVolume", this.toggleVolume);
2025-08-29 17:33:30 +08:00
uni.$on("monitor:test", this.test);
},
onUnload() {
2025-10-11 15:16:38 +08:00
uni.$off("monitor:killView", (bool) => this.killView);
2025-10-09 17:04:26 +08:00
uni.$off("monitor:changeinit", (number) => this.initnumber = number);
2025-09-30 14:56:53 +08:00
uni.$off("monitor:isshow", (bool) => this.isshow = bool);
2025-08-29 17:33:30 +08:00
uni.$off("monitor:doSnapshot", this.doSnapshot);
uni.$off("monitor:startRecord", this.doStartRecord);
uni.$off("monitor:stopRecord", this.doStopRecord);
uni.$off("monitor:openTalk", this.doOpenTalk);
uni.$off("monitor:stopTalk", this.doStopTalk);
uni.$off("monitor:switchDisplay", (payload) => this.switchDisplay(payload));
uni.$off("monitor:startAlarm", this.startAlarm);
uni.$off("monitor:stopAlarm", this.stopAlarm);
uni.$off("monitor:flipImage", (payload) => this.flipImage(payload));
uni.$off("monitor:resumeOrPause", this.resumeOrPause);
uni.$off("monitor:changeQuality", this.changeQuality);
2025-09-02 16:48:59 +08:00
uni.$off("monitor:toggleVolume", this.toggleVolume);
2025-08-29 17:33:30 +08:00
uni.$off("monitor:test", this.test);
},
methods: {
/* ------------------ 原有功能 ------------------ */
handleTelEvent(event) {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:110", "Tel event detail:", event.detail);
},
killView() {
this.$refs.monitor.killView && this.$refs.monitor.killView();
2025-08-29 17:33:30 +08:00
},
switchDisplay(mode) {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:118", "zzzzz", mode);
2025-08-29 17:33:30 +08:00
this.$refs.monitor && this.$refs.monitor.switchDisplayModeFragment(mode);
},
startAlarm() {
this.isAlarming = true;
this.$refs.monitor.startOrStopManualAlarm(this.isAlarming, (res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:125", "startAlarm callback:", res);
2025-08-29 17:33:30 +08:00
});
},
stopAlarm() {
this.isAlarming = false;
this.$refs.monitor.startOrStopManualAlarm(this.isAlarming, (res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:131", "stopAlarm callback:", res);
2025-08-29 17:33:30 +08:00
});
},
flipImage(type) {
this.$refs.monitor.changeImageSwitch(type, (res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:137", "flipImage callback:", res);
2025-08-29 17:33:30 +08:00
});
},
resumeOrPause() {
this.$refs.monitor.resumeOrPause && this.$refs.monitor.resumeOrPause();
},
changeQuality() {
this.$refs.monitor.changeQuality && this.$refs.monitor.changeQuality();
},
2025-09-02 16:48:59 +08:00
toggleVolume() {
this.$refs.monitor.toggleVolume && this.$refs.monitor.toggleVolume();
},
2025-08-29 17:33:30 +08:00
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) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 snapShot()",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "snapShot_not_supported"
});
2025-08-29 17:33:30 +08:00
}
return;
}
if (payload.reqId) {
this._pendingRequests.snapshot.push(payload.reqId);
}
try {
this.$refs.monitor.snapShot((res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:183", "snapShot callback:", res);
2025-08-29 17:33:30 +08:00
this._handleSnapshotResultFromNative(res, payload.reqId);
});
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u6B63\u5728\u622A\u5C4F...",
icon: "none",
duration: 800
});
2025-08-29 17:33:30 +08:00
} catch (err) {
2025-10-11 15:16:38 +08:00
formatAppLog("error", "at pages/camera.nvue:192", "snapShot \u8C03\u7528\u5931\u8D25", err);
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "snapShot \u8C03\u7528\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "snapShot_call_failed",
detail: String(err)
});
2025-08-29 17:33:30 +08:00
}
}
},
// 2. 开始录屏(调用)
// payload 可选:{ reqId: number }
doStartRecord(payload = {}) {
if (!this.$refs.monitor || !this.$refs.monitor.startRecord) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 startRecord()",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "startRecord_not_supported"
});
2025-08-29 17:33:30 +08:00
}
return;
}
try {
this.$refs.monitor.startRecord((res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:225", "startRecord callback:", res);
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: true,
res
});
2025-08-29 17:33:30 +08:00
}
});
this.isRecording = true;
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5F55\u5C4F\u5DF2\u5F00\u59CB",
icon: "none"
});
2025-08-29 17:33:30 +08:00
} catch (err) {
2025-10-11 15:16:38 +08:00
formatAppLog("error", "at pages/camera.nvue:240", "startRecord \u8C03\u7528\u5931\u8D25", err);
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "startRecord \u8C03\u7528\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "startRecord_call_failed",
detail: String(err)
});
2025-08-29 17:33:30 +08:00
}
}
},
// 3. 停止录屏(调用)
// payload 可选:{ reqId: number }
doStopRecord(payload = {}) {
if (!this.$refs.monitor || !this.$refs.monitor.stopRecord) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 stopRecord()",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "stopRecord_not_supported"
});
2025-08-29 17:33:30 +08:00
}
return;
}
if (payload.reqId) {
this._pendingRequests.record.push(payload.reqId);
}
try {
this.$refs.monitor.stopRecord((res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:279", "stopRecord callback:", res);
2025-08-29 17:33:30 +08:00
this._handleRecordResultFromNative(res, payload.reqId);
});
} catch (err) {
2025-10-11 15:16:38 +08:00
formatAppLog("error", "at pages/camera.nvue:284", "stopRecord \u8C03\u7528\u5931\u8D25", err);
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "stopRecord \u8C03\u7528\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "stopRecord_call_failed",
detail: String(err)
});
2025-08-29 17:33:30 +08:00
}
}
},
// 4. 开始对讲(调用)
// payload 可选:{ reqId: number }
doOpenTalk(payload = {}) {
if (!this.$refs.monitor || !this.$refs.monitor.openTalk) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 openTalk()",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "openTalk_not_supported"
});
2025-08-29 17:33:30 +08:00
}
return;
}
if (payload.reqId) {
this._pendingRequests.talk.push(payload.reqId);
}
try {
this.$refs.monitor.openTalk((res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:321", "openTalk callback:", res);
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: true,
res
});
2025-08-29 17:33:30 +08:00
}
});
this.isTalking = true;
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5C1D\u8BD5\u5EFA\u7ACB\u5BF9\u8BB2\u8FDE\u63A5...",
icon: "none"
});
2025-08-29 17:33:30 +08:00
} catch (err) {
2025-10-11 15:16:38 +08:00
formatAppLog("error", "at pages/camera.nvue:336", "openTalk \u8C03\u7528\u5931\u8D25", err);
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "openTalk \u8C03\u7528\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "openTalk_call_failed",
detail: String(err)
});
2025-08-29 17:33:30 +08:00
}
}
},
// 5. 停止对讲(调用)
// payload 可选:{ reqId: number }
doStopTalk(payload = {}) {
if (!this.$refs.monitor || !this.$refs.monitor.stopTalk) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u7EC4\u4EF6\u4E0D\u652F\u6301 stopTalk()",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "stopTalk_not_supported"
});
2025-08-29 17:33:30 +08:00
}
return;
}
try {
this.$refs.monitor.stopTalk((res) => {
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:369", "stopTalk callback:", res);
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: true,
res
});
2025-08-29 17:33:30 +08:00
}
});
this.isTalking = false;
} catch (err) {
2025-10-11 15:16:38 +08:00
formatAppLog("error", "at pages/camera.nvue:379", "stopTalk \u8C03\u7528\u5931\u8D25", err);
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "stopTalk \u8C03\u7528\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (payload.reqId) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${payload.reqId}`, {
ok: false,
error: "stopTalk_call_failed",
detail: String(err)
});
2025-08-29 17:33:30 +08:00
}
}
},
/* ------------------ 事件回调处理(来自原生推送的事件) ------------------ */
// 处理来自模板 @onSnapShot 的事件event.detail
handleSnapShotEvent(event) {
const payload = event && event.detail ? event.detail : event;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:399", "onSnapShot event:", payload);
2025-08-29 17:33:30 +08:00
this._handleSnapshotResultFromNative(payload);
},
// 处理来自模板 @onRecord 的事件event.detail
handleRecordEvent(event) {
const payload = event && event.detail ? event.detail : event;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:407", "onRecord event:", payload);
2025-08-29 17:33:30 +08:00
this._handleRecordResultFromNative(payload);
},
// 处理来自模板 @onTalkStatus 的事件
handleTalkEvent(event) {
const payload = event && event.detail ? event.detail : event;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:414", "onTalkStatus event:", payload);
2025-08-29 17:33:30 +08:00
const status = payload && payload.talkStatus;
const tips = payload && payload.tips;
uni.$emit("monitor:talk:status", payload);
if (this._pendingRequests.talk && this._pendingRequests.talk.length) {
while (this._pendingRequests.talk.length) {
const reqId = this._pendingRequests.talk.shift();
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${reqId}`, {
ok: true,
payload
});
2025-08-29 17:33:30 +08:00
}
}
switch ((status || "").toLowerCase()) {
case "loading":
2025-09-30 14:56:53 +08:00
uni.showToast({
title: tips || "\u5BF9\u8BB2\u8FDE\u63A5\u4E2D...",
icon: "none"
});
2025-08-29 17:33:30 +08:00
this.isTalking = true;
break;
case "playing":
2025-09-30 14:56:53 +08:00
uni.showToast({
title: tips || "\u5BF9\u8BB2\u5DF2\u8FDE\u63A5",
icon: "none"
});
2025-08-29 17:33:30 +08:00
this.isTalking = true;
break;
case "stopped":
2025-09-30 14:56:53 +08:00
uni.showToast({
title: tips || "\u5BF9\u8BB2\u5DF2\u505C\u6B62",
icon: "none"
});
2025-08-29 17:33:30 +08:00
this.isTalking = false;
break;
case "failed":
2025-09-30 14:56:53 +08:00
uni.showToast({
title: tips || "\u5BF9\u8BB2\u5931\u8D25",
icon: "none"
});
2025-08-29 17:33:30 +08:00
this.isTalking = false;
break;
default:
2025-09-30 14:56:53 +08:00
uni.showToast({
title: tips || "\u5BF9\u8BB2\u72B6\u6001: " + (status || "unknown"),
icon: "none"
});
2025-08-29 17:33:30 +08:00
break;
}
},
/* ------------------ 原生结果的内部处理函数(统一处理 callback / event ------------------ */
_handleSnapshotResultFromNative(res, reqIdFromCallback = null) {
if (!res) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u622A\u56FE\u6CA1\u6709\u8FD4\u56DE\u6570\u636E",
icon: "none"
});
2025-08-29 17:33:30 +08:00
if (reqIdFromCallback) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${reqIdFromCallback}`, {
ok: false,
error: "no_data"
});
2025-08-29 17:33:30 +08:00
}
return;
}
let payload = res;
if (res.detail)
payload = res.detail;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:491", "snapshot payload normalized:", payload);
2025-08-29 17:33:30 +08:00
if (reqIdFromCallback) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${reqIdFromCallback}`, {
ok: !!payload.snapShotResult,
payload
});
2025-08-29 17:33:30 +08:00
}
if (!reqIdFromCallback && this._pendingRequests.snapshot && this._pendingRequests.snapshot.length) {
while (this._pendingRequests.snapshot.length) {
const rid = this._pendingRequests.snapshot.shift();
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${rid}`, {
ok: !!payload.snapShotResult,
payload
});
2025-08-29 17:33:30 +08:00
}
}
uni.$emit("monitor:snapshot:done", payload);
if (payload.snapShotResult === true || payload.snapShotResult === "true") {
const url = payload.snapShotUrl || payload.snapShotPath || payload.url;
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u622A\u56FE\u6210\u529F",
icon: "success",
duration: 1200
});
2025-08-29 17:33:30 +08:00
if (url) {
2025-09-30 14:56:53 +08:00
uni.previewImage({
urls: [url]
});
2025-08-29 17:33:30 +08:00
}
} else {
const err = payload.snapShotErrorCode || payload.error || "unknown";
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u622A\u56FE\u5931\u8D25: " + err,
icon: "none",
duration: 2e3
});
2025-10-11 15:16:38 +08:00
formatAppLog("warn", "at pages/camera.nvue:534", "snapshot failed reason:", err, payload);
2025-08-29 17:33:30 +08:00
}
},
_handleRecordResultFromNative(res, reqIdFromCallback = null) {
if (!res) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5F55\u5C4F\u6CA1\u6709\u8FD4\u56DE\u6570\u636E",
icon: "none"
});
2025-08-29 17:33:30 +08:00
this.isRecording = false;
if (reqIdFromCallback) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${reqIdFromCallback}`, {
ok: false,
error: "no_data"
});
2025-08-29 17:33:30 +08:00
}
return;
}
let payload = res;
if (res.detail)
payload = res.detail;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:556", "record payload normalized:", payload);
2025-08-29 17:33:30 +08:00
if (reqIdFromCallback) {
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${reqIdFromCallback}`, {
ok: !!(payload.recordUrl || payload.snapShotResult),
payload
});
2025-08-29 17:33:30 +08:00
}
if (!reqIdFromCallback && this._pendingRequests.record && this._pendingRequests.record.length) {
while (this._pendingRequests.record.length) {
const rid = this._pendingRequests.record.shift();
2025-09-30 14:56:53 +08:00
uni.$emit(`monitor:response:${rid}`, {
ok: !!(payload.recordUrl || payload.snapShotResult),
payload
});
2025-08-29 17:33:30 +08:00
}
}
uni.$emit("monitor:record:done", payload);
if (payload.recordUrl) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5F55\u5C4F\u5B8C\u6210",
icon: "success",
duration: 1400
});
2025-08-29 17:33:30 +08:00
this.isRecording = false;
2025-10-11 15:16:38 +08:00
formatAppLog("log", "at pages/camera.nvue:587", "\u5F55\u5C4F\u5730\u5740\uFF1A", payload.recordUrl);
2025-08-29 17:33:30 +08:00
} else if (payload.recordFailedReason) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5F55\u5C4F\u5931\u8D25: " + payload.recordFailedReason,
icon: "none",
duration: 2e3
});
2025-08-29 17:33:30 +08:00
this.isRecording = false;
2025-10-11 15:16:38 +08:00
formatAppLog("warn", "at pages/camera.nvue:595", "record failed reason:", payload.recordFailedReason);
2025-08-29 17:33:30 +08:00
} else {
if (payload.snapShotResult === true) {
2025-09-30 14:56:53 +08:00
uni.showToast({
title: "\u5F55\u5C4F\u64CD\u4F5C\u5DF2\u5B8C\u6210\uFF08\u8FD4\u56DE\u672A\u77E5\uFF09",
icon: "none"
});
2025-08-29 17:33:30 +08:00
}
this.isRecording = false;
}
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2025-09-02 16:48:59 +08:00
const _component_MonitorView = (0, import_vue.resolveComponent)("MonitorView");
return (0, import_vue.openBlock)(), (0, import_vue.createElementBlock)("scroll-view", {
2025-08-29 17:33:30 +08:00
scrollY: true,
showScrollbar: true,
enableBackToTop: true,
bubble: "true",
style: { flexDirection: "column" }
}, [
2025-09-30 14:56:53 +08:00
(0, import_vue.createElementVNode)(
"div",
{
class: "center-column",
style: (0, import_vue.normalizeStyle)({ height: $data.isshow ? "520px" : "0px" })
2025-09-30 14:56:53 +08:00
},
[
(0, import_vue.createCommentVNode)(" \u89C6\u9891\u64AD\u653E\u7EC4\u4EF6 "),
(0, import_vue.createVNode)(_component_MonitorView, {
ref: "monitor",
2025-10-11 15:16:38 +08:00
init: "5",
style: { "width": "680px", "height": "520px" },
2025-09-30 14:56:53 +08:00
onOnTel: $options.handleTelEvent,
onOnSnapShot: $options.handleSnapShotEvent,
onOnRecord: $options.handleRecordEvent,
onOnTalkStatus: $options.handleTalkEvent
2025-10-11 15:16:38 +08:00
}, null, 8, ["onOnTel", "onOnSnapShot", "onOnRecord", "onOnTalkStatus"])
2025-09-30 14:56:53 +08:00
],
4
/* STYLE */
)
2025-08-29 17:33:30 +08:00
]);
}
2025-10-22 17:28:42 +08:00
var camera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/\u9879\u76EE/hldy_app/pages/camera.nvue"]]);
2025-08-29 17:33:30 +08:00
// <stdin>
var webview = plus.webview.currentWebview();
if (webview) {
const __pageId = parseInt(webview.id);
const __pagePath = "pages/camera";
let __pageQuery = {};
try {
__pageQuery = JSON.parse(webview.__query__);
} catch (e) {
}
camera.mpType = "page";
const app = Vue.createPageApp(camera, { $store: getApp({ allowDefault: true }).$store, __pageId, __pagePath, __pageQuery });
app.provide("__globalStyles", Vue.useCssStyles([...__uniConfig.styles, ...camera.styles || []]));
app.mount("#root");
}
})();