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,60 @@
1
+ const api = require('../apis/order-app-api')
2
+ const cache = require('./cache-data')
3
+
4
+ /**
5
+ * 获取登录医生的数据
6
+ * @param {*} callback 回调
7
+ */
8
+ function loadDoctor(options, callback) {
9
+ const doctorId = options.doctorId
10
+ if (!doctorId) {
11
+ wx.statLog.sendStatLog(null, `场景:${options.scence || '未知'} 未传必要的参数`)
12
+ wx.showToast({
13
+ title: '未传必要的参数doctorId',
14
+ })
15
+ return
16
+ }
17
+ // 由于后续所有联网请求都需要doctorId所以在此缓存doctorId在联网公共参数会用到
18
+ if (doctorId === cache.doctorId() && cache.doctor() !== null) {
19
+ // 如果传入的doctorId和以前已经加载过的doctorId一致并且doctor数据不为空可以不再次加载doctor数据
20
+ cache.cache({
21
+ isTest: options.isTest || false
22
+ })
23
+ } else {
24
+ // 如果传入是新的doctorId,重新缓存doctorId并重置doctor为空
25
+ cache.cache({
26
+ doctorId: doctorId,
27
+ isTest: options.isTest || false,
28
+ doctor: null
29
+ })
30
+ }
31
+
32
+ if (cache.doctor() !== null) {
33
+ callback(true)
34
+ return
35
+ }
36
+ wx.statLog.sendStatLog(null, `开始加载医生数据 doctorId: ${doctorId}`)
37
+ api.getDoctorInfo(doctorId).then((res) => {
38
+ wx.hideLoading()
39
+ wx.statLog.sendStatLog(null, `加载医生数据完成 doctorId: ${cache.doctorId()},继续加载订单数据`)
40
+ cache.cache({
41
+ doctor: res.data
42
+ })
43
+ if (callback) {
44
+ callback(true)
45
+ }
46
+ }).catch((err) => {
47
+ wx.hideLoading()
48
+ wx.statLog.sendStatLog(null, `加载医生数据出错`)
49
+ wx.showToast({
50
+ title: `获取医生信息出错`,
51
+ })
52
+ if (callback) {
53
+ callback(false)
54
+ }
55
+ })
56
+ }
57
+
58
+ module.exports = {
59
+ loadDoctor,
60
+ }
@@ -0,0 +1,135 @@
1
+ import TencentCloudChat from '@tencentcloud/chat';
2
+
3
+ const EventNames = {
4
+ IMLogin: 'IMLogin',
5
+ IMLogout: 'IMLogout',
6
+ IMCustomMessage: 'IMCustomMessage'
7
+ }
8
+
9
+ const hhNavigation = require('../hh-navigation')
10
+ const cache = require('../public/cache-data')
11
+
12
+ var chat
13
+ var isLogined = false
14
+ var isReady = false
15
+ var isInit = false
16
+
17
+ let onMessageReceived = function (event) {
18
+ const messageList = event.data;
19
+ messageList.forEach((message) => {
20
+ if (message.type === TencentCloudChat.TYPES.MSG_CUSTOM) {
21
+ try {
22
+ const data = JSON.parse(message.payload.data)
23
+ if (onMessage(data)) {
24
+ return
25
+ }
26
+ wx.eventBus.post({
27
+ params: data,
28
+ event: EventNames.IMCustomMessage
29
+ })
30
+ } catch (ex) {
31
+
32
+ }
33
+
34
+ }
35
+ });
36
+ };
37
+
38
+ function onMessage(message) {
39
+ const command = message.command
40
+ if (command === 'call') { // 收到了回拨消息
41
+ const orderId = message.orderId
42
+ hhNavigation.videoChat(orderId, null, cache.isTest(), true)
43
+ return true
44
+ }
45
+ return false
46
+ }
47
+
48
+ let onSdkReady = function (event) {
49
+ wx.statLog.sendStatLog(null, `IM SDK Ready`)
50
+ isReady = true
51
+ };
52
+
53
+ let onSdkNotReady = function (event) {
54
+ wx.statLog.sendStatLog(null, `IM SDK Not Ready ${JSON.stringify(event)}`)
55
+ isReady = false
56
+ };
57
+
58
+ function init() {
59
+ if (isInit) {
60
+ return
61
+ }
62
+ wx.statLog.sendStatLog(null, `初始化 IM 管理类`)
63
+ let options = {
64
+ SDKAppID: '1400073238'
65
+ }
66
+ chat = TencentCloudChat.create(options)
67
+ chat.setLogLevel(0)
68
+
69
+ chat.on(TencentCloudChat.EVENT.SDK_READY, onSdkReady);
70
+ chat.on(TencentCloudChat.EVENT.SDK_NOT_READY, onSdkNotReady);
71
+ chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
72
+ isInit = true
73
+ }
74
+
75
+ /**
76
+ * 登录腾讯IM
77
+ * @param {*} userID 用户UserID
78
+ * @param {*} userSig 用户UserSign
79
+ */
80
+ function loginIm(userID, userSig) {
81
+ wx.statLog.sendStatLog(null, `开始登录腾讯IM`)
82
+ if (chat) {
83
+ chat.login({
84
+ userID: userID.toString(),
85
+ userSig
86
+ }).then((res) => {
87
+ isLogined = true
88
+ wx.eventBus.post({
89
+ params: {
90
+ result: true
91
+ },
92
+ event: EventNames.IMLogin
93
+ })
94
+ if (res.data.repeatLogin === true) {
95
+
96
+ }
97
+ wx.statLog.sendStatLog(null, `登录腾讯IM完成`)
98
+ }).catch((error) => {
99
+ wx.statLog.sendStatLog(null, `登录腾讯IM失败 ${JSON.stringify(error)}`)
100
+ isLogined = false
101
+ wx.eventBus.post({
102
+ params: {
103
+ result: false
104
+ },
105
+ event: EventNames.IMLogin
106
+ })
107
+ })
108
+ }
109
+ }
110
+
111
+ function logoutIm() {
112
+ if (isLogined) {
113
+ if (chat) {
114
+ chat.logout().then(() => {
115
+ isLogined = false
116
+ }).catch(() => {
117
+ isLogined = false
118
+ })
119
+ }
120
+ }
121
+ }
122
+
123
+ function destory() {
124
+ if (chat) {
125
+ chat.destory()
126
+ }
127
+ }
128
+
129
+ module.exports = {
130
+ EventNames: EventNames,
131
+ init: init,
132
+ loginIm: loginIm,
133
+ logoutIm: logoutIm,
134
+ destory: destory
135
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * 查看PDF文件格式
3
+ * @param {*} files 必须为对象格式为{name:'', url: ''}这样的列表
4
+ */
5
+ function viewPdfs(files) {
6
+ if (files.length == 1) {
7
+ this.viewPdf(files[0].url)
8
+ } else {
9
+ const items = files.map((file) => {
10
+ return file.name
11
+ })
12
+ wx.showActionSheet({
13
+ itemList: items,
14
+ success: (res) => {
15
+ const url = files[res.tapIndex].url
16
+ this.viewPdf(url)
17
+ },
18
+ fail: function (ers) {
19
+
20
+ }
21
+ })
22
+ }
23
+ }
24
+
25
+ /**
26
+ * 查看单个PDF文件
27
+ * @param {*} url PDF远程地址
28
+ */
29
+ function viewPdf(url) {
30
+ wx.showLoading({
31
+ title: '',
32
+ })
33
+ wx.downloadFile({
34
+ url: url,
35
+ success: function (res) {
36
+ wx.hideLoading()
37
+ if (res.statusCode == 200) {
38
+ const filePath = res.tempFilePath
39
+ wx.openDocument({
40
+ fileType: 'pdf',
41
+ filePath: filePath,
42
+ success: function () {
43
+
44
+ }
45
+
46
+ })
47
+ } else {
48
+ wx.showToast({
49
+ title: '下载PDF文件失败',
50
+ })
51
+ }
52
+ }
53
+ })
54
+ }
55
+
56
+ module.exports = {
57
+ viewPdfs,
58
+ viewPdf
59
+ }
@@ -0,0 +1,13 @@
1
+ const statLogApi = require('../apis/stat-log-api')
2
+
3
+ function sendStatLog(orderId, content, type = statLogApi.logType.netLog) {
4
+ statLogApi.sendLog({
5
+ type: type,
6
+ orderId: orderId,
7
+ content: content
8
+ })
9
+ }
10
+
11
+ module.exports = {
12
+ sendStatLog,
13
+ }