emacroh5lib 1.0.70 → 1.0.73
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
package/src/index.ts
CHANGED
@@ -6,7 +6,7 @@ import createTaskQueue from 'sync-task-queue'
|
|
6
6
|
|
7
7
|
export namespace EMacro {
|
8
8
|
|
9
|
-
export const version = "1.
|
9
|
+
export const version = "1.72"
|
10
10
|
|
11
11
|
export class File {
|
12
12
|
|
@@ -64,11 +64,21 @@ export namespace EMacro {
|
|
64
64
|
if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
|
65
65
|
throw new Error("文件异常")
|
66
66
|
}
|
67
|
+
let directoryName = "";
|
68
|
+
if (files[0].webkitRelativePath != null && files[0].webkitRelativePath.trim() != "" ) {
|
69
|
+
let n = files[0].webkitRelativePath.indexOf("\\")
|
70
|
+
if (n == -1 ) {
|
71
|
+
n = files[0].webkitRelativePath.indexOf("/")
|
72
|
+
}
|
73
|
+
if (n != -1) {
|
74
|
+
directoryName = files[0].webkitRelativePath.substring(0, n)
|
75
|
+
}
|
76
|
+
}
|
67
77
|
|
68
78
|
for (let i = 0; i < files.length; i++) {
|
69
79
|
const file = files[i];
|
70
80
|
const md5 = await File.getFileMD5(file)
|
71
|
-
|
81
|
+
|
72
82
|
let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
|
73
83
|
|
74
84
|
for (let index in fileChunks) {
|
@@ -85,7 +95,8 @@ export namespace EMacro {
|
|
85
95
|
'lastModifiedDate': file.lastModifiedDate, // 最后修改时间
|
86
96
|
'md5': md5,
|
87
97
|
'index': i,
|
88
|
-
'dataType': 'base64' // 数据的类型
|
98
|
+
'dataType': 'base64', // 数据的类型
|
99
|
+
'directoryName': directoryName // 数据的类型
|
89
100
|
}
|
90
101
|
await chunkFileHandle(chunkFile)
|
91
102
|
}
|
@@ -94,11 +105,12 @@ export namespace EMacro {
|
|
94
105
|
completeHandle(files)
|
95
106
|
}
|
96
107
|
|
97
|
-
public static selectFile(options: any = { multiple: true, accept: "*/*" }): Promise<FileList | null> {
|
108
|
+
public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = false): Promise<FileList | null> {
|
98
109
|
return new Promise((res: (value: FileList) => void, rej) => {
|
99
110
|
const el = document.createElement("input");
|
100
111
|
el.type = "file";
|
101
112
|
el.accept = options.accept;
|
113
|
+
el.webkitdirectory = isDirectory;
|
102
114
|
el.multiple = options.multiple;
|
103
115
|
el.addEventListener("change", (_) => {
|
104
116
|
try {
|
@@ -238,8 +250,11 @@ export namespace EMacro {
|
|
238
250
|
return base64;
|
239
251
|
}
|
240
252
|
|
241
|
-
|
242
|
-
|
253
|
+
export const extensionToLowerCase = (fileName: string) => {
|
254
|
+
const n = fileName.lastIndexOf(".");
|
255
|
+
const extension = fileName.substring(n).toLowerCase();
|
256
|
+
return fileName.substring(0, n) + extension;
|
257
|
+
}
|
243
258
|
|
244
259
|
}
|
245
260
|
|
@@ -122,9 +122,7 @@
|
|
122
122
|
this.index = this.currentIndex;
|
123
123
|
this.init();
|
124
124
|
|
125
|
-
setTimeout(() => {
|
126
|
-
this.switchAction("prev");
|
127
|
-
}, 100);
|
125
|
+
setTimeout(() => { this.switchAction("prev"); }, 200);
|
128
126
|
} else {
|
129
127
|
this.$emit("close");
|
130
128
|
}
|
@@ -198,11 +196,10 @@
|
|
198
196
|
|
199
197
|
Promise.race(promises).then((data) => {
|
200
198
|
|
199
|
+
this.image = this.$refs["duoViewerImage"];
|
201
200
|
setTimeout(() => {
|
202
201
|
this.switchAction("prev");
|
203
|
-
},
|
204
|
-
|
205
|
-
this.image = this.$refs["duoViewerImage"];
|
202
|
+
}, 200);
|
206
203
|
this.initDrag();
|
207
204
|
this.$emit("loadComplete");
|
208
205
|
const { width, height } = this.listDataCache[index];
|
@@ -43,7 +43,7 @@
|
|
43
43
|
import DragResizeView from "@/views/DragResizeView/index.vue";
|
44
44
|
import Draw from "@/views/Draw/index.vue";
|
45
45
|
import { formatJson, export_json_to_excel, number_to_excel, testToExcel } from "./Export2Excel"
|
46
|
-
import { EMacro } from "../../utilities/
|
46
|
+
import { EMacro } from "../../utilities/EMacro";
|
47
47
|
import axios from 'axios'
|
48
48
|
import Cookie from 'js-cookie'
|
49
49
|
import LAY_EXCEL from 'lay-excel';
|