diff --git a/src/pages/camera/index.vue b/src/pages/camera/index.vue
index d00a5e7..6fc3d43 100644
--- a/src/pages/camera/index.vue
+++ b/src/pages/camera/index.vue
@@ -4,8 +4,9 @@
-
+
![]()
+
点击重新选择模板
@@ -209,23 +210,41 @@ const takePicture = () => {
console.log("Take Picture !");
};
+const goSelectModel = () => {
+ uni.navigateTo({
+ url: `/pages/chooseStyle/index`,
+ });
+};
+
// 确认照片
const confirmPhoto = () => {
+ // 用户上传的照片,已通过校验,直接放行
if (UimgSrc.value) {
uni.navigateTo({
url: `/pages/createing/index?imageUrl=${UimgSrc.value}&id=${modelId.value}`,
});
} else if (CimgSrc.value) {
- delImage(CimgSrc.value);
+ // 本地存储中的拍照照片
+ const CimageUrl = uni.getStorageSync("CcurrentUrl");
+ // 用户上一次使用相机拍照的照片,从本地回显,已通过校验,直接放行
+ if (CimageUrl) {
+ uni.navigateTo({
+ url: `/pages/createing/index?imageUrl=${CimgSrc.value}&id=${modelId.value}`,
+ });
+ // 用户使用相机拍照的照片,未校验,走完校验流程放行
+ } else {
+ dealImage(CimgSrc.value);
+ }
}
};
-const delImage = (imageUrl) => {
+
+const dealImage = (imageUrl) => {
uni.showLoading({
title: "上传中,马上就好",
});
- let blob = dataURLtoBlob(imageUrl);
// 将二进制数据转换为 Blob 对象
+ let blob = dataURLtoBlob(imageUrl);
checkImageByBaidu(blob);
};
@@ -332,6 +351,7 @@ const uoloadImageAws = async (file, data) => {
duration: 1500,
});
setTimeout(() => {
+ uni.setStorageSync("CcurrentUrl", data.data.url);
uni.navigateTo({
url: `/pages/createing/index?imageUrl=${data.data.url}&id=${modelId.value}`,
});
@@ -396,6 +416,7 @@ const refreshUploadStatus = async (id) => {
isShowCanvas.value = false;
isSuccess.value = true;
isUpload.value = true;
+ uni.setStorageSync("UcurrentUrl", UimgSrc.value);
}
} catch (error) {
console.log(error, "error");
@@ -415,9 +436,27 @@ onLoad((options) => {
});
onMounted(() => {
- console.log(this);
clearInterval(timer.value);
startCamera();
+ const CimageUrl = uni.getStorageSync("CcurrentUrl");
+ const UimageUrl = uni.getStorageSync("UcurrentUrl");
+ if (CimageUrl || UimageUrl) {
+ setTimeout(() => {
+ showQrCode.value = false;
+ if (CimageUrl) {
+ UimgSrc.value = "";
+ CimgSrc.value = CimageUrl;
+ isUpload.value = false;
+ } else if (UimageUrl) {
+ UimgSrc.value = UimageUrl;
+ CimgSrc.value = "";
+ isUpload.value = true;
+ }
+
+ isShowCanvas.value = false;
+ isSuccess.value = true;
+ }, 1000);
+ }
});
//#region 页面初始化和卸载
@@ -472,6 +511,14 @@ onUnload(() => {
width: 100%;
height: 100%;
}
+ .reSelect {
+ position: absolute;
+ width: 250rpx;
+ left: 50%;
+ bottom: 10rpx;
+ text-align: center;
+ transform: translateX(-50%);
+ }
}
}
.bottom {
diff --git a/src/pages/created/index.vue b/src/pages/created/index.vue
index 3203e8f..42af967 100644
--- a/src/pages/created/index.vue
+++ b/src/pages/created/index.vue
@@ -25,7 +25,9 @@
左右滑动查看更多
- 生成中,请稍后...
+ 生成中,可能需要10-30秒,请您稍等