|
@@ -12,9 +12,20 @@ import {params} from "@/hook";
|
|
|
import router, {writeRouteName} from "@/router";
|
|
|
import {baseURL} from "@/dbo/main";
|
|
|
import {defaultUses, uses} from '@/store/SVGLabel'
|
|
|
+import {imageRotate} from "@/utils/image-rotate";
|
|
|
|
|
|
const global = window as any;
|
|
|
|
|
|
+const normalImage = async (url: string) => {
|
|
|
+ const getUrl = await api.getFile(url)
|
|
|
+ const blob = await imageRotate(getUrl)
|
|
|
+ if (!blob) {
|
|
|
+ return url
|
|
|
+ } else {
|
|
|
+ return await api.uploadImage(new File([blob], getId()))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
let count = 0;
|
|
|
export const api =
|
|
|
!global.android
|
|
@@ -70,7 +81,8 @@ export const api =
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- return await this.uploadImage(file)
|
|
|
+ const url = await this.uploadImage(file)
|
|
|
+ return await normalImage(url);
|
|
|
},
|
|
|
async selectPhotoAlbum() {
|
|
|
return await this.photograph()
|
|
@@ -167,7 +179,7 @@ export const api =
|
|
|
const apiName = `photograph${count++}`
|
|
|
global[apiName] = (data) => {
|
|
|
console.log("拍照后路径:", data)
|
|
|
- resolve(data);
|
|
|
+ normalImage(data).then(resolve);
|
|
|
delete global[apiName]
|
|
|
}
|
|
|
global.android.cameraPhotograph(params.m, apiName);
|
|
@@ -178,7 +190,7 @@ export const api =
|
|
|
const apiName = `selectPhotoAlbum${count++}`
|
|
|
global[apiName] = (data) => {
|
|
|
console.log("获得相册图片路径:", data)
|
|
|
- resolve(data);
|
|
|
+ normalImage(data).then(resolve);
|
|
|
delete global[apiName]
|
|
|
}
|
|
|
global.android.selectPhotoAlbum(params.m, apiName);
|
|
@@ -193,7 +205,7 @@ export const api =
|
|
|
};
|
|
|
|
|
|
export const back = () => {
|
|
|
- api.closePage()
|
|
|
+ router.back()
|
|
|
};
|
|
|
|
|
|
const loadStore = async () => {
|