فهرست منبع

修改如下:
1.声像记录里添加自定义返回页面,修改返回逻辑
2.修改默认拍照界面画质选中项

zhangxike 2 روز پیش
والد
کامیت
b6e8dcf5c0

+ 1 - 1
pages/work/record/Camera.uvue

@@ -60,7 +60,7 @@
 				listener: null as CameraContextCameraFrameListener | null,
 				maxZoom: 0,
 				imageSrc: "",
-				quality: "normal",
+				quality: "original",
 				timeout: 30,
 				compressed: false,
 				videoSrc: "",

+ 62 - 41
pages/work/record/InfoDetail.uvue

@@ -55,13 +55,30 @@
 	} from 'vue'
 	import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate, statusDict } from '@/api/work';
 
+	//自定义返回行为,覆盖系统默认返回按钮
+	const backPressOptions = reactive({
+		from: 'backbutton'
+	} as OnBackPressOptions)
+
+	onBackPress((options : OnBackPressOptions) : boolean | null => {
+		console.log('onBackPress', options)
+		uni.navigateTo({
+			url: `/pages/work/record/InfoList`,
+			// 修改动画方向为从左到右退回
+			animationType: 'slide-in-left', // 使用从左到右滑出的动画效果
+			animationDuration: 300 // 动画持续时间,单位ms
+		})
+		// 返回true表示拦截默认返回行为
+		return true
+	})
+
 	const titleList = [{
 		title1: "部位", title2: "进度", title3: "状态"
 	}];
-	
+
 	var taskProcessList = ref<RecordCalculate[]>([]);
 	var initTasks = [] as RecordCalculate[]
-	
+
 	const download = ref<Download>({
 		pdid: 0,
 		workorder: "",
@@ -76,7 +93,7 @@
 		status: 1
 	})
 
-// #ifdef H5
+	// #ifdef H5
 	download = {
 		pdid: 1,
 		workorder: "632-P-01",
@@ -99,58 +116,62 @@
 		{ id: 6, name: "简段-内侧", num: 3, step: 0, state: "waiting" },
 		{ id: 7, name: "隧道管", num: 5, step: 0, state: "waiting" },
 	];
-    // #endif
-	
+	// #endif
+
 	onLoad((options) => {
 		const downloadId = options?.id ?? ""
 		// 模拟数据加载,建议替换为后端接口请求
-           // #ifdef APP-ANDROID
-               //获取下载产品数据			   
-            	getList('app_media_info', 'pdid', downloadId, null,null, null).then((res:UTSJSONObject) => {
-            	 		console.log(res)
-            				let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
-            				if(dataList!=null && dataList.length>0){							
-            					dataList.forEach(item =>{
-            						if(item!=null){
-            							let data = JSON.parse<Download>(item.toJSONString());
-            							if(data!=null){
-            								download.value = data
-            							}
-            						}
-            					});
-            				} 
-            	 })
-           	 
-           	 //获取下载产品任务数据
-           	 getRecordCalculate('app_media_record', downloadId, null).then((res:UTSJSONObject) => {
-           	  		console.log(res)
-           	 			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
-           	 			if(dataList!=null && dataList.length>0){							
-           	 				dataList.forEach(item =>{
-           	 					if(item!=null){
-           	 						let task = JSON.parse<RecordCalculate>(item.toJSONString());
-           	 						if(task!=null){
-           	 							initTasks.push(task)
-           	 						}
-           	 					}
-           	 				});
-           	 			} 
-           		   console.log(initTasks)
-           		   taskProcessList.value = initTasks
-           	  }) 
-           // #endif
+		// #ifdef APP-ANDROID
+		//获取下载产品数据			   
+		getList('app_media_info', 'pdid', downloadId, null, null, null).then((res : UTSJSONObject) => {
+			console.log(res)
+			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
+			if (dataList != null && dataList.length > 0) {
+				dataList.forEach(item => {
+					if (item != null) {
+						let data = JSON.parse<Download>(item.toJSONString());
+						if (data != null) {
+							download.value = data
+						}
+					}
+				});
+			}
+		})
+
+		//获取下载产品任务数据
+		getRecordCalculate('app_media_record', downloadId, null).then((res : UTSJSONObject) => {
+			console.log(res)
+			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
+			if (dataList != null && dataList.length > 0) {
+				dataList.forEach(item => {
+					if (item != null) {
+						let task = JSON.parse<RecordCalculate>(item.toJSONString());
+						if (task != null) {
+							initTasks.push(task)
+						}
+					}
+				});
+			}
+			console.log(initTasks)
+			taskProcessList.value = initTasks
+		})
+		// #endif
 	})
 
 	const goBack = () => {
 		uni.navigateBack()
 	}
 
-	const enterProcess = (photoitem : string, num: number, pid: number) => {
+	const enterProcess = (photoitem : string, num : number, pid : number) => {
 		console.log(photoitem);
 		uni.navigateTo({
 			url: `/pages/work/record/RecordList?photoitem=${photoitem}&num=${num}&pid=${pid}`
 		});
 	}
+
+	defineExpose({
+		backPressOptions
+	})
 </script>
 
 <style scoped>

+ 44 - 24
pages/work/record/InfoList.uvue

@@ -54,7 +54,22 @@
 		ref
 	} from 'vue'
 	import { getList } from '@/api/work';
