diff --git a/src/components/common/PreviewCusGrant.vue b/src/components/common/PreviewCusGrant.vue index 7735a9d..12de9e0 100644 --- a/src/components/common/PreviewCusGrant.vue +++ b/src/components/common/PreviewCusGrant.vue @@ -85,8 +85,6 @@ export default { apiurl: 'http://192.168.1.138:9527', type: 0, }, - - }; }, @@ -159,6 +157,41 @@ export default { // img.src = url; // }); // }, + async fetchAsBlob(url) { + try { + const response = await fetch(url, { + mode: 'cors', + credentials: 'omit' + }); + + if (!response.ok) return null; + + const blob = await response.blob(); + return blob; + } catch (error) { + return null; + } + }, + + async fetchImageToBase64(url) { + try { + const response = await fetch(url, { + mode: 'cors', + credentials: 'omit' + }); + const blob = await response.blob(); + + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsDataURL(blob); + }); + } catch (error) { + console.error('获取图片失败:', error); + throw error; + } + }, rowClick(row) { this.curRow = Object.assign(this.curRow, row, { type: 0, src: this.curRow.apiurl + row.informedConsentFile }) @@ -169,16 +202,16 @@ export default { rowClick1(row) { this.curRow = Object.assign(this.curRow, row, { type: 1, src: this.curRow.apiurl + '/' + row.giveUpCheckSignFile }) - // this.imageToBase64(this.curRow.src) + // this.fetchImageToBase64(this.curRow.src) // .then(base64 => { // this.curRow.src = base64 // }) // .finally(() => { - this.contentShow = '
本人因个人原因,自愿放弃【${asbitemName}】项目的检查。
特此申明!
弃检人签名:${signMan}
本人因个人原因,自愿放弃【${asbitemName}】项目的检查。
特此申明!
弃检人签名:${signMan}