@toolspack/ttd-common 1.2.0 → 1.3.1
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 +602 -860
- package/lib/ttd-common.umd.js +602 -860
- package/lib/ttd-common.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/packages/ukey/Ukey.vue +1 -3
- package/src/packages/ukey/WZHforChrome.js +20 -65
- package/src/packages/ukey/WzhMixin.js +212 -0
- package/src/packages/ukey/WzhSign.vue +5 -192
- package/src/packages/ukey/WzhSignChrome.vue +11 -176
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
<script>
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
import WzhMixin from './WzhMixin';
|
|
10
11
|
|
|
11
12
|
export default {
|
|
13
|
+
mixins: [WzhMixin],
|
|
12
14
|
name: 'wzh-sing',
|
|
13
15
|
data() {
|
|
14
16
|
let codebase = ''
|
|
@@ -30,20 +32,8 @@ export default {
|
|
|
30
32
|
publicPath: 'https://wsp.totodi.com/jz/', // 为了获取public下的静态文件
|
|
31
33
|
codebase,
|
|
32
34
|
classid,
|
|
33
|
-
sourceData: '', // 签名原文, 动态随机字符串
|
|
34
|
-
certType: 'RSA', // 签名算法
|
|
35
|
-
CryptoAgent: null,
|
|
36
35
|
}
|
|
37
36
|
},
|
|
38
|
-
props: {
|
|
39
|
-
api: {
|
|
40
|
-
type: Object,
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
mounted() {
|
|
45
|
-
this.onLoad()
|
|
46
|
-
},
|
|
47
37
|
methods: {
|
|
48
38
|
/**
|
|
49
39
|
* 初始化验签工具包,加载 验签空间(object)
|
|
@@ -57,75 +47,6 @@ export default {
|
|
|
57
47
|
alert('验签插件加载失败!')
|
|
58
48
|
}
|
|
59
49
|
},
|
|
60
|
-
|
|
61
|
-
getUkeyImage() {
|
|
62
|
-
let image = ''
|
|
63
|
-
try {
|
|
64
|
-
image = this.CryptoAgent.GetSealImage('CFCA_UKEY_P11.dll')
|
|
65
|
-
// console.log('CFCA_UKEY_P11', image)
|
|
66
|
-
} catch (e) {
|
|
67
|
-
console.log('CFCA_UKEY_P11 error', e)
|
|
68
|
-
}
|
|
69
|
-
if (!image) {
|
|
70
|
-
try {
|
|
71
|
-
image = this.CryptoAgent.GetSealImage('UyeePKCS11.Enterprise.dll')
|
|
72
|
-
// console.log('UyeePKCS11', image)
|
|
73
|
-
} catch (e) {
|
|
74
|
-
console.log('UyeePKCS11 error', e)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (!image) {
|
|
78
|
-
try {
|
|
79
|
-
image = this.CryptoAgent.GetSealImage('UlanPKCS11.Enterprise.dll')
|
|
80
|
-
// console.log('UlanPKCS11.Enterprise', image)
|
|
81
|
-
} catch (e) {
|
|
82
|
-
console.log('UlanPKCS11.Enterprise error', e)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (!image) {
|
|
86
|
-
try {
|
|
87
|
-
image = this.CryptoAgent.GetSealImage('UlanPKCS11.dll')
|
|
88
|
-
// console.log('UlanPKCS11', image)
|
|
89
|
-
} catch (e) {
|
|
90
|
-
console.log('error', e)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (!image) {
|
|
94
|
-
alert('读取Ukey印章图片失败!')
|
|
95
|
-
}
|
|
96
|
-
return image
|
|
97
|
-
},
|
|
98
|
-
// 消息签名, 生成Base64 编码的 PKCS#7 签名结果
|
|
99
|
-
SignOnClick() {
|
|
100
|
-
this.sourceData = `${new Date().getTime()}`
|
|
101
|
-
try {
|
|
102
|
-
const source = this.sourceData
|
|
103
|
-
let signature = ''
|
|
104
|
-
const signType = 'Attach' // 签名类型
|
|
105
|
-
const selectedAlg = 'SHA-1' // 哈希算法(仅对RSA算法有效,SM2默认使用SM3哈希算法):
|
|
106
|
-
|
|
107
|
-
if (signType === 'Attach') {
|
|
108
|
-
// PKCS#7 Attach
|
|
109
|
-
signature = this.CryptoAgent.SignMsgPKCS7(source, selectedAlg, true)
|
|
110
|
-
} else if (signType === 'Detach') {
|
|
111
|
-
// PKCS#7 Detach
|
|
112
|
-
signature = this.CryptoAgent.SignMsgPKCS7(source, selectedAlg, false)
|
|
113
|
-
} else {
|
|
114
|
-
// PKCS#1
|
|
115
|
-
signature = this.CryptoAgent.SignMsgPKCS1(source, selectedAlg)
|
|
116
|
-
}
|
|
117
|
-
if (!signature) {
|
|
118
|
-
this.ShowErrorInfo()
|
|
119
|
-
return ''
|
|
120
|
-
}
|
|
121
|
-
console.log('SignOnClick 签名结果:', signature)
|
|
122
|
-
return signature
|
|
123
|
-
} catch (e) {
|
|
124
|
-
console.log('SignOnClick error=', e)
|
|
125
|
-
this.ShowErrorInfo()
|
|
126
|
-
return ''
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
50
|
GetCertInfoOnClick(InfoTypeID) {
|
|
130
51
|
InfoTypeID = InfoTypeID || 'SubjectDN'
|
|
131
52
|
try {
|
|
@@ -141,67 +62,27 @@ export default {
|
|
|
141
62
|
return false
|
|
142
63
|
}
|
|
143
64
|
},
|
|
65
|
+
|
|
144
66
|
SelectCertificateOnClick(serialNo = '') {
|
|
145
|
-
// if (!this.isIE) {
|
|
146
|
-
// alert('请使用IE浏览器!')
|
|
147
|
-
// }
|
|
148
67
|
try {
|
|
149
68
|
const subjectDNFilter = '';
|
|
150
69
|
const issuerDNFilter = 'CFCA ACS';// CFCA ACS OCA31 ,CFCA ACS OCA32, CFCA ACS TEST OCA31
|
|
151
70
|
const serialNumFilter = serialNo;
|
|
152
71
|
const bstrSM2CSPNameList = 'Uyee CSP v6.0 (Enterprise)||CFCA FOR UKEY CSP v1.1.0'
|
|
153
72
|
let bSelectCertResult = '';
|
|
154
|
-
console.log('无纸化 选证书 selectSignCert, serialNo(非传)=', serialNo)
|
|
155
73
|
bSelectCertResult = this.CryptoAgent.SelectCertificate(subjectDNFilter, issuerDNFilter, serialNumFilter, bstrSM2CSPNameList);
|
|
156
74
|
// Opera浏览器,NPAPI函数执行结果为false时,不能触发异常,需要自己判断返回值。
|
|
157
75
|
if (!bSelectCertResult) {
|
|
158
|
-
console.log('wzh SelectCertResult 不存在')
|
|
159
76
|
this.ShowErrorInfo()
|
|
160
77
|
return false;
|
|
161
78
|
}
|
|
162
|
-
console.log('wzh SelectCertResult', bSelectCertResult)
|
|
163
79
|
return true
|
|
164
80
|
} catch (e) {
|
|
165
|
-
console.log('wzh SelectCertResult error: ', e)
|
|
166
81
|
this.ShowErrorInfo(e)
|
|
167
82
|
return false
|
|
168
83
|
}
|
|
169
84
|
},
|
|
170
|
-
|
|
171
|
-
const CertContent = this.CryptoAgent.GetSignCertInfo('CertContent');
|
|
172
|
-
this.$emit('getImg', params)
|
|
173
|
-
if (!CertContent) {
|
|
174
|
-
alert('获取证书公钥失败!')
|
|
175
|
-
return Promise.reject()
|
|
176
|
-
}
|
|
177
|
-
if (fileOss.bucketName && fileOss.objectKey) {
|
|
178
|
-
return this.api.getSignHash({
|
|
179
|
-
jsonData: {
|
|
180
|
-
source: 'TTDFUND',
|
|
181
|
-
timestamp: new Date().getTime(),
|
|
182
|
-
msgBody: {
|
|
183
|
-
// 合同地址, 相对路径--合同文件全路径。网络地址:http://xxxxxx.pdf;阿里云地址:oss:bucketxx:key
|
|
184
|
-
attachfile: `oss:${fileOss.bucketName}:${fileOss.objectKey}`,
|
|
185
|
-
reason: '', // 签署原因
|
|
186
|
-
location: '', // 签署地点
|
|
187
|
-
signImgfileName: '', // 图片名称
|
|
188
|
-
signImgfile: params.image, // 图片路径,格式同文件字段类似
|
|
189
|
-
signImgMd5: params.md5, // 印章图片的md5
|
|
190
|
-
sealId: params.sealId, // 印章图片的id
|
|
191
|
-
serialNo: params.serialNo, // 证书序列号
|
|
192
|
-
ukeyType: params.ukeyType, // 证书类型(ttd配置)
|
|
193
|
-
userId: params.userId, // 用户id
|
|
194
|
-
pageNo: label.pageIndex, // 签章页
|
|
195
|
-
pageX: Number(label.X), // 签章页签章位置X坐标
|
|
196
|
-
pageY: Number(label.Y), // 签章页签章位置Y坐标
|
|
197
|
-
certBase64: CertContent, // 证书公钥
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
alert('文件对象不合规!')
|
|
203
|
-
return Promise.reject()
|
|
204
|
-
},
|
|
85
|
+
|
|
205
86
|
async getSignHashValue(item, fileItem, params) {
|
|
206
87
|
let sourceHashData = ''
|
|
207
88
|
const { code, data, msg } = await this.getHashValue(item, fileItem, params);
|
|
@@ -229,75 +110,7 @@ export default {
|
|
|
229
110
|
alert('获取PKCS#7分离式签名失败!')
|
|
230
111
|
return false
|
|
231
112
|
},
|
|
232
|
-
async signFileKeyImage(item, fileItem, params) {
|
|
233
|
-
const res = await this.getSignHashValue(item, fileItem, params)
|
|
234
|
-
let errorMsg = '计算Hash 失败!'
|
|
235
|
-
if (res) {
|
|
236
|
-
const { data, code, msg } = await this.api.mergeHash({
|
|
237
|
-
jsonData: {
|
|
238
|
-
source: 'TTDFUND',
|
|
239
|
-
timestamp: new Date().getTime(),
|
|
240
|
-
msgBody: {
|
|
241
|
-
sigString: res.signature, // 签名后的hash值
|
|
242
|
-
id: res.id, // 计算接口返回的ID
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
})
|
|
246
|
-
// 此方法 code 不能完全说明正确,调用失败code 也是0
|
|
247
|
-
if (code === 0) {
|
|
248
|
-
if (data.bean.url) {
|
|
249
|
-
return data.bean
|
|
250
|
-
}
|
|
251
|
-
errorMsg = data.bean.msg
|
|
252
|
-
} else {
|
|
253
|
-
errorMsg = data.msg || msg
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
this.$message.error(errorMsg || 'error计算Hash失败!')
|
|
257
|
-
return false
|
|
258
|
-
},
|
|
259
|
-
// fileOss: 为文件对象 {obje}
|
|
260
|
-
// isOffset: 修正印章的位置,印章加时间后需要向下修正
|
|
261
|
-
// parama: 其他参数:ukeyType, image, md5, isOffset
|
|
262
|
-
async multipleSign(labels, fileOss, params) {
|
|
263
|
-
let result = ''
|
|
264
|
-
const localParams = { ...params }
|
|
265
|
-
const { isOffset = 18 } = localParams
|
|
266
|
-
if (!localParams.image) {
|
|
267
|
-
alert('印章图片缺失!')
|
|
268
|
-
return false
|
|
269
|
-
}
|
|
270
113
|
|
|
271
|
-
for (let index = 0; index < labels.length; index++) {
|
|
272
|
-
const item = getUrl(labels[index])
|
|
273
|
-
// 此处for循环多个文件时候以前签署,所以提示无意义
|
|
274
|
-
// const message = `签署 [${text}] 位于第${label.pageIndex}页的位置,[总共:${index + 1}/${labels.length}个位置]`
|
|
275
|
-
if (typeof isOffset === 'number') {
|
|
276
|
-
// 印章统一向下偏移
|
|
277
|
-
item.Y -= isOffset
|
|
278
|
-
}
|
|
279
|
-
if (index > 0) {
|
|
280
|
-
const serialNoAgain = this.CryptoAgent.GetSignCertInfo('SerialNumber');
|
|
281
|
-
if (localParams.serialNo !== serialNoAgain) {
|
|
282
|
-
console.log(`params.serialNo:${ localParams.serialNo}`, `serialNoAgain${ serialNoAgain}`)
|
|
283
|
-
alert('签署过程中,请不要更换ukey!')
|
|
284
|
-
return false
|
|
285
|
-
}
|
|
286
|
-
// 这里签署第二个章,需要在第一个签好的文件上签署 所以用result中是文件
|
|
287
|
-
if (result) {
|
|
288
|
-
// eslint-disable-next-line
|
|
289
|
-
result = await this.signFileKeyImage((item), result, {...localParams})
|
|
290
|
-
}
|
|
291
|
-
console.log(`iterateSign 签章结果${index}---result----`, result)
|
|
292
|
-
} else {
|
|
293
|
-
// eslint-disable-next-line
|
|
294
|
-
result = await this.signFileKeyImage((item), fileOss, {...localParams})
|
|
295
|
-
console.log('第一个章 签章结果', result)
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
console.log('multipleSign 签章的结果', result)
|
|
299
|
-
return result
|
|
300
|
-
},
|
|
301
114
|
ShowErrorInfo(response = '') {
|
|
302
115
|
if (!this.CryptoAgent) {
|
|
303
116
|
alert('不支持该功能!');
|
|
@@ -3,28 +3,11 @@
|
|
|
3
3
|
<div class="CryptoAgent-wrapper"></div>
|
|
4
4
|
</template>
|
|
5
5
|
<script>
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import WzhMixin from './WzhMixin';
|
|
8
7
|
import WZHforChrome from './WZHforChrome'
|
|
9
8
|
|
|
10
9
|
export default {
|
|
11
|
-
mixins: [WZHforChrome],
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
sourceData: '', // 签名原文, 动态随机字符串
|
|
15
|
-
certType: 'RSA', // 签名算法
|
|
16
|
-
CryptoAgent: null,
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
api: {
|
|
21
|
-
type: Object,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
mounted() {
|
|
26
|
-
this.onLoad()
|
|
27
|
-
},
|
|
10
|
+
mixins: [WzhMixin, WZHforChrome],
|
|
28
11
|
methods: {
|
|
29
12
|
/**
|
|
30
13
|
* 初始化验签工具包,加载 验签空间(object)
|
|
@@ -35,65 +18,13 @@ export default {
|
|
|
35
18
|
}
|
|
36
19
|
this.LoadObj()
|
|
37
20
|
},
|
|
38
|
-
|
|
39
|
-
async getUkeyImage(bstrP11Name) {
|
|
40
|
-
// 为了兼容 (新老ukey),获取证书的CSPName
|
|
41
|
-
// 老版本ukey CSPName: CFCA FOR UKEY CSP v1.1.0
|
|
42
|
-
// 新版本ukey CSPName: Uyee CSP v6.0 (Enterprise)
|
|
43
|
-
if (!bstrP11Name) {
|
|
44
|
-
let InfoContent = ''
|
|
45
|
-
await this.SelectCertificateOnClick()
|
|
46
|
-
try {
|
|
47
|
-
InfoContent = await this.GetCertInfoOnClick('CSPName');
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.log(e)
|
|
50
|
-
}
|
|
51
|
-
if (InfoContent.indexOf('CFCA FOR UKEY CSP') > -1) {
|
|
52
|
-
bstrP11Name = 'CFCA_UKEY_P11.dll'
|
|
53
|
-
} else {
|
|
54
|
-
bstrP11Name = 'UyeePKCS11.Enterprise.dll'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// console.log('CryptoAgent InfoContent ', InfoContent)
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
// 老ukey 获取图片 'CFCA_UKEY_P11.dll'
|
|
60
|
-
// 新ukey 获取图片 'UyeePKCS11.Enterprise.dll'
|
|
61
|
-
this.CryptoAgent.GetSealImage(bstrP11Name).then((response) => {
|
|
62
|
-
resolve(response.result)
|
|
63
|
-
}).catch((response1) => {
|
|
64
|
-
this.ShowErrorInfo(response1);
|
|
65
|
-
reject(response1)
|
|
66
|
-
});
|
|
67
|
-
})
|
|
68
|
-
},
|
|
69
21
|
GetCertInfoOnClick(InfoTypeID) {
|
|
70
22
|
InfoTypeID = InfoTypeID || 'SubjectDN'
|
|
71
|
-
// console.log('GetCertInfoOnClick:InfoTypeID ', InfoTypeID)
|
|
72
23
|
return this.CryptoAgent.GetSignCertInfo(InfoTypeID).then((response) => response.result).catch((e) => {
|
|
73
24
|
this.ShowErrorInfo(e)
|
|
74
25
|
})
|
|
75
26
|
},
|
|
76
27
|
|
|
77
|
-
async SignOnClick() {
|
|
78
|
-
this.sourceData = `${new Date().getTime()}`
|
|
79
|
-
const source = this.sourceData
|
|
80
|
-
let signature = ''
|
|
81
|
-
const signType = 'Attach' // 签名类型
|
|
82
|
-
const selectedAlg = 'SHA-1' // 哈希算法(仅对RSA算法有效,SM2默认使用SM3哈希算法):
|
|
83
|
-
|
|
84
|
-
if (signType === 'Attach') {
|
|
85
|
-
// PKCS#7 Attach
|
|
86
|
-
signature = await this.CryptoAgent.SignMsgPKCS7(source, selectedAlg, true)
|
|
87
|
-
} else if (signType === 'Detach') {
|
|
88
|
-
// PKCS#7 Detach
|
|
89
|
-
signature = await this.CryptoAgent.SignMsgPKCS7(source, selectedAlg, false)
|
|
90
|
-
} else {
|
|
91
|
-
// PKCS#1
|
|
92
|
-
signature = await this.CryptoAgent.SignMsgPKCS1(source, selectedAlg)
|
|
93
|
-
}
|
|
94
|
-
console.log('SignOnClick 签名结果:', signature)
|
|
95
|
-
return signature.result
|
|
96
|
-
},
|
|
97
28
|
async SelectCertificateOnClick(serialNumFilter = '') {
|
|
98
29
|
const subjectDNFilter = '';
|
|
99
30
|
const issuerDNFilter = 'CFCA ACS ';// CFCA ACS OCA31 ,CFCA ACS OCA32, CFCA ACS TEST OCA31
|
|
@@ -103,7 +34,7 @@ export default {
|
|
|
103
34
|
if (!serialNumFilter) {
|
|
104
35
|
try {
|
|
105
36
|
const version = await this.CryptoAgent.GetVersion()
|
|
106
|
-
console.log('CryptoAgent version ', version)
|
|
37
|
+
// console.log('CryptoAgent version ', version)
|
|
107
38
|
} catch (response) {
|
|
108
39
|
alert('扩展初始化失败,请联系管理员!')
|
|
109
40
|
this.ShowErrorInfo(response);
|
|
@@ -122,41 +53,7 @@ export default {
|
|
|
122
53
|
})
|
|
123
54
|
// 返回值resSelect 在chrome下是 对象,在ie下返回是 true/false
|
|
124
55
|
},
|
|
125
|
-
|
|
126
|
-
const CertContent = await this.GetCertInfoOnClick('CertContent');
|
|
127
|
-
this.$emit('getImg', params)
|
|
128
|
-
if (!CertContent) {
|
|
129
|
-
alert('获取证书公钥失败!')
|
|
130
|
-
return Promise.reject()
|
|
131
|
-
}
|
|
132
|
-
if (fileOss.bucketName && fileOss.objectKey) {
|
|
133
|
-
return this.api.getSignHash({
|
|
134
|
-
jsonData: {
|
|
135
|
-
source: 'TTDFUND',
|
|
136
|
-
timestamp: new Date().getTime(),
|
|
137
|
-
msgBody: {
|
|
138
|
-
// 合同地址, 相对路径--合同文件全路径。网络地址:http://xxxxxx.pdf;阿里云地址:oss:bucketxx:key
|
|
139
|
-
attachfile: `oss:${fileOss.bucketName}:${fileOss.objectKey}`,
|
|
140
|
-
reason: '', // 签署原因
|
|
141
|
-
location: '', // 签署地点
|
|
142
|
-
signImgfileName: '', // 图片名称
|
|
143
|
-
signImgfile: params.image, // 图片路径,格式同文件字段类似
|
|
144
|
-
signImgMd5: params.md5, // 印章图片的md5
|
|
145
|
-
sealId: params.sealId, // 印章图片的id
|
|
146
|
-
serialNo: params.serialNo, // 证书序列号
|
|
147
|
-
ukeyType: params.ukeyType, // 证书类型(ttd配置)
|
|
148
|
-
userId: params.userId, // 用户id
|
|
149
|
-
pageNo: label.pageIndex, // 签章页
|
|
150
|
-
pageX: Number(label.X), // 签章页签章位置X坐标
|
|
151
|
-
pageY: Number(label.Y), // 签章页签章位置Y坐标
|
|
152
|
-
certBase64: CertContent, // 证书公钥
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
alert('文件对象不合规!')
|
|
158
|
-
return Promise.reject()
|
|
159
|
-
},
|
|
56
|
+
|
|
160
57
|
async getSignHashValue(item, fileItem, params) {
|
|
161
58
|
let sourceHashData = ''
|
|
162
59
|
const { code, data } = await this.getHashValue(item, fileItem, params);
|
|
@@ -177,75 +74,13 @@ export default {
|
|
|
177
74
|
this.ShowErrorInfo(response);
|
|
178
75
|
});
|
|
179
76
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
timestamp: new Date().getTime(),
|
|
188
|
-
msgBody: {
|
|
189
|
-
sigString: res.signature, // 签名后的hash值
|
|
190
|
-
id: res.id, // 计算接口返回的ID
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
})
|
|
194
|
-
// 此方法 code 不能完全说明正确,调用失败code 也是0
|
|
195
|
-
if (code === 0) {
|
|
196
|
-
if (data.bean.url) {
|
|
197
|
-
return data.bean
|
|
198
|
-
}
|
|
199
|
-
errorMsg = data.bean.msg
|
|
200
|
-
} else {
|
|
201
|
-
errorMsg = data.msg
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
this.$message.error(errorMsg || 'error计算Hash失败!')
|
|
205
|
-
return false
|
|
206
|
-
},
|
|
207
|
-
// fileOss: 为文件对象 {obje}
|
|
208
|
-
// isOffset: 修正印章的位置,印章加时间后需要向下修正
|
|
209
|
-
// parama: 其他参数:ukeyType, image, md5, isOffset
|
|
210
|
-
async multipleSign(labels, fileOss, params) {
|
|
211
|
-
let result = ''
|
|
212
|
-
const localParams = { ...params }
|
|
213
|
-
const { isOffset = 18 } = localParams
|
|
214
|
-
if (!localParams.image) {
|
|
215
|
-
alert('印章图片缺失!')
|
|
216
|
-
return false
|
|
217
|
-
}
|
|
218
|
-
console.log('multipleSign-params= ', localParams)
|
|
219
|
-
for (let index = 0; index < labels.length; index++) {
|
|
220
|
-
const item = getUrl(labels[index])
|
|
221
|
-
// 此处for循环多个文件时候以前签署,所以提示无意义
|
|
222
|
-
// const message = `签署 [${text}] 位于第${label.pageIndex}页的位置,[总共:${index + 1}/${labels.length}个位置]`
|
|
223
|
-
if (typeof isOffset === 'number') {
|
|
224
|
-
// 印章统一向下偏移
|
|
225
|
-
item.Y -= isOffset
|
|
226
|
-
}
|
|
227
|
-
if (index > 0) {
|
|
228
|
-
const serialNoAgain = await this.GetCertInfoOnClick('SerialNumber');
|
|
229
|
-
if (localParams.serialNo !== serialNoAgain) {
|
|
230
|
-
console.log(`params.serialNo:${ localParams.serialNo}`, `serialNoAgain${ serialNoAgain}`)
|
|
231
|
-
alert('签署过程中,请不要更换ukey!')
|
|
232
|
-
return false
|
|
233
|
-
}
|
|
234
|
-
// 这里签署第二个章,需要在第一个签好的文件上签署 所以用result中是文件
|
|
235
|
-
if (result) {
|
|
236
|
-
// eslint-disable-next-line
|
|
237
|
-
result = await this.signFileKeyImage((item), result, {...localParams})
|
|
238
|
-
}
|
|
239
|
-
console.log(`iterateSign 签章结果${index}---result----`, result)
|
|
240
|
-
} else {
|
|
241
|
-
// eslint-disable-next-line
|
|
242
|
-
result = await this.signFileKeyImage((item), fileOss, {...localParams})
|
|
243
|
-
console.log('第一个章 签章结果', result)
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
console.log('multipleSign 签章的结果', result)
|
|
247
|
-
return result
|
|
248
|
-
},
|
|
77
|
+
},
|
|
78
|
+
beforeDestroy() {
|
|
79
|
+
try {
|
|
80
|
+
this.CryptoAgent.uninit().then(() => { });
|
|
81
|
+
} catch (e) {
|
|
82
|
+
alert(e);
|
|
83
|
+
}
|
|
249
84
|
},
|
|
250
85
|
}
|
|
251
86
|
|