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,391 @@
|
|
|
1
|
+
// components/video-chat/agora-rtc/agora-rtc.js
|
|
2
|
+
|
|
3
|
+
const api = require('../../apis/order-app-api')
|
|
4
|
+
const AgoraSDK = require('../../static/Agora_Miniapp_SDK_for_WeChat')
|
|
5
|
+
const cache = require('../../public/cache-data')
|
|
6
|
+
const logApi = require('../../apis/video-chat-log-api')
|
|
7
|
+
|
|
8
|
+
AgoraSDK.LOG.setLogLevel(-1)
|
|
9
|
+
const appId = '295a656ad89d4ad09282a63a6d4b78dc'
|
|
10
|
+
|
|
11
|
+
Component({
|
|
12
|
+
/**
|
|
13
|
+
* 组件的属性列表
|
|
14
|
+
*/
|
|
15
|
+
properties: {
|
|
16
|
+
orderId: {
|
|
17
|
+
type: String,
|
|
18
|
+
value: null
|
|
19
|
+
},
|
|
20
|
+
callback: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
value: false
|
|
23
|
+
},
|
|
24
|
+
smallVideoTop: {
|
|
25
|
+
type: Number,
|
|
26
|
+
value: 0
|
|
27
|
+
},
|
|
28
|
+
isInVoice: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
value: false
|
|
31
|
+
},
|
|
32
|
+
expertAvatar: {
|
|
33
|
+
type: String,
|
|
34
|
+
value: ''
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 组件的初始数据
|
|
40
|
+
*/
|
|
41
|
+
data: {
|
|
42
|
+
pusher: null, // 主播视频
|
|
43
|
+
mainRemotePlayer: null, // 主画面显示远端视频
|
|
44
|
+
remotePlayerList: [], // 小画面远端视频
|
|
45
|
+
muted: false,
|
|
46
|
+
beauty: 0,
|
|
47
|
+
exitRoom: false
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
lifetimes: {
|
|
51
|
+
attached: function () {
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
ready: function () {
|
|
55
|
+
this.client = null
|
|
56
|
+
this.initChannel()
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 组件的方法列表
|
|
62
|
+
*/
|
|
63
|
+
methods: {
|
|
64
|
+
enterRoom(roomID) {
|
|
65
|
+
const orderId = this.properties.orderId
|
|
66
|
+
if (orderId) {
|
|
67
|
+
api.getAgoraToken(orderId).then((res) => {
|
|
68
|
+
const token = res.data.token
|
|
69
|
+
this.joinChannel({
|
|
70
|
+
roomID: roomID,
|
|
71
|
+
token: token
|
|
72
|
+
})
|
|
73
|
+
}).catch((e) => {
|
|
74
|
+
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// 退出房间
|
|
80
|
+
async exitRoom() {
|
|
81
|
+
this.setData({
|
|
82
|
+
exitRoom: true
|
|
83
|
+
})
|
|
84
|
+
await this.client.unpublish()
|
|
85
|
+
await this.client.leave()
|
|
86
|
+
// await this.client.destory()
|
|
87
|
+
this.triggerEvent("directHangup")
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
async joinChannel(data) {
|
|
91
|
+
const strRoomID = '' + data.roomID
|
|
92
|
+
const uuid = cache.uuid()
|
|
93
|
+
await this.client.join(data.token, strRoomID, uuid)
|
|
94
|
+
const url = await this.client.publish()
|
|
95
|
+
const ts = new Date().getTime()
|
|
96
|
+
this.addMedia(0, uuid, url, {
|
|
97
|
+
key: ts
|
|
98
|
+
})
|
|
99
|
+
this.triggerEvent('sendLog', logApi.logTypes.connect)
|
|
100
|
+
this.triggerEvent('sendCallMessage')
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 初始化SDK
|
|
105
|
+
*/
|
|
106
|
+
async initChannel() {
|
|
107
|
+
this.client = new AgoraSDK.Client()
|
|
108
|
+
this.subscribeEvents()
|
|
109
|
+
await this.client.init(appId)
|
|
110
|
+
await this.client.setRole('broadcaster')
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
subscribeEvents() {
|
|
114
|
+
this.client.on("video-rotation", (e) => {
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
const player = this.getPlayerComponent(e.uid)
|
|
117
|
+
player && player.rotate(e.rotation)
|
|
118
|
+
}, 1000)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
this.client.on("stream-added", async e => {
|
|
122
|
+
let uid = e.uid;
|
|
123
|
+
const ts = new Date().getTime()
|
|
124
|
+
const {
|
|
125
|
+
url,
|
|
126
|
+
rotation
|
|
127
|
+
} = await this.client.subscribe(uid)
|
|
128
|
+
let media = this.data.remotePlayerList || [];
|
|
129
|
+
let matchItem = null;
|
|
130
|
+
if (this.data.mainRemotePlayer && `${this.data.mainRemotePlayer.uid}` === `${uid}`) {
|
|
131
|
+
matchItem = this.data.mainRemotePlayer
|
|
132
|
+
} else {
|
|
133
|
+
for (let i = 0; i < media.length; i++) {
|
|
134
|
+
let item = media[i];
|
|
135
|
+
if (`${item.uid}` === `${uid}`) {
|
|
136
|
+
matchItem = item
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!matchItem) {
|
|
143
|
+
this.addMedia(1, uid, url, {
|
|
144
|
+
key: ts,
|
|
145
|
+
rotation: rotation
|
|
146
|
+
})
|
|
147
|
+
} else {
|
|
148
|
+
this.updateMedia(matchItem.uid, {
|
|
149
|
+
url: url,
|
|
150
|
+
key: ts,
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
this.client.on("stream-removed", e => {
|
|
156
|
+
let uid = e.uid;
|
|
157
|
+
this.removeMedia(uid)
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
this.client.on("error", err => {
|
|
161
|
+
let errObj = err || {};
|
|
162
|
+
let code = errObj.code || 0;
|
|
163
|
+
let reason = errObj.reason || "";
|
|
164
|
+
if (code === 501 || code === 904) {
|
|
165
|
+
this.reconnect()
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
this.client.on('update-url', e => {
|
|
170
|
+
let uid = e.uid;
|
|
171
|
+
let url = e.url;
|
|
172
|
+
let ts = new Date().getTime()
|
|
173
|
+
if (`${uid}` === `${this.uid}`) {} else {
|
|
174
|
+
this.updateMedia(uid, {
|
|
175
|
+
url: url,
|
|
176
|
+
key: ts,
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
this.client.on("token-privilege-will-expire", () => {})
|
|
182
|
+
|
|
183
|
+
this.client.on("token-privilege-did-expire", () => {})
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
onPusherNetstatus: function (e) {
|
|
187
|
+
this.client.updatePusherNetStatus(e.detail)
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
onPusherStatechange: function (e) {
|
|
191
|
+
this.client.updatePusherStateChange(e.detail)
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
onPusherFailed() {
|
|
195
|
+
wx.showModal({
|
|
196
|
+
title: '发生错误',
|
|
197
|
+
content: '推流发生错误,请重新进入房间重试',
|
|
198
|
+
showCancel: false,
|
|
199
|
+
success: () => {
|
|
200
|
+
this.navigateBack()
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
onPlayerNetstatus: function (e) {
|
|
206
|
+
if (this.data.exitRoom) {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
// 遍历所有远端流进行数据上报
|
|
210
|
+
let allPlayerStream = this.data.remotePlayerList
|
|
211
|
+
if (this.data.mainRemotePlayer) {
|
|
212
|
+
this.client.updatePlayerNetStatus(this.data.mainRemotePlayer.uid, e.detail)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
allPlayerStream.forEach(item => {
|
|
216
|
+
this.client.updatePlayerNetStatus(item.uid, e.detail)
|
|
217
|
+
})
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
onPlayerStatechange: function (e) {
|
|
221
|
+
if (this.data.exitRoom) {
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
if (this.data.mainRemotePlayer) {
|
|
225
|
+
this.client.updatePlayerStateChange(this.data.mainRemotePlayer.uid, e.detail)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let allPlayerStream = this.data.remotePlayerList
|
|
229
|
+
// 这里 需要去获取所有远端流的 uid
|
|
230
|
+
allPlayerStream.forEach(item => {
|
|
231
|
+
this.client.updatePlayerStateChange(item.uid, e.detail)
|
|
232
|
+
})
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
addMedia(mediaType, uid, url, options) {
|
|
236
|
+
if (mediaType === 0) {
|
|
237
|
+
//pusher
|
|
238
|
+
this.setData({
|
|
239
|
+
pusher: {
|
|
240
|
+
key: options.key,
|
|
241
|
+
uid: uid,
|
|
242
|
+
url: url,
|
|
243
|
+
muted: false,
|
|
244
|
+
beauty: 0
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
} else {
|
|
248
|
+
if (!this.properties.callback) {
|
|
249
|
+
this.triggerEvent('updateVideoState', 'chatting')
|
|
250
|
+
}
|
|
251
|
+
this.triggerEvent('remoteUserJoin', `${uid}`)
|
|
252
|
+
let media = this.data.remotePlayerList || []
|
|
253
|
+
let mainPlayer = this.data.mainRemotePlayer
|
|
254
|
+
if (media.length == 0 && !mainPlayer) {
|
|
255
|
+
this.setData({
|
|
256
|
+
mainRemotePlayer: {
|
|
257
|
+
key: options.key,
|
|
258
|
+
uid: uid,
|
|
259
|
+
url: url,
|
|
260
|
+
muted: false,
|
|
261
|
+
beauty: 0
|
|
262
|
+
}
|
|
263
|
+
}, () => {
|
|
264
|
+
this.playRemote()
|
|
265
|
+
})
|
|
266
|
+
} else {
|
|
267
|
+
media.push({
|
|
268
|
+
key: options.key,
|
|
269
|
+
uid: uid,
|
|
270
|
+
url: url,
|
|
271
|
+
muted: false,
|
|
272
|
+
beauty: 0
|
|
273
|
+
})
|
|
274
|
+
this.setData({
|
|
275
|
+
remotePlayerList: media
|
|
276
|
+
}, () => {
|
|
277
|
+
this.playRemote()
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* remove media from view
|
|
285
|
+
*/
|
|
286
|
+
removeMedia(uid) {
|
|
287
|
+
this.triggerEvent('remoteUserLeave', `${uid}`)
|
|
288
|
+
let media = this.data.remotePlayerList || []
|
|
289
|
+
if (this.data.mainRemotePlayer && `${this.data.mainRemotePlayer.uid}` === `${uid}`) {
|
|
290
|
+
if (media.length === 0) {
|
|
291
|
+
// 这里需要处理挂断
|
|
292
|
+
// this.exitRoom()
|
|
293
|
+
this.setData({
|
|
294
|
+
mainRemotePlayer: null,
|
|
295
|
+
remotePlayerList: media
|
|
296
|
+
})
|
|
297
|
+
} else {
|
|
298
|
+
const mainPlayer = media.shift()
|
|
299
|
+
this.setData({
|
|
300
|
+
mainRemotePlayer: mainPlayer,
|
|
301
|
+
remotePlayerList: media
|
|
302
|
+
})
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
media = media.filter(item => {
|
|
306
|
+
return `${item.uid}` !== `${uid}`
|
|
307
|
+
})
|
|
308
|
+
this.setData({
|
|
309
|
+
remotePlayerList: media
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* update media object
|
|
316
|
+
* the media component will be fully refreshed if you try to update key
|
|
317
|
+
* property.
|
|
318
|
+
*/
|
|
319
|
+
updateMedia(uid, options) {
|
|
320
|
+
if (this.data.mainRemotePlayer && `${this.data.mainRemotePlayer.uid}` === `${uid}`) {
|
|
321
|
+
let item = Object.assign(this.data.mainRemotePlayer, options)
|
|
322
|
+
this.setData({
|
|
323
|
+
mainRemotePlayer: item
|
|
324
|
+
})
|
|
325
|
+
} else {
|
|
326
|
+
let media = this.data.remotePlayerList || []
|
|
327
|
+
for (let i = 0; i < media.length; i++) {
|
|
328
|
+
let item = media[i];
|
|
329
|
+
if (`${item.uid}` === `${uid}`) {
|
|
330
|
+
media[i] = Object.assign(item, options)
|
|
331
|
+
break
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
this.setData({
|
|
335
|
+
remotePlayerList: media
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 切换摄像头
|
|
343
|
+
*/
|
|
344
|
+
switchCamera() {
|
|
345
|
+
// if (this.pusherContext) {
|
|
346
|
+
// this.pusherContext.switchCamera()
|
|
347
|
+
// }
|
|
348
|
+
this.getPusherComponent().switchCamera()
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* return player component via uid
|
|
353
|
+
*/
|
|
354
|
+
getPlayerComponent(uid) {
|
|
355
|
+
const agoraPlayer = this.selectComponent(`#rtc-player-${uid}`);
|
|
356
|
+
return agoraPlayer;
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* return pusher component
|
|
361
|
+
*/
|
|
362
|
+
getPusherComponent() {
|
|
363
|
+
const agorapusher = this.selectComponent(`#rtc-pusher`);
|
|
364
|
+
return agorapusher;
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
playRemote() {
|
|
368
|
+
if (this.data.mainRemotePlayer) {
|
|
369
|
+
const player = this.getPlayerComponent(this.data.mainRemotePlayer.uid)
|
|
370
|
+
if (player) {
|
|
371
|
+
player.start()
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (this.data.remotePlayerList) {
|
|
375
|
+
this.data.remotePlayerList.forEach((e) => {
|
|
376
|
+
const player = this.getPlayerComponent(e.uid)
|
|
377
|
+
if (player) {
|
|
378
|
+
player.start()
|
|
379
|
+
}
|
|
380
|
+
})
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
switchAudioVideo(toAudio) {
|
|
384
|
+
if (toAudio) {
|
|
385
|
+
this.client.muteLocal('video')
|
|
386
|
+
} else {
|
|
387
|
+
this.client.unmuteLocal('video')
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<agora-player
|
|
2
|
+
wx:if="{{mainRemotePlayer}}"
|
|
3
|
+
id="rtc-player-{{mainRemotePlayer.uid}}"
|
|
4
|
+
showSmall="{{false}}"
|
|
5
|
+
uid="{{mainRemotePlayer.uid}}"
|
|
6
|
+
url="{{mainRemotePlayer.url}}"
|
|
7
|
+
isInVoice="{{isInVoice}}"
|
|
8
|
+
bindnetstatus="onPlayerNetstatus"
|
|
9
|
+
bindstatechange="onPlayerStatechange"
|
|
10
|
+
/>
|
|
11
|
+
<view class="{{mainRemotePlayer ? 'small-item-container' :'fullscreen'}}">
|
|
12
|
+
<agora-pusher
|
|
13
|
+
wx:if="{{pusher}}"
|
|
14
|
+
id="rtc-pusher"
|
|
15
|
+
smallVideoTop="{{smallVideoTop}}"
|
|
16
|
+
url="{{pusher.url}}"
|
|
17
|
+
expertAvatar="{{expertAvatar}}"
|
|
18
|
+
bindnetstatus="onPusherNetstatus"
|
|
19
|
+
bindstatechange="onPusherStatechange"
|
|
20
|
+
chatting="{{mainRemotePlayer != null}}"
|
|
21
|
+
isInVoice="{{isInVoice}}"
|
|
22
|
+
/>
|
|
23
|
+
<view
|
|
24
|
+
wx:if="{{remotePlayerList}}"
|
|
25
|
+
wx:for="{{remotePlayerList}}"
|
|
26
|
+
wx:key="uid"
|
|
27
|
+
>
|
|
28
|
+
<agora-player
|
|
29
|
+
wx:if="{{item}}"
|
|
30
|
+
id="rtc-player-{{item.uid}}"
|
|
31
|
+
showSmall="{{false}}"
|
|
32
|
+
uid="{{item.uid}}"
|
|
33
|
+
url="{{item.url}}"
|
|
34
|
+
isInVoice="{{isInVoice}}"
|
|
35
|
+
bindnetstatus="onPlayerNetstatus"
|
|
36
|
+
bindstatechange="onPlayerStatechange"
|
|
37
|
+
/>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../video-chat.wxss";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// components/video-chat/call_back/call-back.js
|
|
2
|
+
Component({
|
|
3
|
+
/**
|
|
4
|
+
* 组件的属性列表
|
|
5
|
+
*/
|
|
6
|
+
properties: {
|
|
7
|
+
expert: null,
|
|
8
|
+
smallVideoTop: {
|
|
9
|
+
type: Number,
|
|
10
|
+
value: 0
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 组件的初始数据
|
|
16
|
+
*/
|
|
17
|
+
data: {
|
|
18
|
+
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 组件的方法列表
|
|
23
|
+
*/
|
|
24
|
+
methods: {
|
|
25
|
+
/**
|
|
26
|
+
* 拒绝接听被点击
|
|
27
|
+
*/
|
|
28
|
+
_rejectClick() {
|
|
29
|
+
this.triggerEvent("reject")
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 接听按钮被点击
|
|
34
|
+
*/
|
|
35
|
+
_acceptClick() {
|
|
36
|
+
this.triggerEvent("accept")
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<view class="calling-container">
|
|
2
|
+
<view class="callback-expert">
|
|
3
|
+
<image
|
|
4
|
+
class="callback_photo"
|
|
5
|
+
src="{{expert.photourl}}"
|
|
6
|
+
mode="widthFix"
|
|
7
|
+
style="margin-top: {{smallVideoTop}}px;"
|
|
8
|
+
/>
|
|
9
|
+
<view class="callback_name">{{expert.name}}</view>
|
|
10
|
+
</view>
|
|
11
|
+
<view class="bottom-2 bottom">
|
|
12
|
+
<view class="item-button" bindtap="_rejectClick">
|
|
13
|
+
<image
|
|
14
|
+
class="item-button-img"
|
|
15
|
+
src="https://image.hh-medic.com/icon/pacs/hh_hangup.png"
|
|
16
|
+
mode=""
|
|
17
|
+
/>
|
|
18
|
+
<view>拒绝</view>
|
|
19
|
+
</view>
|
|
20
|
+
<view class="item-button" bindtap="_acceptClick">
|
|
21
|
+
<image
|
|
22
|
+
class="item-button-img"
|
|
23
|
+
src="https://image.hh-medic.com/icon/pacs/hh_accept.png"
|
|
24
|
+
mode="scaleToFill"
|
|
25
|
+
/>
|
|
26
|
+
<view>接听</view>
|
|
27
|
+
</view>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* components/video-chat/call_back/call-back.wxss */
|
|
2
|
+
@import "../video-chat.wxss";
|
|
3
|
+
@import "../calling/calling.wxss";
|
|
4
|
+
.bottom-2 {
|
|
5
|
+
justify-content: space-around;
|
|
6
|
+
margin-bottom: 20rpx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.callback-expert {
|
|
10
|
+
position: absolute;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
top: 10rpx;
|
|
15
|
+
right: 10rpx;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.callback_photo {
|
|
19
|
+
width: 200rpx;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.callback_name {
|
|
23
|
+
color: white;
|
|
24
|
+
margin-top: 10rpx;
|
|
25
|
+
font-size: 32rpx;
|
|
26
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
|
|
3
|
+
lifetimes: {
|
|
4
|
+
attached: function () {
|
|
5
|
+
if (this.data.showNotifyButton) {
|
|
6
|
+
return
|
|
7
|
+
}
|
|
8
|
+
this.setData({
|
|
9
|
+
delayShowTimer: setTimeout(() => {
|
|
10
|
+
this.setData({
|
|
11
|
+
showNotifyButton: true
|
|
12
|
+
})
|
|
13
|
+
}, 5000)
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
detached: function() {
|
|
17
|
+
clearTimeout(this.data.delayShowTimer)
|
|
18
|
+
this.setData({
|
|
19
|
+
delayShowTimer: null
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
pageLifetimes: {
|
|
25
|
+
show: function () {
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
hide: function () {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
resize: function () {
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 组件的属性列表
|
|
38
|
+
*/
|
|
39
|
+
properties: {
|
|
40
|
+
isFamilyOrder: {type: Boolean, value: false},
|
|
41
|
+
smallVideoTop: {type: Number, value: 0}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 组件的初始数据
|
|
46
|
+
*/
|
|
47
|
+
data: {
|
|
48
|
+
showNotifyButton: false,
|
|
49
|
+
delayShowTimer: null
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 组件的方法列表
|
|
54
|
+
*/
|
|
55
|
+
methods: {
|
|
56
|
+
/**
|
|
57
|
+
* 取消按钮被点击
|
|
58
|
+
*/
|
|
59
|
+
_cancelClick() {
|
|
60
|
+
this.triggerEvent("cancel")
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 发送呼叫通知
|
|
65
|
+
*/
|
|
66
|
+
_notifyCall() {
|
|
67
|
+
this.triggerEvent("notifyCall")
|
|
68
|
+
if (!this.properties.isFamilyOrder) {
|
|
69
|
+
this.setData({
|
|
70
|
+
showNotifyButton: false
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<view class="calling-container">
|
|
2
|
+
<view class="calling-tip-container">
|
|
3
|
+
<view class="calling-tip-text">
|
|
4
|
+
您已进入视频,可在此界面耐心等待对方进入
|
|
5
|
+
</view>
|
|
6
|
+
<button
|
|
7
|
+
class="calling-tip-button"
|
|
8
|
+
bind:tap="_notifyCall"
|
|
9
|
+
style="opacity:{{showNotifyButton ? 100 : 0}};"
|
|
10
|
+
>
|
|
11
|
+
通知对方加入视频
|
|
12
|
+
</button>
|
|
13
|
+
</view>
|
|
14
|
+
|
|
15
|
+
<image
|
|
16
|
+
class="default_photo"
|
|
17
|
+
src="https://image.hh-medic.com/icon/pacs/hh_chat_default_photo.png"
|
|
18
|
+
mode="widthFix"
|
|
19
|
+
style="margin-top: {{smallVideoTop}}px;"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<view class="bottom-1 bottom">
|
|
23
|
+
<view class="item-button" bindtap="_cancelClick">
|
|
24
|
+
<image
|
|
25
|
+
class="item-button-img"
|
|
26
|
+
src="https://image.hh-medic.com/icon/pacs/hh_hangup.png"
|
|
27
|
+
mode=""
|
|
28
|
+
/>
|
|
29
|
+
<view>取消</view>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import "../controller/controller.wxss";
|
|
2
|
+
|
|
3
|
+
.calling-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-content: center;
|
|
6
|
+
width: 100vw;
|
|
7
|
+
height: 100vh;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.calling-tip-container {
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.calling-tip-text {
|
|
20
|
+
display: flex;
|
|
21
|
+
font-size: 28rpx;
|
|
22
|
+
color: white;
|
|
23
|
+
padding: 20rpx;
|
|
24
|
+
background-color: #00000050;
|
|
25
|
+
border-radius: 10rpx;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.calling-tip-button {
|
|
29
|
+
font-size: 32rpx;
|
|
30
|
+
color: white;
|
|
31
|
+
background-color: #0592f5;
|
|
32
|
+
margin-top: 15rpx;
|
|
33
|
+
padding-bottom: 5rpx;
|
|
34
|
+
padding-top: 5rpx;
|
|
35
|
+
padding-left: 40rpx;
|
|
36
|
+
padding-right: 40rpx;
|
|
37
|
+
border-radius: 15rpx;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.default_photo {
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: 200rpx;
|
|
43
|
+
right: 10rpx;
|
|
44
|
+
top: 10rpx;
|
|
45
|
+
}
|