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.
Files changed (131) hide show
  1. package/components/apis/api-host-define.js +69 -0
  2. package/components/apis/consultation-reply-api.js +21 -0
  3. package/components/apis/dicom-api.js +31 -0
  4. package/components/apis/family-api.js +20 -0
  5. package/components/apis/file-upload-api.js +35 -0
  6. package/components/apis/order-app-api.js +206 -0
  7. package/components/apis/stat-log-api.js +42 -0
  8. package/components/apis/video-chat-log-api.js +47 -0
  9. package/components/apis/video-message-api.js +88 -0
  10. package/components/consultation/detail/behaviors/chat-cell-base-behaviors.js +29 -0
  11. package/components/consultation/detail/behaviors/consultation-behaviors.js +60 -0
  12. package/components/consultation/detail/behaviors/consultation-chat-behaviors.js +321 -0
  13. package/components/consultation/detail/behaviors/consultation-header-media-behaviors.js +176 -0
  14. package/components/consultation/detail/behaviors/consultation-header-text-behaviors.js +325 -0
  15. package/components/consultation/detail/behaviors/consultation-reply-behaviors.js +67 -0
  16. package/components/consultation/detail/consultation-detail-page.js +219 -0
  17. package/components/consultation/detail/consultation-detail-page.json +10 -0
  18. package/components/consultation/detail/consultation-detail-page.wxml +65 -0
  19. package/components/consultation/detail/consultation-detail-page.wxss +51 -0
  20. package/components/consultation/detail/widget/case-image-filter.js +47 -0
  21. package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.js +31 -0
  22. package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.json +4 -0
  23. package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxml +17 -0
  24. package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxss +9 -0
  25. package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +100 -0
  26. package/components/consultation/detail/widget/chat-bottom/chat-bottom.json +4 -0
  27. package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxml +24 -0
  28. package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxss +54 -0
  29. package/components/consultation/detail/widget/chat-bottom/chat-menu-builder.js +131 -0
  30. package/components/consultation/detail/widget/chat-cell-template/chat-cell-template.wxml +173 -0
  31. package/components/consultation/detail/widget/chat-cell.wxss +394 -0
  32. package/components/consultation/detail/widget/detail-media/detail-media.js +47 -0
  33. package/components/consultation/detail/widget/detail-media/detail-media.json +4 -0
  34. package/components/consultation/detail/widget/detail-media/detail-media.wxml +12 -0
  35. package/components/consultation/detail/widget/detail-media/detail-media.wxss +57 -0
  36. package/components/consultation/detail/widget/detail-text/detail-text.js +31 -0
  37. package/components/consultation/detail/widget/detail-text/detail-text.json +4 -0
  38. package/components/consultation/detail/widget/detail-text/detail-text.wxml +6 -0
  39. package/components/consultation/detail/widget/detail-text/detail-text.wxss +14 -0
  40. package/components/consultation/evaluate/evaluate-page.js +157 -0
  41. package/components/consultation/evaluate/evaluate-page.json +3 -0
  42. package/components/consultation/evaluate/evaluate-page.wxml +42 -0
  43. package/components/consultation/evaluate/evaluate-page.wxss +103 -0
  44. package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +144 -0
  45. package/components/consultation/list/consultation-list-page.js +84 -0
  46. package/components/consultation/list/consultation-list-page.json +5 -0
  47. package/components/consultation/list/consultation-list-page.wxml +53 -0
  48. package/components/consultation/list/consultation-list-page.wxss +105 -0
  49. package/components/consultation/reply/behaviors/reply-base-behaviors.js +175 -0
  50. package/components/consultation/reply/consultation-reply-page.js +251 -0
  51. package/components/consultation/reply/consultation-reply-page.json +6 -0
  52. package/components/consultation/reply/consultation-reply-page.wxml +103 -0
  53. package/components/consultation/reply/consultation-reply-page.wxss +169 -0
  54. package/components/consultation/reply/widget/audio-record-view/audio-record-view.js +144 -0
  55. package/components/consultation/reply/widget/audio-record-view/audio-record-view.json +4 -0
  56. package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxml +27 -0
  57. package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxss +197 -0
  58. package/components/hh-doctor.js +36 -0
  59. package/components/hh-navigation.js +87 -0
  60. package/components/public/app-config.js +13 -0
  61. package/components/public/behaviors/order-base-behaviors.js +53 -0
  62. package/components/public/cache-data.js +134 -0
  63. package/components/public/doctor-loader.js +60 -0
  64. package/components/public/im-manager.js +135 -0
  65. package/components/public/pdf-viewer.js +59 -0
  66. package/components/public/stat-log.js +13 -0
  67. package/components/static/Agora_Miniapp_SDK_for_WeChat.js +2 -0
  68. package/components/static/trtc-wx.js +2 -0
  69. package/components/uikit/css/common.wxss +23 -0
  70. package/components/uikit/custom-bottom-pop/custom-bottom-pop.js +37 -0
  71. package/components/uikit/custom-bottom-pop/custom-bottom-pop.json +4 -0
  72. package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxml +9 -0
  73. package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxss +79 -0
  74. package/components/uikit/date-time-picker/date-time-picker.js +115 -0
  75. package/components/uikit/web-view-page/web-view-page.js +87 -0
  76. package/components/uikit/web-view-page/web-view-page.json +3 -0
  77. package/components/uikit/web-view-page/web-view-page.wxml +6 -0
  78. package/components/uikit/web-view-page/web-view-page.wxss +1 -0
  79. package/components/utils/checksumUtils.js +56 -0
  80. package/components/utils/common-utils.js +59 -0
  81. package/components/utils/dateUtils.js +142 -0
  82. package/components/utils/eventBus.js +77 -0
  83. package/components/utils/httpUtils.js +123 -0
  84. package/components/utils/number-utils.js +48 -0
  85. package/components/utils/permission-utils.js +164 -0
  86. package/components/video-chat/agora-rtc/agora-player/agora-player.js +106 -0
  87. package/components/video-chat/agora-rtc/agora-player/agora-player.json +4 -0
  88. package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +24 -0
  89. package/components/video-chat/agora-rtc/agora-player/agora-player.wxss +1 -0
  90. package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +92 -0
  91. package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.json +4 -0
  92. package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +22 -0
  93. package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxss +1 -0
  94. package/components/video-chat/agora-rtc/agora-rtc.js +391 -0
  95. package/components/video-chat/agora-rtc/agora-rtc.json +7 -0
  96. package/components/video-chat/agora-rtc/agora-rtc.wxml +39 -0
  97. package/components/video-chat/agora-rtc/agora-rtc.wxss +1 -0
  98. package/components/video-chat/callback/callback.js +39 -0
  99. package/components/video-chat/callback/callback.json +4 -0
  100. package/components/video-chat/callback/callback.wxml +29 -0
  101. package/components/video-chat/callback/callback.wxss +26 -0
  102. package/components/video-chat/calling/calling.js +75 -0
  103. package/components/video-chat/calling/calling.json +4 -0
  104. package/components/video-chat/calling/calling.wxml +32 -0
  105. package/components/video-chat/calling/calling.wxss +45 -0
  106. package/components/video-chat/controller/controller.js +86 -0
  107. package/components/video-chat/controller/controller.json +4 -0
  108. package/components/video-chat/controller/controller.wxml +73 -0
  109. package/components/video-chat/controller/controller.wxss +71 -0
  110. package/components/video-chat/remote-player/remote-player.js +42 -0
  111. package/components/video-chat/remote-player/remote-player.json +4 -0
  112. package/components/video-chat/remote-player/remote-player.wxml +37 -0
  113. package/components/video-chat/remote-player/remote-player.wxss +1 -0
  114. package/components/video-chat/video-chat.js +297 -0
  115. package/components/video-chat/video-chat.json +7 -0
  116. package/components/video-chat/video-chat.wxml +56 -0
  117. package/components/video-chat/video-chat.wxss +97 -0
  118. package/components/video-chat-page/behaviors/chat-files-behaviors.js +243 -0
  119. package/components/video-chat-page/behaviors/chat-log-behaviors.js +90 -0
  120. package/components/video-chat-page/behaviors/chat-sound-behaviors.js +60 -0
  121. package/components/video-chat-page/behaviors/video-chat-behaviors.js +524 -0
  122. package/components/video-chat-page/case-group-view/case-group-view.js +38 -0
  123. package/components/video-chat-page/case-group-view/case-group-view.json +4 -0
  124. package/components/video-chat-page/case-group-view/case-group-view.wxml +32 -0
  125. package/components/video-chat-page/case-group-view/case-group-view.wxss +44 -0
  126. package/components/video-chat-page/video-chat-defines.js +39 -0
  127. package/components/video-chat-page/video-chat-page.js +212 -0
  128. package/components/video-chat-page/video-chat-page.json +14 -0
  129. package/components/video-chat-page/video-chat-page.wxml +88 -0
  130. package/components/video-chat-page/video-chat-page.wxss +45 -0
  131. package/package.json +18 -0
