修改NFC读取

This commit is contained in:
xuli
2025-12-01 18:07:02 +08:00
parent b444bcee57
commit 11990a62da
296 changed files with 3808 additions and 282 deletions

View File

@@ -6,7 +6,9 @@
:leftFlag="true" :rightFlag="true"
>
<template #right>
<view class="head-right" @click="handleQuestion">
<!-- 状态是4-已完成 5-已过期的不能再问题上报了 -->
<block v-if="optionObj.taskStatus==5||optionObj.taskStatus==4"></block>
<view v-else class="head-right" @click="handleQuestion">
<view class="btn-yellow">
<img :src="'static/images/polling/icon-repair.png'" class="img-repair" />新建问题上报
</view>
@@ -92,7 +94,7 @@
<view>{{ item.pointName }}</view>
</view>
<!-- #ifdef APP-PLUS -->
<view class="r-right" @click.stop="initNFC">
<view class="r-right" @click.stop="initNFC(item,index)">
<img :src="'static/images/polling/icon-NFCcode.png'" class="img-nfc" /> 开始识别
</view>
<!-- #endif -->
@@ -156,8 +158,10 @@
</block>
<view class="report-border" :style="{borderColor:index<optionObj.pointList.length-1?'#E7E7E7':'#fff'}"></view>
</view>
<view class="btn-submit">
<button type="primary" @click="handleSubmit" :loading="submitLoading">提交</button>
<!-- 状态是4-已完成 5-已过期的不能再修改了 -->
<block v-if="optionObj.taskStatus==5||optionObj.taskStatus==4"></block>
<view v-else class="btn-submit">
<button type="primary" @click="handleSubmit" :loading="submitLoading" >提交</button>
</view>
</block>
<view v-else class="no-data">
@@ -195,11 +199,20 @@
></customShowModal>
<!-- 图片放大 -->
<mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview>
<mediaPreview :visible="isVisible"
:url="mediaUrl"
@close="handlePreviewClose"
></mediaPreview>
<!-- NFC 弹窗 -->
<NFCTemplate v-if="nfcShow" ref="nfcTemplateRef"
@close="nfcClose"
@confirm="nfcConfirm"
></NFCTemplate>
</view>
</template>
<script setup>
import { ref,onMounted,onUnmounted,nextTick,computed,reactive } from 'vue'
import { ref,onMounted,onUnmounted,nextTick,computed,reactive,getCurrentInstance } from 'vue'
import { onLoad,onHide} from '@dcloudio/uni-app';
import { MINIO_KEY } from '@/enums/cacheEnums';
import customHeader from '@/components/customHeader.vue';
@@ -208,14 +221,13 @@ 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 NFCTemplate from "@/components/NFCTemplate.vue"
import { parseTime } from '@/utils/datetime.js';
import { formatTaskStatus } from '@/utils/status.js';
import { taskGroupDetail,submitResult,minioUpload } from '@/api/polling.js'
import {compressImageUni} from '@/utils/common.js'
// import {uploadFileMinio} from '@/utils/minio.js'
// #ifdef APP-PLUS
let m1CardModule = uni.requireNativePlugin("LF-Sense-Card-M1")
// #endif
const { proxy } = getCurrentInstance();
let taskId = ref(undefined);
let groupId = ref(undefined);
@@ -227,6 +239,8 @@ onLoad(option => {
minioObj = JSON.parse(uni.getStorageSync(MINIO_KEY) || "\{\}")
// console.log(minioObj)
})
// 下拉刷新
@@ -431,15 +445,29 @@ const handlePreviewClose=()=>{
// nfc 处理
let cardUID = ref('');
let cardValue = ref('');
const initNFC = async(item) => {
m1CardModule.openNativeSenseCard({
'keyA': 'TestKey',
'sector': 0,
'block': 0
},ret => {
cardUID.value = ret.uid
cardValue.value = ret.code
})
let nfcShow = ref(false);
const nfcTemplateRef = ref(null);
// optionObj.pointList
let nfcIndex = ref(0);
const initNFC = async(item,index) => {
nfcShow.value = true;
nfcIndex.value=index;
// uni.navigateTo({url:'/pages/business/polling/nfcTest/index'})
// #ifdef APP-PLUS
setTimeout(()=>{
// console.log("nfcTemplateRef==",nfcTemplateRef.value)
if (nfcTemplateRef.value) {
nfcTemplateRef.value.listenNFCStatus();
}
},500)
// #endif
}
const nfcClose = async(item) => {
nfcShow.value = false;
}
const nfcConfirm=(result)=>{
console.log("confirm=>",result)
optionObj.pointList[nfcIndex].resultContent = result
}
// 扫二维码
@@ -576,6 +604,7 @@ onUnmounted(() => {
})
</script>
<style scoped>
.scroll-h{
/* #ifdef APP-PLUS */
height:calc(100vh - 78px) !important;