hh-doctor-sdk 0.5.4 → 0.5.8
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 +1 -1
- package/components/apis/stat-log-api.js +27 -1
- package/components/consultation/detail/widget/case-image-filter.js +2 -1
- package/components/hh-doctor.js +22 -0
- package/components/public/stat-log.js +5 -0
- package/components/video-chat/agora-rtc/agora-rtc.js +75 -9
- package/components/video-chat/video-chat.js +12 -1
- package/components/video-chat-page/video-chat-page.js +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,33 @@ function sendLog(data) {
|
|
|
36
36
|
return httpUtils.get(apiPaths.statLog, params, null)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function pointLog(type, content, orderId) {
|
|
40
|
+
const isTest = cache.isTest()
|
|
41
|
+
let host = isTest ? 'https://test.hh-medic.com/point-log?' : "https://sec.hh-medic.com/point-log?"
|
|
42
|
+
const id = cache.getLogId() || 1
|
|
43
|
+
let url = `${host}sdkProductId=${appConfig.appID}`
|
|
44
|
+
+ `&uuid=${cache.uuid()}`
|
|
45
|
+
+ `&tid=${cache.doctorId()}`
|
|
46
|
+
+ `&session=${cache.getSessionId()}`
|
|
47
|
+
+ `&orderId=${orderId || ''}`
|
|
48
|
+
+ `&type=${type || 0}`
|
|
49
|
+
+ `&version=${appConfig.appVersion}`
|
|
50
|
+
+ `&t=${new Date().getTime()}`
|
|
51
|
+
+ `&id=${id}`
|
|
52
|
+
if ('object' == typeof content) {
|
|
53
|
+
for (const key in content) {
|
|
54
|
+
url += `&${key}=${encodeURIComponent(content[key])}`
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
url += `&content=${encodeURIComponent(content)}`
|
|
58
|
+
}
|
|
59
|
+
wx.downloadFile({
|
|
60
|
+
url: url,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
39
64
|
module.exports = {
|
|
40
65
|
sendLog,
|
|
41
|
-
logType
|
|
66
|
+
logType,
|
|
67
|
+
pointLog
|
|
42
68
|
}
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
function imageList(caseImageList) {
|
|
9
9
|
const images = caseImageList.filter((value, index, array) => {
|
|
10
|
+
console.log(JSON.stringify(value))
|
|
10
11
|
if (value.s3key && value.s3key.length > 0) {
|
|
11
12
|
return !value.s3key.endsWith('.pdf') && !value.s3key.endsWith('.mp4')
|
|
12
13
|
}
|
|
13
|
-
return value.imageurl && !value.imageurl.includes('.pdf') && !value.
|
|
14
|
+
return value.imageurl && !value.imageurl.includes('.pdf') && !value.imageurl.includes('.mp4')
|
|
14
15
|
})
|
|
15
16
|
|
|
16
17
|
const imageDataList = images.map((value, index, array) => {
|
package/components/hh-doctor.js
CHANGED
|
@@ -34,10 +34,32 @@ function setLoginCheck(judgeLogin, directLogin) {
|
|
|
34
34
|
wx.loginConfig.directLogin = directLogin
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function enterForground() {
|
|
38
|
+
wx.statLog.sendStatLog('', '学术小程序进入前台')
|
|
39
|
+
wx.statLog.pointLog(0, {
|
|
40
|
+
ec: 'wmp_doctor_sdk',
|
|
41
|
+
ea: 'life_change',
|
|
42
|
+
el: 'forground',
|
|
43
|
+
ev: 1
|
|
44
|
+
}, null)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function enterBackground() {
|
|
48
|
+
wx.statLog.sendStatLog('', '学术小程序进入后台')
|
|
49
|
+
wx.statLog.pointLog(0, {
|
|
50
|
+
ec: 'wmp_doctor_sdk',
|
|
51
|
+
ea: 'life_change',
|
|
52
|
+
el: 'forground',
|
|
53
|
+
ev: 0
|
|
54
|
+
}, null)
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
module.exports = {
|
|
38
58
|
initSDK,
|
|
39
59
|
initEventBus,
|
|
40
60
|
initTim,
|
|
41
61
|
initStatLog,
|
|
42
62
|
setLoginCheck,
|
|
63
|
+
enterForground,
|
|
64
|
+
enterBackground
|
|
43
65
|
}
|
|
@@ -43,18 +43,27 @@ Component({
|
|
|
43
43
|
* 组件的初始数据
|
|
44
44
|
*/
|
|
45
45
|
data: {
|
|
46
|
+
roomID: null,
|
|
47
|
+
token: null,
|
|
46
48
|
pusher: null, // 主播视频
|
|
47
49
|
mainRemotePlayer: null, // 主画面显示远端视频
|
|
48
50
|
remotePlayerList: [], // 小画面远端视频
|
|
49
51
|
muted: false,
|
|
50
52
|
beauty: 0,
|
|
51
53
|
exitRoom: false,
|
|
52
|
-
remoteAudioStatus: {}
|
|
54
|
+
remoteAudioStatus: {},
|
|
55
|
+
reconnetCount: 0
|
|
53
56
|
},
|
|
54
57
|
|
|
55
58
|
lifetimes: {
|
|
56
59
|
attached: function () {
|
|
57
60
|
|
|
61
|
+
},
|
|
62
|
+
detached: function() {
|
|
63
|
+
if (this.reconnectTimer) {
|
|
64
|
+
clearTimeout(this.reconnectTimer)
|
|
65
|
+
this.reconnectTimer = null
|
|
66
|
+
}
|
|
58
67
|
},
|
|
59
68
|
ready: function () {
|
|
60
69
|
this.client = null
|
|
@@ -71,11 +80,12 @@ Component({
|
|
|
71
80
|
if (orderId) {
|
|
72
81
|
api.getAgoraToken(orderId).then((res) => {
|
|
73
82
|
const token = res.data.token
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
token: token,
|
|
83
|
+
this.setData({
|
|
84
|
+
roomID: '' + roomID,
|
|
85
|
+
token: token
|
|
78
86
|
})
|
|
87
|
+
wx.statLog.sendStatLog(orderId, `获取声网token成功 -> ${token}`)
|
|
88
|
+
this.joinChannel()
|
|
79
89
|
}).catch((e) => {
|
|
80
90
|
wx.statLog.sendStatLog(orderId, `获取声网token失败 -> ${JSON.stringify(e)}`)
|
|
81
91
|
wx.showToast({
|
|
@@ -113,12 +123,13 @@ Component({
|
|
|
113
123
|
}
|
|
114
124
|
},
|
|
115
125
|
|
|
116
|
-
async joinChannel(
|
|
117
|
-
const strRoomID =
|
|
126
|
+
async joinChannel() {
|
|
127
|
+
const strRoomID = this.data.roomID
|
|
128
|
+
const token = this.data.token
|
|
118
129
|
const uuid = cache.uuid()
|
|
119
|
-
wx.statLog.sendStatLog(this.properties.orderId, `声网开始进房 ${uuid} - ${strRoomID} - ${
|
|
130
|
+
wx.statLog.sendStatLog(this.properties.orderId, `声网开始进房 ${uuid} - ${strRoomID} - ${token}`)
|
|
120
131
|
try {
|
|
121
|
-
await this.client.join(
|
|
132
|
+
await this.client.join(token, strRoomID, uuid)
|
|
122
133
|
const url = await this.client.publish()
|
|
123
134
|
const ts = new Date().getTime()
|
|
124
135
|
this.addMedia(0, uuid, url, {
|
|
@@ -133,6 +144,29 @@ Component({
|
|
|
133
144
|
}
|
|
134
145
|
},
|
|
135
146
|
|
|
147
|
+
async reJoinChannel() {
|
|
148
|
+
const strRoomID = this.data.roomID
|
|
149
|
+
const token = this.data.token
|
|
150
|
+
const uuid = cache.uuid()
|
|
151
|
+
let uids = this.data.remotePlayerList.map((user) => {
|
|
152
|
+
return user.uid
|
|
153
|
+
})
|
|
154
|
+
uids.splice(0, 0, uuid)
|
|
155
|
+
wx.statLog.sendStatLog(this.properties.orderId, `声网开始重新进房 ${uuid} - ${strRoomID} - ${token}`)
|
|
156
|
+
try {
|
|
157
|
+
await this.client.rejoin(token, strRoomID, uuid, uids)
|
|
158
|
+
const url = await this.client.publish()
|
|
159
|
+
const ts = new Date().getTime()
|
|
160
|
+
this.addMedia(0, uuid, url, {
|
|
161
|
+
key: ts
|
|
162
|
+
})
|
|
163
|
+
wx.statLog.sendStatLog(this.properties.orderId, '(声网)本人重新加入房间')
|
|
164
|
+
} catch (error) {
|
|
165
|
+
wx.statLog.sendStatLog(this.properties.orderId, `(声网)进房出错 ${JSON.stringify(error)}`)
|
|
166
|
+
this.reconnect()
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
|
|
136
170
|
/**
|
|
137
171
|
* 初始化SDK
|
|
138
172
|
*/
|
|
@@ -148,6 +182,38 @@ Component({
|
|
|
148
182
|
}
|
|
149
183
|
},
|
|
150
184
|
|
|
185
|
+
async reconnect() {
|
|
186
|
+
if (ths.data.reconnetCount >= 3) {
|
|
187
|
+
this.errorTipHangup('尝试回复连接失败,请稍后重试')
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
this.setData({
|
|
191
|
+
reconnetCount: this.data.reconnetCount + 1
|
|
192
|
+
})
|
|
193
|
+
wx.statLog.sendStatLog(this.properties.orderId, `(声网)开始重新连接`)
|
|
194
|
+
wx.showToast({
|
|
195
|
+
title: `尝试恢复连接...`,
|
|
196
|
+
icon: 'none',
|
|
197
|
+
duration: 5000
|
|
198
|
+
});
|
|
199
|
+
// always destroy client first
|
|
200
|
+
// *important* miniapp supports 5 websockets maximum at same time
|
|
201
|
+
// do remember to destroy old client first before creating new ones
|
|
202
|
+
await client.destroy();
|
|
203
|
+
client = null
|
|
204
|
+
|
|
205
|
+
this.reconnectTimer = setTimeout(async () => {
|
|
206
|
+
try {
|
|
207
|
+
await this.initChannel()
|
|
208
|
+
await this.reJoinChannel()
|
|
209
|
+
} catch (e) {
|
|
210
|
+
wx.statLog.sendStatLog(this.properties.orderId, `(声网)重新连接失败 ${JSON.stringify(e)}`)
|
|
211
|
+
// remember control max reconnect times
|
|
212
|
+
return this.reconnect();
|
|
213
|
+
}
|
|
214
|
+
}, 1 * 1000);
|
|
215
|
+
},
|
|
216
|
+
|
|
151
217
|
errorTipHangup(tip) {
|
|
152
218
|
wx.showToast({
|
|
153
219
|
title: tip,
|
|
@@ -157,7 +157,7 @@ Component({
|
|
|
157
157
|
const {
|
|
158
158
|
player
|
|
159
159
|
} = event.data
|
|
160
|
-
wx.statLog.sendStatLog(this.properties.orderId,
|
|
160
|
+
wx.statLog.sendStatLog(this.properties.orderId, `远端用户${player.userID}开始推送视频`)
|
|
161
161
|
this.triggerEvent('updateUserAudioStatus', {
|
|
162
162
|
userId: player.userID,
|
|
163
163
|
audio: false
|
|
@@ -219,6 +219,17 @@ Component({
|
|
|
219
219
|
pusher: pusher
|
|
220
220
|
})
|
|
221
221
|
})
|
|
222
|
+
this.TRTC.on(TRTC_EVENT.LOCAL_NET_STATE_UPDATE, (event) => {
|
|
223
|
+
const netStatus = event.data.pusher.netStatus
|
|
224
|
+
wx.statLog.sendStatLog(this.properties.orderId, `本地网络发生变化=> ${JSON.stringify(netStatus)}`)
|
|
225
|
+
})
|
|
226
|
+
this.TRTC.on(TRTC_EVENT.REMOTE_NET_STATE_UPDATE, (event) => {
|
|
227
|
+
wx.statLog.sendStatLog(this.properties.orderId, `用户网络发生变化=> ${JSON.stringify(event)}`)
|
|
228
|
+
})
|
|
229
|
+
this.TRTC.on(TRTC_EVENT.ERROR, (event) => {
|
|
230
|
+
const { code, message } = event.data
|
|
231
|
+
wx.statLog.sendStatLog(this.properties.orderId, `发生错误=> ${code} = ${message}`)
|
|
232
|
+
})
|
|
222
233
|
},
|
|
223
234
|
// 请保持跟 wxml 中绑定的事件名称一致
|
|
224
235
|
_pusherStateChangeHandler(event) {
|
|
@@ -106,7 +106,7 @@ Page({
|
|
|
106
106
|
}, 1000);
|
|
107
107
|
return false
|
|
108
108
|
}
|
|
109
|
-
const info = wx.
|
|
109
|
+
const info = wx.getDeviceInfo()
|
|
110
110
|
//mac windows 无需处理顶部间距
|
|
111
111
|
const isPC = info.platform === 'mac' || info.platform === 'windows'
|
|
112
112
|
const res = wx.getMenuButtonBoundingClientRect()
|