hh-doctor-sdk 0.1.7 → 0.1.9

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.
@@ -36,7 +36,6 @@ module.exports = Behavior({
36
36
  messageMediaFiles: [], // 图片和视频数据
37
37
  scrollTo: null,
38
38
  showPreview: false,
39
- triggered: true,
40
39
  })
41
40
  wx.showNavigationBarLoading()
42
41
  this.loadOrder(() => {
@@ -44,6 +43,7 @@ module.exports = Behavior({
44
43
  this.setData({
45
44
  triggered: false,
46
45
  })
46
+ wx.stopPullDownRefresh()
47
47
  this.buildOrderInfo()
48
48
  this.loadDicom()
49
49
  this.selectComponent('#chat-bottom').initMenuData()
@@ -81,9 +81,12 @@ module.exports = Behavior({
81
81
  messages: list,
82
82
  isRequest: isRequest,
83
83
  }, () => {
84
- this.setData({
85
- scrollTo: `message-bottom`
86
- })
84
+ wx.createSelectorQuery().select('#scroll-body').boundingClientRect(res => {
85
+ wx.pageScrollTo({
86
+ scrollTop: res.bottom,
87
+ duration: 200
88
+ })
89
+ }).exec()
87
90
  })
88
91
  }
89
92
  },
@@ -105,6 +105,7 @@ Page({
105
105
  if (this.data.orderId === null || this.data.orderId === '') {
106
106
  return
107
107
  }
108
+ this._stopPlayAudio(true)
108
109
  this.loadOrderInfo()
109
110
  },
110
111
 
@@ -117,22 +118,16 @@ Page({
117
118
  const url = event.currentTarget.dataset.url
118
119
  const index = event.currentTarget.dataset.index
119
120
  const playerUrl = `${url}${url.endsWith('.amr') ? '.mp3' : ''}`
120
- if (audioPlayer) {
121
- if (currentPlayIndex >= 0) {
122
- this._stopAudioAnimation()
123
- }
124
- audioPlayer.stop()
125
- audioPlayer.destroy()
126
- audioPlayer = null
127
- if (playerUrl == currentPlayUrl) {
128
- return
129
- }
121
+ const same = playerUrl == currentPlayUrl
122
+ this._stopPlayAudio()
123
+ if (same) {
124
+ return
130
125
  }
131
126
  const player = wx.createInnerAudioContext()
132
127
  player.src = playerUrl
133
128
  player.play()
134
129
  player.onEnded(() => {
135
- this._stopAudioAnimation()
130
+ this._stopAudioAnimation(false)
136
131
  })
137
132
  audioPlayer = player
138
133
  currentPlayIndex = index
@@ -142,6 +137,19 @@ Page({
142
137
  }, 400)
143
138
  },
144
139
 
140
+ _stopPlayAudio(onlyStopInterval) {
141
+ if (audioPlayer) {
142
+ if (currentPlayIndex >= 0) {
143
+ this._stopAudioAnimation(onlyStopInterval)
144
+ }
145
+ audioPlayer.stop()
146
+ audioPlayer.destroy()
147
+ audioPlayer = null
148
+ currentPlayUrl = null
149
+ currentPlayIndex = -1
150
+ }
151
+ },
152
+
145
153
  _audioAnimation() {
146
154
  const message = this.data.messages[currentPlayIndex]
147
155
  var value = message.animationValue
@@ -158,9 +166,12 @@ Page({
158
166
  })
159
167
  },
160
168
 
161
- _stopAudioAnimation() {
169
+ _stopAudioAnimation(onlyStopInterval) {
162
170
  if (audioAnimationInterval) {
163
171
  clearInterval(audioAnimationInterval)
172
+ if (onlyStopInterval) {
173
+ return
174
+ }
164
175
  }
165
176
  const message = this.data.messages[currentPlayIndex]
166
177
  message.animationValue = 3
@@ -213,5 +224,5 @@ Page({
213
224
  let isRequest = this.data.isRequest
214
225
  hhNavigation.evaluate(this.data.orderId, isRequest)
215
226
  }
216
- }
227
+ },
217
228
  })
@@ -6,5 +6,7 @@
6
6
  "chat-bottom": "./widget/chat-bottom/chat-bottom"
7
7
  },
8
8
  "navigationBarTitleText": "咨询单详情",
9
- "backgroundColor": "#000000"
9
+ "backgroundColor": "#f3f5fb",
10
+ "enablePullDownRefresh": true,
11
+ "backgroundTextStyle": "dark"
10
12
  }
@@ -7,14 +7,10 @@
7
7
  />
8
8
  本咨询为视频咨询,请设置你方便的视频时间</view
9
9
  >
10
- <scroll-view
11
- class="scroll-view"
12
- scroll-y
13
- scroll-into-view="{{scrollTo}}"
14
- type="list"
15
- refresher-enabled="true"
16
- bindrefresherrefresh="onPullDownRefresh"
17
- refresher-triggered="{{triggered}}"
10
+ <view
11
+ id="scroll-body"
12
+ class="body-display"
13
+ style="{{ notifySetVideoTime ? 'top: 80rpx;' : ''}}"
18
14
  >
19
15
  <view
20
16
  class="consultation-header"
@@ -32,6 +28,8 @@
32
28
  scroll-x
33
29
  class="consultation-header-media-scroll-view"
34
30
  enable-flex="true"
31
+ enhanced="true"
32
+ show-scrollbar="false"
35
33
  >
36
34
  <view class="consultation-header-media-box">
37
35
  <block wx:for="{{mediaInfo}}" wx:key="image">
@@ -70,7 +68,7 @@
70
68
  </block>
71
69
  </view>
72
70
  <view id="message-bottom" class="message-bottom"></view>
73
- </scroll-view>
71
+ </view>
74
72
  <chat-bottom
75
73
  id="chat-bottom"
76
74
  wx:if="{{order && doctorInfo}}"
@@ -7,6 +7,8 @@ page {
7
7
  }
8
8
 
9
9
  .body-display {
10
+ position: absolute;
11
+ width: 100%;
10
12
  display: flex;
11
13
  flex-direction: column;
12
14
  }
@@ -36,6 +38,13 @@ page {
36
38
  height: 215rpx;
37
39
  }
38
40
 
41
+ consultation-header-media-scroll-view ::-webkit-scrollbar {
42
+ display: none;
43
+ width: 0;
44
+ height: 0;
45
+ color: transparent;
46
+ }
47
+
39
48
  .doctor-info-container {
40
49
  display: flex;
41
50
  border-top: 1rpx #dcdcdcff solid;
@@ -56,10 +65,15 @@ page {
56
65
  }
57
66
 
58
67
  .set-time-tip {
68
+ width: 100%;
69
+ height: 80rpx;
70
+ position: fixed;
71
+ left: 0;
72
+ top: 0;
59
73
  display: flex;
60
74
  flex-direction: row;
75
+ padding: 0 30rpx;
61
76
  background-color: #fffae6;
62
- padding: 20rpx 30rpx;
63
77
  color: #f01414;
64
78
  align-items: center;
65
79
  font-size: 30rpx;
@@ -36,12 +36,10 @@ module.exports = Behavior({
36
36
 
37
37
  methods: {
38
38
  loadList() {
39
- this.setData({
40
- triggered: true
41
- })
42
39
  wx.showNavigationBarLoading()
43
40
  api.orderList().then((res) => {
44
41
  wx.hideNavigationBarLoading()
42
+ wx.stopPullDownRefresh()
45
43
  this.setData({
46
44
  triggered: false
47
45
  })
@@ -10,7 +10,6 @@ Page({
10
10
  */
11
11
  data: {
12
12
  needRefresh: false,
13
- triggered: false,
14
13
  },
15
14
 
16
15
  /**
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "usingComponents": {},
3
3
  "navigationBarTitleText": "咨询单",
4
- "backgroundColor": "#000000",
5
- "enablePullDownRefresh": true
4
+ "backgroundColor": "#f3f5fb",
5
+ "enablePullDownRefresh": true,
6
+ "backgroundTextStyle": "dark"
6
7
  }
@@ -1,62 +1,47 @@
1
1
  <view class="match-parent">
2
- <scroll-view
3
- class="scroll-view"
4
- type="list"
5
- scroll-y
6
- scroll-into-view="{{scrollTo}}"
7
- refresher-enabled="true"
8
- bindrefresherrefresh="onPullDownRefresh"
9
- refresher-triggered="{{triggered}}"
10
- >
11
- <view class="chatting-body">
12
- <block
13
- wx:for="{{orderGroup}}"
14
- wx:key="orderGroup"
15
- wx:for-item="group"
2
+ <view class="chatting-body">
3
+ <block wx:for="{{orderGroup}}" wx:key="orderGroup" wx:for-item="group">
4
+ <view wx:if="{{group.showSection}}" class="order-group"
5
+ >{{group.title}}</view
16
6
  >
17
- <view wx:if="{{group.showSection}}" class="order-group"
18
- >{{group.title}}</view
7
+ <view class="chatting-body">
8
+ <block
9
+ wx:for="{{group.list}}"
10
+ wx:key="order"
11
+ wx:for-item="order"
19
12
  >
20
- <view class="chatting-body">
21
- <block
22
- wx:for="{{group.list}}"
23
- wx:key="order"
24
- wx:for-item="order"
13
+ <view
14
+ data-orderid="{{order.orderId}}"
15
+ class="order-item"
16
+ bind:tap="clickOrderItem"
25
17
  >
26
- <view
27
- data-orderid="{{order.orderId}}"
28
- class="order-item"
29
- bind:tap="clickOrderItem"
30
- >
31
- <view class="order-patient">
32
- <view class="order-item-name">
33
- {{order.patientName}}
34
- <image
35
- class="order-status-icon"
36
- wx:if="{{order.icon}}"
37
- src="{{order.icon}}"
38
- />
39
- </view>
40
- <view
41
- wx:if="{{order.orderStatusTips}}"
42
- class="order-status {{order.statusColor}}"
43
- >{{order.orderStatusTips}}
44
- </view>
45
- </view>
46
- <view class="order-hospital"
47
- >{{order.doctorName}} {{order.hospitalName}}
18
+ <view class="order-patient">
19
+ <view class="order-item-name">
20
+ {{order.patientName}}
21
+ <image
22
+ class="order-status-icon"
23
+ wx:if="{{order.icon}}"
24
+ src="{{order.icon}}"
25
+ />
48
26
  </view>
49
27
  <view
50
- wx:if="{{order.provideTime != null}}"
51
- class="provide-time"
52
- >{{order.provideTime}}
28
+ wx:if="{{order.orderStatusTips}}"
29
+ class="order-status {{order.statusColor}}"
30
+ >{{order.orderStatusTips}}
53
31
  </view>
54
- <view wx:if="{{order.showLine}}" class="line" />
55
32
  </view>
56
- </block>
57
- </view>
58
- </block>
59
- </view>
60
- <view class="message-bottom"></view>
61
- </scroll-view>
33
+ <view class="order-hospital"
34
+ >{{order.doctorName}} {{order.hospitalName}}
35
+ </view>
36
+ <view
37
+ wx:if="{{order.provideTime != null}}"
38
+ class="provide-time"
39
+ >{{order.provideTime}}
40
+ </view>
41
+ <view wx:if="{{order.showLine}}" class="line" />
42
+ </view>
43
+ </block>
44
+ </view>
45
+ </block>
46
+ </view>
62
47
  </view>
@@ -6,15 +6,11 @@ page {
6
6
  height: 100%;
7
7
  }
8
8
 
9
- .message-bottom {
10
- width: 100%;
11
- padding-bottom: constant(safe-area-inset-bottom); /* 兼容 IOS<11.2 */
12
- padding-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
13
- }
14
-
15
9
  .chatting-body {
16
10
  display: flex;
17
11
  flex-direction: column;
12
+ padding-bottom: constant(safe-area-inset-bottom); /* 兼容 IOS<11.2 */
13
+ padding-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
18
14
  }
19
15
 
20
16
  .order-group {
@@ -1,6 +1,6 @@
1
1
  <view class="page">
2
2
  <scroll-view class="page-scroll-view" scroll-y:true>
3
- <scroll-view scroll-x>
3
+ <scroll-view scroll-x enhanced="true" show-scrollbar="false">
4
4
  <view class="order-media-container">
5
5
  <block wx:for="{{mediaInfo}}" wx:key="this">
6
6
  <view
@@ -15,6 +15,13 @@ page {
15
15
  margin-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
16
16
  }
17
17
 
18
+ scroll-view ::-webkit-scrollbar {
19
+ display: none;
20
+ width: 0;
21
+ height: 0;
22
+ color: transparent;
23
+ }
24
+
18
25
  .page-scroll-view {
19
26
  width: 100%;
20
27
  height: 100%;
@@ -89,6 +89,7 @@ Component({
89
89
  await this.client.unpublish()
90
90
  await this.client.leave()
91
91
  // await this.client.destory()
92
+ wx.statLog.sendStatLog(null, '(声网)本人离开房间')
92
93
  this.triggerEvent("directHangup")
93
94
  },
94
95
 
@@ -101,6 +102,7 @@ Component({
101
102
  this.addMedia(0, uuid, url, {
102
103
  key: ts
103
104
  })
105
+ wx.statLog.sendStatLog(null, '(声网)本人加入房间')
104
106
  this.triggerEvent('sendLog', logApi.logTypes.connect)
105
107
  this.triggerEvent('sendCallMessage')
106
108
  },
@@ -143,7 +145,7 @@ Component({
143
145
  }
144
146
  }
145
147
  }
146
-
148
+ wx.statLog.sendStatLog(null, `(声网)${uid}加入房间`)
147
149
  if (!matchItem) {
148
150
  this.addMedia(1, uid, url, {
149
151
  key: ts,
@@ -159,6 +161,7 @@ Component({
159
161
 
160
162
  this.client.on("stream-removed", e => {
161
163
  let uid = e.uid;
164
+ wx.statLog.sendStatLog(null, `(声网)${uid}离开房间`)
162
165
  this.removeMedia(uid)
163
166
  })
164
167
 
@@ -166,6 +169,7 @@ Component({
166
169
  let errObj = err || {};
167
170
  let code = errObj.code || 0;
168
171
  let reason = errObj.reason || "";
172
+ wx.statLog.sendStatLog(null, `(声网)发生错误(${code} -> ${reason})`)
169
173
  if (code === 501 || code === 904) {
170
174
  this.reconnect()
171
175
  }
@@ -188,8 +192,8 @@ Component({
188
192
  this.client.on("token-privilege-did-expire", () => {})
189
193
 
190
194
  this.client.on("mute-video", (e) => {
191
- console.error(JSON.stringify(e))
192
195
  const uuid = e.uid
196
+ wx.statLog.sendStatLog(null, `(声网)远端用户切换为音频(${uuid})`)
193
197
  this.triggerEvent('updateUserAudioStatus', {
194
198
  userId: uuid,
195
199
  audio: true
@@ -197,8 +201,8 @@ Component({
197
201
  })
198
202
 
199
203
  this.client.on("unmute-video", (e) => {
200
- console.error(JSON.stringify(e))
201
204
  const uuid = e.uid
205
+ wx.statLog.sendStatLog(null, `(声网)远端用户切换为视频(${uuid})`)
202
206
  this.triggerEvent('updateUserAudioStatus', {
203
207
  userId: uuid,
204
208
  audio: false
@@ -404,6 +408,7 @@ Component({
404
408
  }
405
409
  },
406
410
  switchAudioVideo(toAudio) {
411
+ wx.statLog.sendStatLog(null, `(声网)切换为${toAudio ? '音频' : '视频'}`)
407
412
  if (toAudio) {
408
413
  this.client.muteLocal('video')
409
414
  } else {
@@ -114,12 +114,14 @@ Component({
114
114
  const TRTC_EVENT = this.TRTC.EVENT
115
115
  // 初始化事件订阅
116
116
  this.TRTC.on(TRTC_EVENT.LOCAL_JOIN, (event) => {
117
+ wx.statLog.sendStatLog(null, '本人加入房间')
117
118
  this.triggerEvent('sendLog', logApi.logTypes.connect)
118
119
  if (!this.properties.callback) {
119
120
  this.triggerEvent('sendCallMessage')
120
121
  }
121
122
  })
122
123
  this.TRTC.on(TRTC_EVENT.LOCAL_LEAVE, (event) => {
124
+ wx.statLog.sendStatLog(null, '本人离开房间')
123
125
  this.triggerEvent("directHangup")
124
126
  })
125
127
  this.TRTC.on(TRTC_EVENT.ERROR, (event) => {
@@ -131,6 +133,7 @@ Component({
131
133
  const {
132
134
  userID
133
135
  } = event.data
136
+ wx.statLog.sendStatLog(null, `${userID}加入房间`)
134
137
  this.triggerEvent('updateVideoState', 'chatting')
135
138
  this.triggerEvent('remoteUserJoin', `${userID}`)
136
139
  }
@@ -141,6 +144,7 @@ Component({
141
144
  userID,
142
145
  playerList
143
146
  } = event.data
147
+ wx.statLog.sendStatLog(null, `${userID}离开房间`)
144
148
  this.triggerEvent('remoteUserLeave', `${userID}`)
145
149
  this._updatePlayerList(playerList)
146
150
  })
@@ -149,6 +153,7 @@ Component({
149
153
  const {
150
154
  player
151
155
  } = event.data
156
+ wx.statLog.sendStatLog(null, `${player.userID}远端用户开始推送视频`)
152
157
  this.triggerEvent('updateUserAudioStatus', {
153
158
  userId: player.userID,
154
159
  audio: false
@@ -163,6 +168,7 @@ Component({
163
168
  const {
164
169
  player
165
170
  } = event.data
171
+ wx.statLog.sendStatLog(null, `${player.userID}远端用户停止推送视频`)
166
172
  this.triggerEvent('updateUserAudioStatus', {
167
173
  userId: player.userID,
168
174
  audio: true
@@ -177,6 +183,7 @@ Component({
177
183
  const {
178
184
  player
179
185
  } = event.data
186
+ wx.statLog.sendStatLog(null, `${player.userID}远端用户开始推送音频`)
180
187
  this.setPlayerAttributesHandler(player, {
181
188
  muteAudio: false
182
189
  })
@@ -187,6 +194,7 @@ Component({
187
194
  const {
188
195
  player
189
196
  } = event.data
197
+ wx.statLog.sendStatLog(null, `${player.userID}远端用户停止推送音频`)
190
198
  this.setPlayerAttributesHandler(player, {
191
199
  muteAudio: true
192
200
  })
@@ -288,6 +296,7 @@ Component({
288
296
  mainRemotePlayer: null,
289
297
  remotePlayerList: null
290
298
  })
299
+ wx.statLog.sendStatLog(null, '远端用户都离开了房间自己也需要离开房间,停止推送音视频')
291
300
  // 此时房间内远端用户都离开了,需要自己也离开房间
292
301
  this.setPusherAttributesHandler({
293
302
  enableCamera: false,
@@ -296,13 +305,12 @@ Component({
296
305
  }
297
306
  },
298
307
  switchAudioVideo(toAudio) {
308
+ wx.statLog.sendStatLog(null, `切换为${toAudio ? '音频' : '视频'}`)
299
309
  if (toAudio) {
300
- // this.TRTC.getPusherInstance().pause()
301
310
  this.setPusherAttributesHandler({
302
311
  enableCamera: false,
303
312
  })
304
313
  } else {
305
- // this.TRTC.getPusherInstance().resume()
306
314
  this.setPusherAttributesHandler({
307
315
  enableCamera: true,
308
316
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"