-	
+
+	const backPressOptions = reactive({
+		from: 'backbutton'
+	} as OnBackPressOptions)
+
+	onBackPress((options : OnBackPressOptions) : boolean | null => {
+		console.log('onBackPress', options)
+		// 使用reLaunch代替switchTab,避免多层跳转时的闪回问题
+		// reLaunch会关闭所有页面并打开到目标页面,适合需要完全重置导航栈的场景
+		uni.reLaunch({
+			url: `/pages/work/index`,
+		})
+		// 返回true表示拦截默认返回行为
+		return true
+	})
+
 	type Download = {
 		pdid : number,
 		workorder : string,
@@ -64,33 +79,33 @@
 		processno : string,
 		updatetime : string,
 		progress : string,
-		status : number 
+		status : number
 	}
-	
+
 	var initDownloads = [] as Download[]
-	var downloads = ref<Download[]>([]);	
-	const map = ref(new Map<number, string>([[1,'未执行'],[2,'执行中'],[3,'执行完'],[4,'有错误']]))
-		
+	var downloads = ref<Download[]>([]);
+	const map = ref(new Map<number, string>([[1, '未执行'], [2, '执行中'], [3, '执行完'], [4, '有错误']]))
+
 	// #ifdef APP-ANDROID
-	 getList('app_media_info', null, null, null,null, null).then((res:UTSJSONObject) => {
-	  		console.log(res)
-			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
-			if(dataList!=null && dataList.length>0){
-				dataList.forEach(item =>{
-					if(item!=null){
-						let download = JSON.parse<Download>(item.toJSONString());
-						if(download!=null){
-							initDownloads.push(download)
-						}
+	getList('app_media_info', null, null, null, null, null).then((res : UTSJSONObject) => {
+		console.log(res)
+		let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
+		if (dataList != null && dataList.length > 0) {
+			dataList.forEach(item => {
+				if (item != null) {
+					let download = JSON.parse<Download>(item.toJSONString());
+					if (download != null) {
+						initDownloads.push(download)
 					}
-				});
-			}
-			console.log(initDownloads)
-			downloads.value = initDownloads
-	  })		
+				}
+			});
+		}
+		console.log(initDownloads)
+		downloads.value = initDownloads
+	})
 	// #endif
 
-   // #ifdef H5
+	// #ifdef H5
 	downloads = [{
 		pdid: 1,
 		workorder: "632-P-01",
@@ -124,7 +139,7 @@
 		status: 1
 	}] as Download[];
 
-    // #endif
+	// #endif
 
 	const download = (e : any) => {
 		console.log("开始下载...")
@@ -137,6 +152,10 @@
 			url: `/pages/work/record/InfoDetail?id=${id}`
 		});
 	}
+
+	defineExpose({
+		backPressOptions
+	})
 </script>
 
 <style scope>
@@ -241,10 +260,11 @@
 	.bg-black {
 		background-color: #102a43;
 	}
-	
+
 	.btn-first {
 		margin-left: 5rpx;
 	}
+
 	.btn-second {
 		margin-right: 5rpx;
 	}

+ 27 - 7
pages/work/record/RecordList.uvue

@@ -114,6 +114,28 @@
 	} from 'vue'
 	import { getList, Record, recordStatusDict, updateData } from '@/api/work';
 
+	// 存储页面参数
+	let photoitem = "";
+	let pid = "";
+	let senum = "";
+
+	//自定义返回行为,覆盖系统默认返回按钮
+	const backPressOptions = reactive({
+		from: 'backbutton'
+	} as OnBackPressOptions)
+
+	onBackPress((options : OnBackPressOptions) : boolean | null => {
+		console.log('onBackPress', options)
+		uni.navigateTo({
+			url: `/pages/work/record/InfoDetail?id=${pid}`,
+			// 修改动画方向为从左到右退回
+			animationType: 'slide-in-left', // 使用从左到右滑出的动画效果
+			animationDuration: 300 // 动画持续时间,单位ms
+		})
+		// 返回true表示拦截默认返回行为
+		return true
+	})
+
 	//检查项目最大数量
 	var maxcount = 5
 	var current = ref(1)
@@ -121,10 +143,6 @@
 	const closeTags = ref<boolean[]>([]);
 	var initRecords = [] as Record[]
 
-	// 存储页面参数
-	let photoitem = "";
-	let pid = "";
-
 	// 定义数据刷新函数
 	const refreshRecords = (index : number) => {
 		// 清空现有数据
@@ -178,12 +196,11 @@
 		photoitem = options?.photoitem ?? ""
 		const num = options?.num ?? "1"
 		pid = options?.pid ?? "1"
+		senum = options?.senum ?? "1"
 		maxcount = parseInt(num)
 
-		console.log(closeTags.value)
-
 		// 加载初始数据
-		refreshRecords(0);
+		refreshRecords(parseInt(senum));
 	});
 
 
@@ -300,6 +317,9 @@
 			url: `/pages/work/record/Camera?id=${id}&num=${num}`
 		})
 	}
+	defineExpose({
+		backPressOptions
+	})
 </script>
 
 <style scoped>

+ 12 - 0
pages/work/record/camera-scan-code.uvue

@@ -116,6 +116,18 @@
 				}] as ImageItem[]
 			}
 		},
+		onBackPress() {
+			// 覆盖系统默认的返回行为,返回到指定页面
+			//?photoitem=${photoitem}&num=${num}&pid=${pid}
+			uni.navigateTo({
+				url: `/pages/work/record/RecordList?photoitem=${this.joinRecord.photoitem}&num=${this.joinRecord.num}&pid=${this.joinRecord.pid}&senum=${this.joinRecord.senum}`,
+				// 修改动画方向为从左到右退回
+				animationType: 'slide-in-left', // 使用从左到右滑出的动画效果
+				animationDuration: 300 // 动画持续时间,单位ms
+			})
+			// 返回true表示拦截默认返回行为
+			return true
+		},
 		onLoad(options) {
 			this.path = options?.['path'] ?? ''
 			let recordId = options?.['recordId'] ?? ''