emacroh5lib 1.0.71 → 1.0.74

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacroh5lib",
3
- "version": "1.0.71",
3
+ "version": "1.0.74",
4
4
  "description": "EMacro前端组件库",
5
5
  "main": "dist/emacroh5lib.min.js",
6
6
  "scripts": {
@@ -6,7 +6,7 @@ import createTaskQueue from 'sync-task-queue'
6
6
 
7
7
  export namespace EMacro {
8
8
 
9
- export const version = "1.1"
9
+ export const version = "1.72"
10
10
 
11
11
  export class File {
12
12
 
@@ -65,12 +65,22 @@ export namespace EMacro {
65
65
  throw new Error("文件异常")
66
66
  }
67
67
 
68
+
68
69
  for (let i = 0; i < files.length; i++) {
69
70
  const file = files[i];
70
71
  const md5 = await File.getFileMD5(file)
71
72
 
72
73
  let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
73
74
 
75
+ let directoryName = "";
76
+ if (files[i].webkitRelativePath != null && files[i].webkitRelativePath.trim() != "") {
77
+ let n = files[i].webkitRelativePath.lastIndexOf("\\")
78
+ if (n == -1)
79
+ n = files[i].webkitRelativePath.lastIndexOf("/")
80
+ if (n != -1)
81
+ directoryName = files[i].webkitRelativePath.substring(0, n)
82
+ }
83
+
74
84
  for (let index in fileChunks) {
75
85
  let chunk = fileChunks[Number(index)]
76
86
  const base64 = await File.getBase64(chunk) as string
@@ -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 = true): 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 {
@@ -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/File";
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';
@@ -47,7 +47,7 @@
47
47
 
48
48
  <script>
49
49
 
50
- import { EMacro } from "../../utilities/File";
50
+ import { EMacro } from "../../utilities/EMacro";
51
51
 
52
52
  export default {
53
53
  name: "ImageViewer",