会议/病例

main
SWX\10484 4 days ago
parent 3fd7b850d2
commit 90a6487548
  1. 264
      src/views/videoCommunication/realTimeConsultation.vue

@ -75,6 +75,13 @@
<footer class="bottom-bar">
<div class="left-section">
<el-button type="primary" @click="handleAddCase">创建病例</el-button>
<div class="patient-info" v-if="patientInfo">
<span class="patient-field">姓名{{ patientInfo.patient_name }}</span>
<span class="patient-field">年龄{{ patientInfo.ageText }}</span>
<span class="patient-field">
部位{{ patientInfo.positions.join(' | ') }}
</span>
</div>
</div>
<div class="tools-section">
<div class="tool-item" @click="toggleMic">
@ -263,6 +270,7 @@ import {
postConsultationInfo,
postConsultationStop
} from "@/api/videoCommunication";
import { patientAgeTypeList } from "@/api/cases/index.js";
export default {
name: 'MeetingRoom',
components: {
@ -271,9 +279,12 @@ export default {
},
data() {
return {
// ==================== ====================
patientInfo: null, // { patient_name, ageText, positions, reportCount }
// ==================== ====================
meetingTitle: '',
meetingCode: '1687110',
meetingCode: '',
participantCount: 1,
resolution: '1080P',
frameRate: 25,
@ -301,6 +312,12 @@ export default {
micOn: true,
camOn: true,
localStream: null,
device: {
isInit: false,
audio: [],
video: [],
output: [],
},
//
audioContext: null,
@ -375,6 +392,51 @@ export default {
fullPageCaptureIsSelecting: false,
fullPageCaptureStartX: 0,
fullPageCaptureStartY: 0,
userID: '',
roomID: "",
isJoined: false,
isDisconnect: false,
isEnvChange: false,
localCameraStream: {
aDeviceID: "",
vDeviceID: "",
oDeviceID: "",
isPreviewed: false,
videoElement: null,
publishID: "",
muteVideo: false,
muteAudio: false,
type: window.hirtcwebsdk.StreamType.Camera,
},
localScreenStream: {
type: window.hirtcwebsdk.StreamType.Screen,
publishID: "",
muteVideo: false,
muteAudio: false,
},
localCameraStreamEx: {
tag: "tag1",
aDeviceID: "",
vDeviceID: "",
isPreviewed: false,
videoElement: null,
publishID: "",
muteVideo: false,
muteAudio: false,
},
remoteStream: [],
userList: [],
device: {
isInit: false,
audio: [],
video: [],
output: [],
},
joinRetry: 0,
publishRetry: 0,
subscribeRetry: 0,
maxRetry: 3,
};
},
computed: {
@ -391,10 +453,12 @@ export default {
},
},
mounted() {
if (this.$route.query.roomId_id) this.creatRoom()
this.initSDK()
this.initPage();
this.initSDK();
// this.initSDK();
},
methods: {
@ -407,7 +471,6 @@ export default {
name: '',
room_id: this.$route.query.roomId_id
})
console.log(1111111111,res)
this.consultation_id = res.data.consultation_id
const ret = await postConsultationInfo({
consultation_id: res.data.consultation_id,
@ -415,6 +478,10 @@ export default {
room_id: ''
})
this.meetingTitle = ret.data.name
this.meetingCode = ret.data.invite_code
this.participantCount = ret.data.user_num
this.userID = ret.data.user_id
this.roomID = ret.data.room_id
} catch (error) {
}
@ -423,9 +490,30 @@ export default {
handleAddCase() {
this.$refs.caseFormDialogRef.handleAdd();
},
//
//
handleView(row) {
this.$tab.openPage(row.patient_name + '-' + row.id, '/cases/detail/' + row.id);
if (!row) return;
//
let ageText = '';
if (row.patient_age != null) {
const ageList = patientAgeTypeList();
const ageLabel = ageList.find(i => i.value == row.patient_age_type);
ageText = `${row.patient_age}${ageLabel ? ageLabel.label : ''}`;
}
// positions position_text
let positions = [];
if (row.positions && row.positions.length) {
positions = row.positions.reduce((prev, cur) => {
prev.push(cur.level2.name)
return prev
}, [])
}
this.patientInfo = {
patient_name: row.patient_name || '',
ageText,
positions: row.position_text ? [...positions, row.position_text] : positions
};
},
// ==================== 1 ====================
//
@ -458,7 +546,7 @@ export default {
window.hirtcwebsdk.init({
serviceID: '56da5fd8921f4f7093a42e2a',
serviceKey: '2c17c6393771ee3048ae34d6b965sdew',
Services: { BasicRoomServiceToken: "http://120.221.95.4/v1/auth/token" },
Services: { BasicRoomServiceToken: "https://120.221.95.4:7080/v1/auth/token" },
cameraLayers: [
{
width: 320,
@ -487,19 +575,148 @@ export default {
forceArea: true,
screenEnableAudio: true,
});
// window.hirtcwebsdk.addListener("joined", this.handleJoined); //
// window.hirtcwebsdk.join(this.userID, this.roomID, this.$store.state.user.userInfo.name);
// this.join()
// const userID = this.userID.trim();
// const roomID = this.roomID.trim();
// const uName = (this.$store.state.user.name || '').trim();
// console.log(12121212)
// console.log(userID, roomID);
// if (userID === "") {
// this.$message({
// message: "",
// type: "warning",
// });
// return;
// }
// if (roomID === "") {
// this.$message({
// message: "",
// type: "warning",
// });
// }
//
// askForPermission() => permission => getDevices() => deviceList
// window.hirtcwebsdk.askForPermission(true, true);
// this.join()
const roomId = 'room_' + (this.meetingCode || 'default');
// const roomId = 'room_' + (this.meetingCode || 'default');
const uid = String(this.$store.state.user.id || Date.now());
const uName = (this.$store.state.user.name || '用户').trim();
console.log(roomId, uid, uName)
window.hirtcwebsdk.addListener('joined', () => {
this.$message.success('加入会议成功');
this.updateParticipantCount();
// // console.log(roomId, uid, uName)
window.hirtcwebsdk.addListener('joined', userList => {
userList.forEach(user => {
const { userID, streams } = user
console.log(userID, streams)
})
});
window.hirtcwebsdk.join(this.$route.query.roomId_id, uid, uName);
window.hirtcwebsdk.join(this.$route.query.roomId_id, uid, this.$store.state.user.userInfo.name);
// window.hirtcwebsdk.join(this.userID, this.roomID, );
// window.hirtcwebsdk.addListener('user-joined', this.updateParticipantCount);
// window.hirtcwebsdk.addListener('user-left', this.updateParticipantCount);
},
join() {
window.hirtcwebsdk.addListener('user-joined', this.updateParticipantCount);
window.hirtcwebsdk.addListener('user-left', this.updateParticipantCount);
},
publish() {
//
if (!this.isJoined) {
this.$message({
message: "请进房成功后,再发布",
type: "warning",
});
return;
}
// init() initLocalStream()
// publish() => published
if (this.localCameraStream.isPreviewed) {
window.hirtcwebsdk.publish(this.localCameraStream.type);
} else {
this.$message({
message: "没有预览成功,请检查设备",
type: "warning",
});
}
},
bindEvent() {
// window.hirtcwebsdk.addListener("permission", this.handlePermission); //
// window.hirtcwebsdk.addListener("deviceList", this.handleDeviceList); //
// window.hirtcwebsdk.addListener("deviceChanged", this.handleDeviceChanged); //
window.hirtcwebsdk.addListener("joined", this.handleJoined); //
console.log(111111111)
// window.hirtcwebsdk.addListener("camera", this.handleCameraPreview); //
// window.hirtcwebsdk.addListener("screen", this.handleSreenPreview); //
// window.hirtcwebsdk.addListener("cameraEx", this.handleCameraExPreview); //
// window.hirtcwebsdk.addListener("published", this.handlePublished); // /
// window.hirtcwebsdk.addListener("publishedEx", this.handlePublishedEx); // /
// window.hirtcwebsdk.addListener("subscribed", this.handleSubscribed); //
// window.hirtcwebsdk.addListener("someoneJoined", this.handleSomeoneJoined); //
// window.hirtcwebsdk.addListener("someoneLeft", this.handleSomeoneLeft); //
// window.hirtcwebsdk.addListener("streamAdded", this.handleStreamAdded); //
// window.hirtcwebsdk.addListener("streamRemoved", this.handleStreamRemoved); //
// window.hirtcwebsdk.addListener("streamUpdated", this.handleStreamUpdated); //
// window.hirtcwebsdk.addListener("disconnected", this.handleDisconnected); // ,,
// window.hirtcwebsdk.addListener("reconnected", this.handleReconnected); //
// window.hirtcwebsdk.addListener("error", this.handleError); //
},
handleDeviceList(info) {
if (!info) {
return;
}
const newDevice = JSON.parse(JSON.stringify(info));
if (!this.device.isInit) {
this.device.audio = newDevice.audioinput;
this.device.video = newDevice.videoinput;
this.device.output = newDevice.audiooutput;
this.device.isInit = true;
this.initLocalStream(this.localCameraStream.type);
this.initLocalStream(this.localCameraStreamEx.tag);
} else {
// TODO device newDevice ,,
}
},
handleJoined(users) {
console.log("handleJoined>>>>>>>>>>>>>")
this.joinRetry = 0;
if (users && users.length > 0) {
this.userList = users;
users.forEach((user) => {
if (user.streams && user.streams.length > 0) {
user.streams.forEach((stream) => {
this.subscribe({
...stream,
userID: user.userID,
});
});
}
});
}
//
this.userList.unshift({
userID: `${this.userID}(我)`,
});
this.isJoined = true;
this.$message({
message: "进房成功",
type: "success",
});
//
if (this.localCameraStream.isPreviewed) {
this.publish();
}
},
// ==================== 2 + ====================
@ -1481,6 +1698,25 @@ export default {
.left-section {
margin-right: 20px;
display: flex;
align-items: center;
gap: 12px;
.patient-info {
color: white;
font-size: 13px;
.patient-field {
display: flex;
align-items: center;
gap: 2px;
label {
color: #80cbc4;
font-weight: 400;
}
}
}
}
.tools-section {

Loading…
Cancel
Save