From 7f57be970f25640aebcd19855f31dc21d41eb1c3 Mon Sep 17 00:00:00 2001
From: pengjun <158915633@qq.com>
Date: Thu, 12 Sep 2024 18:04:45 +0800
Subject: [PATCH] pic
---
src/components/doctorCheck/CheckPicture.vue | 34 ++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/components/doctorCheck/CheckPicture.vue b/src/components/doctorCheck/CheckPicture.vue
index 3282bec..f61d017 100644
--- a/src/components/doctorCheck/CheckPicture.vue
+++ b/src/components/doctorCheck/CheckPicture.vue
@@ -289,7 +289,7 @@ export default {
},
// 浏览Dcm文件
- btnBrowseDcm() {
+ btnBrowseDcmBak() {
if (!this.doctorCheck.RegisterCheckId) {
this.$message.warning({ showClose: true, message: "未选中组合项目!" });
return;
@@ -317,7 +317,39 @@ export default {
//(可选)移除刚才添加到 DOM 中的 元素
// 如果你选择了将 元素添加到 DOM 中,现在可以移除它
// document.body.removeChild(a);
+ },
+
+ btnBrowseDcm() {
+ let userName = "peis", key = "peis@123"
+ // let encodedAuthstring = btoa(this.stringToAscIIBytes(`${userName}:${key}`));
+ let encodedAuthstring = this.toBase64FromUtf8(`${userName}:${key}`);
+ console.log('encodedAuthstring', encodedAuthstring)
+ const url = 'http://192.168.4.161:8042/ohif/viewer?url=../studies/dcdc7b20-fe11f38d-f5357ad7-139cd2cd-c0bd3701/ohif-dicom-json';
+ const Authorization = 'Basic ' + encodedAuthstring;
+
+ fetch(url, {
+ headers: {
+ 'Authorization': Authorization
+ }
+ })
+ .then(response => response.json())
+ .then(data => console.log(data))
+ .catch(error => console.error('Error:', error));
+ },
+
+ toBase64FromUtf8(str) {
+ // 使用 TextEncoder 将字符串转换为UTF-8字节序列
+ const encoder = new TextEncoder();
+ const bytes = encoder.encode(str);
+
+ // 将字节序列转换为二进制字符串
+ let binaryString = '';
+ for (let byte of bytes) {
+ binaryString += String.fromCharCode(byte);
+ }
+ // 使用 btoa 将二进制字符串转换为Base64
+ return btoa(binaryString);
},
//导图(上传图片)