hh-doctor-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/apis/api-host-define.js +69 -0
- package/components/apis/consultation-reply-api.js +21 -0
- package/components/apis/dicom-api.js +31 -0
- package/components/apis/family-api.js +20 -0
- package/components/apis/file-upload-api.js +35 -0
- package/components/apis/order-app-api.js +206 -0
- package/components/apis/stat-log-api.js +42 -0
- package/components/apis/video-chat-log-api.js +47 -0
- package/components/apis/video-message-api.js +88 -0
- package/components/consultation/detail/behaviors/chat-cell-base-behaviors.js +29 -0
- package/components/consultation/detail/behaviors/consultation-behaviors.js +60 -0
- package/components/consultation/detail/behaviors/consultation-chat-behaviors.js +321 -0
- package/components/consultation/detail/behaviors/consultation-header-media-behaviors.js +176 -0
- package/components/consultation/detail/behaviors/consultation-header-text-behaviors.js +325 -0
- package/components/consultation/detail/behaviors/consultation-reply-behaviors.js +67 -0
- package/components/consultation/detail/consultation-detail-page.js +219 -0
- package/components/consultation/detail/consultation-detail-page.json +10 -0
- package/components/consultation/detail/consultation-detail-page.wxml +65 -0
- package/components/consultation/detail/consultation-detail-page.wxss +51 -0
- package/components/consultation/detail/widget/case-image-filter.js +47 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.js +31 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.json +4 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxml +17 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxss +9 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +100 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.json +4 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxml +24 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxss +54 -0
- package/components/consultation/detail/widget/chat-bottom/chat-menu-builder.js +131 -0
- package/components/consultation/detail/widget/chat-cell-template/chat-cell-template.wxml +173 -0
- package/components/consultation/detail/widget/chat-cell.wxss +394 -0
- package/components/consultation/detail/widget/detail-media/detail-media.js +47 -0
- package/components/consultation/detail/widget/detail-media/detail-media.json +4 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxml +12 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxss +57 -0
- package/components/consultation/detail/widget/detail-text/detail-text.js +31 -0
- package/components/consultation/detail/widget/detail-text/detail-text.json +4 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxml +6 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxss +14 -0
- package/components/consultation/evaluate/evaluate-page.js +157 -0
- package/components/consultation/evaluate/evaluate-page.json +3 -0
- package/components/consultation/evaluate/evaluate-page.wxml +42 -0
- package/components/consultation/evaluate/evaluate-page.wxss +103 -0
- package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +144 -0
- package/components/consultation/list/consultation-list-page.js +84 -0
- package/components/consultation/list/consultation-list-page.json +5 -0
- package/components/consultation/list/consultation-list-page.wxml +53 -0
- package/components/consultation/list/consultation-list-page.wxss +105 -0
- package/components/consultation/reply/behaviors/reply-base-behaviors.js +175 -0
- package/components/consultation/reply/consultation-reply-page.js +251 -0
- package/components/consultation/reply/consultation-reply-page.json +6 -0
- package/components/consultation/reply/consultation-reply-page.wxml +103 -0
- package/components/consultation/reply/consultation-reply-page.wxss +169 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.js +144 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.json +4 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxml +27 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxss +197 -0
- package/components/hh-doctor.js +36 -0
- package/components/hh-navigation.js +87 -0
- package/components/public/app-config.js +13 -0
- package/components/public/behaviors/order-base-behaviors.js +53 -0
- package/components/public/cache-data.js +134 -0
- package/components/public/doctor-loader.js +60 -0
- package/components/public/im-manager.js +135 -0
- package/components/public/pdf-viewer.js +59 -0
- package/components/public/stat-log.js +13 -0
- package/components/static/Agora_Miniapp_SDK_for_WeChat.js +2 -0
- package/components/static/trtc-wx.js +2 -0
- package/components/uikit/css/common.wxss +23 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.js +37 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.json +4 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxml +9 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxss +79 -0
- package/components/uikit/date-time-picker/date-time-picker.js +115 -0
- package/components/uikit/web-view-page/web-view-page.js +87 -0
- package/components/uikit/web-view-page/web-view-page.json +3 -0
- package/components/uikit/web-view-page/web-view-page.wxml +6 -0
- package/components/uikit/web-view-page/web-view-page.wxss +1 -0
- package/components/utils/checksumUtils.js +56 -0
- package/components/utils/common-utils.js +59 -0
- package/components/utils/dateUtils.js +142 -0
- package/components/utils/eventBus.js +77 -0
- package/components/utils/httpUtils.js +123 -0
- package/components/utils/number-utils.js +48 -0
- package/components/utils/permission-utils.js +164 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.js +106 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.json +4 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +24 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +92 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.json +4 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +22 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-rtc.js +391 -0
- package/components/video-chat/agora-rtc/agora-rtc.json +7 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxml +39 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxss +1 -0
- package/components/video-chat/callback/callback.js +39 -0
- package/components/video-chat/callback/callback.json +4 -0
- package/components/video-chat/callback/callback.wxml +29 -0
- package/components/video-chat/callback/callback.wxss +26 -0
- package/components/video-chat/calling/calling.js +75 -0
- package/components/video-chat/calling/calling.json +4 -0
- package/components/video-chat/calling/calling.wxml +32 -0
- package/components/video-chat/calling/calling.wxss +45 -0
- package/components/video-chat/controller/controller.js +86 -0
- package/components/video-chat/controller/controller.json +4 -0
- package/components/video-chat/controller/controller.wxml +73 -0
- package/components/video-chat/controller/controller.wxss +71 -0
- package/components/video-chat/remote-player/remote-player.js +42 -0
- package/components/video-chat/remote-player/remote-player.json +4 -0
- package/components/video-chat/remote-player/remote-player.wxml +37 -0
- package/components/video-chat/remote-player/remote-player.wxss +1 -0
- package/components/video-chat/video-chat.js +297 -0
- package/components/video-chat/video-chat.json +7 -0
- package/components/video-chat/video-chat.wxml +56 -0
- package/components/video-chat/video-chat.wxss +97 -0
- package/components/video-chat-page/behaviors/chat-files-behaviors.js +243 -0
- package/components/video-chat-page/behaviors/chat-log-behaviors.js +90 -0
- package/components/video-chat-page/behaviors/chat-sound-behaviors.js +60 -0
- package/components/video-chat-page/behaviors/video-chat-behaviors.js +524 -0
- package/components/video-chat-page/case-group-view/case-group-view.js +38 -0
- package/components/video-chat-page/case-group-view/case-group-view.json +4 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxml +32 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxss +44 -0
- package/components/video-chat-page/video-chat-defines.js +39 -0
- package/components/video-chat-page/video-chat-page.js +212 -0
- package/components/video-chat-page/video-chat-page.json +14 -0
- package/components/video-chat-page/video-chat-page.wxml +88 -0
- package/components/video-chat-page/video-chat-page.wxss +45 -0
- package/package.json +18 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
const api = require('../../apis/order-app-api')
|
|
2
|
+
const message_api = require('../../apis/video-message-api')
|
|
3
|
+
const family_api = require('../../apis/family-api')
|
|
4
|
+
const checkPermission = require('../../utils/permission-utils')
|
|
5
|
+
const cache = require('../../public/cache-data')
|
|
6
|
+
const dicomApi = require('../../apis/dicom-api')
|
|
7
|
+
|
|
8
|
+
const defines = require('../video-chat-defines')
|
|
9
|
+
|
|
10
|
+
module.exports = Behavior({
|
|
11
|
+
|
|
12
|
+
behaviors: [
|
|
13
|
+
require('../../public/behaviors/order-base-behaviors'),
|
|
14
|
+
require('./chat-log-behaviors'),
|
|
15
|
+
require('./chat-sound-behaviors'),
|
|
16
|
+
require('./chat-files-behaviors')
|
|
17
|
+
],
|
|
18
|
+
/**
|
|
19
|
+
* 页面的初始数据
|
|
20
|
+
*/
|
|
21
|
+
data: {
|
|
22
|
+
callback: false, // 是否是专家回拨
|
|
23
|
+
order: null, // 订单数据
|
|
24
|
+
isFamilyOrder: false, // 是否为视频医生单子
|
|
25
|
+
isFromAgora: false, // 是否是声网来源的单子
|
|
26
|
+
expert: null, // 专家回拨时用到的专家数据
|
|
27
|
+
roomID: null,
|
|
28
|
+
videoStatus: 'calling',
|
|
29
|
+
startChatTime: false,
|
|
30
|
+
smallVideoTop: 0,
|
|
31
|
+
userDidInRoom: false,
|
|
32
|
+
doctorInfoMap: {},
|
|
33
|
+
userIdList: [],
|
|
34
|
+
hangupType: null,
|
|
35
|
+
newCases: false,
|
|
36
|
+
isInVoice: false,
|
|
37
|
+
expertAvatar: null,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
methods: {
|
|
41
|
+
/**
|
|
42
|
+
* 进入视频界面先加载订单
|
|
43
|
+
*/
|
|
44
|
+
loadOrderInfo() {
|
|
45
|
+
this.loadOrder(() => {
|
|
46
|
+
const order = this.data.order
|
|
47
|
+
const isFamilyOrder = order.patient.patientUuid != undefined && order.patient.patientUuid > 0
|
|
48
|
+
let expertAvatar = null
|
|
49
|
+
if (order.orderService.expertList && order.orderService.expertList.length > 0) {
|
|
50
|
+
expertAvatar = order.orderService.expertList[0].photourl
|
|
51
|
+
}
|
|
52
|
+
this.setData({
|
|
53
|
+
isFamilyOrder: isFamilyOrder,
|
|
54
|
+
isFromAgora: order.actionSource.toLowerCase().includes('srtc'),
|
|
55
|
+
expertAvatar: expertAvatar,
|
|
56
|
+
})
|
|
57
|
+
this.loadDicom()
|
|
58
|
+
this.loadRoomData()
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
loadDicom() {
|
|
63
|
+
wx.statLog.sendStatLog(null, '获取订单中的DICOM数据')
|
|
64
|
+
dicomApi.getDicom(this.data.orderId).then((res) => {
|
|
65
|
+
wx.statLog.sendStatLog(null, '获取订单中的DICOM数据完成')
|
|
66
|
+
if (res.status == 200 && res.data && res.data.list && res.data.list.length > 0) {
|
|
67
|
+
this.setData({
|
|
68
|
+
dicoms: res.data.list
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}).catch((err) => {
|
|
72
|
+
wx.statLog.sendStatLog(null, `获取订单中的DICOM数据失败(${JSON.stringify(err)})`)
|
|
73
|
+
})
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 加载房间号
|
|
78
|
+
*/
|
|
79
|
+
loadRoomData() {
|
|
80
|
+
wx.statLog.sendStatLog(null, '在获取房间号之前检测是否开启了音视频权限')
|
|
81
|
+
const orderId = this.data.orderId
|
|
82
|
+
checkPermission.checkMediaPermission().then(() => {
|
|
83
|
+
wx.statLog.sendStatLog(null, '开始获取房间号')
|
|
84
|
+
api.getRoomId(orderId).then((res) => {
|
|
85
|
+
this.setData({
|
|
86
|
+
roomID: res.data.roomId
|
|
87
|
+
}, () => {
|
|
88
|
+
wx.statLog.sendStatLog(null, `获取房间号完成${JSON.stringify({roomID: this.data.roomID})}`)
|
|
89
|
+
if (!this.data.callback) {
|
|
90
|
+
this._enterRoom(res.data.roomId)
|
|
91
|
+
} else {
|
|
92
|
+
this.loadExpertInfo()
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}).catch(() => {
|
|
97
|
+
wx.statLog.sendStatLog(null, '用户未授权音视频权限直接退出页面')
|
|
98
|
+
this.sendPermissionFailed()
|
|
99
|
+
this._directHangup()
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* 加载专家数据
|
|
104
|
+
*/
|
|
105
|
+
loadExpertInfo() {
|
|
106
|
+
if (this.data.callback) {
|
|
107
|
+
wx.statLog.sendStatLog(null, '专家回拨后开始获取专家数据并显示回拨界面')
|
|
108
|
+
const order = this.data.order
|
|
109
|
+
var expertId = order.expertid
|
|
110
|
+
const expertList = order.orderService.expertList
|
|
111
|
+
if (expertList && Array.isArray(expertList) && expertList.length > 0) {
|
|
112
|
+
expertId = expertList[expertList.length - 1].expertid
|
|
113
|
+
}
|
|
114
|
+
api.getExpertInfo(expertId).then((res) => {
|
|
115
|
+
wx.statLog.sendStatLog(null, '获取专家数据完成并显示回拨界面')
|
|
116
|
+
if (res) {
|
|
117
|
+
this.setData({
|
|
118
|
+
expert: res.data
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
}).catch((err) => {
|
|
122
|
+
wx.statLog.sendStatLog(null, `获取专家数据失败(${JSON.stringify(err)})`)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
_enterRoom(roomID) {
|
|
127
|
+
if (this.data.isFromAgora) {
|
|
128
|
+
wx.statLog.sendStatLog(null, '开始进房(声网RTC)')
|
|
129
|
+
this.selectComponent('#artc').enterRoom(roomID)
|
|
130
|
+
} else {
|
|
131
|
+
wx.statLog.sendStatLog(null, '开始进房(腾讯RTC)')
|
|
132
|
+
this.selectComponent('#trtc').enterRoom(roomID)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
_exitRoom() {
|
|
138
|
+
if (this.data.isFromAgora) {
|
|
139
|
+
wx.statLog.sendStatLog(null, '退出房间(声网RTC)')
|
|
140
|
+
this.selectComponent('#artc').exitRoom()
|
|
141
|
+
} else {
|
|
142
|
+
wx.statLog.sendStatLog(null, '退出房间(腾讯RTC)')
|
|
143
|
+
this.selectComponent('#trtc').exitRoom()
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
_updateVideoState(params) {
|
|
148
|
+
const status = params.detail
|
|
149
|
+
// 如果更新的新状态和现有状态一致则无需再次更新
|
|
150
|
+
if (this.data.videoStatus === status) {
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
if (status === defines.videoStatus.chatting) {
|
|
154
|
+
wx.statLog.sendStatLog(null, '切换到视频中界面')
|
|
155
|
+
if (!this.data.callback) { // 只有专家主动呼叫需要发送开始视频日志
|
|
156
|
+
wx.statLog.sendStatLog(null, '发送了视频开始的日志')
|
|
157
|
+
this.sendStart()
|
|
158
|
+
}
|
|
159
|
+
this.stopCallRing()
|
|
160
|
+
this.setData({
|
|
161
|
+
startChatTime: true
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
this.setData({
|
|
165
|
+
videoStatus: status
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 呼叫时点击取消
|
|
171
|
+
*/
|
|
172
|
+
_controllerCancel() {
|
|
173
|
+
wx.statLog.sendStatLog(null, `${cache.doctorName()}点击取消呼叫`)
|
|
174
|
+
this._sendLog(`${cache.doctorName()}取消呼叫`)
|
|
175
|
+
this._cancelCall()
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 专家回拨接听
|
|
180
|
+
*/
|
|
181
|
+
_controllerAccept() {
|
|
182
|
+
wx.statLog.sendStatLog(null, `${cache.doctorName()}点击接听`)
|
|
183
|
+
this._sendLog('点击接听')
|
|
184
|
+
const roomID = this.data.roomID
|
|
185
|
+
this._updateVideoState({
|
|
186
|
+
detail: defines.videoStatus.chatting
|
|
187
|
+
})
|
|
188
|
+
this.enterRoom(roomID)
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 专家回拨主动拒绝接听
|
|
193
|
+
*/
|
|
194
|
+
_controllerReject() {
|
|
195
|
+
wx.statLog.sendStatLog(null, `${cache.doctorName()}拒绝接听`)
|
|
196
|
+
this._sendLog('点击拒绝')
|
|
197
|
+
this._reject()
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// 点击发送呼叫通知
|
|
201
|
+
_controllerNotifyCall() {
|
|
202
|
+
wx.statLog.sendStatLog(null, '手动发送呼叫通知消息')
|
|
203
|
+
this.sendCallMessage().then(() => {
|
|
204
|
+
wx.statLog.sendStatLog(null, '手动发送呼叫通知消息成功')
|
|
205
|
+
wx.showToast({
|
|
206
|
+
title: '已成功通知对方接听',
|
|
207
|
+
})
|
|
208
|
+
}).catch(() => {
|
|
209
|
+
wx.statLog.sendStatLog(null, '手动发送呼叫通知消息失败')
|
|
210
|
+
wx.showToast({
|
|
211
|
+
title: '通知失败,对方可能无法加入视频',
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 切换语音和视频状态
|
|
218
|
+
*/
|
|
219
|
+
_controllerChangeVoiceVideo() {
|
|
220
|
+
const isInVoice = !this.data.isInVoice
|
|
221
|
+
this.setData({
|
|
222
|
+
isInVoice: isInVoice,
|
|
223
|
+
})
|
|
224
|
+
const isFromAgora = this.data.isFromAgora
|
|
225
|
+
message_api.bindData({
|
|
226
|
+
'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
227
|
+
'orderId': this.data.orderId
|
|
228
|
+
})
|
|
229
|
+
wx.statLog.sendStatLog(null, `切换语音视频,切换为${isInVoice ? '音频' : '视频'}`)
|
|
230
|
+
if (this.data.isFromAgora) {
|
|
231
|
+
wx.statLog.sendStatLog(null, '切换语音视频(声网RTC)')
|
|
232
|
+
this.selectComponent('#artc').switchAudioVideo(isInVoice)
|
|
233
|
+
} else {
|
|
234
|
+
wx.statLog.sendStatLog(null, '切换语音视频(腾讯RTC)')
|
|
235
|
+
this.selectComponent('#trtc').switchAudioVideo(isInVoice)
|
|
236
|
+
}
|
|
237
|
+
if (isInVoice) {
|
|
238
|
+
message_api.sendSwitch2Audio(isFromAgora)
|
|
239
|
+
} else {
|
|
240
|
+
message_api.sendSwitch2Video(isFromAgora)
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* 查看病历图片
|
|
246
|
+
*/
|
|
247
|
+
// _controllerCheckCase() {
|
|
248
|
+
// wx.statLog.sendStatLog(null, '点击查看图片病历资料')
|
|
249
|
+
// this.viewOrderCase()
|
|
250
|
+
// },
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 查看病历PDF
|
|
254
|
+
*/
|
|
255
|
+
// _controllerCheckPdf() {
|
|
256
|
+
// wx.statLog.sendStatLog(null, '点击查看PDF病历资料')
|
|
257
|
+
// this.viewPdfFiles()
|
|
258
|
+
// },
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* 查看病历DICOM
|
|
262
|
+
*/
|
|
263
|
+
// _controllerCheckDicom() {
|
|
264
|
+
// wx.statLog.sendStatLog(null, '点击查看DICOM病历资料')
|
|
265
|
+
// this.viewDicoms()
|
|
266
|
+
// },
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* 视频中挂断
|
|
270
|
+
*/
|
|
271
|
+
_controllerHangup() {
|
|
272
|
+
wx.statLog.sendStatLog(null, '点击挂断视频通话')
|
|
273
|
+
this.hangup(defines.hangupTypes.hangup)
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 切换摄像头
|
|
278
|
+
*/
|
|
279
|
+
// _switchCamera() {
|
|
280
|
+
// wx.statLog.sendStatLog(null, '切换摄像头')
|
|
281
|
+
// if (this.data.isFromAgora) {
|
|
282
|
+
// this.selectComponent('#artc').switchCamera()
|
|
283
|
+
// } else {
|
|
284
|
+
// this.selectComponent('#trtc').switchCamera()
|
|
285
|
+
// }
|
|
286
|
+
// },
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 主动呼叫时取消呼叫
|
|
290
|
+
*/
|
|
291
|
+
_cancelCall() {
|
|
292
|
+
wx.statLog.sendStatLog(null, '点击取消视频通话')
|
|
293
|
+
if (this.data.order) {
|
|
294
|
+
this.hangup(defines.hangupTypes.cancel)
|
|
295
|
+
} else {
|
|
296
|
+
this._directHangup()
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
_viewCase() {
|
|
302
|
+
this.setData({
|
|
303
|
+
newCases: false
|
|
304
|
+
})
|
|
305
|
+
this.loadFiles(this.data.order, () => {
|
|
306
|
+
wx.hideLoading()
|
|
307
|
+
this.selectComponent('#casePop').show()
|
|
308
|
+
})
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* 对方拒绝接听
|
|
313
|
+
*/
|
|
314
|
+
_reject() {
|
|
315
|
+
wx.statLog.sendStatLog(null, '点击拒绝视频通话')
|
|
316
|
+
if (this.data.isFromAgora) {
|
|
317
|
+
this.selectComponent('#artc').setPusherAttributesHandler({
|
|
318
|
+
enableMic: false,
|
|
319
|
+
enableMic: false
|
|
320
|
+
})
|
|
321
|
+
} else {
|
|
322
|
+
this.selectComponent('#trtc').setPusherAttributesHandler({
|
|
323
|
+
enableMic: false,
|
|
324
|
+
enableMic: false
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
this.hangup(defines.hangupTypes.reject)
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* 发送呼叫消息
|
|
332
|
+
*/
|
|
333
|
+
sendCallMessage() {
|
|
334
|
+
wx.statLog.sendStatLog(null, '发送呼叫消息')
|
|
335
|
+
return new Promise((resolve, reject) => {
|
|
336
|
+
message_api.bindData({
|
|
337
|
+
'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
338
|
+
'orderId': this.data.orderId
|
|
339
|
+
})
|
|
340
|
+
message_api.sendCall().then((res) => {
|
|
341
|
+
if (res.status == 200) {
|
|
342
|
+
resolve()
|
|
343
|
+
wx.statLog.sendStatLog(null, '发送呼叫消息成功')
|
|
344
|
+
this.sendCallSuccess()
|
|
345
|
+
} else {
|
|
346
|
+
wx.statLog.sendStatLog(null, '发送呼叫消息失败')
|
|
347
|
+
this.sendCallFailed()
|
|
348
|
+
reject()
|
|
349
|
+
}
|
|
350
|
+
}).catch((e) => {
|
|
351
|
+
wx.statLog.sendStatLog(null, `发送呼叫消息异常(${JSON.stringify(e)})`)
|
|
352
|
+
this.sendCallFailed()
|
|
353
|
+
reject()
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* 发送取消呼叫消息
|
|
360
|
+
*/
|
|
361
|
+
sendCancelMessage() {
|
|
362
|
+
wx.statLog.sendStatLog(null, '发送取消呼叫消息')
|
|
363
|
+
message_api.bindData({
|
|
364
|
+
'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
365
|
+
'orderId': this.data.orderId
|
|
366
|
+
})
|
|
367
|
+
return message_api.sendCancel()
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* 发送拒绝呼叫消息
|
|
372
|
+
*/
|
|
373
|
+
sendRejectMessage() {
|
|
374
|
+
wx.statLog.sendStatLog(null, '发送拒绝呼叫消息')
|
|
375
|
+
message_api.bindData({
|
|
376
|
+
'toUUID': this.data.expert.uuid,
|
|
377
|
+
'orderId': this.orderId
|
|
378
|
+
})
|
|
379
|
+
return message_api.sendReject()
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
hangup(type) {
|
|
383
|
+
switch (type) {
|
|
384
|
+
case defines.hangupTypes.reject: // 收到回拨拒绝
|
|
385
|
+
wx.statLog.sendStatLog(null, '拒绝接听')
|
|
386
|
+
this.sendRejectMessage()
|
|
387
|
+
this.setData({
|
|
388
|
+
hangupType: defines.hangupTypes.reject,
|
|
389
|
+
}, () => {
|
|
390
|
+
this._directHangup()
|
|
391
|
+
})
|
|
392
|
+
break
|
|
393
|
+
case defines.hangupTypes.cancel: // 取消视频呼叫
|
|
394
|
+
wx.statLog.sendStatLog(null, '取消视频通话呼叫')
|
|
395
|
+
this.sendCancelMessage()
|
|
396
|
+
this.setData({
|
|
397
|
+
hangupType: defines.hangupTypes.cancel,
|
|
398
|
+
}, () => {
|
|
399
|
+
this._exitRoom()
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
break
|
|
403
|
+
case defines.hangupTypes.hangup: // 主动挂断视频
|
|
404
|
+
wx.statLog.sendStatLog(null, '正常挂断视频通话')
|
|
405
|
+
this.setData({
|
|
406
|
+
hangupType: defines.hangupTypes.hangup,
|
|
407
|
+
}, () => {
|
|
408
|
+
this._exitRoom()
|
|
409
|
+
})
|
|
410
|
+
break
|
|
411
|
+
case defines.hangupTypes.otherCancel: // 专家回拨的时候专家侧取消
|
|
412
|
+
wx.statLog.sendStatLog(null, '专家已经取消视频呼叫')
|
|
413
|
+
this.setData({
|
|
414
|
+
hangupType: defines.hangupTypes.otherCancel,
|
|
415
|
+
}, () => {
|
|
416
|
+
this._directHangup()
|
|
417
|
+
})
|
|
418
|
+
break
|
|
419
|
+
case defines.hangupTypes.otherReject: // 对方拒绝接听
|
|
420
|
+
wx.statLog.sendStatLog(null, '对方拒绝接听视频呼叫')
|
|
421
|
+
this.sendRefuse() //发送对方拒绝的日志
|
|
422
|
+
hType = defines.hangupTypes.otherReject
|
|
423
|
+
this.setData({
|
|
424
|
+
hangupType: defines.hangupTypes.otherReject,
|
|
425
|
+
}, () => {
|
|
426
|
+
this._exitRoom()
|
|
427
|
+
})
|
|
428
|
+
break
|
|
429
|
+
default:
|
|
430
|
+
break
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* 直接挂断退出界面
|
|
436
|
+
*/
|
|
437
|
+
_directHangup() {
|
|
438
|
+
if (!this.data.callback && this.data.startChatTime) {
|
|
439
|
+
wx.statLog.sendStatLog(null, '发送完成订单日志')
|
|
440
|
+
this.sendEnd() // 发送完成订单日志
|
|
441
|
+
}
|
|
442
|
+
let tips = '视频已挂断'
|
|
443
|
+
if (this.data.hangupType) {
|
|
444
|
+
switch (this.data.hangupType) {
|
|
445
|
+
case defines.hangupTypes.cancel: // 取消视频呼叫
|
|
446
|
+
tips = '视频呼叫已取消'
|
|
447
|
+
break
|
|
448
|
+
case defines.hangupTypes.otherCancel: // 专家回拨的时候专家侧取消
|
|
449
|
+
tips = '对方已取消呼叫'
|
|
450
|
+
break
|
|
451
|
+
case defines.hangupTypes.otherReject: // 对方拒绝接听
|
|
452
|
+
tips = '对方拒已绝接视频通话'
|
|
453
|
+
break
|
|
454
|
+
default:
|
|
455
|
+
break
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
wx.showToast({
|
|
459
|
+
icon: 'none',
|
|
460
|
+
title: tips,
|
|
461
|
+
})
|
|
462
|
+
this.playHangup()
|
|
463
|
+
setTimeout(() => {
|
|
464
|
+
wx.navigateBack()
|
|
465
|
+
}, 800);
|
|
466
|
+
},
|
|
467
|
+
|
|
468
|
+
_onRemoteUserJoin(data) {
|
|
469
|
+
const userId = data.detail
|
|
470
|
+
wx.statLog.sendStatLog(null, `远端用户加入房间${JSON.stringify({userId: userId})}`)
|
|
471
|
+
if (!this.data.userIdList.includes(userId)) {
|
|
472
|
+
this.data.userIdList.push(userId)
|
|
473
|
+
}
|
|
474
|
+
this._getDoctorInfo(userId)
|
|
475
|
+
const isExpertSelf = cache.doctorId() === this.data.order.expertid
|
|
476
|
+
if (isExpertSelf && userId == this.data.order.doctorUuid) {
|
|
477
|
+
this.setData({
|
|
478
|
+
userDidInRoom: true
|
|
479
|
+
})
|
|
480
|
+
wx.statLog.sendStatLog(null, `专家和用户视频成功`)
|
|
481
|
+
this._sendLog('专家和用户视频成功')
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
_onRemoteUserLeave(data) {
|
|
486
|
+
const userId = data.detail
|
|
487
|
+
wx.statLog.sendStatLog(null, `远端用户离开房间${JSON.stringify({userId: userId})}`)
|
|
488
|
+
const newList = []
|
|
489
|
+
this.data.userIdList.forEach((element) => {
|
|
490
|
+
if (userId !== element) {
|
|
491
|
+
newList.push(element)
|
|
492
|
+
}
|
|
493
|
+
})
|
|
494
|
+
this.data.userIdList = newList
|
|
495
|
+
// 所有远端用户退出房间后,需要检测是不是医助退出房间,
|
|
496
|
+
// 如果医助退出房间的时候用户并没有和专家视频则专家此时不挂断,如果用户和专家视频过了医助退出房间专家直接挂断
|
|
497
|
+
if (this.data.userIdList.length === 0) {
|
|
498
|
+
const doctor = this.data.doctorInfoMap[userId]
|
|
499
|
+
if (this.data.userDidInRoom || doctor == null || !doctor.hasAid) {
|
|
500
|
+
wx.statLog.sendStatLog(null, `用户和专家视频完成退出房间${JSON.stringify({userId: userId})}`)
|
|
501
|
+
this._exitRoom()
|
|
502
|
+
} else {
|
|
503
|
+
wx.statLog.sendStatLog(null, `医助退出房间(${userId}),重新进入呼叫界面`)
|
|
504
|
+
this.setData({
|
|
505
|
+
videoStatus: defines.videoStatus.calling
|
|
506
|
+
})
|
|
507
|
+
this.playCallRing()
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
_getDoctorInfo(userId) {
|
|
513
|
+
if (!this.data.doctorInfoMap[userId]) {
|
|
514
|
+
family_api.getDoctorInfo(userId).then((res) => {
|
|
515
|
+
if (res.status === 200 && res.data) {
|
|
516
|
+
this.data.doctorInfoMap[userId] = res.data
|
|
517
|
+
}
|
|
518
|
+
}).catch((err) => {
|
|
519
|
+
|
|
520
|
+
})
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// components/video-chat-page/case-group-view/case-group-view.js
|
|
2
|
+
Component({
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 组件的属性列表
|
|
6
|
+
*/
|
|
7
|
+
properties: {
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
value: ''
|
|
11
|
+
},
|
|
12
|
+
files: {
|
|
13
|
+
type: Array,
|
|
14
|
+
value: []
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 组件的初始数据
|
|
20
|
+
*/
|
|
21
|
+
data: {
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 组件的方法列表
|
|
27
|
+
*/
|
|
28
|
+
methods: {
|
|
29
|
+
clickMedia: function (e) {
|
|
30
|
+
const type = e.currentTarget.dataset.type
|
|
31
|
+
const url = e.currentTarget.dataset.url
|
|
32
|
+
this.triggerEvent('clickMedia', {
|
|
33
|
+
type: type,
|
|
34
|
+
url: url
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<view class="group-route">
|
|
2
|
+
<view class="case-group-title">{{title}}</view>
|
|
3
|
+
<scroll-view
|
|
4
|
+
wx:if="{{files.length > 0}}"
|
|
5
|
+
type="list"
|
|
6
|
+
scroll-x="true"
|
|
7
|
+
class="case-files-scroll-view"
|
|
8
|
+
enable-flex="true"
|
|
9
|
+
>
|
|
10
|
+
<view class="case-files-box">
|
|
11
|
+
<block wx:for="{{files}}" wx:key="image">
|
|
12
|
+
<view
|
|
13
|
+
class="case-image-box"
|
|
14
|
+
bind:tap="clickMedia"
|
|
15
|
+
data-type="{{item.type}}"
|
|
16
|
+
data-url="{{item.url}}"
|
|
17
|
+
>
|
|
18
|
+
<image
|
|
19
|
+
class="case-image"
|
|
20
|
+
src="{{item.thumb}}"
|
|
21
|
+
mode="aspectFill"
|
|
22
|
+
/>
|
|
23
|
+
<image
|
|
24
|
+
wx:if="{{item.type == 'video'}}"
|
|
25
|
+
class="chat-video-play"
|
|
26
|
+
src="https://imgs.hh-medic.com/icon/wmp/hhdoctor/video-play.png"
|
|
27
|
+
/>
|
|
28
|
+
</view>
|
|
29
|
+
</block>
|
|
30
|
+
</view>
|
|
31
|
+
</scroll-view>
|
|
32
|
+
</view>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.group-route {
|
|
2
|
+
padding-bottom: 15rpx;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.case-group-title {
|
|
6
|
+
font-size: 30rpx;
|
|
7
|
+
color: #333333;
|
|
8
|
+
margin: 20rpx 30rpx;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.case-image-box {
|
|
12
|
+
position: relative;
|
|
13
|
+
width: 150rpx;
|
|
14
|
+
height: 150rpx;
|
|
15
|
+
border-radius: 12rpx;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
margin-left: 30rpx;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
flex-grow: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.case-image {
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.chat-video-play {
|
|
29
|
+
width: 60rpx;
|
|
30
|
+
height: 60rpx;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: calc(50% - 30rpx);
|
|
33
|
+
left: calc(50% - 30rpx);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.case-files-box {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.case-files-scroll-view {
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
height: 150rpx;
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// 视频中消息类型
|
|
2
|
+
const commands = {
|
|
3
|
+
call: "call",
|
|
4
|
+
accept: "ACCEPT",
|
|
5
|
+
interrupt: "interrupt",
|
|
6
|
+
busy: 'busy',
|
|
7
|
+
cancel: 'cancel',
|
|
8
|
+
rejectWMP: 'REJECT_wmp',
|
|
9
|
+
reject: 'REJECT',
|
|
10
|
+
switchToAudio: 'SWITCH_TO_AUDIO',
|
|
11
|
+
switchToVideo: 'SWITCH_TO_VIDEO',
|
|
12
|
+
switchToAudioWMP: 'SWITCH_TO_AUDIO_SYNC_wmp',
|
|
13
|
+
switchToVideoWMP: 'SWITCH_TO_VIDEO_SYNC_wmp',
|
|
14
|
+
switchToAudioAgora: 'SWITCH_TO_AUDIO_SYNC_agora',
|
|
15
|
+
switchToVideoAgora: 'SWITCH_TO_AUDIO_SYNC_agora',
|
|
16
|
+
uploadPic: 'uploadPic'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 挂断类型
|
|
20
|
+
const hangupTypes = {
|
|
21
|
+
hangup: 'hangup', // 正常挂断
|
|
22
|
+
cancel: 'cancel', // 自己主动取消呼叫
|
|
23
|
+
reject: 'reject', // 被呼叫方拒绝
|
|
24
|
+
otherCancel: 'otherCancel', // 专家回拨,专家取消
|
|
25
|
+
otherReject: 'otherReject', // 对方拒绝接听 busy 或者是 reject类的
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 视频通话状态
|
|
29
|
+
const videoStatus = {
|
|
30
|
+
call_back: 'call_back', // 回拨等待
|
|
31
|
+
calling: 'calling', // 正在呼叫
|
|
32
|
+
chatting: 'chatting' // 通话中
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
commands,
|
|
37
|
+
hangupTypes: hangupTypes,
|
|
38
|
+
videoStatus: videoStatus,
|
|
39
|
+
}
|