@toolspack/ttd-common 0.4.6 → 0.4.8
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 +8 -6
- package/lib/ttd-common.common.js +157 -123
- package/lib/ttd-common.umd.js +157 -123
- package/lib/ttd-common.umd.min.js +1 -1
- package/package.json +2 -2
- package/src/packages/cfca/CfcaPdf.vue +33 -25
- package/src/packages/ukey/WzhSign.vue +26 -20
|
@@ -119,13 +119,13 @@ export default {
|
|
|
119
119
|
if (!InfoContent) {
|
|
120
120
|
const errorDesc = this.CryptoAgent.GetLastErrorDesc()
|
|
121
121
|
alert(errorDesc)
|
|
122
|
-
return
|
|
122
|
+
return false
|
|
123
123
|
}
|
|
124
124
|
return InfoContent
|
|
125
125
|
} catch (e) {
|
|
126
126
|
console.log('GetCertInfoOnClick-WzhSign: ', e)
|
|
127
127
|
const errorDesc = this.CryptoAgent.GetLastErrorDesc()
|
|
128
|
-
alert(errorDesc)
|
|
128
|
+
alert(errorDesc + e)
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
SelectCertificateOnClick(serialNo = '') {
|
|
@@ -145,21 +145,24 @@ export default {
|
|
|
145
145
|
const errorDesc = this.CryptoAgent.GetLastErrorDesc();
|
|
146
146
|
console.log('wzh SelectCertResult 不存在', errorDesc)
|
|
147
147
|
alert(errorDesc);
|
|
148
|
-
return;
|
|
148
|
+
return false;
|
|
149
149
|
}
|
|
150
150
|
console.log('wzh SelectCertResult', bSelectCertResult)
|
|
151
151
|
return true
|
|
152
152
|
} catch (e) {
|
|
153
153
|
const errorDesc2 = this.CryptoAgent.GetLastErrorDesc();
|
|
154
154
|
console.log('wzh SelectCertResult catch error: ', errorDesc2)
|
|
155
|
-
alert(errorDesc2);
|
|
155
|
+
alert(errorDesc2 + e);
|
|
156
156
|
return false
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
getHashValue(label, fileOss, sealImage) {
|
|
160
160
|
const CertContent = this.CryptoAgent.GetSignCertInfo('CertContent');
|
|
161
161
|
this.$emit('getImg', sealImage)
|
|
162
|
-
|
|
162
|
+
if (!CertContent) {
|
|
163
|
+
alert('获取证书公钥失败!')
|
|
164
|
+
return Promise.reject()
|
|
165
|
+
}
|
|
163
166
|
if (fileOss.bucketName && fileOss.objectKey) {
|
|
164
167
|
return this.api.getSignHash({
|
|
165
168
|
jsonData: {
|
|
@@ -187,7 +190,6 @@ export default {
|
|
|
187
190
|
try {
|
|
188
191
|
let sourceHashData = ''
|
|
189
192
|
const { code, data } = await this.getHashValue(item, fileItem, image);
|
|
190
|
-
console.log('getSignHashValue', data)
|
|
191
193
|
if (code === 0) {
|
|
192
194
|
if (`${data.bean.code}` === '200') { sourceHashData = data.bean.pdfHash }
|
|
193
195
|
}
|
|
@@ -209,11 +211,12 @@ export default {
|
|
|
209
211
|
} catch (e) {
|
|
210
212
|
const errorDesc2 = this.CryptoAgent.GetLastErrorDesc();
|
|
211
213
|
console.log('getSignHashValue', e)
|
|
212
|
-
alert(errorDesc2);
|
|
214
|
+
alert(errorDesc2 + e);
|
|
213
215
|
}
|
|
214
216
|
},
|
|
215
217
|
async signFileKeyImage(item, fileItem, image) {
|
|
216
218
|
const res = await this.getSignHashValue(item, fileItem, image)
|
|
219
|
+
let errorMsg = '计算Hash 失败!'
|
|
217
220
|
if (res) {
|
|
218
221
|
const { data, code } = await this.api.mergeHash({
|
|
219
222
|
jsonData: {
|
|
@@ -226,38 +229,42 @@ export default {
|
|
|
226
229
|
},
|
|
227
230
|
})
|
|
228
231
|
// 此方法 code 不能完全说明正确,调用失败code 也是0
|
|
229
|
-
if (code === 0
|
|
230
|
-
|
|
232
|
+
if (code === 0) {
|
|
233
|
+
if (data.bean.url) {
|
|
234
|
+
return data.bean
|
|
235
|
+
}
|
|
236
|
+
errorMsg = data.bean.msg
|
|
237
|
+
} else {
|
|
238
|
+
errorMsg = data.msg
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
|
-
this.$message.error('计算Hash
|
|
241
|
+
this.$message.error(errorMsg || 'error计算Hash失败!')
|
|
234
242
|
return false
|
|
235
243
|
},
|
|
236
244
|
// fileOss: 为文件对象 {obje}
|
|
237
245
|
// isOffset: 修正印章的位置,印章加时间后需要向下修正
|
|
238
|
-
async multipleSign(labels, fileOss, serialNo, image, isOffset =
|
|
239
|
-
console.log('multipleSign 循环签的begin ', serialNo)
|
|
246
|
+
async multipleSign(labels, fileOss, serialNo, image, isOffset = 18) {
|
|
240
247
|
const serialNoBegin = this.CryptoAgent.GetSignCertInfo('SerialNumber');
|
|
241
|
-
console.log('serialNoBegin', serialNoBegin)
|
|
242
248
|
let result = ''
|
|
249
|
+
if (!image) {
|
|
250
|
+
alert('印章图片缺失!')
|
|
251
|
+
return false
|
|
252
|
+
}
|
|
243
253
|
|
|
244
254
|
for (let index = 0; index < labels.length; index++) {
|
|
245
255
|
const item = getUrl(labels[index])
|
|
246
256
|
// 此处for循环多个文件时候以前签署,所以提示无意义
|
|
247
257
|
// const message = `签署 [${text}] 位于第${label.pageIndex}页的位置,[总共:${index + 1}/${labels.length}个位置]`
|
|
248
|
-
if (
|
|
249
|
-
//
|
|
258
|
+
if (typeof isOffset === 'number') {
|
|
259
|
+
// 印章统一向下偏移
|
|
250
260
|
item.Y -= isOffset
|
|
251
261
|
}
|
|
252
262
|
if (index > 0) {
|
|
253
|
-
console.log('无需重新验签:index=', index)
|
|
254
263
|
const serialNoAgain = this.CryptoAgent.GetSignCertInfo('SerialNumber');
|
|
255
|
-
console.log('本次获得的序列号serialNoAgain:', serialNoAgain)
|
|
256
264
|
if (serialNoBegin !== serialNoAgain) {
|
|
257
265
|
alert('签署过程中,请不要更换ukey!')
|
|
258
266
|
return false
|
|
259
267
|
}
|
|
260
|
-
console.log('resutl=', result)
|
|
261
268
|
// 这里签署第二个章,需要在第一个签好的文件上签署 所以用result中是文件
|
|
262
269
|
if (result) {
|
|
263
270
|
// eslint-disable-next-line
|
|
@@ -266,7 +273,6 @@ export default {
|
|
|
266
273
|
|
|
267
274
|
console.log(`iterateSign 签章结果${index}---result----`, result)
|
|
268
275
|
} else {
|
|
269
|
-
console.log('第一个章,不用验签', index)
|
|
270
276
|
// eslint-disable-next-line
|
|
271
277
|
result = await this.signFileKeyImage((item), fileOss, image)
|
|
272
278
|
console.log('第一个章 签章结果', result)
|
|
@@ -283,7 +289,7 @@ export default {
|
|
|
283
289
|
.CryptoAgent-wrapper {
|
|
284
290
|
height: 0;
|
|
285
291
|
width: 0;
|
|
286
|
-
position:
|
|
292
|
+
position: absolute;
|
|
287
293
|
left: -5000px;
|
|
288
294
|
}
|
|
289
295
|
</style>>
|