hh-doctor-sdk 0.7.5 → 0.7.6
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/hh-doctor.js
CHANGED
|
@@ -53,6 +53,7 @@ async function isDoctorAuth(doctorId) {
|
|
|
53
53
|
// const haveLicense = (doctorInfo.superLicenseUrl && doctorInfo.superLicenseUrl.length > 0) || (doctorInfo.superLicense1Url && doctorInfo.superLicense1Url.length > 0);
|
|
54
54
|
// return isAuthHH && haveLicense;
|
|
55
55
|
}
|
|
56
|
+
|
|
56
57
|
return false;
|
|
57
58
|
} catch {
|
|
58
59
|
return false;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<view class="item-button" bindtap="_clickViewCase">
|
|
28
28
|
<image
|
|
29
29
|
class="item-button-img"
|
|
30
|
-
src="
|
|
30
|
+
src="https://image.hh-medic.com/icon/pacs/hh_chat_bingli.png"
|
|
31
31
|
mode=""
|
|
32
32
|
/>
|
|
33
33
|
<view class="control-button-text">病历资料</view>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 视频铃声
|
|
3
3
|
*/
|
|
4
|
+
|
|
5
|
+
// 真机上 InnerAudioContext 创建后立即 play 偶发不生效,
|
|
6
|
+
// 改为立即播放并在未开始时有限次重试,成功后即停止重试
|
|
7
|
+
const RING_MAX_RETRY = 5
|
|
8
|
+
const RING_RETRY_INTERVAL = 200
|
|
9
|
+
|
|
4
10
|
module.exports = Behavior({
|
|
5
11
|
data: {
|
|
6
12
|
calling: {
|
|
@@ -18,27 +24,39 @@ module.exports = Behavior({
|
|
|
18
24
|
* 播放呼叫铃声
|
|
19
25
|
*/
|
|
20
26
|
playCallRing() {
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
// 重新发起呼叫,先清理上一次的实例与重试
|
|
28
|
+
this.stopCallRing()
|
|
29
|
+
|
|
30
|
+
const audioContext = wx.createInnerAudioContext()
|
|
31
|
+
audioContext.src = this.data.calling.url
|
|
32
|
+
audioContext.loop = true
|
|
23
33
|
this.setData({
|
|
24
34
|
callingAudioContext: audioContext,
|
|
25
35
|
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
audioContext.
|
|
29
|
-
|
|
36
|
+
|
|
37
|
+
// 一旦真正开始播放,立即停止重试
|
|
38
|
+
audioContext.onPlay(() => this._clearRingPlayTimer())
|
|
39
|
+
|
|
40
|
+
let retry = 0
|
|
41
|
+
const tryPlay = () => {
|
|
42
|
+
// 实例已被 stopCallRing 销毁则终止,避免野实例继续播放
|
|
43
|
+
if (this.data.callingAudioContext !== audioContext) return
|
|
30
44
|
audioContext.play()
|
|
31
|
-
|
|
45
|
+
this._ringPlayTimer = setTimeout(() => {
|
|
46
|
+
if (retry++ < RING_MAX_RETRY) tryPlay()
|
|
47
|
+
}, RING_RETRY_INTERVAL)
|
|
48
|
+
}
|
|
49
|
+
tryPlay()
|
|
32
50
|
},
|
|
33
51
|
/**
|
|
34
52
|
* 停止播放呼叫铃声
|
|
35
53
|
*/
|
|
36
54
|
stopCallRing() {
|
|
37
|
-
|
|
55
|
+
this._clearRingPlayTimer()
|
|
56
|
+
const audioContext = this.data.callingAudioContext
|
|
38
57
|
if (audioContext) {
|
|
39
|
-
audioContext.stop()
|
|
40
|
-
audioContext.destroy()
|
|
41
|
-
audioContext = null
|
|
58
|
+
audioContext.stop()
|
|
59
|
+
audioContext.destroy()
|
|
42
60
|
this.setData({
|
|
43
61
|
callingAudioContext: null,
|
|
44
62
|
})
|
|
@@ -49,12 +67,21 @@ module.exports = Behavior({
|
|
|
49
67
|
*/
|
|
50
68
|
playHangup() {
|
|
51
69
|
this.stopCallRing()
|
|
52
|
-
|
|
70
|
+
const audioContext = wx.createInnerAudioContext({
|
|
53
71
|
useWebAudioImplement: false
|
|
54
72
|
})
|
|
55
73
|
audioContext.src = this.data.hangup.url
|
|
56
74
|
audioContext.loop = false
|
|
57
75
|
audioContext.play()
|
|
58
76
|
},
|
|
77
|
+
/**
|
|
78
|
+
* 清除待执行的重试定时器
|
|
79
|
+
*/
|
|
80
|
+
_clearRingPlayTimer() {
|
|
81
|
+
if (this._ringPlayTimer) {
|
|
82
|
+
clearTimeout(this._ringPlayTimer)
|
|
83
|
+
this._ringPlayTimer = null
|
|
84
|
+
}
|
|
85
|
+
},
|
|
59
86
|
}
|
|
60
|
-
})
|
|
87
|
+
})
|