pengjun 1 year ago
parent
commit
7f57be970f
  1. 34
      src/components/doctorCheck/CheckPicture.vue

34
src/components/doctorCheck/CheckPicture.vue

@ -289,7 +289,7 @@ export default {
}, },
// Dcm // Dcm
btnBrowseDcm() {
btnBrowseDcmBak() {
if (!this.doctorCheck.RegisterCheckId) { if (!this.doctorCheck.RegisterCheckId) {
this.$message.warning({ showClose: true, message: "未选中组合项目!" }); this.$message.warning({ showClose: true, message: "未选中组合项目!" });
return; return;
@ -317,7 +317,39 @@ export default {
// DOM <a> // DOM <a>
// <a> DOM // <a> DOM
// document.body.removeChild(a); // 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);
}, },
// //

Loading…
Cancel
Save