@@ -0,0 +1,144 @@
1
+ const recorder = wx.getRecorderManager()
2
+
3
+ Component({
4
+
5
+ lifetimes: {
6
+
7
+ ready: function () {
8
+ recorder.onStart(() => {})
9
+ recorder.onPause(() => {})
10
+ recorder.onStop((res) => {
11
+ this.triggerEvent('audiorecord', res)
12
+ })
13
+ },
14
+ attached: function () {},
15
+ detached: function () {}
16
+ },
17
+
18
+ /**
19
+ * 组件的属性列表
20
+ */
21
+ properties: {
22
+
23
+ },
24
+
25
+ /**
26
+ * 组件的初始数据
27
+ */
28
+ data: {
29
+ init: true,
30
+ show: false,
31
+ state: 'ready',
32
+ seconds: 0,
33
+ timer: null,
34
+ isFinish: false,
35
+ button: '点击录制',
36
+ },
37
+
38
+ /**
39
+ * 组件的方法列表
40
+ */
41
+ methods: {
42
+ show() {
43
+ this.setData({
44
+ show: true,
45
+ init: false,
46
+ })
47
+ },
48
+ hide() {
49
+ this.setData({
50
+ show: false,
51
+ })
52
+ this.triggerEvent('audiorecord', null)
53
+ this._resetTime()
54
+ },
55
+
56
+ _resetTime() {
57
+ if (this.data.timer) {
58
+ clearInterval(this.data.timer)
59
+ }
60
+ this.setData({
61
+ seconds: 0,
62
+ state: 'ready',
63
+ timer: null,
64
+ button: '点击录制',
65
+ })
66
+ },
67
+
68
+ recordAudio() {
69
+ if (this.data.isFinish) {
70
+ if (this.data.seconds >= 300) {
71
+ wx.showToast({
72
+ title: '已经录制到最长时限,无法继续录制',
73
+ })
74
+ }
75
+ return
76
+ }
77
+
78
+ if (this.data.state == 'ready') {
79
+ this.setData({
80
+ state: 'recording',
81
+ button: '点击暂停录制',
82
+ })
83
+ var options = {
84
+ format: 'mp3',
85
+ duration: 300000,
86
+ }
87
+ recorder.start(options)
88
+ this.countDown()
89
+ } else if (this.data.state == 'recording') {
90
+ this.setData({
91
+ state: 'pause',
92
+ button: '点击继续录制',
93
+ })
94
+ recorder.pause()
95
+ clearInterval(this.data.timer)
96
+ } else if (this.data.state == 'pause') {
97
+ this.setData({
98
+ state: 'recording',
99
+ button: '点击暂停录制',
100
+ })
101
+ recorder.resume()
102
+ this.countDown()
103
+ }
104
+ },
105
+
106
+ countDown() {
107
+ if (this.data.isFinish) {
108
+ return
109
+ }
110
+ this.setData({
111
+ timer: setInterval(() => {
112
+ var seconds = this.data.seconds + 1
113
+ if (this.data.seconds >= 300) {
114
+ this.setData({
115
+ isFinish: true,
116
+ button: '已录制最大时长'
117
+ })
118
+ recorder.stop()
119
+ clearInterval(this.data.timer)
120
+ return;
121
+ }
122
+ this.setData({
123
+ seconds: seconds
124
+ })
125
+ }, 1000)
126
+ })
127
+ },
128
+ // 完成录音使用
129
+ finishRecord() {
130
+ recorder.stop()
131
+ clearInterval(this.data.timer)
132
+ this.setData({
133
+ init: true,
134
+ show: false,
135
+ state: 'ready',
136
+ seconds: 0,
137
+ timer: null,
138
+ isFinish: false,
139
+ button: '点击录制',
140
+ filePath: null,
141
+ })
142
+ },
143
+ }
144
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,27 @@
1
+ <view
2
+ class="audio-record-popup {{init ? 'default-hide' : ''}} {{show ? 'show': 'hide' }}"
3
+ >
4
+ </view>
5
+
6
+ <view
7
+ class="audio-record-popup-container {{init ? 'default-hide' : ''}} {{show ? 'show': 'hide' }}"
8
+ >
9
+ <button class="close-button" bind:tap="hide">关闭</button>
10
+ <view class="audio-record-wait-record">
11
+ <text class="record-button"
12
+ >{{seconds > 0 ? seconds + '″/300″' : '最长支持300秒录音'}}</text
13
+ >
14
+ <view class="recode" bind:tap="recordAudio">
15
+ <view
16
+ class="record-wave-multiple {{state == 'recording' && !isFinish ? '' : 'hide'}}"
17
+ >
18
+ <view></view>
19
+ <view></view>
20
+ <view></view>
21
+ </view>
22
+ <view class="record-bgm"></view>
23
+ </view>
24
+ <text class="record-button">{{button}}</text>
25
+ <button class="finish-button" bind:tap="finishRecord">完成</button>
26
+ </view>
27
+ </view>
@@ -0,0 +1,197 @@
1
+ .audio-record-popup {
2
+ position: absolute;
3
+ left: 0;
4
+ bottom: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background: rgba(0, 0, 0, 0.5);
8
+ z-index: 999;
9
+ }
10
+
11
+ .default-hide {
12
+ display: none;
13
+ }
14
+
15
+ .audio-record-popup.show {
16
+ animation: slideBGtUp 0.5s ease-in both;
17
+ }
18
+
19
+ .audio-record-popup.hide {
20
+ animation: slideBGDown 0.5s ease-in both;
21
+ }
22
+
23
+ @keyframes slideBGtUp {
24
+ from {
25
+ background: transparent;
26
+ }
27
+ to {
28
+ background: rgba(0, 0, 0, 0.5);
29
+ visibility: visible;
30
+ }
31
+ }
32
+
33
+ @keyframes slideBGDown {
34
+ from {
35
+ background: rgba(0, 0, 0, 0.1);
36
+ }
37
+ to {
38
+ background: transparent;
39
+ visibility: hidden;
40
+ }
41
+ }
42
+
43
+ .audio-record-popup-container {
44
+ position: absolute;
45
+ left: 0;
46
+ bottom: 0;
47
+ width: 100%;
48
+ height: 500rpx;
49
+ /* height: 35%; */
50
+ overflow: hidden;
51
+ z-index: 9999;
52
+ background: #ffffff;
53
+ }
54
+
55
+ .audio-record-popup-container.show {
56
+ transform-origin: bottom; /* 设置动画的变换原点为底部 */
57
+ animation: slideIn 0.6s ease-in-out both; /* 添加弹窗动画 */
58
+ }
59
+
60
+ .audio-record-popup-container.hide {
61
+ transform-origin: bottom; /* 设置动画的变换原点为底部 */
62
+ animation: slideOut 0.6s ease-in-out both; /* 添加弹窗动画 */
63
+ }
64
+
65
+ @keyframes slideIn {
66
+ from {
67
+ bottom: -100%;
68
+ }
69
+ to {
70
+ bottom: 0;
71
+ }
72
+ }
73
+
74
+ @keyframes slideOut {
75
+ from {
76
+ bottom: 0;
77
+ }
78
+ to {
79
+ bottom: -100%;
80
+ }
81
+ }
82
+
83
+ .audio-record-container {
84
+ width: 100%;
85
+ height: 100%;
86
+ }
87
+
88
+ .audio-record-wait-record {
89
+ display: flex;
90
+ position: absolute;
91
+ top: 50%;
92
+ transform: translate(-50%, -50%);
93
+ left: 50%;
94
+ justify-items: center;
95
+ justify-content: center;
96
+ flex-direction: column;
97
+ }
98
+
99
+ .recode {
100
+ position: relative;
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: center;
104
+ width: 120rpx;
105
+ height: 120rpx;
106
+ border-radius: 50%;
107
+ color: #fff;
108
+ margin: 0 auto;
109
+ }
110
+ .recode .record-bgm {
111
+ width: 105rpx;
112
+ height: 105rpx;
113
+ border-radius: 50%;
114
+ background: #0096f0;
115
+ }
116
+ .recode .record-wave-multiple {
117
+ position: absolute;
118
+ left: 0;
119
+ top: 0;
120
+ }
121
+
122
+ .record-wave-multiple.hide {
123
+ display: none;
124
+ }
125
+
126
+ .record-wave-multiple > view {
127
+ display: inline-block;
128
+ background-color: #0096f0;
129
+ border: 0 solid #0096f0;
130
+ position: absolute;
131
+ top: -25rpx;
132
+ left: -27rpx;
133
+ width: 170rpx;
134
+ height: 170rpx;
135
+ border-radius: 100%;
136
+ opacity: 0;
137
+ -webkit-animation: circle-wave-multiple 1.8s
138
+ cubic-bezier(0.41, 0.4, 0.67, 1) 0s infinite;
139
+ animation: circle-wave-multiple 1.8s cubic-bezier(0.41, 0.4, 0.67, 1) 0s
140
+ infinite;
141
+ }
142
+ .record-wave-multiple > view:nth-child(2) {
143
+ -webkit-animation-delay: 0.6s;
144
+ animation-delay: 0.6s;
145
+ }
146
+ .record-wave-multiple > view:nth-child(3) {
147
+ -webkit-animation-delay: 1.2s;
148
+ animation-delay: 1.2s;
149
+ }
150
+ @keyframes circle-wave-multiple {
151
+ 0% {
152
+ opacity: 0;
153
+ transform: scale(0.4);
154
+ }
155
+ 5% {
156
+ opacity: 0.5;
157
+ }
158
+ 100% {
159
+ opacity: 0;
160
+ transform: scale(1);
161
+ }
162
+ }
163
+
164
+ .record-button {
165
+ margin: 15rpx auto;
166
+ font-size: 28rpx;
167
+ color: #333333;
168
+ }
169
+
170
+ .finish-button {
171
+ margin: 15rpx 30rpx 0 30rpx;
172
+ padding: 0 80rpx;
173
+ border-radius: 12rpx;
174
+ border: 2rpx #f0f0f0 solid;
175
+ height: 60rpx;
176
+ line-height: 60rpx;
177
+ background-color: transparent;
178
+ color: #0096f0;
179
+ font-weight: normal;
180
+ font-size: 28rpx;
181
+ }
182
+
183
+ .close-button {
184
+ position: absolute;
185
+ top: 0;
186
+ right: 0;
187
+ margin: 0;
188
+ border: 0 red solid !important;
189
+ background-color: transparent;
190
+ color: #333333;
191
+ font-weight: normal;
192
+ font-size: 32rpx;
193
+ }
194
+
195
+ .close-button::after {
196
+ border: none;
197
+ }
@@ -0,0 +1,36 @@
1
+ function initEventBus() {
2
+ if (wx.eventBus) {
3
+ return
4
+ }
5
+ wx.eventBus = require('./utils/eventBus').eventBus //这里注册全局监听工具
6
+ }
7
+
8
+ function initTim() {
9
+ if (wx.hhImManager) {
10
+ return
11
+ }
12
+ const imManager = require('./public/im-manager')
13
+ imManager.init()
14
+ wx.hhImManager = imManager
15
+ }
16
+
17
+ function initStatLog() {
18
+ if (wx.statLog) {
19
+ return
20
+ }
21
+ wx.statLog = require('./public/stat-log')
22
+ }
23
+
24
+ function initSDK() {
25
+ initStatLog()
26
+ initEventBus()
27
+ initTim()
28
+ wx.baseNavigationPath = '/miniprogram_npm/hh-sdk-test-demo/'
29
+ }
30
+
31
+ module.exports = {
32
+ initSDK,
33
+ initEventBus,
34
+ initTim,
35
+ initStatLog,
36
+ }
@@ -0,0 +1,87 @@
1
+ const pages = {
2
+ orderList: 'consultation/list/consultation-list-page',
3
+ orderDetail: 'consultation/detail/consultation-detail-page',
4
+ orderReply: 'consultation/reply/consultation-reply-page',
5
+ webPage: 'uikit/web-view-page/web-view-page',
6
+ evaluate: 'consultation/evaluate/evaluate-page',
7
+ videoChat: 'video-chat-page/video-chat-page',
8
+ }
9
+
10
+
11
+ function _basePath() {
12
+ return wx.baseNavigationPath || '/components/'
13
+ }
14
+
15
+ /**
16
+ * 跳转page
17
+ * @param {*} path 在components内部的路径,最开始不用加/
18
+ * @param {*} params 路径后需要拼接的参数,数据格式为字典
19
+ */
20
+ function navigateTo(path, params) {
21
+ let url = `${_basePath()}${path}`
22
+ for (let [key, value] of Object.entries(params || {})) {
23
+ if (!url.includes(`&${key}=`)) {
24
+ url = `${url}${url.includes('?') ? '&' : '?'}${key}=${encodeURIComponent(value)}`
25
+ }
26
+ }
27
+ wx.navigateTo({
28
+ url: url,
29
+ fail: (res) => {
30
+ console.error(res)
31
+ }
32
+ })
33
+ }
34
+
35
+ function orderList(doctorId, isTest) {
36
+ navigateTo(pages.orderList, {
37
+ 'doctorId': doctorId,
38
+ 'isTest': isTest
39
+ })
40
+ }
41
+
42
+ function orderDetail(orderId, doctorId, isTest) {
43
+ navigateTo(pages.orderDetail, {
44
+ 'orderId': orderId,
45
+ 'doctorId': doctorId,
46
+ 'isTest': isTest
47
+ })
48
+ }
49
+
50
+ function orderReply(type, order) {
51
+ navigateTo(pages.orderReply, {
52
+ 'type': type,
53
+ 'order': order,
54
+ })
55
+ }
56
+
57
+ function webPage(url) {
58
+ navigateTo(pages.webPage, {
59
+ 'url': url,
60
+ })
61
+ }
62
+
63
+ function evaluate(orderId, isRequest) {
64
+ navigateTo(pages.evaluate, {
65
+ 'orderId': orderId,
66
+ 'isRequest': isRequest,
67
+ })
68
+ }
69
+
70
+ function videoChat(orderId, doctorId, isTest, callback) {
71
+ navigateTo(pages.videoChat, {
72
+ 'orderId': orderId,
73
+ 'doctorId': doctorId,
74
+ 'isTest': isTest,
75
+ 'callback': callback || false
76
+ })
77
+ }
78
+
79
+ module.exports = {
80
+ navigateTo,
81
+ orderList,
82
+ orderDetail,
83
+ orderReply,
84
+ webPage,
85
+ evaluate,
86
+ videoChat,
87
+ }
@@ -0,0 +1,13 @@
1
+ const appVersion = '7.1.6'
2
+ const appID = '10423'
3
+ const appKey = ''
4
+ const appSecret = 'N0e7293NSF8nBZjO'
5
+ const sessionId = '1776843236242882600'
6
+
7
+ module.exports = {
8
+ appVersion,
9
+ appID,
10
+ appKey,
11
+ appSecret,
12
+ sessionId,
13
+ }
@@ -0,0 +1,53 @@
1
+ const api = require('../../apis/order-app-api')
2
+ const cache = require('../../public/cache-data')
3
+
4
+ module.exports = Behavior({
5
+
6
+ behaviors: [],
7
+
8
+ data: {
9
+ orderId: null, // 订单Id
10
+ order: null, // 订单
11
+ feedbackStar: null,
12
+ },
13
+
14
+ methods: {
15
+
16
+ /**
17
+ * 进入视频界面先加载订单
18
+ * @param callback 回调
19
+ */
20
+ loadOrder(callback) {
21
+ wx.showLoading({
22
+ title: '加载订单数据...',
23
+ mask: true,
24
+ })
25
+ wx.statLog.sendStatLog(null, '开始获取订单详情数据')
26
+ const orderId = this.data.orderId
27
+ api.getOrderDetail(orderId).then((res) => {
28
+ wx.statLog.sendStatLog(null, '获取订单详情数据完成')
29
+ wx.hideLoading()
30
+ const order = res.data.order
31
+ const feedbackStar = res.data.feedbackStar
32
+ this.setData({
33
+ order: order,
34
+ feedbackStar: feedbackStar,
35
+ }, () => {
36
+ if (callback) {
37
+ callback()
38
+ }
39
+
40
+ })
41
+ }).catch((e) => {
42
+ wx.statLog.sendStatLog(null, `获取订单数据出错${JSON.stringify(e)}`)
43
+ wx.hideLoading()
44
+ wx.showToast({
45
+ title: '加载订单出错',
46
+ })
47
+ setTimeout(() => {
48
+ wx.navigateBack()
49
+ }, 1000);
50
+ })
51
+ },
52
+ }
53
+ })
@@ -0,0 +1,134 @@
1
+ function cache(data) {
2
+ var doctorOptions = wx.doctorOptions || {}
3
+ if (data.doctorId && data.doctorId !== null && data.doctorId !== '') {
4
+ generateSessionId()
5
+ }
6
+ if (data.doctor != null) {
7
+ const token = data.doctor.videoToken
8
+ const uuid = data.doctor.uuid
9
+ wx.hhImManager.loginIm(uuid, token)
10
+ }
11
+ const newData = Object.assign(doctorOptions, data)
12
+ wx.doctorOptions = newData
13
+ }
14
+
15
+ function getValue(key) {
16
+ var doctorOptions = wx.doctorOptions || {}
17
+ if (!key) {
18
+ return null
19
+ }
20
+ return doctorOptions[key]
21
+ }
22
+
23
+ function getLogId() {
24
+ var doctorOptions = wx.doctorOptions || {}
25
+ var logId = doctorOptions.logId || 0
26
+ logId++
27
+ cache({
28
+ logId: logId
29
+ })
30
+ return logId
31
+ }
32
+
33
+ function clearLogId() {
34
+ cache({
35
+ logId: 0
36
+ })
37
+ }
38
+
39
+ /**
40
+ * 需要在合适的时机生成打点日志所需的sessionId
41
+ */
42
+ function generateSessionId() {
43
+ var doctorOptions = wx.doctorOptions || {}
44
+ if (!doctorOptions.sessionId || doctorOptions.sessionId.length == 0) {
45
+ const sessionId = `${doctorId()}${Math.random().toString(36).substr(2).substr(0, 8)}`
46
+ cache({
47
+ sessionId: sessionId
48
+ })
49
+ }
50
+ }
51
+
52
+ /**
53
+ * 记录日志上下文的sessionId
54
+ */
55
+ function getSessionId() {
56
+ const doctorOptions = wx.doctorOptions || {}
57
+ return doctorOptions.sessionId
58
+ }
59
+
60
+ /**
61
+ * 获取医生ID
62
+ */
63
+ function doctorId() {
64
+ return getValue('doctorId')
65
+ }
66
+
67
+ function isRequest(docId) {
68
+ return doctorId() == docId
69
+ }
70
+
71
+ function phone() {
72
+ const doctorInfo = doctor()
73
+ if (doctorInfo) {
74
+ return doctorInfo.phoneno
75
+ }
76
+ return null
77
+ }
78
+
79
+ function uuid() {
80
+ const doctorInfo = doctor()
81
+ if (doctorInfo) {
82
+ return doctorInfo.uuid
83
+ }
84
+ return null
85
+ }
86
+
87
+ function videoToken() {
88
+ const doctorInfo = doctor()
89
+ if (doctorInfo) {
90
+ return doctorInfo.videoToken
91
+ }
92
+ return null
93
+ }
94
+
95
+ function doctorName() {
96
+ const doctorInfo = doctor()
97
+ if (doctorInfo) {
98
+ return doctorInfo.name
99
+ }
100
+ return null
101
+ }
102
+
103
+ function doctor() {
104
+ if (wx.doctorOptions) {
105
+ return wx.doctorOptions.doctor || null
106
+ }
107
+ return null
108
+ }
109
+
110
+ function isLoadDoctor() {
111
+ return doctor() != null
112
+ }
113
+
114
+ function isTest() {
115
+ return getValue('isTest') || false
116
+ }
117
+
118
+ module.exports = {
119
+ cache,
120
+ isLoadDoctor,
121
+ getValue,
122
+ uuid,
123
+ videoToken,
124
+ isTest,
125
+ doctorId,
126
+ doctorName,
127
+ doctor,
128
+ phone,
129
+ generateSessionId,
130
+ getSessionId,
131
+ getLogId,
132
+ clearLogId,
133
+ isRequest
134
+ }