This commit is contained in:
commit
569fbbf51d
24
pages.json
24
pages.json
|
|
@ -98,18 +98,18 @@
|
|||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"app-plus": {
|
||||
"subNVues": [{
|
||||
"id": "monitorSub",
|
||||
"path": "pages/smallcarmera",
|
||||
"style": {
|
||||
"position": "absolute",
|
||||
"left": "230px",
|
||||
"top": "150px",
|
||||
"width": "680px",
|
||||
"height": "520px",
|
||||
"background": "transparent"
|
||||
}
|
||||
}]
|
||||
// "subNVues": [{
|
||||
// "id": "monitorSub",
|
||||
// "path": "pages/smallcarmera",
|
||||
// "style": {
|
||||
// "position": "absolute",
|
||||
// "left": "230px",
|
||||
// "top": "150px",
|
||||
// "width": "680px",
|
||||
// "height": "520px",
|
||||
// "background": "transparent"
|
||||
// }
|
||||
// }]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,16 @@ export const waterwaterRead = (cid,address) => {
|
|||
// method: 'get'
|
||||
// })
|
||||
// }
|
||||
|
||||
// 摄像头报修
|
||||
export const cameraInfobaoxiu = (id) => {
|
||||
return request({
|
||||
url: `${uni.getStorageSync('serverUrl')}/api/iot/tplink/cameraInfo/baoxiu`,
|
||||
method: 'post',
|
||||
data: {
|
||||
id:id
|
||||
},
|
||||
})
|
||||
}
|
||||
// 温湿度计保修
|
||||
export const humidDevicebaoxiu = (id) => {
|
||||
return request({
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -169,9 +169,9 @@
|
|||
|
||||
if (lanjie.value) {
|
||||
lanjie.value = false
|
||||
console.log("!!!!!!!", movetype.value,
|
||||
zeroIndex.value,
|
||||
typeNow.value)
|
||||
// console.log("!!!!!!!", movetype.value,
|
||||
// zeroIndex.value,
|
||||
// typeNow.value)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@
|
|||
return result;
|
||||
}
|
||||
// 生命周期钩子
|
||||
onShow(() => {
|
||||
onMounted(() => {
|
||||
|
||||
//首次加载和跳转回来需要重新做个动画
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
@click.stop="housactive(index)">
|
||||
<!-- <image :src="'/static/index/warehouse/active/w'+index+'.png'" mode="aspectFill"
|
||||
v-if="housedex!=index"></image> -->
|
||||
|
||||
|
||||
<donghua :width="item.width" :height="item.height" :links="item.url" :playing="index == housedex" />
|
||||
|
||||
<!-- <image :src="'/static/index/warehouse/active/i'+index+'.png'" mode="aspectFill" v-if="housedex==index"></image> -->
|
||||
</view>
|
||||
|
||||
|
|
@ -23,8 +26,8 @@
|
|||
<!-- 采购增加层级高度方便点击 -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="annotation" :class="'annotation'+(i+1)" v-for="(v,i) in ['付款','采购','结账','拣货','护理单元','中控室']"
|
||||
:key='i'>
|
||||
<view class="annotation" :class="'annotation'+(i+1)" v-for="(v,i) in ['付款','采购','拣货','结账','护理单元','监控室']"
|
||||
:key='i' @click="onlyjump(i)">
|
||||
<view> </view>
|
||||
<view class="tp">
|
||||
<text>{{v}}</text>
|
||||
|
|
@ -34,12 +37,15 @@
|
|||
<image src="/static/index/warehouse/y0.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="onlyjump(5)" class="zhanwei"></view>
|
||||
|
||||
<arrowkeys @movecard="movecard" :getblue="getblue" :moveleft="45" />
|
||||
<view class="operationbtn">
|
||||
<view v-for="(v,i) in ['请领出库','退货入库','库存盘点','实时监控']" @tap="onTap(i)"
|
||||
:class="beblue === i ? 'click-box-target' : 'click-box'">
|
||||
<image :src="beblue === i?'/static/index/warehouse/ku/rq'+i+'.png':'/static/index/warehouse/ku/rs'+i+'.png'" mode="aspectFill"></image>
|
||||
<image
|
||||
:src="beblue === i?'/static/index/warehouse/ku/rq'+i+'.png':'/static/index/warehouse/ku/rs'+i+'.png'"
|
||||
mode="aspectFill"></image>
|
||||
{{v}}
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,6 +68,13 @@
|
|||
const housactive = (index : number) => {
|
||||
if (index > 5) { return }
|
||||
housedex.value = index;
|
||||
console.log("index", index)
|
||||
// 只有中心的四个有动画.....所以点不到监控室
|
||||
if (index === 5) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/watch/full"
|
||||
})
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
housedex.value = 1
|
||||
|
|
@ -108,12 +121,25 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
const onlyjump = (index : number) => {
|
||||
console.log("点击了哪个图标", index)
|
||||
if (index > 5) { return }
|
||||
if(index<4){
|
||||
housedex.value = index;
|
||||
}
|
||||
|
||||
if (index === 5) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/watch/full"
|
||||
})
|
||||
}
|
||||
}
|
||||
const beblue = ref<number>(-1);
|
||||
let clickResetTimer : ReturnType<typeof setTimeout> | null = null;
|
||||
// 单击(或短按)
|
||||
function onTap(dir : number) {
|
||||
clearClickResetTimer()
|
||||
|
||||
console.log("?????",dir)
|
||||
beblue.value = dir
|
||||
clickResetTimer = setTimeout(() => {
|
||||
beblue.value = -1
|
||||
|
|
@ -245,6 +271,7 @@
|
|||
margin: 0 0.3vw;
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.25s ease;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
|
||||
image {
|
||||
width: 1.6vw;
|
||||
height: 1.6vw;
|
||||
|
|
@ -430,13 +457,14 @@
|
|||
}
|
||||
|
||||
.annotation3 {
|
||||
top: 24vw;
|
||||
left: 49.3vw;
|
||||
top: 18vw;
|
||||
left: 70vw;
|
||||
}
|
||||
|
||||
.annotation4 {
|
||||
top: 18vw;
|
||||
left: 70vw;
|
||||
|
||||
top: 24vw;
|
||||
left: 49.3vw;
|
||||
}
|
||||
|
||||
.annotation5 {
|
||||
|
|
@ -469,11 +497,13 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
text {
|
||||
position: relative;
|
||||
font-weight: 400;
|
||||
|
|
@ -519,4 +549,12 @@
|
|||
background-position: center center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.zhanwei {
|
||||
position: absolute;
|
||||
top: 40vh;
|
||||
right: 3vw;
|
||||
width: 13vw;
|
||||
height: 13vw;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
@scrolltolower="plsbuytolower" :lower-threshold="200">
|
||||
<view class="margin-height"></view>
|
||||
<view class="boxitem" v-for="(v,i) in plsbuy" :key='i'
|
||||
:class="{'yujing':v.cgdType=='9','active':leftitem==i}" @click="getmiddle(v,i);saveleftgo = i;">
|
||||
:class="{'yujing':v?.cgdType=='9','active':leftitem==i}" @click="getmiddle(v,i);saveleftgo = i;">
|
||||
|
||||
<view>{{ v.cgdNo }}</view>
|
||||
<view>供应商:{{ v.gysId_dictText }}</view>
|
||||
<view>采购人: {{ v.createBy_dictText }}</view>
|
||||
<view>{{ v.qgDate }}</view>
|
||||
<view v-if="v.cgdType=='9'" class="zuofei">
|
||||
<view v-if="v?.cgdType=='9'" class="zuofei">
|
||||
已作废
|
||||
</view>
|
||||
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
<donghua width="2vw" height="2vw" :links="v.url" :playing="i === anmidex"
|
||||
class="donghua" />
|
||||
</view>
|
||||
<text>
|
||||
<text :style="plsbuy[leftitem]?.cgdType == '9'?{color:`#c8c8c8`}:{}">
|
||||
{{v.name}}
|
||||
</text>
|
||||
</view>
|
||||
|
|
@ -701,6 +701,14 @@
|
|||
const anmidex = ref(-1)
|
||||
const admiclick = (i : number) => {
|
||||
anmidex.value = i;
|
||||
if(plsbuy.value[leftitem.value]?.cgdType == '9'){
|
||||
uni.showToast({
|
||||
title: '该表单已经作废',
|
||||
icon: 'none', // 'none' 表示不带图标
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
switch (i) {
|
||||
case 0:
|
||||
bebad();
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
|
@ -4,8 +4,5 @@ Promise.resolve("./pages/camera.js").then((res) => {
|
|||
Promise.resolve("./pages/fullcamera.js").then((res) => {
|
||||
res();
|
||||
});
|
||||
Promise.resolve("./pages/smallcarmera.js").then((res) => {
|
||||
res();
|
||||
});
|
||||
Promise.resolve("./app.css.js").then(() => {
|
||||
});
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
)
|
||||
]);
|
||||
}
|
||||
const camera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/项目/hldy_app/pages/camera.nvue"]]);
|
||||
const camera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/hldy_app/pages/camera.nvue"]]);
|
||||
export {
|
||||
camera as default
|
||||
};
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
)
|
||||
]);
|
||||
}
|
||||
const fullcamera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/项目/hldy_app/pages/fullcamera.nvue"]]);
|
||||
const fullcamera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/hldy_app/pages/fullcamera.nvue"]]);
|
||||
export {
|
||||
fullcamera as default
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,585 +0,0 @@
|
|||
import { _ as _export_sfc, f as formatAppLog, r as requireNativePlugin } from "../_plugin-vue_export-helper.js";
|
||||
import { resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, createCommentVNode, createVNode } from "vue";
|
||||
const _style_0 = { "center-column": { "": { "width": 675, "height": 475, "borderRadius": 30, "overflow": "hidden" } } };
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
phoneNumber: "1234567890",
|
||||
initnumber: 5,
|
||||
isAlarming: false,
|
||||
isRecording: false,
|
||||
// 录屏状态
|
||||
isTalking: false,
|
||||
// 对讲状态
|
||||
_pendingRequests: {
|
||||
snapshot: [],
|
||||
record: [],
|
||||
talk: []
|
||||
},
|
||||
suo: true,
|
||||
isshow: false,
|
||||
globalEvent: ""
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:29", "???加载");
|
||||
this.globalEvent = requireNativePlugin && requireNativePlugin("globalEvent");
|
||||
if (this.globalEvent && this.globalEvent.addEventListener) {
|
||||
this.globalEvent.addEventListener("myEvent", (e) => {
|
||||
if (e.recordUrl) {
|
||||
uni.showToast({
|
||||
title: "录屏成功",
|
||||
icon: "success",
|
||||
// 'success' | 'loading' | 'none'
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
if (e.snapShotUrl) {
|
||||
uni.showToast({
|
||||
title: "截屏成功",
|
||||
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("smallmonitor:changeinit", (number) => {
|
||||
this.$refs.monitor.initAutoPlay(number);
|
||||
uni.setStorageSync("saveinit", number);
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:63", "saveinit", number);
|
||||
});
|
||||
uni.$on("smallmonitor:isshow", (bool) => {
|
||||
this.isshow = bool;
|
||||
});
|
||||
uni.$on("smallmonitor:killView", this.killView);
|
||||
uni.$on("smallmonitor:doSnapshot", this.doSnapshot);
|
||||
uni.$on("smallmonitor:startRecord", this.doStartRecord);
|
||||
uni.$on("smallmonitor:stopRecord", this.doStopRecord);
|
||||
uni.$on("smallmonitor:openTalk", this.doOpenTalk);
|
||||
uni.$on("smallmonitor:stopTalk", this.doStopTalk);
|
||||
uni.$on("smallmonitor:switchDisplay", (payload) => this.switchDisplay(payload));
|
||||
uni.$on("smallmonitor:startAlarm", this.startAlarm);
|
||||
uni.$on("smallmonitor:stopAlarm", this.stopAlarm);
|
||||
uni.$on("smallmonitor:flipImage", (payload) => this.flipImage(payload));
|
||||
uni.$on("smallmonitor:resumeOrPause", this.resumeOrPause);
|
||||
uni.$on("smallmonitor:changeQuality", this.changeQuality);
|
||||
uni.$on("smallmonitor:toggleVolume", this.toggleVolume);
|
||||
uni.$on("smallmonitor:test", this.test);
|
||||
},
|
||||
onUnload() {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:86", "fullcamera 卸载,清理事件");
|
||||
if (this.globalEvent && this.globalEvent.removeEventListener) {
|
||||
this.globalEvent.removeEventListener("myEvent");
|
||||
}
|
||||
const events = [
|
||||
"smallmonitor:killView",
|
||||
"smallmonitor:changeinit",
|
||||
"smallmonitor:isshow",
|
||||
"smallmonitor:doSnapshot",
|
||||
"smallmonitor:startRecord",
|
||||
"smallmonitor:stopRecord",
|
||||
"smallmonitor:openTalk",
|
||||
"smallmonitor:stopTalk",
|
||||
"smallmonitor:switchDisplay",
|
||||
"smallmonitor:startAlarm",
|
||||
"smallmonitor:stopAlarm",
|
||||
"smallmonitor:flipImage",
|
||||
"smallmonitor:resumeOrPause",
|
||||
"smallmonitor:changeQuality",
|
||||
"smallmonitor:toggleVolume",
|
||||
"smallmonitor:test"
|
||||
];
|
||||
events.forEach((ev) => uni.$off(ev));
|
||||
},
|
||||
methods: {
|
||||
/* ------------------ 原有功能 ------------------ */
|
||||
handleTelEvent(event) {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:117", "Tel event detail:", event.detail);
|
||||
},
|
||||
killView() {
|
||||
this.$refs.monitor.killView && this.$refs.monitor.killView();
|
||||
},
|
||||
switchDisplay(mode) {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:125", "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/smallcarmera.nvue:132", "startAlarm callback:", res);
|
||||
});
|
||||
},
|
||||
stopAlarm() {
|
||||
this.isAlarming = false;
|
||||
this.$refs.monitor.startOrStopManualAlarm(this.isAlarming, (res) => {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:138", "stopAlarm callback:", res);
|
||||
});
|
||||
},
|
||||
flipImage(type) {
|
||||
this.$refs.monitor.changeImageSwitch(type, (res) => {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:144", "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: "组件不支持 snapShot()",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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/smallcarmera.nvue:190", "snapShot callback:", res);
|
||||
this._handleSnapshotResultFromNative(res, payload.reqId);
|
||||
});
|
||||
uni.showToast({
|
||||
title: "正在截屏...",
|
||||
icon: "none",
|
||||
duration: 800
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/smallcarmera.nvue:199", "snapShot 调用失败", err);
|
||||
uni.showToast({
|
||||
title: "snapShot 调用失败",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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: "组件不支持 startRecord()",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor:response:${payload.reqId}`, {
|
||||
ok: false,
|
||||
error: "startRecord_not_supported"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.$refs.monitor.startRecord((res) => {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:232", "startRecord callback:", res);
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor:response:${payload.reqId}`, {
|
||||
ok: true,
|
||||
res
|
||||
});
|
||||
}
|
||||
});
|
||||
this.isRecording = true;
|
||||
uni.showToast({
|
||||
title: "录屏已开始",
|
||||
icon: "none"
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/smallcarmera.nvue:247", "startRecord 调用失败", err);
|
||||
uni.showToast({
|
||||
title: "startRecord 调用失败",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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: "组件不支持 stopRecord()",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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/smallcarmera.nvue:286", "stopRecord callback:", res);
|
||||
this._handleRecordResultFromNative(res, payload.reqId);
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/smallcarmera.nvue:291", "stopRecord 调用失败", err);
|
||||
uni.showToast({
|
||||
title: "stopRecord 调用失败",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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: "组件不支持 openTalk()",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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/smallcarmera.nvue:328", "openTalk callback:", res);
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor:response:${payload.reqId}`, {
|
||||
ok: true,
|
||||
res
|
||||
});
|
||||
}
|
||||
});
|
||||
this.isTalking = true;
|
||||
uni.showToast({
|
||||
title: "尝试建立对讲连接...",
|
||||
icon: "none"
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/smallcarmera.nvue:343", "openTalk 调用失败", err);
|
||||
uni.showToast({
|
||||
title: "openTalk 调用失败",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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: "组件不支持 stopTalk()",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor:response:${payload.reqId}`, {
|
||||
ok: false,
|
||||
error: "stopTalk_not_supported"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.$refs.monitor.stopTalk((res) => {
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:376", "stopTalk callback:", res);
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor:response:${payload.reqId}`, {
|
||||
ok: true,
|
||||
res
|
||||
});
|
||||
}
|
||||
});
|
||||
this.isTalking = false;
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/smallcarmera.nvue:386", "stopTalk 调用失败", err);
|
||||
uni.showToast({
|
||||
title: "stopTalk 调用失败",
|
||||
icon: "none"
|
||||
});
|
||||
if (payload.reqId) {
|
||||
uni.$emit(`smallmonitor: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/smallcarmera.nvue:406", "onSnapShot event:", payload);
|
||||
this._handleSnapshotResultFromNative(payload);
|
||||
},
|
||||
// 处理来自模板 @onRecord 的事件(event.detail)
|
||||
handleRecordEvent(event) {
|
||||
const payload = event && event.detail ? event.detail : event;
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:414", "onRecord event:", payload);
|
||||
this._handleRecordResultFromNative(payload);
|
||||
},
|
||||
// 处理来自模板 @onTalkStatus 的事件
|
||||
handleTalkEvent(event) {
|
||||
const payload = event && event.detail ? event.detail : event;
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:421", "onTalkStatus event:", payload);
|
||||
const status = payload && payload.talkStatus;
|
||||
const tips = payload && payload.tips;
|
||||
uni.$emit("smallmonitor:talk:status", payload);
|
||||
if (this._pendingRequests.talk && this._pendingRequests.talk.length) {
|
||||
while (this._pendingRequests.talk.length) {
|
||||
const reqId = this._pendingRequests.talk.shift();
|
||||
uni.$emit(`smallmonitor:response:${reqId}`, {
|
||||
ok: true,
|
||||
payload
|
||||
});
|
||||
}
|
||||
}
|
||||
switch ((status || "").toLowerCase()) {
|
||||
case "loading":
|
||||
uni.showToast({
|
||||
title: tips || "对讲连接中...",
|
||||
icon: "none"
|
||||
});
|
||||
this.isTalking = true;
|
||||
break;
|
||||
case "playing":
|
||||
uni.showToast({
|
||||
title: tips || "对讲已连接",
|
||||
icon: "none"
|
||||
});
|
||||
this.isTalking = true;
|
||||
break;
|
||||
case "stopped":
|
||||
uni.showToast({
|
||||
title: tips || "对讲已停止",
|
||||
icon: "none"
|
||||
});
|
||||
this.isTalking = false;
|
||||
break;
|
||||
case "failed":
|
||||
uni.showToast({
|
||||
title: tips || "对讲失败",
|
||||
icon: "none"
|
||||
});
|
||||
this.isTalking = false;
|
||||
break;
|
||||
default:
|
||||
uni.showToast({
|
||||
title: tips || "对讲状态: " + (status || "unknown"),
|
||||
icon: "none"
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
/* ------------------ 原生结果的内部处理函数(统一处理 callback / event) ------------------ */
|
||||
_handleSnapshotResultFromNative(res, reqIdFromCallback = null) {
|
||||
if (!res) {
|
||||
uni.showToast({
|
||||
title: "截图没有返回数据",
|
||||
icon: "none"
|
||||
});
|
||||
if (reqIdFromCallback) {
|
||||
uni.$emit(`smallmonitor:response:${reqIdFromCallback}`, {
|
||||
ok: false,
|
||||
error: "no_data"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
let payload = res;
|
||||
if (res.detail)
|
||||
payload = res.detail;
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:498", "snapshot payload normalized:", payload);
|
||||
if (reqIdFromCallback) {
|
||||
uni.$emit(`smallmonitor: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(`smallmonitor:response:${rid}`, {
|
||||
ok: !!payload.snapShotResult,
|
||||
payload
|
||||
});
|
||||
}
|
||||
}
|
||||
uni.$emit("smallmonitor:snapshot:done", payload);
|
||||
if (payload.snapShotResult === true || payload.snapShotResult === "true") {
|
||||
const url = payload.snapShotUrl || payload.snapShotPath || payload.url;
|
||||
uni.showToast({
|
||||
title: "截图成功",
|
||||
icon: "success",
|
||||
duration: 1200
|
||||
});
|
||||
if (url) {
|
||||
uni.previewImage({
|
||||
urls: [url]
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const err = payload.snapShotErrorCode || payload.error || "unknown";
|
||||
uni.showToast({
|
||||
title: "截图失败: " + err,
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
formatAppLog("warn", "at pages/smallcarmera.nvue:541", "snapshot failed reason:", err, payload);
|
||||
}
|
||||
},
|
||||
_handleRecordResultFromNative(res, reqIdFromCallback = null) {
|
||||
if (!res) {
|
||||
uni.showToast({
|
||||
title: "录屏没有返回数据",
|
||||
icon: "none"
|
||||
});
|
||||
this.isRecording = false;
|
||||
if (reqIdFromCallback) {
|
||||
uni.$emit(`smallmonitor:response:${reqIdFromCallback}`, {
|
||||
ok: false,
|
||||
error: "no_data"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
let payload = res;
|
||||
if (res.detail)
|
||||
payload = res.detail;
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:563", "record payload normalized:", payload);
|
||||
if (reqIdFromCallback) {
|
||||
uni.$emit(`smallmonitor: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(`smallmonitor:response:${rid}`, {
|
||||
ok: !!(payload.recordUrl || payload.snapShotResult),
|
||||
payload
|
||||
});
|
||||
}
|
||||
}
|
||||
uni.$emit("smallmonitor:record:done", payload);
|
||||
if (payload.recordUrl) {
|
||||
uni.showToast({
|
||||
title: "录屏完成",
|
||||
icon: "success",
|
||||
duration: 1400
|
||||
});
|
||||
this.isRecording = false;
|
||||
formatAppLog("log", "at pages/smallcarmera.nvue:594", "录屏地址:", payload.recordUrl);
|
||||
} else if (payload.recordFailedReason) {
|
||||
uni.showToast({
|
||||
title: "录屏失败: " + payload.recordFailedReason,
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
this.isRecording = false;
|
||||
formatAppLog("warn", "at pages/smallcarmera.nvue:602", "record failed reason:", payload.recordFailedReason);
|
||||
} else {
|
||||
if (payload.snapShotResult === true) {
|
||||
uni.showToast({
|
||||
title: "录屏操作已完成(返回未知)",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
this.isRecording = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
const _component_MonitorView = resolveComponent("MonitorView");
|
||||
return openBlock(), createElementBlock("scroll-view", {
|
||||
scrollY: true,
|
||||
showScrollbar: true,
|
||||
enableBackToTop: true,
|
||||
bubble: "true",
|
||||
style: { flexDirection: "column" }
|
||||
}, [
|
||||
createElementVNode(
|
||||
"div",
|
||||
{
|
||||
class: "center-column",
|
||||
style: normalizeStyle({ height: $data.isshow ? "675px" : "0px" })
|
||||
},
|
||||
[
|
||||
createCommentVNode(" 视频播放组件 "),
|
||||
createVNode(_component_MonitorView, {
|
||||
ref: "monitor",
|
||||
init: "5",
|
||||
style: { "width": "675px", "height": "475px" },
|
||||
onOnTel: $options.handleTelEvent,
|
||||
onOnSnapShot: $options.handleSnapShotEvent,
|
||||
onOnRecord: $options.handleRecordEvent,
|
||||
onOnTalkStatus: $options.handleTalkEvent
|
||||
}, null, 8, ["onOnTel", "onOnSnapShot", "onOnRecord", "onOnTalkStatus"])
|
||||
],
|
||||
4
|
||||
/* STYLE */
|
||||
)
|
||||
]);
|
||||
}
|
||||
const smallcarmera = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/项目/hldy_app/pages/smallcarmera.nvue"]]);
|
||||
export {
|
||||
smallcarmera as default
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue