diff --git a/pages.json b/pages.json index d507c78..835676d 100644 --- a/pages.json +++ b/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" + // } + // }] } } diff --git a/pages/NursingNew/component/api.js b/pages/NursingNew/component/api.js index e2c3943..3650630 100644 --- a/pages/NursingNew/component/api.js +++ b/pages/NursingNew/component/api.js @@ -96,7 +96,16 @@ export const waterwaterRead = (cid,address) => { // method: 'get' // }) // } - +// 摄像头报修 +// export const humidDevicebaoxiu = (id) => { +// return request({ +// url: `${uni.getStorageSync('serverUrl')}/api/iot/humidDevice/baoxiu`, +// method: 'post', +// data: { +// id:id +// }, +// }) +// } // 温湿度计保修 export const humidDevicebaoxiu = (id) => { return request({ diff --git a/pages/NursingNew/component/equipment.vue b/pages/NursingNew/component/equipment.vue index 6eebc2a..660dad6 100644 --- a/pages/NursingNew/component/equipment.vue +++ b/pages/NursingNew/component/equipment.vue @@ -81,7 +81,7 @@ - + - + - + - + - + + + + + + + + + + NUID:{{rightmessage.nuId?rightmessage.nuId:''}} + + + {{rightmessage.nuName?rightmessage.nuName:''}} + + + + + {{rightmessage.deviceStatus=='1'?'在线':'离线'}} + + + + SN:{{rightmessage.sn}} + + + 设备名称:{{rightmessage.deviceName?rightmessage.deviceName:''}} + + + + + + + + + + + + + {{ shexiangbuttonName[index] }} + + + + + + @@ -394,7 +456,7 @@ - + @@ -437,353 +499,356 @@ ]) + // 绑定到 scroll-view 的 scroll-left + const scrollLeft = ref(0) - const downpicture = [ - "原图", - "全景拉伸", - "四分屏", - "180°全景", - "360°全景" - ] - const bottomTargetIndex = ref(-1); - const downtarget = ref(-1); - const second = ref(0); - const cameraArray = ref([ - "截图", - "录制", - "对讲", - "静音", - "预警", - // "返回", - "图片", - "视频", - "清晰度", - "翻转", - ]) - const cameratarget = ref([]); - const wheelRef = ref(null); - const movecamera = (type : number) => { - handleKey(type) - } - // 对 moveFirstUp / moveFirstDown 包装防抖 - const moveUpDebounced = useThrottle(() => wheelRef.value?.moveFirstUp(), 400) - const moveDownDebounced = useThrottle(() => wheelRef.value?.moveFirstDown(), 400) - const moveUpsecond = useThrottle(() => wheelRef.value?.moveSecondUp(), 400) - const moveDownsecond = useThrottle(() => wheelRef.value?.moveSecondDown(), 400) - const clickDownsecond = useThrottle(() => doSomething(), 700) - function doSomething() { - wheelRef.value?.startchange() - if (first.value === 0) { - if (second.value) { - uni.$emit('smallmonitor:toggleVolume'); - } else { - uni.$emit('smallmonitor:toggleVolume'); - } - } - if (first.value === 1) { - if (second.value) { - uni.$emit('smallmonitor:stopTalk'); - } else { - uni.$emit('smallmonitor:openTalk'); - } - } - if (first.value === 2) { - uni.$emit('smallmonitor:doSnapshot'); - } - if (first.value === 3) { - if (second.value) { - uni.$emit('smallmonitor:stopRecord'); - } else { - uni.$emit('smallmonitor:startRecord'); - } - } - if (first.value === 4) { - if (!second.value) { - savefirst.value = first.value - first.value = -1; - yuntai.value = true; - } else { + // const downpicture = [ + // "原图", + // "全景拉伸", + // "四分屏", + // "180°全景", + // "360°全景" + // ] + // const bottomTargetIndex = ref(-1); + // const downtarget = ref(-1); + // const second = ref(0); + // const cameraArray = ref([ + // "截图", + // "录制", + // "对讲", + // "静音", + // "预警", + // // "返回", + // "图片", + // "视频", + // "清晰度", + // "翻转", + // ]) + // const cameratarget = ref([]); + // const wheelRef = ref(null); + // const movecamera = (type : number) => { + // handleKey(type) + // } + // // 对 moveFirstUp / moveFirstDown 包装防抖 + // const moveUpDebounced = useThrottle(() => wheelRef.value?.moveFirstUp(), 400) + // const moveDownDebounced = useThrottle(() => wheelRef.value?.moveFirstDown(), 400) + // const moveUpsecond = useThrottle(() => wheelRef.value?.moveSecondUp(), 400) + // const moveDownsecond = useThrottle(() => wheelRef.value?.moveSecondDown(), 400) + // const clickDownsecond = useThrottle(() => doSomething(), 700) + // function doSomething() { + // wheelRef.value?.startchange() - } + // if (first.value === 0) { + // if (second.value) { + // uni.$emit('smallmonitor:toggleVolume'); + // } else { + // uni.$emit('smallmonitor:toggleVolume'); + // } + // } + // if (first.value === 1) { + // if (second.value) { + // uni.$emit('smallmonitor:stopTalk'); + // } else { + // uni.$emit('smallmonitor:openTalk'); + // } + // } + // if (first.value === 2) { + // uni.$emit('smallmonitor:doSnapshot'); + // } + // if (first.value === 3) { + // if (second.value) { + // uni.$emit('smallmonitor:stopRecord'); + // } else { + // uni.$emit('smallmonitor:startRecord'); + // } + // } + // if (first.value === 4) { + // if (!second.value) { + // savefirst.value = first.value + // first.value = -1; + // yuntai.value = true; + // } else { - } - if (first.value === 5) { - if (gaoqing.value !== second.value) { - gaoqing.value = second.value - uni.$emit('smallmonitor:changeQuality'); // 发起截图请求,不关心回调 - } - } - if (first.value === 6) { - uni.$emit('smallmonitor:switchDisplay', second.value) - } - if (first.value === 7) { - if (second.value === 3) { - uni.$emit('smallmonitor:flipImage', 6) - } else { - uni.$emit('smallmonitor:flipImage', second.value) - } + // } - } - if (first.value === 8) { - if (second.value) { - uni.$emit('smallmonitor:stopAlarm') - } else { - uni.$emit('smallmonitor:startAlarm') - } + // } + // if (first.value === 5) { + // if (gaoqing.value !== second.value) { + // gaoqing.value = second.value + // uni.$emit('smallmonitor:changeQuality'); // 发起截图请求,不关心回调 + // } + // } + // if (first.value === 6) { + // uni.$emit('smallmonitor:switchDisplay', second.value) + // } + // if (first.value === 7) { + // if (second.value === 3) { + // uni.$emit('smallmonitor:flipImage', 6) + // } else { + // uni.$emit('smallmonitor:flipImage', second.value) + // } - } - } - function useThrottle(fn : () => void, delay = 1000) { - let throttling = false - return () => { - if (throttling) return - fn() - throttling = true - setTimeout(() => { - throttling = false - }, delay) - } - } - const gaoqing = ref(0); - const yuntai = ref(false); - const savefirst = ref(-1); - const first = ref(5); - // 核心逻辑 - function handleKey(type : number) { - switch (type) { - case 0: runDirection(1, 0); break // 上 - case 1: runDirection(5, 1); break // 右 - case 2: runDirection(7, 2); break // 下 - case 3: runDirection(3, 3); break // 左 - case 4: // 确定 - first.value = savefirst.value - yuntai.value = false - savefirst.value = -1 - moveUpsecond() - clickDownsecond() - break - case 5: // 取消 - first.value = savefirst.value - yuntai.value = false - savefirst.value = -1 - moveUpsecond() - clickDownsecond() - break - } - } - // 当前活跃的方向(0,1,2,3) - // -1 表示没有活跃方向 - let activeDir = -1 - // 定时器 map,key = 方向 - const stopTimers : Record = {} - // 管理方向的开始/停止 - function runDirection(dirCode : number, type : number) { - // 如果换方向,先停掉旧的 - if (activeDir !== -1 && activeDir !== type) { - stopDirection(activeDir) - } + // } + // if (first.value === 8) { + // if (second.value) { + // uni.$emit('smallmonitor:stopAlarm') + // } else { + // uni.$emit('smallmonitor:startAlarm') + // } - activeDir = type + // } + // } + // function useThrottle(fn : () => void, delay = 1000) { + // let throttling = false + // return () => { + // if (throttling) return + // fn() + // throttling = true + // setTimeout(() => { + // throttling = false + // }, delay) + // } + // } + // const gaoqing = ref(0); + // const yuntai = ref(false); + // const savefirst = ref(-1); + // const first = ref(5); + // // 核心逻辑 + // function handleKey(type : number) { + // switch (type) { + // case 0: runDirection(1, 0); break // 上 + // case 1: runDirection(5, 1); break // 右 + // case 2: runDirection(7, 2); break // 下 + // case 3: runDirection(3, 3); break // 左 + // case 4: // 确定 + // first.value = savefirst.value + // yuntai.value = false + // savefirst.value = -1 + // moveUpsecond() + // clickDownsecond() + // break + // case 5: // 取消 + // first.value = savefirst.value + // yuntai.value = false + // savefirst.value = -1 + // moveUpsecond() + // clickDownsecond() + // break + // } + // } + // // 当前活跃的方向(0,1,2,3) + // // -1 表示没有活跃方向 + // let activeDir = -1 + // // 定时器 map,key = 方向 + // const stopTimers : Record = {} + // // 管理方向的开始/停止 + // function runDirection(dirCode : number, type : number) { + // // 如果换方向,先停掉旧的 + // if (activeDir !== -1 && activeDir !== type) { + // stopDirection(activeDir) + // } - // 执行开始 - movedirection(dirCode, 1) + // activeDir = type - // 重置 stop 计时器 - if (stopTimers[type]) clearTimeout(stopTimers[type]) + // // 执行开始 + // movedirection(dirCode, 1) - stopTimers[type] = setTimeout(() => { - stopDirection(type) - }, 550) // 如果 550ms 内没有新指令 → 自动停止 - } + // // 重置 stop 计时器 + // if (stopTimers[type]) clearTimeout(stopTimers[type]) - // 停止动作 - function stopDirection(type : number) { - if (type === -1) return - let dirCode = 0 - switch (type) { - case 0: dirCode = 1; break - case 1: dirCode = 5; break - case 2: dirCode = 7; break - case 3: dirCode = 3; break - } - movedirection(dirCode, 0).then((res : any) => { }) + // stopTimers[type] = setTimeout(() => { + // stopDirection(type) + // }, 550) // 如果 550ms 内没有新指令 → 自动停止 + // } - clearTimeout(stopTimers[type]) - stopTimers[type] = null - if (activeDir === type) activeDir = -1 - } + // // 停止动作 + // function stopDirection(type : number) { + // if (type === -1) return + // let dirCode = 0 + // switch (type) { + // case 0: dirCode = 1; break + // case 1: dirCode = 5; break + // case 2: dirCode = 7; break + // case 3: dirCode = 3; break + // } + // movedirection(dirCode, 0).then((res : any) => { }) - // 简单的宽松解析函数 - function parseDateFlexible(s) { - if (s instanceof Date) return s - if (typeof s !== 'string') throw new Error('birth must be string or Date') - // 支持 "YYYY-MM-DD" 或 "YYYY年MM月DD日" 或 "YYYY/MM/DD" - const m = s.match(/(\d{4})\D+(\d{1,2})\D+(\d{1,2})/) - if (!m) throw new Error('无法解析的日期格式') - return new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) - } - const removeIndexOnce = (index : number) => { - const pos = cameratarget.value.indexOf(index) - if (pos !== -1) { - cameratarget.value.splice(pos, 1) // 从 pos 开始删除 1 个元素 - } - } - const wheretarget = ref(3); - const where = [ - { - name: "左右翻转", - url: "/static/index/camera/800.png", - target: "/static/index/camera/801.png", - }, - { - name: "上下翻转", - url: "/static/index/camera/810.png", - target: "/static/index/camera/811.png", - }, - { - name: "中心翻转", - url: "/static/index/camera/820.png", - target: "/static/index/camera/821.png", - }, - { - name: "不翻转", - url: "/static/index/camera/830.png", - target: "/static/index/camera/831.png", - }, - ] - const jumpopen = ref(false); - const rightjumpopen = ref(false); - const clickcamera = (index : number) => { - switch (index) { - case 0: - // 触发快照事件 - uni.$emit('smallmonitor:doSnapshot') + // clearTimeout(stopTimers[type]) + // stopTimers[type] = null + // if (activeDir === type) activeDir = -1 + // } - // 如果数组里不存在就 push(避免重复) - if (!cameratarget.value.includes(index)) { - cameratarget.value.push(index) - } + // // 简单的宽松解析函数 + // function parseDateFlexible(s) { + // if (s instanceof Date) return s + // if (typeof s !== 'string') throw new Error('birth must be string or Date') + // // 支持 "YYYY-MM-DD" 或 "YYYY年MM月DD日" 或 "YYYY/MM/DD" + // const m = s.match(/(\d{4})\D+(\d{1,2})\D+(\d{1,2})/) + // if (!m) throw new Error('无法解析的日期格式') + // return new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) + // } + // const removeIndexOnce = (index : number) => { + // const pos = cameratarget.value.indexOf(index) + // if (pos !== -1) { + // cameratarget.value.splice(pos, 1) // 从 pos 开始删除 1 个元素 + // } + // } + // const wheretarget = ref(3); + // const where = [ + // { + // name: "左右翻转", + // url: "/static/index/camera/800.png", + // target: "/static/index/camera/801.png", + // }, + // { + // name: "上下翻转", + // url: "/static/index/camera/810.png", + // target: "/static/index/camera/811.png", + // }, + // { + // name: "中心翻转", + // url: "/static/index/camera/820.png", + // target: "/static/index/camera/821.png", + // }, + // { + // name: "不翻转", + // url: "/static/index/camera/830.png", + // target: "/static/index/camera/831.png", + // }, + // ] + // const jumpopen = ref(false); + // const rightjumpopen = ref(false); + // const clickcamera = (index : number) => { + // switch (index) { + // case 0: + // // 触发快照事件 + // uni.$emit('smallmonitor:doSnapshot') - // 如果之前有定时器,先清掉(实现“重新计时”) - if (removeTimers.has(index)) { - clearTimeout(removeTimers.get(index)!) - } + // // 如果数组里不存在就 push(避免重复) + // if (!cameratarget.value.includes(index)) { + // cameratarget.value.push(index) + // } - // 新建一个 1s 后移除的定时器 - const timerId = setTimeout(() => { - const pos = cameratarget.value.indexOf(index) - if (pos !== -1) { - cameratarget.value.splice(pos, 1) - } - removeTimers.delete(index) - }, 500) + // // 如果之前有定时器,先清掉(实现“重新计时”) + // if (removeTimers.has(index)) { + // clearTimeout(removeTimers.get(index)!) + // } - removeTimers.set(index, timerId) - break - case 1: - if (cameratarget.value.includes(index)) { - uni.$emit('smallmonitor:stopRecord'); - removeIndexOnce(index) - } else { - uni.$emit('smallmonitor:startRecord'); - cameratarget.value.push(index) - } - break - case 2: - if (cameratarget.value.includes(index)) { - uni.$emit('smallmonitor:stopTalk'); - removeIndexOnce(index) - } else { - uni.$emit('smallmonitor:openTalk'); - cameratarget.value.push(index) - } - break - case 3: - if (cameratarget.value.includes(index)) { - uni.$emit('smallmonitor:toggleVolume'); - removeIndexOnce(index) - } else { - uni.$emit('smallmonitor:toggleVolume'); - cameratarget.value.push(index) - } - break - case 4: - if (cameratarget.value.includes(index)) { - uni.$emit('smallmonitor:stopAlarm') - removeIndexOnce(index) - } else { - uni.$emit('smallmonitor:startAlarm') - cameratarget.value.push(index) - } - break - // case 5: + // // 新建一个 1s 后移除的定时器 + // const timerId = setTimeout(() => { + // const pos = cameratarget.value.indexOf(index) + // if (pos !== -1) { + // cameratarget.value.splice(pos, 1) + // } + // removeTimers.delete(index) + // }, 500) - // jumpopen.value = false; - // uni.navigateBack() - // break - case 5: - if (cameratarget.value.includes(index)) { - removeIndexOnce(index) - } else { - cameratarget.value.push(index) - } - break - case 6: - if (cameratarget.value.includes(index)) { - removeIndexOnce(index) - } else { - cameratarget.value.push(index) - } - break - case 7: - if (cameratarget.value.includes(index)) { - uni.$emit('smallmonitor:changeQuality'); - removeIndexOnce(index) - } else { - uni.$emit('smallmonitor:changeQuality'); - cameratarget.value.push(index) - } - break - case 8: - rightjumpopen.value = true - break - } - } - const clickjump = (index : number) => { - wheretarget.value = index; - if (index === 3) { - uni.$emit('smallmonitor:flipImage', 6) - removeIndexOnce(9) - } else { - uni.$emit('smallmonitor:flipImage', index) - cameratarget.value.push(9) - } + // removeTimers.set(index, timerId) + // break + // case 1: + // if (cameratarget.value.includes(index)) { + // uni.$emit('smallmonitor:stopRecord'); + // removeIndexOnce(index) + // } else { + // uni.$emit('smallmonitor:startRecord'); + // cameratarget.value.push(index) + // } + // break + // case 2: + // if (cameratarget.value.includes(index)) { + // uni.$emit('smallmonitor:stopTalk'); + // removeIndexOnce(index) + // } else { + // uni.$emit('smallmonitor:openTalk'); + // cameratarget.value.push(index) + // } + // break + // case 3: + // if (cameratarget.value.includes(index)) { + // uni.$emit('smallmonitor:toggleVolume'); + // removeIndexOnce(index) + // } else { + // uni.$emit('smallmonitor:toggleVolume'); + // cameratarget.value.push(index) + // } + // break + // case 4: + // if (cameratarget.value.includes(index)) { + // uni.$emit('smallmonitor:stopAlarm') + // removeIndexOnce(index) + // } else { + // uni.$emit('smallmonitor:startAlarm') + // cameratarget.value.push(index) + // } + // break + // // case 5: - } - const clickDownCard = (index : number) => { - // cleanandopen() - bottomTargetIndex.value = index; - // clickDownCard(0) - downtarget.value = index; - switch (index) { - case 0: - uni.$emit('smallmonitor:switchDisplay', 0) - break - case 1: - uni.$emit('smallmonitor:switchDisplay', 4) - break - case 2: - uni.$emit('smallmonitor:switchDisplay', 1) - break - case 3: - uni.$emit('smallmonitor:switchDisplay', 2) - break - case 4: - uni.$emit('smallmonitor:switchDisplay', 3) - break - } - } + // // jumpopen.value = false; + // // uni.navigateBack() + // // break + // case 5: + // if (cameratarget.value.includes(index)) { + // removeIndexOnce(index) + // } else { + // cameratarget.value.push(index) + // } + // break + // case 6: + // if (cameratarget.value.includes(index)) { + // removeIndexOnce(index) + // } else { + // cameratarget.value.push(index) + // } + // break + // case 7: + // if (cameratarget.value.includes(index)) { + // uni.$emit('smallmonitor:changeQuality'); + // removeIndexOnce(index) + // } else { + // uni.$emit('smallmonitor:changeQuality'); + // cameratarget.value.push(index) + // } + // break + // case 8: + // rightjumpopen.value = true + // break + // } + // } + // const clickjump = (index : number) => { + // wheretarget.value = index; + // if (index === 3) { + // uni.$emit('smallmonitor:flipImage', 6) + // removeIndexOnce(9) + // } else { + // uni.$emit('smallmonitor:flipImage', index) + // cameratarget.value.push(9) + // } + + // } + // const clickDownCard = (index : number) => { + // // cleanandopen() + // bottomTargetIndex.value = index; + // // clickDownCard(0) + // downtarget.value = index; + // switch (index) { + // case 0: + // uni.$emit('smallmonitor:switchDisplay', 0) + // break + // case 1: + // uni.$emit('smallmonitor:switchDisplay', 4) + // break + // case 2: + // uni.$emit('smallmonitor:switchDisplay', 1) + // break + // case 3: + // uni.$emit('smallmonitor:switchDisplay', 2) + // break + // case 4: + // uni.$emit('smallmonitor:switchDisplay', 3) + // break + // } + // } // 监听 isMain 的变化,但只在 isShow 为 true 时响应 @@ -803,7 +868,7 @@ zeroIndex.value = 0; typeNowtarget.value = zeroIndex.value; changeallmessage() - + } else if (oldVal === false && newVal === true) { movetype.value = -1 zeroIndex.value = -1 @@ -890,16 +955,21 @@ if (zeroIndex.value < allArray.value.length - 1) { zeroIndex.value++ typeNowtarget.value = zeroIndex.value; + scrollLeft.value = zeroIndex.value * 130 changeallmessage() } break; case 2: - + if (typeNow.value) { savetopindex.value = zeroIndex.value; movetype.value = 1 zeroIndex.value = 0 + } else { + savetopindex.value = zeroIndex.value; + movetype.value = 2 + zeroIndex.value = 0 } @@ -909,6 +979,7 @@ if (zeroIndex.value) { zeroIndex.value-- typeNowtarget.value = zeroIndex.value; + scrollLeft.value = zeroIndex.value * 130 changeallmessage() } else { movetype.value = -1 @@ -1010,13 +1081,22 @@ break; case 3: + if (typeNow.value) { + zeroIndex.value = 0 + movetype.value = 1 + } - zeroIndex.value = 0 - movetype.value = 1 break; case 4: if (typeNow.value != 3) { + + if (!typeNow.value && !zeroIndex.value) { + uni.navigateTo({ + url: "/pages/watch/full" + }) + return + } if (!zeroIndex.value) { if (indexmessage.value.relayState === '1') { openlahzha.value = true @@ -1029,7 +1109,9 @@ openbaoxiu.value = true; emit("canback", true) } - } else { + } + + else { openbaoxiu.value = true; emit("canback", true) } @@ -1242,6 +1324,12 @@ } const clickRightMenu = (index : number) => { + if (!typeNow.value && !index) { + uni.navigateTo({ + url: "/pages/watch/full" + }) + return + } zeroIndex.value = index; clean(); movetype.value = 2; @@ -1358,6 +1446,7 @@ )], ) const buttonName = ref(['清零', "抄表", "日志", "拉闸", "合闸", "报修"]) + const shexiangbuttonName = ref(["预览", "报修"]) const waterbuttonName = ref(['清零', "抄表", "日志", "开阀", "关阀", "报修"]) const wendubuttonName = ref(["抄表", "日志", "报修"]) const typeArray = ref([ @@ -1437,31 +1526,60 @@ ) const name = ref(""); - //随机数 const randomValue = ref(0) - let timer = null + let startValue = 0 + let targetValue = 0 + let startTime = 0 + let duration = 300 + let animating = false - // function getRandomNumber() { - // return Number((Math.random() * 100000).toFixed(2)) - // } - function rollTo(target) { - let current = 0 - const duration = 200 // 滚动总时长:1秒 - const steps = 60 // 每秒大约 60 帧 - const interval = duration / steps - const step = target / steps - - clearInterval(timer) // 防止上一个定时器干扰 - timer = setInterval(() => { - current += step - if (current >= target) { - current = target - clearInterval(timer) - } - randomValue.value = Number(current.toFixed(2)) - }, interval) + // 兼容处理:performance.now() 不存在时用 Date.now() + function nowTime() { + return (typeof performance !== 'undefined' && performance.now) + ? performance.now() + : Date.now() } + function rollTo(target) { + animating = false // 立即停止上一个动画 + startValue = randomValue.value + targetValue = target + startTime = nowTime() + duration = 300 + animating = true + requestAnimationFrameCompat(animate) + } + + function animate() { + if (!animating) return + const now = nowTime() + const elapsed = now - startTime + let progress = elapsed / duration + if (progress > 1) progress = 1 + + // 缓动函数 easeOutCubic + const eased = 1 - Math.pow(1 - progress, 3) + randomValue.value = Number((startValue + (targetValue - startValue) * eased).toFixed(2)) + + if (progress < 1) { + requestAnimationFrameCompat(animate) + } else { + animating = false + } + } + + // 通用 requestAnimationFrame 兼容 + function requestAnimationFrameCompat(cb) { + if (typeof requestAnimationFrame !== 'undefined') { + requestAnimationFrame(cb) + } else { + // UniApp 里一般没有 raf,用 setTimeout 模拟 + setTimeout(cb, 16) // 约 60fps + } + } + + + const indexmessage = ref({ eleValue: "", address: "", @@ -1494,113 +1612,107 @@ typeNow.value = 0; photoplay.value = true; init(); - + yulan(); }) const changeallmessage = () => { uni.$emit('smallmonitor:isshow', false) - typeNow.value=allArray.value[typeNowtarget.value].typeNumber; + typeNow.value = allArray.value[typeNowtarget.value].typeNumber; if (typeNow.value === 1) { indexmessage.value = allArray.value[typeNowtarget.value] const firstTarget = indexmessage.value.eleValue; - + if (indexmessage.value.relayState === '1') { + rightArray.value = [mobanrightArray.value[1], mobanrightArray.value[2]] + } else { + rightArray.value = [mobanrightArray.value[0], mobanrightArray.value[2]] + } + rollTo(Number(firstTarget)) } else if (typeNow.value === 2) { watermessage.value = allArray.value[typeNowtarget.value] const secondTarget = watermessage.value.waterValue - + if (watermessage.value.relayState === '1') { + waterrightArray.value = [mobanrightArray.value[1], mobanrightArray.value[2]] + } else { + waterrightArray.value = [mobanrightArray.value[0], mobanrightArray.value[2]] + } rollTo(Number(secondTarget)) } else if (typeNow.value === 3) { tempmessage.value = allArray.value[typeNowtarget.value] const thirdTarget = tempmessage.value.temperature - + rollTo(Number(thirdTarget)) } else if (!typeNow.value) { rightmessage.value = allArray.value[typeNowtarget.value] - uni.$emit('smallmonitor:isshow', true) + rightArray.value = [mobanrightArray.value[0], mobanrightArray.value[2]] } } const rightmessage = ref({ deviceName: "", - deviceStatus: "1" + deviceStatus: "1", + nuId: "", + nuName: "", + sn: "", + reportingTime: "", + id: 0, + // maintainStatus: "", }); const allArray = ref([]); + const yulan = () => { + console.log("?????") + setTimeout(() => { + typeNowtarget.value = 0 + changeallmessage() + }, 500) + } const init = () => { allArray.value = []; // console.log("????", uni.getStorageSync('serverUrl'), uni.getStorageSync('nuId')) electricityMeterlist().then((res : any) => { console.log("!!!", res.result) - if(res.result.cameraInfoEntityList.length && res.result.cameraInfoEntityList !=null){ - res.result.cameraInfoEntityList.forEach((element:any,index:number)=>{ + if (res.result.cameraInfoEntityList.length && res.result.cameraInfoEntityList != null) { + res.result.cameraInfoEntityList.forEach((element : any, index : number) => { element.typeNumber = 0 element.lookName = "摄像头" + index; element.donghuapian = typeArray.value[0].url allArray.value.push(element) }) } - if(res.result.electricityMeterEntityList.length && res.result.electricityMeterEntityList !=null){ - res.result.electricityMeterEntityList.forEach((element:any,index:number)=>{ + if (res.result.electricityMeterEntityList.length && res.result.electricityMeterEntityList != null) { + res.result.electricityMeterEntityList.forEach((element : any, index : number) => { element.typeNumber = 1 element.lookName = "电表" + index element.donghuapian = typeArray.value[1].url allArray.value.push(element) }) } - if(res.result.waterMeterEntityList.length && res.result.waterMeterEntityList !=null){ - res.result.waterMeterEntityList.forEach((element:any,index:number)=>{ + if (res.result.waterMeterEntityList.length && res.result.waterMeterEntityList != null) { + res.result.waterMeterEntityList.forEach((element : any, index : number) => { element.typeNumber = 2 element.lookName = "水表" + index element.donghuapian = typeArray.value[2].url allArray.value.push(element) }) } - if(res.result.humidDeviceEntityList.length && res.result.humidDeviceEntityList !=null){ - res.result.humidDeviceEntityList.forEach((element:any,index:number)=>{ + if (res.result.humidDeviceEntityList.length && res.result.humidDeviceEntityList != null) { + res.result.humidDeviceEntityList.forEach((element : any, index : number) => { element.typeNumber = 3 element.lookName = "温度计" + index element.donghuapian = typeArray.value[3].url allArray.value.push(element) }) } - console.log("allArray.value",allArray.value) - uni.$emit('smallmonitor:killView'); - if (!typeNow.value) { - if (res.result.cameraInfoEntityList[0].deviceName) { - console.log("????") - uni.$emit('smallmonitor:isshow', true); - // 加点延迟吧 - setTimeout(() => { - rightmessage.value = res.result.cameraInfoEntityList[0] - uni.$emit('smallmonitor:changeinit', res.result.cameraInfoEntityList[0].deviceIndex); + // rightmessage.value = res.result.cameraInfoEntityList[0] + // //温度计 + // tempmessage.value = res.result.humidDeviceEntityList[0]; + // // 这个是电表 + // indexmessage.value = res.result.electricityMeterEntityList[0] - }, 100) + // // 这个是水表 + // watermessage.value = res.result.waterMeterEntityList[0] - } else { - uni.$emit('smallmonitor:isshow', false) - } - } else { - uni.$emit('smallmonitor:isshow', false) - } - - rightmessage.value = res.result.cameraInfoEntityList - //温度计 - tempmessage.value = res.result.humidDeviceEntityList[0]; - // 这个是电表 - indexmessage.value = res.result.electricityMeterEntityList[0] - if (indexmessage.value.relayState === '1') { - rightArray.value = [mobanrightArray.value[1], mobanrightArray.value[2]] - } else { - rightArray.value = [mobanrightArray.value[0], mobanrightArray.value[2]] - } - // 这个是水表 - watermessage.value = res.result.waterMeterEntityList[0] - if (watermessage.value.relayState === '1') { - waterrightArray.value = [mobanrightArray.value[1], mobanrightArray.value[2]] - } else { - waterrightArray.value = [mobanrightArray.value[0], mobanrightArray.value[2]] - } }) } const lanjie = ref(false); @@ -1651,6 +1763,7 @@ position: relative; font-size: 28rpx; + .new-weight { margin-left: 30rpx; font-weight: 600; @@ -1785,10 +1898,15 @@ .big-img { width: 600rpx; height: 600rpx; - // margin-top: 100rpx; margin: 50rpx 0; } + .big-img-shexiang { + width: 600rpx; + height: 650rpx; + margin-bottom: 35.5rpx; + } + .left-menu { @@ -2199,117 +2317,11 @@ } } - .big-bgc { - margin-left: 40rpx; - margin-top: -40rpx; - width: 1350rpx; - height: 950rpx; - border-radius: 55rpx; - overflow: hidden; - display: flex; - justify-content: center; - align-items: center; - position: relative; - } - - .picture { - display: flex; - margin-top: 50rpx; - margin-left: 30rpx; - - .picture-card { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - margin-left: 20rpx; - margin-right: 10rpx; - width: 200rpx; - - .bgc-card { - width: 100%; - height: 130rpx; - background-color: rgba(226, 227, 231, 0.5); - border-radius: 30rpx; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 10rpx; - } - } - } - - .right-right { - position: absolute; - right: 0rpx; - top: 80rpx; - height: calc(100% - 250rpx); - width: 570rpx; - - - } - - .bottom-view { - margin-left: 90rpx; - margin-top: 220rpx; - // padding-top: 80rpx; - width: 440rpx; - height: 800rpx; - border-radius: 50rpx; - background-color: rgba(226, 227, 231, 0.5); - position: relative; - display: flex; - flex-wrap: wrap; - overflow: hidden; - align-items: flex-start; - align-content: flex-start; - - .small-button-father { - margin-top: 20rpx; - margin-bottom: 0; - margin-left: 28rpx; - text-align: center; - - .bottom-button { - background-color: #F2F2F4; - display: flex; - justify-content: center; - align-items: center; - width: 110rpx; - height: 110rpx; - border: 1rpx solid #CDD3DD; - border-radius: 35rpx; - margin-bottom: 5rpx; - } - } - } - - .jump-white { - position: absolute; - bottom: 20rpx; - left: 50rpx; - width: 300rpx; - height: 400rpx; - background-color: #fff; - border-radius: 30rpx; - box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1) - } - - .jump-item { - margin: 10rpx 10rpx; - height: 60rpx; - justify-content: center; - width: 93%; - display: flex; - border-radius: 20rpx; - align-items: center; - } - - .shebei { - width: 100%; - margin-top: 10rpx; - margin-left: 30rpx; - margin-top: 60rpx; - // justify-content: space-around; + .gray-bgc { + background-color: #E8E9ED; + padding: 10rpx 30rpx; + font-size: 30rpx; + border-radius: 15rpx; + margin-top: 15rpx; } \ No newline at end of file diff --git a/pages/NursingNew/component/index.vue b/pages/NursingNew/component/index.vue index 2cb0ca7..8bafc3a 100644 --- a/pages/NursingNew/component/index.vue +++ b/pages/NursingNew/component/index.vue @@ -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 } diff --git a/pages/NursingNew/index.vue b/pages/NursingNew/index.vue index 213340e..fc7239b 100644 --- a/pages/NursingNew/index.vue +++ b/pages/NursingNew/index.vue @@ -456,7 +456,7 @@ return result; } // 生命周期钩子 - onShow(() => { + onMounted(() => { //首次加载和跳转回来需要重新做个动画 setTimeout(() => { diff --git a/pages/Warehouse/Warehouse.vue b/pages/Warehouse/Warehouse.vue index 955df8e..438c295 100644 --- a/pages/Warehouse/Warehouse.vue +++ b/pages/Warehouse/Warehouse.vue @@ -6,7 +6,8 @@ @click.stop="housactive(index)"> - + @@ -23,8 +24,8 @@ - + {{v}} @@ -34,14 +35,17 @@ + - - {{v}} - + + {{v}} + @@ -61,6 +65,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" + }) + } } const navurl = ref(''); const movecard = (type : number) => { @@ -104,6 +115,19 @@ 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(-1); let clickResetTimer : ReturnType | null = null; // 单击(或短按) @@ -117,17 +141,17 @@ }, 500) switch (dir) { case 0: - + break case 1: - + break case 2: - + break case 3: uni.navigateTo({ - url:"/pages/watch/full" + url: "/pages/watch/full" }) break } @@ -241,7 +265,8 @@ margin: 0 0.3vw; transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.25s ease; -webkit-tap-highlight-color: transparent; - image{ + + image { width: 1.6vw; height: 1.6vw; margin-right: .2vw; @@ -255,7 +280,7 @@ .click-box-target { background: #FFFFFF; - box-shadow: 0px 0px 3vw 0px rgba(12,102,209,0.33) inset; + box-shadow: 0px 0px 3vw 0px rgba(12, 102, 209, 0.33) inset; // box-shadow: 0rpx 0rpx 3vw 0rpx rgba(38,137,255,0.44) inset; color: rgba(108, 132, 160, 1) !important; animation: scalePulse 360ms cubic-bezier(.2, .8, .2, 1); @@ -455,7 +480,7 @@ >view { position: relative; - + &:nth-child(2) { width: 6.5vw; height: 3.2vw; @@ -465,12 +490,14 @@ display: flex; align-items: center; justify-content: center; - image{ + + image { position: absolute; top: 0; left: 0; } - text{ + + text { position: relative; font-weight: 400; font-size: 1.1vw; @@ -515,4 +542,12 @@ background-position: center center; overflow: hidden; } + + .zhanwei { + position: absolute; + top: 40vh; + right: 3vw; + width: 13vw; + height: 13vw; + } \ No newline at end of file diff --git a/pages/Warehouse/purchaseorder.vue b/pages/Warehouse/purchaseorder.vue index 4973abf..92091d2 100644 --- a/pages/Warehouse/purchaseorder.vue +++ b/pages/Warehouse/purchaseorder.vue @@ -14,13 +14,13 @@ @scrolltolower="plsbuytolower" :lower-threshold="200"> + :class="{'yujing':v?.cgdType=='9','active':leftitem==i}" @click="getmiddle(v,i);saveleftgo = i;"> {{ v.cgdNo }} 供应商:{{ v.gysId_dictText }} 采购人: {{ v.createBy_dictText }} {{ v.qgDate }} - + 已作废 @@ -159,7 +159,7 @@ - + {{v.name}} @@ -700,6 +700,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(); diff --git a/static/index/newindex/wendu/6.png b/static/index/newindex/wendu/6.png new file mode 100644 index 0000000..fc337f5 Binary files /dev/null and b/static/index/newindex/wendu/6.png differ diff --git a/static/index/newindex/wendu/yulan.png b/static/index/newindex/wendu/yulan.png new file mode 100644 index 0000000..457aef7 Binary files /dev/null and b/static/index/newindex/wendu/yulan.png differ diff --git a/unpackage.zip b/unpackage.zip new file mode 100644 index 0000000..ef9b601 Binary files /dev/null and b/unpackage.zip differ diff --git a/unpackage/dist/dev/.nvue/app.js b/unpackage/dist/dev/.nvue/app.js index 42292cd..53d7547 100644 --- a/unpackage/dist/dev/.nvue/app.js +++ b/unpackage/dist/dev/.nvue/app.js @@ -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(() => { }); diff --git a/unpackage/dist/dev/.nvue/pages/smallcarmera.js b/unpackage/dist/dev/.nvue/pages/smallcarmera.js deleted file mode 100644 index a71e230..0000000 --- a/unpackage/dist/dev/.nvue/pages/smallcarmera.js +++ /dev/null @@ -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 -};