@toolspack/ttd-common 0.5.6 → 1.0.0
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/README.md +3 -1
- package/lib/ttd-common.common.js +13876 -2563
- package/lib/ttd-common.umd.js +13876 -2563
- package/lib/ttd-common.umd.min.js +63 -1
- package/package.json +2 -2
- package/src/App.vue +6 -20
- package/src/packages/index.js +3 -0
- package/src/packages/pdfjs/{PdfView2.vue → PdfView216.vue} +10 -10
- package/src/packages/ukey/SignNew.vue +21 -14
- package/src/packages/ukey/Ukey.vue +1 -1
- package/src/packages/ukey/WzhSign.vue +5 -6
- package/src/packages/ukey/WzhSignChrome.vue +2 -6
- package/src/packages/ukey/SignNew copy.vue +0 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolspack/ttd-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/ttd-common.umd.min.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"lint": "vue-cli-service lint --max-warnings 100"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "^1.5.0",
|
|
14
13
|
"babel-cli": "^6.26.0",
|
|
15
14
|
"babel-laoder": "0.0.1-security",
|
|
16
15
|
"babel-polyfill": "^6.26.0",
|
|
17
16
|
"core-js": "^3.6.5",
|
|
18
17
|
"less": "^3.8.1",
|
|
19
18
|
"less-loader": "^4.1.0",
|
|
19
|
+
"pdfjs-dist": "2.16.105",
|
|
20
20
|
"vue": "^2.6.12"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
package/src/App.vue
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="app">
|
|
3
3
|
<form id="myForm" @submit.prevent="uploadFile">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
<label for="">请上传:</label>
|
|
5
|
+
<input type="file" ref="fileInput" multiple name="files"><br>
|
|
6
|
+
<input type="hidden" name="bucketName" :value="uName">
|
|
7
|
+
<input type="submit" value="提交">
|
|
8
|
+
</form>
|
|
9
9
|
<PdfView :pdfurl="url" />
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import
|
|
15
|
-
import PdfView from './packages/pdfjs/PdfView2.vue'
|
|
14
|
+
import PdfView from './packages/pdfjs/PdfView216.vue'
|
|
16
15
|
|
|
17
16
|
const _baseUrl = 'http://peys.totodi.com:37811/'
|
|
18
17
|
|
|
@@ -40,19 +39,6 @@ export default {
|
|
|
40
39
|
|
|
41
40
|
// 添加其他字段数据到表单中
|
|
42
41
|
formData.append('u_name', this.uName);
|
|
43
|
-
|
|
44
|
-
// 发送异步请求
|
|
45
|
-
axios.post(this.action, formData)
|
|
46
|
-
.then((response) => {
|
|
47
|
-
// 处理上传成功的回调
|
|
48
|
-
console.log('上传成功');
|
|
49
|
-
// 执行其他操作
|
|
50
|
-
})
|
|
51
|
-
.catch((error) => {
|
|
52
|
-
// 处理上传失败的回调
|
|
53
|
-
console.error('上传失败', error);
|
|
54
|
-
// 执行其他操作
|
|
55
|
-
});
|
|
56
42
|
},
|
|
57
43
|
},
|
|
58
44
|
}
|
package/src/packages/index.js
CHANGED
|
@@ -4,10 +4,13 @@ import WzhSign from './ukey/WzhSign.vue'
|
|
|
4
4
|
import SignNew from './ukey/SignNew.vue'
|
|
5
5
|
import WzhSignChrome from './ukey/WzhSignChrome.vue'
|
|
6
6
|
|
|
7
|
+
import PdfView216 from './pdfjs/PdfView216.vue'
|
|
8
|
+
|
|
7
9
|
export default {
|
|
8
10
|
CfcaPdf,
|
|
9
11
|
Ukey,
|
|
10
12
|
WzhSign,
|
|
11
13
|
WzhSignChrome,
|
|
12
14
|
SignNew,
|
|
15
|
+
PdfView216,
|
|
13
16
|
}
|
|
@@ -193,16 +193,16 @@ export default {
|
|
|
193
193
|
let pdfDoc_
|
|
194
194
|
try {
|
|
195
195
|
console.log('888--')
|
|
196
|
-
const pdfData = await fetch(
|
|
197
|
-
|
|
198
|
-
);
|
|
199
|
-
const arrayBufferPdf = await pdfData.arrayBuffer(); // 转成 ArrayBuffer 塞给 pdf.js
|
|
200
|
-
pdfDoc_ = await PDFJS.getDocument({ data: arrayBufferPdf }).promise;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
// const pdfData = await fetch(
|
|
197
|
+
// new URL(url, window.location).href,
|
|
198
|
+
// );
|
|
199
|
+
// const arrayBufferPdf = await pdfData.arrayBuffer(); // 转成 ArrayBuffer 塞给 pdf.js
|
|
200
|
+
// pdfDoc_ = await PDFJS.getDocument({ data: arrayBufferPdf }).promise;
|
|
201
|
+
pdfDoc_ = await PDFJS.getDocument({
|
|
202
|
+
url: encodeURI(url),
|
|
203
|
+
cMapUrl: 'https://unpkg.com/pdfjs-dist@2.16.105/cmaps/',
|
|
204
|
+
cMapPacked: true,
|
|
205
|
+
}).promise
|
|
206
206
|
} catch (error) {
|
|
207
207
|
console.log('999999--')
|
|
208
208
|
console.error(error)
|
|
@@ -23,31 +23,38 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
created() {
|
|
26
|
-
|
|
26
|
+
this.getBrowserInfo()
|
|
27
27
|
},
|
|
28
28
|
mounted() {
|
|
29
29
|
if (this.isIE) {
|
|
30
|
+
console.log('--- ie sign')
|
|
30
31
|
this.child = this.$refs.signIe
|
|
31
32
|
} else {
|
|
33
|
+
console.log('--- chrome sign')
|
|
32
34
|
this.child = this.$refs.signChrome
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
methods: {
|
|
36
38
|
getBrowserInfo() {
|
|
37
|
-
|
|
38
|
-
// if (appName.indexOf('Internet') >= 0) {
|
|
39
|
-
// this.isIE = true
|
|
40
|
-
// return false
|
|
41
|
-
// }
|
|
42
|
-
// if (appVersion.indexOf('Trident') >= 0) {
|
|
43
|
-
// this.isIE = true
|
|
44
|
-
// return false
|
|
45
|
-
// }
|
|
39
|
+
const { userAgent, plugins, mimeTypes } = navigator
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
if (userAgent.indexOf('Trident') >= 0) {
|
|
42
|
+
this.isIE = true
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
// 360的急速模式,需要使用ie签署控件(無法實現,或不稳定,360会快速修复让用户无法检测)
|
|
46
|
+
// const plugin360 = [
|
|
47
|
+
// '360', '360SoftMgrPlugin', 'ActiveX hosting plugin for Firefox/Chrome',
|
|
48
|
+
// 'GamePlugin', 'QQMail Plugin', 'Tencent QQ', 'npQQPhotoDrawEx']
|
|
49
|
+
if (plugins['360SoftMgrPlugin']) {
|
|
50
|
+
this.isIE = true
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
if (mimeTypes['application/360softmgrplugin']) {
|
|
54
|
+
this.isIE = true
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
this.isIE = false
|
|
51
58
|
},
|
|
52
59
|
},
|
|
53
60
|
}
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
<script>
|
|
9
|
-
// import { getSignHash, mergeHash } from '@/api/ess'
|
|
10
|
-
|
|
11
9
|
import { getUrl } from '../utils'
|
|
12
10
|
|
|
13
11
|
export default {
|
|
@@ -24,8 +22,11 @@ export default {
|
|
|
24
22
|
classid = 'clsid:8BF7E683-630E-4B59-9E61-C996B671EBDF'
|
|
25
23
|
// classid = 'clsid:63F9892E-D854-476E-A839-C8BA79254EC1'
|
|
26
24
|
}
|
|
25
|
+
|
|
26
|
+
const { userAgent } = navigator
|
|
27
|
+
const isIE = userAgent.indexOf('Trident') >= 0
|
|
27
28
|
return {
|
|
28
|
-
isIE
|
|
29
|
+
isIE,
|
|
29
30
|
publicPath: 'https://wsp.totodi.com/jz/', // 为了获取public下的静态文件
|
|
30
31
|
codebase,
|
|
31
32
|
classid,
|
|
@@ -51,8 +52,6 @@ export default {
|
|
|
51
52
|
if (this.CryptoAgent) {
|
|
52
53
|
return false
|
|
53
54
|
}
|
|
54
|
-
// 使用refs 拿到的元素 不能ukey签章
|
|
55
|
-
// this.CryptoAgent = document.getElementById('CryptoAgent')
|
|
56
55
|
this.CryptoAgent = this.$refs.CryptoAgent
|
|
57
56
|
if (!this.CryptoAgent) {
|
|
58
57
|
alert('验签插件加载失败!')
|
|
@@ -315,4 +314,4 @@ export default {
|
|
|
315
314
|
position: absolute;
|
|
316
315
|
left: -5000px;
|
|
317
316
|
}
|
|
318
|
-
</style
|
|
317
|
+
</style>
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<!--无纸化 签署-->
|
|
2
2
|
<template>
|
|
3
|
-
<div class="CryptoAgent-wrapper">
|
|
4
|
-
</div>
|
|
3
|
+
<div class="CryptoAgent-wrapper"></div>
|
|
5
4
|
</template>
|
|
6
5
|
<script>
|
|
7
|
-
// import { getSignHash, mergeHash } from '@/api/ess'
|
|
8
|
-
|
|
9
6
|
import { getUrl } from '../utils'
|
|
10
7
|
|
|
11
8
|
import WZHforChrome from './WZHforChrome'
|
|
@@ -14,7 +11,6 @@ export default {
|
|
|
14
11
|
mixins: [WZHforChrome],
|
|
15
12
|
data() {
|
|
16
13
|
return {
|
|
17
|
-
isIE: navigator.appName.indexOf('Internet') >= 0 || navigator.appVersion.indexOf('Trident') >= 0,
|
|
18
14
|
sourceData: '', // 签名原文, 动态随机字符串
|
|
19
15
|
certType: 'RSA', // 签名算法
|
|
20
16
|
CryptoAgent: null,
|
|
@@ -244,4 +240,4 @@ export default {
|
|
|
244
240
|
position: absolute;
|
|
245
241
|
left: -5000px;
|
|
246
242
|
}
|
|
247
|
-
</style
|
|
243
|
+
</style>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<WzhSign :api="api" ref="signIe" v-if="isIE" />
|
|
4
|
-
<WzhSignChrome :api="api" ref="signChrome" v-else />
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
<script>
|
|
8
|
-
import WzhSign from './WzhSign.vue';
|
|
9
|
-
import WzhSignChrome from './WzhSignChrome.vue';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
components: { WzhSign, WzhSignChrome },
|
|
13
|
-
data() {
|
|
14
|
-
return {
|
|
15
|
-
child: null,
|
|
16
|
-
isIE: true,
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
api: {
|
|
21
|
-
type: Object,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
created() {
|
|
26
|
-
// this.getBrowserInfo()
|
|
27
|
-
},
|
|
28
|
-
mounted() {
|
|
29
|
-
if (this.isIE) {
|
|
30
|
-
this.child = this.$refs.signIe
|
|
31
|
-
} else {
|
|
32
|
-
this.child = this.$refs.signChrome
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
getBrowserInfo() {
|
|
37
|
-
const { appVersion, appName } = navigator
|
|
38
|
-
if (appName.indexOf('Internet') >= 0) {
|
|
39
|
-
this.isIE = true
|
|
40
|
-
return false
|
|
41
|
-
}
|
|
42
|
-
if (appVersion.indexOf('Trident') >= 0) {
|
|
43
|
-
this.isIE = true
|
|
44
|
-
return false
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// 360的急速模式,需要使用id签署控件
|
|
48
|
-
// if (appVersion.indexOf(' WOW64') >= 0) {
|
|
49
|
-
// this.isIE = true
|
|
50
|
-
// }
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
</script>
|