Quellcode durchsuchen

脱敏定义全局

刘拾玖 vor 4 Monaten
Ursprung
Commit
b5b79b6b58
3 geänderte Dateien mit 32 neuen und 14 gelöschten Zeilen
  1. 6 0
      lib/util.ts
  2. 17 10
      pages/index/CfAppraise.vue
  3. 9 4
      pages/index/TopCard.vue

+ 6 - 0
lib/util.ts

@@ -341,3 +341,9 @@ export function DictLabelCFZT(index){
 	return dict_type[index]
 }
 
+// 定义全局变量
+export const globalState = {
+  showIcon: false,
+}
+
+

+ 17 - 10
pages/index/CfAppraise.vue

@@ -66,10 +66,10 @@
 	</view>
 </template>
 <script lang="ts" setup>
-	import { ref, PropType,watch, onMounted } from 'vue'
+	import { ref, PropType,watch } from 'vue'
 	import dlg from '@/lib/dlg.ts'
 	import rest from '@/stores/rest'
-	import { onShow } from "@dcloudio/uni-app";
+
 
 	import CfAppraiseStar from './CfAppraiseStar.vue'
 
@@ -110,10 +110,9 @@
 
 	// 上传图片
 	const onSelectFile = async (res) => {
-		console.log("上传", res)
 		if (!res.tempFilePaths.length) return;
 		uni.showLoading({
-			title: '',
+			title: '正在上传...',
 			mask: true
 		});
 		for (var i = 0; i < res.tempFilePaths.length; i++) {
@@ -184,13 +183,21 @@
 		info.value.text = props.dataList.content
 		info.value.imgList = props.dataList.imgList
 		info.value.anonymous = props.dataList.anonymity == 1 ? true : false
-		console.log("getInfo",info.value)
 	}
-	onShow(() => {
-		if (props.isEdit){
-			getInfo()
-		}
-	})
+	
+	watch(() => props.isEdit, (newValue) => {
+	  // console.log("watch isEdit", newValue);
+	  if (newValue) {
+	    getInfo();
+	  }
+	}, { immediate: true });
+	
+	watch(() => props.dataList, (newValue) => {
+	  // console.log("watch dataList", newValue);
+	  if (props.isEdit) {
+	    getInfo();
+	  }
+	}, { immediate: true });
 </script>
 
 <style lang="scss" scoped>

+ 9 - 4
pages/index/TopCard.vue

@@ -26,6 +26,7 @@
 <script lang="ts" setup>
 	import { ref, onMounted, PropType } from 'vue'
 	import rest from '@/stores/rest'
+	import { onLoad,onShow } from "@dcloudio/uni-app";
 	import { aesEncrypt, aesDecrypt } from "@/lib/encryption";
 	import * as link from '@/lib/link'
 	import {
@@ -34,7 +35,8 @@
 		maskCardNo,
 		maskName,
 	} from '@/lib/util'
-	import { BasicInfoVO } from '../../lib/type';
+	import { BasicInfoVO } from '@/lib/type';
+	import { globalState } from '@/lib/util'
 	
 	const props = defineProps({
 		data: {
@@ -64,6 +66,7 @@
 
 	const onClick = () => {
 		showIcon.value = !showIcon.value
+		globalState.showIcon = showIcon.value
 		onUpdate(showIcon.value)
 	}
 
@@ -96,7 +99,7 @@
 			originalInfo.value.address = `${firstAddressInfo.province || ''}${firstAddressInfo.city || ''}${firstAddressInfo.area || ''}`
 			originalInfo.value.addressDetails = firstAddressInfo.shrdzxxdz
 		}
-		onUpdate(false)
+		onUpdate(showIcon.value)
 	}
 
 	const onUpdate = (isMasked : boolean) => {
@@ -113,10 +116,12 @@
 		link.goAddressList(aesEncrypt(originalInfo.value.idCard))
 	}
 
-	onMounted(() => {
+	
+	onShow (()=> {
+		showIcon.value = globalState.showIcon
 		dataList.value.hzxm = props.data.hzxm
 		dataList.value.hzsfzh = props.data.zjhm
-		getInfo()
+		setTimeout(()=>getInfo(), 5)
 	})
 </script>