diff --git a/src/pages.json b/src/pages.json
index 05d2808..0d7a9a7 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -580,6 +580,30 @@
"navigationBarTitleText": "OCR查询"
}
},
+ {
+ "path": "pages/devicesSearch/ocrSearch2",
+ "style": {
+ "navigationBarTitleText": "OCR查询2"
+ }
+ },
+ {
+ "path": "pages/devicesSearch/ocrSearch3",
+ "style": {
+ "navigationBarTitleText": "OCR查询3"
+ }
+ },
+ {
+ "path": "pages/devicesSearch/ocrSearch4",
+ "style": {
+ "navigationBarTitleText": "OCR查询4"
+ }
+ },
+ {
+ "path": "pages/devicesSearch/ocrSearch5",
+ "style": {
+ "navigationBarTitleText": "OCR查询5"
+ }
+ },
{
"path": "pages/devicesSearch/camera",
"style": {
diff --git a/src/pages/devicesSearch/ocrSearch2.vue b/src/pages/devicesSearch/ocrSearch2.vue
new file mode 100644
index 0000000..2b9e8f4
--- /dev/null
+++ b/src/pages/devicesSearch/ocrSearch2.vue
@@ -0,0 +1,983 @@
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+ 📷
+
+
+
+
+
+
+
+ 正在识别中...
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/devicesSearch/ocrSearch3.vue b/src/pages/devicesSearch/ocrSearch3.vue
new file mode 100644
index 0000000..d05fc5a
--- /dev/null
+++ b/src/pages/devicesSearch/ocrSearch3.vue
@@ -0,0 +1,1279 @@
+
+
+
+
+
+
+ 开始识别
+
+
+
+
+
+ 设备编码
+
+
+
+
+
+
+
+
+ 编码检索
+
+
+
+
+
+
+
+
+
+
+ {{ codeData.materialType }}
+
+
+ {{ codeData.materialName }}
+
+
+ {{ codeData.materialModel }}
+
+
+ {{ codeData.maCode }}
+
+
+ {{ codeData.statusName }}
+
+
+ {{ codeData.inspectionTime }}
+
+
+ {{ codeData.nextInspectionTime }}
+
+
+ {{ codeData.inspectionPerson }}
+
+
+ {{ codeData.inspectionVerifier }}
+
+
+ {{ codeData.contactNumber }}
+
+
+ {{ codeData.materialProject }}
+
+
+ {{ codeData.materialUnit }}
+
+
+
+
+
+
+
+
+
+ 请将识别编码置于取景框内,完成扫描
+
+
+
+
+ 正在聚焦...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+ 📷
+
+
+
+
+
+
+
+ 正在识别中...
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/devicesSearch/ocrSearch4.vue b/src/pages/devicesSearch/ocrSearch4.vue
new file mode 100644
index 0000000..d05fc5a
--- /dev/null
+++ b/src/pages/devicesSearch/ocrSearch4.vue
@@ -0,0 +1,1279 @@
+
+
+
+
+
+
+ 开始识别
+
+
+
+
+
+ 设备编码
+
+
+
+
+
+
+
+
+ 编码检索
+
+
+
+
+
+
+
+
+
+
+ {{ codeData.materialType }}
+
+
+ {{ codeData.materialName }}
+
+
+ {{ codeData.materialModel }}
+
+
+ {{ codeData.maCode }}
+
+
+ {{ codeData.statusName }}
+
+
+ {{ codeData.inspectionTime }}
+
+
+ {{ codeData.nextInspectionTime }}
+
+
+ {{ codeData.inspectionPerson }}
+
+
+ {{ codeData.inspectionVerifier }}
+
+
+ {{ codeData.contactNumber }}
+
+
+ {{ codeData.materialProject }}
+
+
+ {{ codeData.materialUnit }}
+
+
+
+
+
+
+
+
+
+ 请将识别编码置于取景框内,完成扫描
+
+
+
+
+ 正在聚焦...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+ 📷
+
+
+
+
+
+
+
+ 正在识别中...
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/devicesSearch/ocrSearch5.vue b/src/pages/devicesSearch/ocrSearch5.vue
new file mode 100644
index 0000000..d05fc5a
--- /dev/null
+++ b/src/pages/devicesSearch/ocrSearch5.vue
@@ -0,0 +1,1279 @@
+
+
+
+
+
+
+ 开始识别
+
+
+
+
+
+ 设备编码
+
+
+
+
+
+
+
+
+ 编码检索
+
+
+
+
+
+
+
+
+
+
+ {{ codeData.materialType }}
+
+
+ {{ codeData.materialName }}
+
+
+ {{ codeData.materialModel }}
+
+
+ {{ codeData.maCode }}
+
+
+ {{ codeData.statusName }}
+
+
+ {{ codeData.inspectionTime }}
+
+
+ {{ codeData.nextInspectionTime }}
+
+
+ {{ codeData.inspectionPerson }}
+
+
+ {{ codeData.inspectionVerifier }}
+
+
+ {{ codeData.contactNumber }}
+
+
+ {{ codeData.materialProject }}
+
+
+ {{ codeData.materialUnit }}
+
+
+
+
+
+
+
+
+
+ 请将识别编码置于取景框内,完成扫描
+
+
+
+
+ 正在聚焦...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+ 📷
+
+
+
+
+
+
+
+ 正在识别中...
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/search/index.vue b/src/pages/search/index.vue
index 04d3c17..10a4916 100644
--- a/src/pages/search/index.vue
+++ b/src/pages/search/index.vue
@@ -117,6 +117,26 @@ const newInfoList = ref([
url: '/pages/devicesSearch/ocrSearch',
iconSrc: '../../static/searchModel/qrCode.png',
},
+ {
+ title: 'OCR查询2',
+ url: '/pages/devicesSearch/ocrSearch2',
+ iconSrc: '../../static/searchModel/qrCode.png',
+ },
+ {
+ title: 'OCR查询3',
+ url: '/pages/devicesSearch/ocrSearch3',
+ iconSrc: '../../static/searchModel/qrCode.png',
+ },
+ {
+ title: 'OCR查询4',
+ url: '/pages/devicesSearch/ocrSearch4',
+ iconSrc: '../../static/searchModel/qrCode.png',
+ },
+ {
+ title: 'OCR查询5',
+ url: '/pages/devicesSearch/ocrSearch5',
+ iconSrc: '../../static/searchModel/qrCode.png',
+ },
{
title: '设备编码查询',
url: '/pages/devicesSearch/codeSearch',
diff --git a/src/services/utils/imageUtils.js b/src/services/utils/imageUtils.js
index 4ed4006..2aa173d 100644
--- a/src/services/utils/imageUtils.js
+++ b/src/services/utils/imageUtils.js
@@ -228,37 +228,44 @@ class ImageUtils {
* @param {object} options 处理选项
* @returns {Promise} 处理后的Base64字符串
*/
- static async processImage(imagePath, options = {}) {
- const { maxWidth = 1024, maxHeight = 1024, quality = 50, outputFormat = "base64" } = options
+ static async processImage(imagePaths, options = {}) {
+ const { maxWidth = 1024, maxHeight = 1024, quality = 50, outputFormat = "base64" } = options;
+
+ // 存储处理后的图片数据
+ let processedImages = [];
try {
- console.log("开始处理图片:", imagePath)
+ console.log("开始处理图片数组:", imagePaths);
- // 如果已经是 base64 格式,直接处理
- if (imagePath.startsWith("data:image/")) {
- if (outputFormat === "base64") {
- return imagePath.split(",")[1]
+ for (let imagePath of imagePaths) {
+ if (imagePath.startsWith("data:image/")) {
+ if (outputFormat === "base64") {
+ // 如果需要的是 base64 格式,并且输入已经是 base64,则直接添加到结果列表中(去掉前缀)
+ processedImages.push(imagePath.split(",")[1]);
+ } else {
+ // 如果需要其他格式,则可能需要转换
+ processedImages.push(imagePath);
+ }
} else {
- return imagePath
+ // 处理非 base64 图片路径
+ const resizedImagePath = await this.getSmallImage(imagePath, maxWidth, maxHeight);
+ console.log("图片缩放完成:", resizedImagePath);
+
+ if (outputFormat === "base64") {
+ const base64Result = await this.imageToBase64(resizedImagePath, quality);
+ console.log("图片转换为base64完成");
+ processedImages.push(base64Result);
+ } else {
+ processedImages.push(resizedImagePath);
+ }
}
}
- // 1. 先缩放图片
- const resizedImagePath = await this.getSmallImage(imagePath, maxWidth, maxHeight)
- console.log("图片缩放完成:", resizedImagePath)
-
- // 2. 根据输出格式返回结果
- if (outputFormat === "base64") {
- const base64Result = await this.imageToBase64(resizedImagePath, quality)
- console.log("图片转换为base64完成")
- return base64Result
- } else {
- return resizedImagePath
- }
+ return processedImages;
} catch (error) {
- console.error("Process image failed:", error)
- // 如果所有方法都失败,尝试简单的压缩
- return await this.simpleProcess(imagePath, options)
+ console.error("Process image failed:", error);
+ // 这里可以决定如何处理错误,比如返回部分成功的结果或者尝试简单的压缩等
+ return await Promise.reject(error); // 抛出错误以便上层调用者处理
}
}