@toolspack/ttd-common 0.4.7 → 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 +153 -110
- package/lib/ttd-common.umd.js +153 -110
- 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 +25 -11
|
@@ -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,20 +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
|
+
if (!CertContent) {
|
|
163
|
+
alert('获取证书公钥失败!')
|
|
164
|
+
return Promise.reject()
|
|
165
|
+
}
|
|
162
166
|
if (fileOss.bucketName && fileOss.objectKey) {
|
|
163
167
|
return this.api.getSignHash({
|
|
164
168
|
jsonData: {
|
|
@@ -207,11 +211,12 @@ export default {
|
|
|
207
211
|
} catch (e) {
|
|
208
212
|
const errorDesc2 = this.CryptoAgent.GetLastErrorDesc();
|
|
209
213
|
console.log('getSignHashValue', e)
|
|
210
|
-
alert(errorDesc2);
|
|
214
|
+
alert(errorDesc2 + e);
|
|
211
215
|
}
|
|
212
216
|
},
|
|
213
217
|
async signFileKeyImage(item, fileItem, image) {
|
|
214
218
|
const res = await this.getSignHashValue(item, fileItem, image)
|
|
219
|
+
let errorMsg = '计算Hash 失败!'
|
|
215
220
|
if (res) {
|
|
216
221
|
const { data, code } = await this.api.mergeHash({
|
|
217
222
|
jsonData: {
|
|
@@ -224,25 +229,34 @@ export default {
|
|
|
224
229
|
},
|
|
225
230
|
})
|
|
226
231
|
// 此方法 code 不能完全说明正确,调用失败code 也是0
|
|
227
|
-
if (code === 0
|
|
228
|
-
|
|
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
|
|
229
239
|
}
|
|
230
240
|
}
|
|
231
|
-
this.$message.error('计算Hash
|
|
241
|
+
this.$message.error(errorMsg || 'error计算Hash失败!')
|
|
232
242
|
return false
|
|
233
243
|
},
|
|
234
244
|
// fileOss: 为文件对象 {obje}
|
|
235
245
|
// isOffset: 修正印章的位置,印章加时间后需要向下修正
|
|
236
|
-
async multipleSign(labels, fileOss, serialNo, image, isOffset =
|
|
246
|
+
async multipleSign(labels, fileOss, serialNo, image, isOffset = 18) {
|
|
237
247
|
const serialNoBegin = this.CryptoAgent.GetSignCertInfo('SerialNumber');
|
|
238
248
|
let result = ''
|
|
249
|
+
if (!image) {
|
|
250
|
+
alert('印章图片缺失!')
|
|
251
|
+
return false
|
|
252
|
+
}
|
|
239
253
|
|
|
240
254
|
for (let index = 0; index < labels.length; index++) {
|
|
241
255
|
const item = getUrl(labels[index])
|
|
242
256
|
// 此处for循环多个文件时候以前签署,所以提示无意义
|
|
243
257
|
// const message = `签署 [${text}] 位于第${label.pageIndex}页的位置,[总共:${index + 1}/${labels.length}个位置]`
|
|
244
258
|
if (typeof isOffset === 'number') {
|
|
245
|
-
//
|
|
259
|
+
// 印章统一向下偏移
|
|
246
260
|
item.Y -= isOffset
|
|
247
261
|
}
|
|
248
262
|
if (index > 0) {
|
|
@@ -275,7 +289,7 @@ export default {
|
|
|
275
289
|
.CryptoAgent-wrapper {
|
|
276
290
|
height: 0;
|
|
277
291
|
width: 0;
|
|
278
|
-
position:
|
|
292
|
+
position: absolute;
|
|
279
293
|
left: -5000px;
|
|
280
294
|
}
|
|
281
295
|
</style>>
|