af-mobile-client-vue3 1.1.46 → 1.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -25,7 +25,6 @@ watch(() => props.imageList, (newVal) => {
|
|
|
25
25
|
|
|
26
26
|
// 触发拍照
|
|
27
27
|
function triggerCamera() {
|
|
28
|
-
console.log('>>>> uploader 上传111')
|
|
29
28
|
mobileUtil.execute({
|
|
30
29
|
funcName: 'takePicture',
|
|
31
30
|
param: {},
|
|
@@ -38,26 +37,26 @@ function triggerCamera() {
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
// 处理拍照后的上传
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
formData.append('imgPath', photoData.filePath)
|
|
52
|
-
formData.append('urlPath', `/api/${import.meta.env.VITE_APP_SYSTEM_NAME}/resource/upload`)
|
|
40
|
+
function getImageMimeType(fileName: string): string {
|
|
41
|
+
const ext = fileName.split('.').pop()?.toLowerCase()
|
|
42
|
+
if (ext === 'jpg' || ext === 'jpeg')
|
|
43
|
+
return 'image/jpeg'
|
|
44
|
+
if (ext === 'png')
|
|
45
|
+
return 'image/png'
|
|
46
|
+
if (ext === 'gif')
|
|
47
|
+
return 'image/gif'
|
|
48
|
+
return 'image/png' // 默认
|
|
49
|
+
}
|
|
53
50
|
|
|
51
|
+
function handlePhotoUpload(photoData: any) {
|
|
54
52
|
// 添加临时预览
|
|
53
|
+
const mimeType = getImageMimeType(photoData.filePath)
|
|
55
54
|
const tempFile = {
|
|
56
55
|
uid: Date.now() + Math.random().toString(36).substr(2, 5),
|
|
57
|
-
name: photoData.
|
|
56
|
+
name: photoData.filePath.split('/').pop(),
|
|
58
57
|
status: 'uploading',
|
|
59
58
|
message: '上传中...',
|
|
60
|
-
url: `data
|
|
59
|
+
url: `data:${mimeType};base64,${photoData.content}`,
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
if (!imageList.value) {
|