|
|
@@ -148,12 +148,13 @@ import { uploadImg, getStoreOcrData } from "@/api/modules/newLoginApi";
|
|
|
import { getStoreHeadImg, saveStoreHeadImg } from "@/api/modules/storeDecoration";
|
|
|
import { getDetail } from "@/api/modules/homeEntry";
|
|
|
import { localGet } from "@/utils";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
|
|
|
const loading = ref(false);
|
|
|
const singleFormRef = ref<FormInstance>();
|
|
|
const multipleFormRef = ref<FormInstance>();
|
|
|
const sortableInstance = ref<Sortable | null>(null);
|
|
|
-
|
|
|
+const router = useRouter();
|
|
|
const imgModeActive = ref(null);
|
|
|
const storeName = ref("");
|
|
|
const handleStoreOcrAfterUploadMore = async (imageUrl: string) => {
|
|
|
@@ -179,17 +180,30 @@ const handleStoreOcr = async (params: { imageUrl: string }) => {
|
|
|
try {
|
|
|
const res: any = await getStoreOcrData({ imageUrl: params.imageUrl, merchantName: storeName.value });
|
|
|
if (res.code === 200) {
|
|
|
- ElNotification({
|
|
|
- title: "OCR识别成功",
|
|
|
- message: `识别结果: ${res.msg || "无"}`,
|
|
|
- type: "success",
|
|
|
- duration: 5000
|
|
|
- });
|
|
|
+ if (res.data.overall_match) {
|
|
|
+ ElNotification({
|
|
|
+ title: "OCR识别成功",
|
|
|
+ message: `识别结果: ${res.msg || "无"}`,
|
|
|
+ type: "success",
|
|
|
+ duration: 5000
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ title: "OCR识别失败",
|
|
|
+ message: "图片不符合规范,请重新上传",
|
|
|
+ type: "error",
|
|
|
+ duration: 5000
|
|
|
+ });
|
|
|
+ formData.singleImage = "";
|
|
|
+ formData.multipleImages = [];
|
|
|
+ }
|
|
|
} else {
|
|
|
// 业务逻辑错误,只在这里显示错误消息
|
|
|
const errorMsg = res?.msg || "未查询到OCR识别数据";
|
|
|
ElMessage.error(errorMsg);
|
|
|
const error = new Error(errorMsg);
|
|
|
+ formData.singleImage = "";
|
|
|
+ formData.multipleImages = [];
|
|
|
(error as any).handled = true; // 标记错误已被处理
|
|
|
throw error;
|
|
|
}
|
|
|
@@ -567,6 +581,7 @@ const handleSave = async () => {
|
|
|
type: "success",
|
|
|
duration: 3000
|
|
|
});
|
|
|
+ router.push("/home/index");
|
|
|
|
|
|
// 根据返回的imgModeActive值设置当前模式
|
|
|
// 0表示单图模式,其他值表示多图模式
|