提交 5690a4ca 编写于 作者: 张磊's avatar 张磊

Merge branch 'feature/zl' into 'release'

test live status info

See merge request !226
......@@ -62,6 +62,13 @@ export const messageHistory = async (data) => {
});
};
export const getOnlineStatus = async (roomId) => {
return request({
url: `/coupler/trtc/room/online/userList?roomId=${roomId}`,
method: 'get',
});
};
export const messageSend = async (data) => {
return request({
url: '/im/team/op/message/send',
......
......@@ -123,6 +123,7 @@
callDirect,
usersigTrtc,
diagnoseEndCall,
getOnlineStatus,
} from '@/api/diagnosis';
export default {
......@@ -159,16 +160,13 @@
answerTime: 0, // 接诊医生接入时长
useTime: 0, // 问诊时长
loseTime: 0, // 问诊剩余时长
askTimeFn: null,
answerTimeFn: null,
useTimeFn: null,
loseTimeFn: null,
timerOfStatus: null,
type: 1, // 1: 语音 2: 视频
startTime: 0,
endTime: 0,
time: 30, // 总时长
memberList: [],
tid: '', // 群id
diagnoseLogId: '', // 问诊id
isMuted: true,
liveInfoSave: {},
......@@ -196,10 +194,11 @@
watch: {
currentChat(newVal, oldVal) {
if (newVal !== oldVal && newVal.imTeamId) {
const { imTeamId, diagnoseLogId } = this.currentChat;
this.tid = imTeamId;
const { diagnoseLogId } = this.currentChat;
this.diagnoseLogId = diagnoseLogId;
this.init();
} else {
clearInterval(this.timerOfStatus);
}
},
},
......@@ -222,6 +221,7 @@
// 获取视频参数
this.getViedoParams();
this.getInfo(); // 获取用户信息列表
this.getOnlineStatus(); // 实时获取用户状态
},
toggleVol() {
if (this.isMuted) {
......@@ -239,7 +239,6 @@
if (data.role == 2 && this.userTrtcEntryStatus != 2) {
return false;
}
console.log('--this.roomId', this.currentChat, data, this.roomId);
const params = {
imAccId: data.accId,
imTeamId: this.currentChat.imTeamId,
......@@ -304,7 +303,6 @@
.catch(() => {
this.$message.error('未获取到相关信息');
this.memberList = [];
// this.getErr();
});
},
// 获取AppId
......@@ -548,21 +546,6 @@
this.muteLocalAudio();
this.rtc.leave();
this.clearSession();
// window.location.href = 'about:blank';
// window.close();
},
// 结束会话
overFn() {
this.$refs.alert
.init({
cancleTxt: '取消',
confirmTxt: '我知道了',
title: '确定要结束会话么?',
})
.then(() => {
this.out();
})
.catch(() => {});
},
out() {
diagnoseEndCall({
......@@ -611,9 +594,6 @@
});
},
clearTime() {
clearInterval(this.askTimeFn);
clearInterval(this.answerTimeFn);
clearInterval(this.useTimeFn);
clearInterval(this.loseTimeFn);
this.isMuted = true;
},
......@@ -629,6 +609,38 @@
checkChrome() {
return getBroswer().broswer == 'Chrome';
},
getOnlineStatus() {
const { roomId } = this.currentChat;
const that = this;
this.timerOfStatus = setInterval(function () {
getOnlineStatus(roomId).then((res) => {
const l = res.data;
console.log('res==', res, that.memberList);
if (
l &&
l.length > 0 &&
that.memberList &&
that.memberList.length > 0
) {
that.memberList.map((i) => {
if (l.includes[i]) {
// 在线 更新状态
that.addNewMember(i.liveUserId);
} else {
// 不在线 更新状态
if (i.role == 1 && that.doctorTrtcEntryStatus != 3) {
that.addNewMember(i.liveUserId);
}
if (i.role == 2 && that.userTrtcEntryStatus != 3) {
that.addNewMember(i.liveUserId);
}
}
});
}
});
}, 2000);
},
},
};
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册