|
|
|
@ -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 中的 <a> 元素 |
|
|
|
// 如果你选择了将 <a> 元素添加到 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); |
|
|
|
}, |
|
|
|
|
|
|
|
//导图(上传图片) |
|
|
|
|