巡检
This commit is contained in:
@@ -129,8 +129,8 @@
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<view class="img-show" v-for="(item2,index) in imgArr2" :key="index">
|
||||
<img :src="item2" />
|
||||
<view class="img-show" v-for="(item2,index) in imgArr2" :key="index" @click="showMediaPreview(item2)">
|
||||
<img :src="item2.shortUrl" />
|
||||
</view>
|
||||
<view class="img-con" @click="chooseImage(item)">
|
||||
<img :src="'static/images/polling/icon-AddPic.png'" class="img-pic" />
|
||||
@@ -145,8 +145,8 @@
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<view class="img-show" v-for="(item2,index) in videoArr2" :key="index">
|
||||
<video :src="item2" controls></video>
|
||||
<view class="img-show" v-for="(item2,index) in videoArr2" :key="index" @click="showMediaPreview(item2)">
|
||||
<video :src="item2.url" controls v-show="videoShow"></video>
|
||||
</view>
|
||||
<view class="img-con" @click="chooseVideo(item)">
|
||||
<img :src="'static/images/polling/icon-AddVideo.png'" class="img-pic" />
|
||||
@@ -194,6 +194,8 @@
|
||||
ref="showModel3"
|
||||
></customShowModal>
|
||||
|
||||
<!-- 图片放大 -->
|
||||
<mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
@@ -205,28 +207,28 @@ import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
|
||||
import multipleSelect from "@/components/multipleSelect.vue";
|
||||
import pollingShowModal from "@/components/pollingShowModal.vue";
|
||||
import customShowModal from "@/components/customShowModal.vue"
|
||||
import mediaPreview from "@/components/mediaPreview.vue"
|
||||
import { parseTime } from '@/utils/datetime.js';
|
||||
import { formatTaskStatus } from '@/utils/status.js';
|
||||
import { taskGroupDetail,submitResult,minioUpload } from '@/api/polling.js'
|
||||
import {compressImageUni,getMinioThumbUrl} from '@/utils/common.js'
|
||||
import {compressImageUni} from '@/utils/common.js'
|
||||
// import {uploadFileMinio} from '@/utils/minio.js'
|
||||
// #ifdef APP-PLUS
|
||||
import nfcUtil from "@/utils/nfcUtil.js"
|
||||
let m1CardModule = uni.requireNativePlugin("LF-Sense-Card-M1")
|
||||
// #endif
|
||||
|
||||
let taskId = ref(undefined);
|
||||
let groupId = ref(undefined);
|
||||
let minioObj = ref({});
|
||||
let minioObj = {};
|
||||
onLoad(option => {
|
||||
// console.log(option)
|
||||
taskId.value = option.taskId;
|
||||
groupId.value = option.groupId;
|
||||
|
||||
minioObj.value = JSON.parse(uni.getStorageSync(MINIO_KEY) || "\{\}")
|
||||
// console.log(minioObj.value)
|
||||
minioObj = JSON.parse(uni.getStorageSync(MINIO_KEY) || "\{\}")
|
||||
// console.log(minioObj)
|
||||
})
|
||||
|
||||
|
||||
// 下拉刷新
|
||||
const mescrollRef = ref(null);
|
||||
const mescrollInit = (mescroll) => {
|
||||
@@ -269,21 +271,24 @@ const getList = async() => {
|
||||
}else if(item.pointType==7){
|
||||
imgArr.value=[];
|
||||
imgArr2.value=[];
|
||||
let imgList = item.resultContent.split(",");
|
||||
let imgList = item.resultContent?.split(",")||[];
|
||||
imgList.forEach(imgUrl=>{
|
||||
imgArr.value.push(imgUrl);
|
||||
let urlNew = minioObj.value.endpoint + "/thumb/"+minioObj.value.bucketName +"/"+imgUrl
|
||||
imgArr2.value.push(urlNew)
|
||||
imgArr2.value.push({
|
||||
shortUrl:minioObj.minioThumbUrl +"/"+imgUrl,
|
||||
url:minioObj.minioUrl +"/"+imgUrl,
|
||||
})
|
||||
})
|
||||
|
||||
}else if(item.pointType==8){
|
||||
videoArr.value=[];
|
||||
videoArr2.value=[]
|
||||
let videoList = item.resultContent.split(",");
|
||||
let videoList = item.resultContent?.split(",")||[];
|
||||
videoList.forEach(videoUrl=>{
|
||||
videoArr.value.push(videoUrl);
|
||||
let urlNew = minioObj.value.endpoint + "/"+minioObj.value.bucketName +"/"+videoUrl
|
||||
videoArr2.value.push(urlNew)
|
||||
videoArr2.value.push({
|
||||
shortUrl:minioObj.minioThumbUrl +"/"+videoUrl,
|
||||
url:minioObj.minioUrl +"/"+videoUrl,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -408,70 +413,32 @@ const chooseVideo = (item) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 放大视频或图片
|
||||
let isVisible= ref(false);//放大处理
|
||||
let mediaUrl= ref('');//放大地址
|
||||
let videoShow = ref(true);
|
||||
const showMediaPreview=(item)=>{
|
||||
console.log("showMediaPreview===")
|
||||
isVisible.value = true;
|
||||
videoShow.value = false;
|
||||
mediaUrl.value = item.url
|
||||
}
|
||||
const handlePreviewClose=()=>{
|
||||
isVisible.value = false;
|
||||
videoShow.value = true;
|
||||
}
|
||||
|
||||
// nfc 处理
|
||||
let discoveryCallback = null
|
||||
let cardUID = ref('');
|
||||
let cardValue = ref('');
|
||||
const initNFC = async(item) => {
|
||||
// console.log("initNFC=>",plus)
|
||||
|
||||
//这里用异步获取读取到的NFC数据
|
||||
const nfcId = await nfcUtil.listenNFCStatus();
|
||||
console.log("initNFC=>",nfcId)
|
||||
|
||||
// 确保在 App 环境
|
||||
// if (typeof plus === 'undefined') {
|
||||
// showModel3('此功能仅支持 App 端')
|
||||
// return
|
||||
// }
|
||||
|
||||
// // 检查设备是否支持NFC
|
||||
// if (!plus.nfc) {
|
||||
// showModel3('设备不支持 NFC')
|
||||
// return;
|
||||
// }
|
||||
// if (!plus.nfc.isSupportNFC()) {
|
||||
// showModel3('设备不支持 NFC')
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // 检查NFC是否开启
|
||||
// plus.nfc.isNFCEnabled((enabled) => {
|
||||
// if (enabled) {
|
||||
// startDiscovery()
|
||||
// } else {
|
||||
// showModel3('请先开启设备NFC功能')
|
||||
// }
|
||||
// },(error) => {
|
||||
// console.error('检查NFC状态失败:'+error.message);
|
||||
// showModel3('检查NFC状态失败')
|
||||
// })
|
||||
}
|
||||
// 执行NFC扫描
|
||||
const startDiscovery = () => {
|
||||
// 开始监听NFC标签
|
||||
plus.nfc.startDiscovery((res) => {
|
||||
console.log('NFC监听启动成功')
|
||||
// 监听NFC标签被发现的事件
|
||||
discoveryCallback = (result) => {
|
||||
try {
|
||||
console.log("NFC监听返回=>",result)
|
||||
// 尝试读取标签ID或NDEF数据
|
||||
const tag = result.tag
|
||||
if (tag && tag.id) {
|
||||
// 将标签ID字节数组转换为十六进制字符串
|
||||
const tagId = tag.id.map(b => b.toString(16).padStart(2, '0')).join(':')
|
||||
console.log(`检测到标签,ID: ${tagId}`)
|
||||
// 此处可以处理tag.ndefMessage等数据
|
||||
} else {
|
||||
console.log( `检测到标签,但无法解析数据`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log( '处理NFC数据时出错:' + error.message)
|
||||
}
|
||||
}
|
||||
plus.nfc.addEventListener('discovered', discoveryCallback, false)
|
||||
},(err) => {
|
||||
console.log( 'NFC监听启动失败:' + err.message)
|
||||
m1CardModule.openNativeSenseCard({
|
||||
'keyA': 'TestKey',
|
||||
'sector': 0,
|
||||
'block': 0
|
||||
},ret => {
|
||||
cardUID.value = ret.uid
|
||||
cardValue.value = ret.code
|
||||
})
|
||||
}
|
||||
|
||||
@@ -576,8 +543,9 @@ const handleConfirm=()=>{
|
||||
submitResult(submitParam).then(res=>{
|
||||
subTime.value = res;
|
||||
visible.value = false;
|
||||
console.log("submitResult=>",visible.value)
|
||||
// console.log("submitResult=>",visible.value)
|
||||
showModel2('此巡检项已完成');
|
||||
uni.navigateBack();
|
||||
}).finally(() => {
|
||||
submitLoading.value = false;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user