emacroh5lib 1.0.29 → 1.0.32
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.
|
3
|
+
"version": "1.0.32",
|
4
4
|
"description": "EMacro前端组件库",
|
5
5
|
"main": "dist/emacroh5lib.min.js",
|
6
6
|
"scripts": {
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"serve": "webpack serve",
|
15
15
|
"dev": "vue-cli-service test:e2e",
|
16
16
|
"commit": "cz",
|
17
|
-
"push": "
|
17
|
+
"push": "npm run build && npm publish --registry https://registry.npmjs.org",
|
18
18
|
"test": "echo \"Error: no test specified\" && exit 1"
|
19
19
|
},
|
20
20
|
"keywords": [
|
@@ -106,4 +106,4 @@
|
|
106
106
|
"xlsx": "^0.18.5",
|
107
107
|
"xlsx-style": "^0.8.13"
|
108
108
|
}
|
109
|
-
}
|
109
|
+
}
|
package/src/utilities/File.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.1"
|
10
10
|
|
11
11
|
export class File {
|
12
12
|
|
@@ -59,9 +59,7 @@ export namespace EMacro {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
// 文件上传
|
62
|
-
public static async uploadFiles(files,
|
63
|
-
console.error(err);
|
64
|
-
}) {
|
62
|
+
public static async uploadFiles(files, chunkFileHandle, fileComplete = (file) => { }, completeHandle = (files) => { }, chunkSize: number = 1024 * 1024 * 1) {
|
65
63
|
|
66
64
|
if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
|
67
65
|
throw new Error("文件异常")
|
@@ -76,7 +74,7 @@ export namespace EMacro {
|
|
76
74
|
for (let index in fileChunks) {
|
77
75
|
let chunk = fileChunks[Number(index)]
|
78
76
|
const base64 = await File.getBase64(chunk) as string
|
79
|
-
let
|
77
|
+
let chunkFile = {
|
80
78
|
'chunkIndex': Number(index), // 分片位置
|
81
79
|
'chunksLength': chunksLength, // 分片长度
|
82
80
|
'sliceSize': sliceSize, // 分片大小
|
@@ -86,12 +84,14 @@ export namespace EMacro {
|
|
86
84
|
'data': base64.split(';base64,')[1], // 文件数据
|
87
85
|
'lastModifiedDate': file.lastModifiedDate, // 最后修改时间
|
88
86
|
'md5': md5,
|
87
|
+
'index': i,
|
89
88
|
'dataType': 'base64' // 数据的类型
|
90
89
|
}
|
91
|
-
await
|
90
|
+
await chunkFileHandle(chunkFile)
|
92
91
|
}
|
93
|
-
|
92
|
+
fileComplete(file);
|
94
93
|
}
|
94
|
+
completeHandle(files)
|
95
95
|
}
|
96
96
|
|
97
97
|
public static selectFile(options: any = { multiple: true, accept: "*/*" }): Promise<FileList | null> {
|
@@ -137,6 +137,23 @@ export namespace EMacro {
|
|
137
137
|
|
138
138
|
}
|
139
139
|
|
140
|
+
export const fullScreen = (docElm: any = null) => {
|
141
|
+
if (docElm === null) {
|
142
|
+
docElm = document.documentElement
|
143
|
+
}
|
144
|
+
if (docElm.requestFullscreen) {
|
145
|
+
docElm.requestFullscreen();
|
146
|
+
} else if (docElm.mozRequestFullScreen) {
|
147
|
+
docElm.mozRequestFullScreen();
|
148
|
+
} else if (docElm.msRequestFullscreen) {
|
149
|
+
docElm.msRequestFullscreen();
|
150
|
+
} else if (docElm.oRequestFullscreen) {
|
151
|
+
docElm.oRequestFullscreen();
|
152
|
+
} else if (docElm.webkitRequestFullScreen) {
|
153
|
+
docElm.webkitRequestFullScreen();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
140
157
|
}
|
141
158
|
|
142
159
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<img ref="duoViewerImage" :src="realSrc" alt="image" class="duo-viewer-mask__image" />
|
5
5
|
</div>
|
6
6
|
<div class="duo-viewer-footer">
|
7
|
-
<div class="duo-viewer-footer__title">{{
|
7
|
+
<div class="duo-viewer-footer__title">{{ realName }}</div>
|
8
8
|
<div class="duo-viewer-footer__toolbar">
|
9
9
|
<ul>
|
10
10
|
<li class="duo-viewer-footer__zoom-in" data-viewer-action="zoom-in"></li>
|
@@ -43,7 +43,10 @@
|
|
43
43
|
</template>
|
44
44
|
|
45
45
|
<script>
|
46
|
-
|
46
|
+
|
47
|
+
// 需优化问题,图片很多时卡顿, 增加页面宽高自适应按钮
|
48
|
+
|
49
|
+
|
47
50
|
|
48
51
|
export default {
|
49
52
|
name: "ImageViewer",
|
@@ -71,6 +74,18 @@
|
|
71
74
|
type: Number,
|
72
75
|
default: 0,
|
73
76
|
},
|
77
|
+
name: {
|
78
|
+
type: [String, Array],
|
79
|
+
default: null,
|
80
|
+
},
|
81
|
+
shrink: {
|
82
|
+
type: Number,
|
83
|
+
default: .4,
|
84
|
+
},
|
85
|
+
enlarge: {
|
86
|
+
type: Number,
|
87
|
+
default: .6,
|
88
|
+
}
|
74
89
|
},
|
75
90
|
computed: {
|
76
91
|
listLength() {
|
@@ -79,6 +94,17 @@
|
|
79
94
|
realSrc() {
|
80
95
|
return this.list[this.index];
|
81
96
|
},
|
97
|
+
realName() {
|
98
|
+
if (this.name == null) {
|
99
|
+
return this.list[this.index];
|
100
|
+
} else if (typeof this.name == "string") {
|
101
|
+
return this.name
|
102
|
+
} else if (Array.isArray(this.name)) {
|
103
|
+
return this.name[this.index];
|
104
|
+
} else {
|
105
|
+
return "未命名"
|
106
|
+
}
|
107
|
+
},
|
82
108
|
currentData() {
|
83
109
|
return this.listDataCache[this.index];
|
84
110
|
},
|
@@ -312,11 +338,11 @@
|
|
312
338
|
if (h <= 20 && type === "out") return;
|
313
339
|
|
314
340
|
if (type === "out") {
|
315
|
-
this.setStyleByName(image, "width", `${w *
|
316
|
-
this.setStyleByName(image, "height", `${h *
|
341
|
+
this.setStyleByName(image, "width", `${w * this.shrink}px`);
|
342
|
+
this.setStyleByName(image, "height", `${h * this.shrink}px`);
|
317
343
|
} else {
|
318
|
-
this.setStyleByName(image, "width", `${w * (1 +
|
319
|
-
this.setStyleByName(image, "height", `${h * (1 +
|
344
|
+
this.setStyleByName(image, "width", `${w * (1 + this.enlarge)}px`);
|
345
|
+
this.setStyleByName(image, "height", `${h * (1 + this.enlarge)}px`);
|
320
346
|
}
|
321
347
|
|
322
348
|
this.currentData.width = this.getStyleByName(this.image, "width");
|
@@ -362,6 +388,10 @@
|
|
362
388
|
// up
|
363
389
|
this.zoom("in");
|
364
390
|
}
|
391
|
+
if (e && e.keyCode == 27) {
|
392
|
+
// esc
|
393
|
+
this.handleClose()
|
394
|
+
}
|
365
395
|
});
|
366
396
|
},
|
367
397
|
|
@@ -501,5 +531,6 @@
|
|
501
531
|
};
|
502
532
|
</script>
|
503
533
|
|
504
|
-
<style>
|
534
|
+
<style lang="less" scoped>
|
535
|
+
@import "./style/css/index.css";
|
505
536
|
</style>
|