This commit is contained in:
Teng 2025-10-28 17:34:53 +08:00
commit 31f2f0782b
11 changed files with 778 additions and 65 deletions

View File

@ -6,8 +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" />
<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>
@ -62,6 +64,7 @@
},
});
const housedex = ref(-1);
const housactive = (index : number) => {
if (index > 5) { return }
housedex.value = index;
@ -73,6 +76,9 @@
})
}
}
onMounted(()=>{
housedex.value = 1
})
const navurl = ref('');
const movecard = (type : number) => {
// console.log(type,housedex.value)
@ -148,11 +154,12 @@
break
case 2:
break
case 3:
uni.navigateTo({
url: "/pages/watch/full"
})
break
case 3:
break
}
}
@ -197,6 +204,18 @@
width: '26vw',
height: '16vw'
},
{
url: genPaths(
'/static/index/warehouse/animation',
'Pick0',
4, //
'png',
1, // 1
false //
),
width: '17vw',
height: '13vw'
},
{
url: genPaths(
'/static/index/warehouse/animation',
@ -209,18 +228,7 @@
width: '24vw',
height: '16vw'
},
{
url: genPaths(
'/static/index/warehouse/animation',
'Pick0',
4, //
'png',
1, // 1
false //
),
width: '17vw',
height: '13vw'
}
])
</script>
@ -339,7 +347,7 @@
z-index: 27;
}
.itemact3 {
.itemact4 {
width: 24vw;
height: 16vw;
top: 28vw;
@ -347,7 +355,7 @@
z-index: 55;
}
.itemact4 {
.itemact3{
width: 17vw;
height: 13vw;
top: 22vw;

View File

@ -10,13 +10,32 @@ export const queryInvoicingList = (params) => {
})
}
export const getMaterialTreeData = () => {
// 获取物料分类树(请购列表使用)
export const getMaterialTreeData = (params) => {
return request({
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/getMaterialTreeData`,
method: 'get'
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/getMaterialTreeData?nuId=`+params.nuId,
method: 'get',
data: params,
})
}
// (业务)获取物料分类树(购物车使用)
export const getGwcMaterialTreeData = (params) => {
return request({
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/getGwcMaterialTreeData?nuId=`+params.nuId,
method: 'get',
data: params
})
}
// (业务)获取物料分类树(采购单使用)
export const getCgdMaterialTreeData = (params) => {
return request({
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/getCgdMaterialTreeData?nuId=`+params.nuId,
method: 'get',
data: params,
})
}
export const queryNuInfoByNuId = (params) => {
return request({
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/queryNuInfoByNuId`,
@ -108,3 +127,12 @@ export const voidedCgdMain = (params) => {
data: params,
})
}
//修改库房物料是否启用
export const updateWarehouserEnabled = (params) => {
return request({
url: `${uni.getStorageSync('serverUrl')}/api/pad/invoicing/updateWarehouserEnabled`,
method: 'post',
data: params,
})
}

View File

@ -96,15 +96,14 @@
<view class="shitem">
<view class="shypk">
<view>生活用品库</view>
<view>
<!-- <view>
<view class="swsh guodu" :class="shyp?'act':''" @click="switchshyp">
<view class="guodu"></view>
</view>
<text>
{{!shyp?'停用':'启用'}}
</text>
</view>
</view> -->
</view>
<view class="jqry">
<view class="left tp">
@ -140,6 +139,7 @@
<view class="scroltype">
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop3"
class="scroll-Y">
<view :class="scroll.act3==-1?'act':''" @click="typescroll(3,-1,{})" >全部</view>
<view :class="scroll.act3==i?'act':''"
v-for="(v,i) in TreeData[scroll.act1]?.children[scroll.act2]?.children"
@click="typescroll(3,i,v)">
@ -149,6 +149,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop2"
class="scroll-Y">
<view :class="scroll.act2==-1?'act':''" @click="typescroll(2,-1,{})" >全部</view>
<view :class="scroll.act2==i?'act':''" v-for="(v,i) in TreeData[scroll.act1]?.children"
@click="typescroll(2,i,v)">
{{v.title}}
@ -157,6 +158,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop1"
class="scroll-Y scrl1">
<view :class="scroll.act1==-1?'act':''" @click="typescroll(1,-1,{})" >全部</view>
<view :class="scroll.act1==i?'act':''" v-for="(v,i) in TreeData" @click="typescroll(1,i,v)">
<image :src="serverUrl + v.appCheckIconPath" mode="aspectFill" v-if="scroll.act1==i">
</image>
@ -313,7 +315,7 @@
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineProps } from 'vue';
import { queryShoppingCartList, getMaterialTreeData, queryNuInfoByNuId, updateKfstatus,deleteQgInfoById,emptiedQgInfo ,queryWlInfoByWlId,generatedPurchaseOrder,generatedPurchaseViewOrder } from './api/lunpan.js'
import { queryShoppingCartList, getGwcMaterialTreeData, queryNuInfoByNuId, updateKfstatus,deleteQgInfoById,emptiedQgInfo ,queryWlInfoByWlId,generatedPurchaseOrder,generatedPurchaseViewOrder } from './api/lunpan.js'
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import shadowview from './components/ShadowView.vue';
import calculator from './components/calculator.vue';
@ -390,6 +392,7 @@
const shopclick = (i : number, k : number,flag:boolean) => {
if(i==shopitem.value&&!flag){
InvoicingList.value[shopitem.value].flag = !InvoicingList.value[shopitem.value].flag;
panduan();
}
if (k == 2) {
let num = Math.ceil((i + 1) / 2)
@ -400,13 +403,15 @@
scrolltop.value = (num - 2) * 240;
shopitem.value = i;
}
panduan();
}
const xuanzhong = (o:any)=>{
o.flag = !o.flag
panduan()
}
const typescroll = (e : number, i : number, v : object) => {
if (e == 1) {
scroll.act2 = -1;
scroll.act3 = -1;
@ -415,7 +420,7 @@
form.categoryId = v?.categoryId;
form.typeId = '';
form.medicationId = '';
if (scroll.act1 == i) {
if (scroll.act1 == i ||i==-1) {
scroll.act1 = -1;
form.categoryId = '';
form.pageNo = 1;
@ -470,7 +475,9 @@
})
}
const getMaterial = () => {
getMaterialTreeData().then(res => {
getGwcMaterialTreeData(form).then(res => {
console.log(res)
TreeData.value = res.result
})
}
@ -510,7 +517,8 @@
}
})
InvoicingList.value.push(...res.result.records);
status.value = res.result.total == InvoicingList.value.length ? 'nomore' : 'loadmore'
status.value = res.result.total == InvoicingList.value.length ? 'nomore' : 'loadmore';
panduan();
})
}
const movecard = (type : number, l : number) => {
@ -612,6 +620,7 @@
return
}
InvoicingList.value[shopitem.value].flag = !InvoicingList.value[shopitem.value].flag;
panduan();
setTimeout(()=>{
anmidex.value = -1;
tmr.value = true;
@ -776,6 +785,9 @@
wlxq.value = true
})
}
const panduan =()=>{
animArray.value[0].name =InvoicingList.value[shopitem.value].flag? '取消':'选择'
}
const animArray = ref([
{
url: genPaths(
@ -786,7 +798,7 @@
1, // 1
false //
),
name: '选择/取消',
name: '选择',
imgurl: '/static/index/warehouse/procurement/select/select1.png'
},
{

View File

@ -48,11 +48,13 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scrolltop" class="scroll-Y"
@scrolltolower="scrolltolower" :lower-threshold="200" @scroll="scrollview">
<view class="boxitem" v-for="(v,i) in InvoicingList" :key='i'
:class="{'yujing':Number(v.lowerLimit)>=Number(v.kcsl),'active':shopitem==i}"
:class="{'yujing':Number(v.lowerLimit)>=Number(v.kcsl),'active':shopitem==i,'ty':v.izEnabled=='1'}"
@click="shopclick(i)">
<view>{{v.materialName}}</view>
<view>规格型号: {{v.specificationModel}}</view>
<view>
{{v.materialName}}
</view>
<view>采购单位 {{v.materialUnits}}</view>
<view>规格型号: {{v.specificationModel}}</view>
<view>
<view class="carditem" :class="{'hl':v.tagType==1,'yl':v.tagType==2,'bj':v.tagType>2}">
<image src="/static/index/warehouse/procurement/hl.png" mode="aspectFill"
@ -89,15 +91,14 @@
<view class="shitem">
<view class="shypk">
<view>生活用品库</view>
<view>
<!-- <view>
<view class="swsh guodu" :class="shyp?'act':''" @click="switchshyp">
<view class="guodu"></view>
</view>
<text>
{{!shyp?'停用':'启用'}}
</text>
</view>
</view> -->
</view>
<view class="jqry">
<view class="left tp">
@ -132,6 +133,7 @@
<view class="scroltype">
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop3"
class="scroll-Y">
<view :class="scroll.act3==-1?'act':''" @click="typescroll(3,-1,{})" >全部</view>
<view :class="scroll.act3==i?'act':''"
v-for="(v,i) in TreeData[scroll.act1]?.children[scroll.act2]?.children"
@click="typescroll(3,i,v)">
@ -141,6 +143,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop2"
class="scroll-Y">
<view :class="scroll.act2==-1?'act':''" @click="typescroll(2,-1,{})" >全部</view>
<view :class="scroll.act2==i?'act':''" v-for="(v,i) in TreeData[scroll.act1]?.children"
@click="typescroll(2,i,v)">
{{v.title}}
@ -149,6 +152,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop1"
class="scroll-Y scrl1">
<view :class="scroll.act1==-1?'act':''" @click="typescroll(1,-1,{})" >全部</view>
<view :class="scroll.act1==i?'act':''" v-for="(v,i) in TreeData" @click="typescroll(1,i,v)">
<image :src="serverUrl + v.appCheckIconPath" mode="aspectFill" v-if="scroll.act1==i">
</image>
@ -228,9 +232,11 @@
<view class="rightcont">
<view>
<text>{{caigouobj.materialName}}</text>
<view class="swsh guodu" :class="shyp?'act':''" @click="switchshyp">
<view class="swsh guodu" :class="caigouobj.izEnabled=='0'?'act':''" @click="caiswitchshyp(caigouobj.izEnabled,caigouobj.id)">
<view class="guodu"></view>
</view>
<view style="margin-left: 5rpx;white-space: nowrap;">{{caigouobj.izEnabled_dictText}}</view>
</view>
<view>
<view>物料编码: {{caigouobj.materialNo}}</view>
@ -340,7 +346,16 @@
</view>
<view class="mengban" v-if="wlxq" @click="qingkong"></view>
<view class="wuliao guodu" :class="wlxq?'':'uncrkcard'">
<view class="name">{{wuliaoobj.materialName}}</view>
<view class="name">
<view>{{wuliaoobj.materialName}}</view>
<!-- <view>
<view class="swsh guodu" :class="caigouobj.izEnabled=='0'?'act':''"
@click="caiswitchshyp(caigouobj.izEnabled,caigouobj.id)">
<view class="guodu"></view>
</view>
<text>{{caigouobj.izEnabled_dictText}}</text>
</view> -->
</view>
<view class="znk tp">
<image class="crkcard-img"
:src="wuliaoobj.materialImg?serverUrl + wuliaoobj.materialImg : '/static/index/warehouse/procurement/k.png'"
@ -389,7 +404,7 @@
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineProps } from 'vue';
import { queryInvoicingList, getMaterialTreeData, queryNuInfoByNuId, updateKfstatus,queryWlInfoByWlId,addShoppingCartList,queryShoppingCartList } from './api/lunpan.js'
import { queryInvoicingList,updateWarehouserEnabled, getMaterialTreeData, queryNuInfoByNuId, updateKfstatus,queryWlInfoByWlId,addShoppingCartList,queryShoppingCartList } from './api/lunpan.js'
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import shadowview from './components/ShadowView.vue';
import calculator from './components/calculator.vue';
@ -443,6 +458,23 @@
}
})
}
const caiswitchshyp = (code:string,id:string,s:string) =>{
let obj = {
id:id,
izEnabled: code=='0' ? '1' : '0'
}
updateWarehouserEnabled(obj).then(res => {
if (res.success) {
caigouobj.value.izEnabled = (code=='0' ? '1' : '0');
caigouobj.value.izEnabled_dictText = (code =='0' ? '停用' : '启用');
} else {
uni.showToast({
icon: 'error',
title: res.message
})
}
})
}
const shopclick = (i : number, k : number) => {
if (k == 2) {
let num = Math.ceil((i + 1) / 2)
@ -543,7 +575,7 @@
})
}
const getMaterial = () => {
getMaterialTreeData().then(res => {
getMaterialTreeData(form).then(res => {
TreeData.value = res.result
})
}
@ -709,6 +741,16 @@
gysarr.value = [];
caigouobj.value = InvoicingList.value[shopitem.value];
caigouobj.value.Limitnum = Number(caigouobj.value?.upperLimit)-Number(caigouobj.value.kcsl);
if(shyp.value==false){
uni.showToast({
icon:'none',
title:'该仓库已关闭,无法采购~'
})
setTimeout(()=>{
anmidex.value = -1;
},1000)
return
}
let n = [];
let id = [];
n = caigouobj.value.suppliers_dictText.split(/[, ]+/);
@ -725,8 +767,9 @@
anmidex.value = -1;
break;
case 3:
caigouobj.value = InvoicingList.value[shopitem.value];
let obj = {
wlId:InvoicingList.value[shopitem.value].wlId,
wlId:caigouobj.value.wlId,
nuId:form.nuId
}
queryWlInfoByWlId(obj).then(res=>{
@ -757,6 +800,13 @@
const timers = ref(true)
const connfig = () =>{
if(timers.value==false){return}
if(caigouobj.value.izEnabled=='1'){
uni.showToast({
icon:'none',
title:'该物料已关闭,无法采购~'
})
return
}
timers.value=false;
let dt = {
nuId:form.nuId,
@ -967,11 +1017,29 @@
.name {
width: 100%;
font-weight: bold;
font-size: 1.4vw;
color: #212327;
height: 3vw;
line-height: 1.5vw;
display: flex;
justify-content: space-between;
align-items: center;
view{
>&:nth-child(1){
width: 80%;
height: 3vw;
font-weight: bold;
font-size: 1.4vw;
color: #212327;
line-height: 1.5vw;
}
>&:nth-child(2){
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
text{
color: #333;
}
}
}
}
}
@ -1953,7 +2021,7 @@
background: rgba(255, 255, 255, .7);
border-radius: 1.6vw;
margin: 0 1.3vw 1.2vw 0;
border: 2px dashed #fff;
border: 2px solid #fff;
display: inline-block;
padding: 2.3vw;
position: relative;
@ -1976,13 +2044,16 @@
&:nth-child(1) {
font-weight: bold;
font-size: 1.5vw;
color: #333;
width: 100%;
display: flex;
justify-content: space-between;
white-space: nowrap;
overflow: hidden;
width: 100%;
text-overflow: ellipsis;
font-weight: bold;
font-size: 1.5vw;
}
&:nth-child(2) {
@ -2084,10 +2155,18 @@
}
}
.ty{
background: #e8e9ed !important;
border: 2px solid #f5f5f5;
view{
color: #666666 !important;
}
}
.active {
border: 2px dashed #017DE9 !important;
}
.swsh {
width: 2.7vw;
height: 1.5vw;

View File

@ -125,6 +125,7 @@
<view class="scroltype">
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop3"
class="scroll-Y">
<view :class="scroll.act3==-1?'act':''" @click="typescroll(3,-1,{})" >全部</view>
<view :class="scroll.act3==i?'act':''"
v-for="(v,i) in TreeData[scroll.act1]?.children[scroll.act2]?.children"
@click="typescroll(3,i,v)">
@ -134,6 +135,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop2"
class="scroll-Y">
<view :class="scroll.act2==-1?'act':''" @click="typescroll(2,-1,{})" >全部</view>
<view :class="scroll.act2==i?'act':''" v-for="(v,i) in TreeData[scroll.act1]?.children"
@click="typescroll(2,i,v)">
{{v.title}}
@ -142,6 +144,7 @@
<scroll-view scroll-y="true" scroll-with-animation :scroll-top="scroll.scrolltop1"
class="scroll-Y scrl1">
<view :class="scroll.act1==-1?'act':''" @click="typescroll(1,-1,{})" >全部</view>
<view :class="scroll.act1==i?'act':''" v-for="(v,i) in TreeData" @click="typescroll(1,i,v)">
<image :src="serverUrl + v.appCheckIconPath" mode="aspectFill" v-if="scroll.act1==i">
</image>
@ -302,7 +305,7 @@
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineProps } from 'vue';
import { queryInvoicingList, getMaterialTreeData, queryNuInfoByNuId, updateKfstatus, queryCgdList, queryCgdInfoList, queryWlInfoByWlId, voidedCgdMain } from './api/lunpan.js'
import { queryInvoicingList, getCgdMaterialTreeData, queryNuInfoByNuId, updateKfstatus, queryCgdList, queryCgdInfoList, queryWlInfoByWlId, voidedCgdMain } from './api/lunpan.js'
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import shadowview from './components/ShadowView.vue';
import calculator from './components/calculator.vue';
@ -360,7 +363,8 @@
Object.assign(form, mobanform)
form.cgdId = item.id
queryInvo()
queryInvo();
getMaterial();
// console.log("", form)
}
const switchshyp = () => {
@ -476,8 +480,6 @@
onLoad(() => {
form.nuId = uni.getStorageSync('nuId');
serverUrl.value = uni.getStorageSync('serverUrl') + '/sys/common/static/';
getMaterial();
cell();
firstgetqueryCgdList();
})
@ -488,8 +490,6 @@
Object.assign(plzinfo, mobanplzinfo)
serverUrl.value = uni.getStorageSync('serverUrl') + '/sys/common/static/';
getMaterial();
cell();
firstgetqueryCgdList();
}
@ -511,7 +511,8 @@
plsbuy.value.push(...res.result.records)
form.cgdId = plsbuy.value[0].id
queryInvo()
queryInvo();
getMaterial();
if (res.result.records.length < plzinfo.pageSize) {
plzinfo.canpull = false;
}
@ -553,7 +554,9 @@
})
}
const getMaterial = () => {
getMaterialTreeData().then(res => {
getCgdMaterialTreeData(form).then(res => {
console.log(form)
console.log(res)
TreeData.value = res.result
})
}
@ -587,9 +590,7 @@
}
const queryInvo = () => {
// console.log("form", form)
queryCgdInfoList(form).then(res => {
console.log(form)
console.log(res.result)
queryCgdInfoList(form).then(res => {
InvoicingList.value.push(...res.result.records);
// console.log("chu", InvoicingList.value)
detailform.wlId = InvoicingList.value[0].wlId

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -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
};

View File

@ -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
};

View File

@ -0,0 +1,585 @@
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