浏览代码

优化消息中心/巡检NFC监听器

fanghuisheng 8 月之前
父节点
当前提交
20f9feee30

+ 6 - 1
src/pages/business/common/projectMange/record/details.vue

@@ -1,5 +1,5 @@
 <template>
-  <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" :title="state.options.createBy + '的日报'" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
+  <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" :title="state.options.createBy + '的日报'" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff" @leftClick="goRecordDataRefresh()">
     <template #left>
       <view class="u-navbar__content__left__item">
         <u-icon name="arrow-left" size="19" color="#000"></u-icon>
@@ -114,6 +114,11 @@ function init() {
     });
 }
 
+/** 返回列表页数据刷新 */
+function goRecordDataRefresh() {
+  uni.$emit("projectMange_record", true); //监听器
+}
+
 onReady(() => {});
 
 onShow(() => {

+ 8 - 2
src/pages/business/common/projectMange/record/index.vue

@@ -74,7 +74,7 @@
 
 <script setup>
 /*----------------------------------依赖引入-----------------------------------*/
-import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
+import { onLoad, onShow, onReady, onHide, onLaunch, onUnload, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
 import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
 /*----------------------------------接口引入-----------------------------------*/
 import { projectApi } from "@/api/business/project.js";
@@ -163,13 +163,19 @@ function tabsClick(e) {
 onReady(() => {});
 
 onShow(() => {
-  init();
   //调用系统主题颜色
   proxy.$settingStore.systemThemeColor([1]);
 });
 
 onLoad((options) => {
   init();
+  uni.$on("projectMange_record", function (value) {
+    init();
+  });
+});
+
+onUnload(() => {
+  uni.$off("projectMange_record"); //将值删除监听器
 });
 </script>
 

+ 3 - 3
src/pages/business/zhaf/xunJian/collect/index.vue

@@ -226,16 +226,16 @@ onShow(() => {
   //调用系统主题颜色
   proxy.$settingStore.systemThemeColor([1]);
 
-  uni.$on("tagid", function (value) {
+  uni.$on("NFC_readID", function (value) {
     setTimeout(() => {
       proxy.$tab.navigateTo(`/pages/business/zhaf/xunJian/collect/components/collectDetail?siteNubmber=${value}&siteType=${2}`);
-      uni.$off("tagid"); //将值删除监听器
+      uni.$off("NFC_readID"); //将值删除监听器
     }, 0);
   });
 });
 
 onUnload(() => {
-  uni.$off("tagid"); //将值删除监听器
+  uni.$off("NFC_readID"); //将值删除监听器
 });
 
 onReady(() => {});

+ 2 - 2
src/pages/business/zhaf/xunJian/plan/components/report.vue

@@ -202,13 +202,13 @@ onLoad((options) => {
 onShow(() => {
   //调用系统主题颜色
   proxy.$settingStore.systemThemeColor([1]);
-  uni.$on("tagid", function (value) {
+  uni.$on("NFC_readID", function (value) {
     siteDetailsApi(value);
   });
 });
 
 onUnload(() => {
-  uni.$off("tagid"); //将值删除监听器
+  uni.$off("NFC_readID"); //将值删除监听器
 });
 
 onMounted(() => {});

+ 2 - 2
src/pages/business/zhaf/xunJian/plan/index.vue

@@ -384,13 +384,13 @@ onShow(() => {
   //调用系统主题颜色
   proxy.$settingStore.systemThemeColor([1]);
 
-  uni.$on("tagid", function (value) {
+  uni.$on("NFC_readID", function (value) {
     planListApi(value);
   });
 });
 
 onUnload(() => {
-  uni.$off("tagid"); //将值删除监听器
+  uni.$off("NFC_readID"); //将值删除监听器
 });
 
 onMounted(() => {});

+ 1 - 1
src/plugins/nfc.plugins.js

@@ -219,7 +219,7 @@ function __read(intent) {
         var tagid = bytesToHexString(tag.getId());
 
         setTimeout(() => {
-            uni.$emit("tagid", tagid); //将值存储监听器
+            uni.$emit("NFC_readID", tagid); //将值存储监听器
             tab.navigateBack(1); //返回上一级页面
             closeReadAndWrite();
         }, 1000);