hh-doctor-sdk 0.1.2 → 0.1.4

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.
@@ -14,6 +14,7 @@ module.exports = Behavior({
14
14
  headerTexts: [], // 头部文字部分
15
15
  mediaInfo: [], // 头部媒体数据部分
16
16
  dicoms: [], // DICOM数据
17
+ triggered: false,
17
18
  },
18
19
 
19
20
  lifetimes: {
@@ -35,11 +36,17 @@ module.exports = Behavior({
35
36
  messageMediaFiles: [], // 图片和视频数据
36
37
  scrollTo: null,
37
38
  showPreview: false,
39
+ triggered: true,
38
40
  })
41
+ wx.showNavigationBarLoading()
39
42
  this.loadOrder(() => {
40
- this.selectComponent('#chat-bottom').initMenuData()
43
+ wx.hideNavigationBarLoading()
44
+ this.setData({
45
+ triggered: false,
46
+ })
41
47
  this.buildOrderInfo()
42
48
  this.loadDicom()
49
+ this.selectComponent('#chat-bottom').initMenuData()
43
50
  })
44
51
  },
45
52
 
@@ -13,9 +13,7 @@ Page({
13
13
  /**
14
14
  * 页面的初始数据
15
15
  */
16
- data: {
17
-
18
- },
16
+ data: {},
19
17
 
20
18
  /**
21
19
  * 生命周期函数--监听页面加载
@@ -86,7 +84,7 @@ Page({
86
84
  * 页面相关事件处理函数--监听用户下拉动作
87
85
  */
88
86
  onPullDownRefresh() {
89
-
87
+ this._refreshOrder()
90
88
  },
91
89
 
92
90
  /**
@@ -12,8 +12,14 @@
12
12
  scroll-y
13
13
  scroll-into-view="{{scrollTo}}"
14
14
  type="list"
15
+ refresher-enabled="true"
16
+ bindrefresherrefresh="onPullDownRefresh"
17
+ refresher-triggered="{{triggered}}"
15
18
  >
16
- <view class="consultation-header" wx:if="{{order}}">
19
+ <view
20
+ class="consultation-header"
21
+ wx:if="{{headerTexts.length > 0 || mediaInfo.length > 0}}"
22
+ >
17
23
  <block wx:for="{{headerTexts}}" wx:key="text">
18
24
  <detail-text
19
25
  label="{{item.label}}"
@@ -44,7 +50,7 @@
44
50
  ><text class="doctor-info">{{doctorInfo}}</text>
45
51
  </view>
46
52
  </view>
47
- <view class="chatting-body">
53
+ <view class="chatting-body" wx:if="{{messages && messages.length > 0}}">
48
54
  <block wx:for="{{messages}}" wx:key="message">
49
55
  <block wx:if="{{item.custom}}">
50
56
  <template is="{{item.template}}" data="{{...item}}" />
@@ -67,7 +73,7 @@
67
73
  </scroll-view>
68
74
  <chat-bottom
69
75
  id="chat-bottom"
70
- wx:if="{{order}}"
76
+ wx:if="{{order && doctorInfo}}"
71
77
  order="{{order}}"
72
78
  bind:changeDateTime="changeDateTimeControl"
73
79
  bind:changeDateTimeColumn="changeDateTimeColumnControl"
@@ -39,7 +39,9 @@ module.exports = Behavior({
39
39
  this.setData({
40
40
  triggered: true
41
41
  })
42
+ wx.showNavigationBarLoading()
42
43
  api.orderList().then((res) => {
44
+ wx.hideNavigationBarLoading()
43
45
  this.setData({
44
46
  triggered: false
45
47
  })
@@ -29,7 +29,6 @@ function initSDK() {
29
29
  }
30
30
 
31
31
  function setLoginCheck(judgeLogin, directLogin) {
32
- console.error('增加登录检测配置===>')
33
32
  wx.loginConfig = {}
34
33
  wx.loginConfig.judgeLogin = judgeLogin
35
34
  wx.loginConfig.directLogin = directLogin
@@ -19,15 +19,15 @@ module.exports = Behavior({
19
19
  * @param callback 回调
20
20
  */
21
21
  loadOrder(callback) {
22
- wx.showLoading({
23
- title: '加载订单数据...',
24
- mask: true,
25
- })
22
+ // wx.showLoading({
23
+ // title: '加载订单数据...',
24
+ // mask: true,
25
+ // })
26
26
  wx.statLog.sendStatLog(null, '开始获取订单详情数据')
27
27
  const orderId = this.data.orderId
28
28
  api.getOrderDetail(orderId).then((res) => {
29
29
  wx.statLog.sendStatLog(null, '获取订单详情数据完成')
30
- wx.hideLoading()
30
+ // wx.hideLoading()
31
31
  const order = res.data.order
32
32
  const feedbackStar = res.data.feedbackStar
33
33
  let notifySetVideoTime = false
@@ -44,7 +44,6 @@ module.exports = Behavior({
44
44
  if (callback) {
45
45
  callback()
46
46
  }
47
-
48
47
  })
49
48
  }).catch((e) => {
50
49
  wx.statLog.sendStatLog(null, `获取订单数据出错${JSON.stringify(e)}`)
@@ -48,7 +48,7 @@ let onSdkReady = function (event) {
48
48
 
49
49
  let onSdkNotReady = function (event) {
50
50
  wx.statLog.sendStatLog(null, `IM SDK Not Ready ${JSON.stringify(event)}`)
51
- console.error('销毁腾讯IM实例 onSdkNotReady')
51
+ // console.error('销毁腾讯IM实例 onSdkNotReady')
52
52
  };
53
53
 
54
54
  function init() {
@@ -56,7 +56,7 @@ function init() {
56
56
  return
57
57
  }
58
58
  wx.statLog.sendStatLog(null, `初始化 IM 管理类`)
59
- console.error('初始化 IM 管理类')
59
+ // console.error('初始化 IM 管理类')
60
60
  let options = {
61
61
  SDKAppID: '1400073238'
62
62
  }
@@ -79,7 +79,7 @@ function init() {
79
79
  */
80
80
  function loginIm(userID, userSig) {
81
81
  wx.statLog.sendStatLog(null, '开始登录腾讯IM')
82
- console.error('开始登录腾讯IM')
82
+ // console.error('开始登录腾讯IM')
83
83
  if (chat) {
84
84
  chat.login({
85
85
  userID: userID.toString(),
@@ -114,9 +114,9 @@ function logoutIm() {
114
114
  }
115
115
  }
116
116
 
117
- function destory() {
117
+ function destroy() {
118
118
  if (chat) {
119
- console.error('销毁腾讯IM实例')
119
+ // console.error('销毁腾讯IM实例')
120
120
  chat.destroy()
121
121
  chat = null
122
122
  }
@@ -127,5 +127,5 @@ module.exports = {
127
127
  init: init,
128
128
  loginIm: loginIm,
129
129
  logoutIm: logoutIm,
130
- destory: destory
130
+ destroy: destroy
131
131
  }
@@ -32,7 +32,7 @@ Component({
32
32
  expertAvatar: {
33
33
  type: String,
34
34
  value: ''
35
- }
35
+ },
36
36
  },
37
37
 
38
38
  /**
@@ -44,7 +44,8 @@ Component({
44
44
  remotePlayerList: [], // 小画面远端视频
45
45
  muted: false,
46
46
  beauty: 0,
47
- exitRoom: false
47
+ exitRoom: false,
48
+ remoteAudioStatus: {}
48
49
  },
49
50
 
50
51
  lifetimes: {
@@ -181,6 +182,24 @@ Component({
181
182
  this.client.on("token-privilege-will-expire", () => {})
182
183
 
183
184
  this.client.on("token-privilege-did-expire", () => {})
185
+
186
+ this.client.on("mute-video", (e) => {
187
+ console.error(JSON.stringify(e))
188
+ const uuid = e.uid
189
+ this.triggerEvent('updateUserAudioStatus', {
190
+ userId: uuid,
191
+ audio: true
192
+ })
193
+ })
194
+
195
+ this.client.on("unmute-video", (e) => {
196
+ console.error(JSON.stringify(e))
197
+ const uuid = e.uid
198
+ this.triggerEvent('updateUserAudioStatus', {
199
+ userId: uuid,
200
+ audio: false
201
+ })
202
+ })
184
203
  },
185
204
 
186
205
  onPusherNetstatus: function (e) {
@@ -387,5 +406,11 @@ Component({
387
406
  this.client.unmuteLocal('video')
388
407
  }
389
408
  },
409
+
410
+ updateAudioStatus(remoteAudioStatus) {
411
+ this.setData({
412
+ remoteAudioStatus: remoteAudioStatus,
413
+ })
414
+ }
390
415
  },
391
416
  })
@@ -4,7 +4,7 @@
4
4
  showSmall="{{false}}"
5
5
  uid="{{mainRemotePlayer.uid}}"
6
6
  url="{{mainRemotePlayer.url}}"
7
- isInVoice="{{isInVoice}}"
7
+ isInVoice="{{isInVoice || remoteAudioStatus['' + mainRemotePlayer.uid]}}"
8
8
  bindnetstatus="onPlayerNetstatus"
9
9
  bindstatechange="onPlayerStatechange"
10
10
  />
@@ -33,7 +33,7 @@
33
33
  showSmall="{{true}}"
34
34
  uid="{{item.uid}}"
35
35
  url="{{item.url}}"
36
- isInVoice="{{isInVoice}}"
36
+ isInVoice="{{isInVoice || remoteAudioStatus['' + item.uid]}}"
37
37
  bindnetstatus="onPlayerNetstatus"
38
38
  bindstatechange="onPlayerStatechange"
39
39
  />
@@ -20,7 +20,7 @@ Component({
20
20
  isInVoice: {
21
21
  type: Boolean,
22
22
  value: false,
23
- }
23
+ },
24
24
  },
25
25
 
26
26
  /**
@@ -39,6 +39,7 @@ Component({
39
39
  remotePlayerList: [],
40
40
  mainRemotePlayer: null,
41
41
  mainRemoteUser: null,
42
+ remoteAudioStatus: {}
42
43
  },
43
44
 
44
45
  lifetimes: {
@@ -144,6 +145,10 @@ Component({
144
145
  const {
145
146
  player
146
147
  } = event.data
148
+ this.triggerEvent('updateUserAudioStatus', {
149
+ userId: player.userID,
150
+ audio: false
151
+ })
147
152
  // 开始播放远端的视频流,默认是不播放的
148
153
  this.setPlayerAttributesHandler(player, {
149
154
  muteVideo: false
@@ -154,6 +159,10 @@ Component({
154
159
  const {
155
160
  player
156
161
  } = event.data
162
+ this.triggerEvent('updateUserAudioStatus', {
163
+ userId: player.userID,
164
+ audio: true
165
+ })
157
166
  // 开始播放远端的视频流,默认是不播放的
158
167
  this.setPlayerAttributesHandler(player, {
159
168
  muteVideo: true
@@ -293,5 +302,11 @@ Component({
293
302
  const frontCamera = this.data.pusher.frontCamera === 'front' ? 'back' : 'front'
294
303
  this.TRTC.getPusherInstance().switchCamera(frontCamera)
295
304
  },
305
+
306
+ updateAudioStatus(remoteAudioStatus) {
307
+ this.setData({
308
+ remoteAudioStatus: remoteAudioStatus,
309
+ })
310
+ }
296
311
  }
297
312
  })
@@ -3,7 +3,7 @@
3
3
  wx:if="{{mainRemotePlayer}}"
4
4
  remoteUser="{{mainRemotePlayer}}"
5
5
  showSmall="{{false}}"
6
- isInVoice="{{isInVoice}}"
6
+ isInVoice="{{isInVoice || remoteAudioStatus['' + mainRemotePlayer.userID]}}"
7
7
  bind:playerStateChange="_playerStateChange"
8
8
  bind:playerFullscreenChange="_playerFullscreenChange"
9
9
  bind:playerNetStatus="_playerNetStatus"
@@ -46,7 +46,7 @@
46
46
  wx:if="{{item}}"
47
47
  remoteUser="{{item}}"
48
48
  showSmall="{{true}}"
49
- isInVoice="{{isInVoice}}"
49
+ isInVoice="{{isInVoice || remoteAudioStatus['' + item.userID]}}"
50
50
  bind:playerStateChange="_playerStateChange"
51
51
  bind:playerFullscreenChange="_playerFullscreenChange"
52
52
  bind:playerNetStatus="_playerNetStatus"
@@ -106,6 +106,7 @@ module.exports = Behavior({
106
106
  const isPdf = url.includes('.pdf')
107
107
  if (isPdf) {
108
108
  type = 'pdf'
109
+ thumb = 'https://image.hh-medic.com/icon/pacs/hh_icon_pdf.png'
109
110
  } else if (isVideo) {
110
111
  type = 'video'
111
112
  thumb = `${url}?x-oss-process=video/snapshot,t_0,f_jpg`
@@ -35,6 +35,7 @@ module.exports = Behavior({
35
35
  newCases: false,
36
36
  isInVoice: false,
37
37
  expertAvatar: null,
38
+ remoteAudioStatus: {},
38
39
  },
39
40
 
40
41
  methods: {
@@ -241,30 +242,6 @@ module.exports = Behavior({
241
242
  }
242
243
  },
243
244
 
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
245
  /**
269
246
  * 视频中挂断
270
247
  */
@@ -273,18 +250,6 @@ module.exports = Behavior({
273
250
  this.hangup(defines.hangupTypes.hangup)
274
251
  },
275
252
 
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
253
  /**
289
254
  * 主动呼叫时取消呼叫
290
255
  */
@@ -139,7 +139,7 @@ Page({
139
139
  wx.statLog.sendStatLog(this.data.orderId, `收到IM消息(${JSON.stringify(params)})`)
140
140
  console.error(`收到IM消息(${JSON.stringify(params)})`)
141
141
  if (params) {
142
- this.onMessage(params.command)
142
+ this.onMessage(params.command, params.uuid)
143
143
  }
144
144
  }
145
145
  })
@@ -159,7 +159,7 @@ Page({
159
159
  * 处理消息
160
160
  * @param {*} command 消息命令
161
161
  */
162
- onMessage(command) {
162
+ onMessage(command, uuid) {
163
163
  switch (command) {
164
164
  case defines.commands.reject:
165
165
  case defines.commands.rejectWMP:
@@ -178,15 +178,17 @@ Page({
178
178
  break
179
179
  case defines.commands.switchToAudioWMP:
180
180
  case defines.commands.switchToAudioAgora:
181
- this.setData({
182
- isInVoice: true,
183
- })
181
+ // this.updateUserAudioStatus(uuid, true)
182
+ // this.setData({
183
+ // isInVoice: true,
184
+ // })
184
185
  break
185
186
  case defines.commands.switchToVideoWMP:
186
187
  case defines.commands.switchToVideoAgora:
187
- this.setData({
188
- isInVoice: false,
189
- })
188
+ // this.updateUserAudioStatus(uuid, false)
189
+ // this.setData({
190
+ // isInVoice: false,
191
+ // })
190
192
  break
191
193
  }
192
194
  },
@@ -211,5 +213,29 @@ Page({
211
213
  } else if (type === 'pdf') {
212
214
  pdfViewer.viewPdf(url)
213
215
  }
216
+ },
217
+
218
+ updateUserAudioStatus(data) { //uuid, toAudio
219
+ const {
220
+ userId,
221
+ audio
222
+ } = data.detail
223
+ let remoteAudioStatus = this.data.remoteAudioStatus
224
+ remoteAudioStatus[userId] = audio
225
+ let inAudio = true
226
+ this.data.userIdList.forEach((userId) => {
227
+ if (!remoteAudioStatus[userId]) {
228
+ inAudio = false
229
+ }
230
+ });
231
+ if (this.data.isFromAgora) {
232
+ this.selectComponent('#artc').updateAudioStatus(remoteAudioStatus)
233
+ } else {
234
+ this.selectComponent('#trtc').updateAudioStatus(remoteAudioStatus)
235
+ }
236
+ this.setData({
237
+ isInVoice: inAudio,
238
+ remoteAudioStatus: remoteAudioStatus,
239
+ })
214
240
  }
215
241
  })
@@ -10,12 +10,14 @@
10
10
  smallVideoTop="{{smallVideoTop}}"
11
11
  isFamilyOrder="{{isFamilyOrder}}"
12
12
  expertAvatar="{{expertAvatar}}"
13
+ remoteAudioStatus="{{remoteAudioStatus}}"
13
14
  bind:directHangup="_directHangup"
14
15
  bind:sendCallMessage="sendCallMessage"
15
16
  bind:updateVideoState="_updateVideoState"
16
17
  bind:sendLog="_sendLogC"
17
18
  bind:remoteUserJoin="_onRemoteUserJoin"
18
19
  bind:remoteUserLeave="_onRemoteUserLeave"
20
+ bind:updateUserAudioStatus="updateUserAudioStatus"
19
21
  />
20
22
  <agora-video-chat
21
23
  id="artc"
@@ -27,12 +29,14 @@
27
29
  smallVideoTop="{{smallVideoTop}}"
28
30
  isFamilyOrder="{{isFamilyOrder}}"
29
31
  expertAvatar="{{expertAvatar}}"
32
+ remoteAudioStatus="{{remoteAudioStatus}}"
30
33
  bind:directHangup="_directHangup"
31
34
  bind:sendCallMessage="sendCallMessage"
32
35
  bind:updateVideoState="_updateVideoState"
33
36
  bind:sendLog="_sendLogC"
34
37
  bind:remoteUserJoin="_onRemoteUserJoin"
35
38
  bind:remoteUserLeave="_onRemoteUserLeave"
39
+ bind:updateUserAudioStatus="updateUserAudioStatus"
36
40
  />
37
41
  </block>
38
42
  <video-controller
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"