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.
- package/components/apis/api-host-define.js +69 -0
- package/components/apis/consultation-reply-api.js +21 -0
- package/components/apis/dicom-api.js +31 -0
- package/components/apis/family-api.js +20 -0
- package/components/apis/file-upload-api.js +35 -0
- package/components/apis/order-app-api.js +206 -0
- package/components/apis/stat-log-api.js +42 -0
- package/components/apis/video-chat-log-api.js +47 -0
- package/components/apis/video-message-api.js +88 -0
- package/components/consultation/detail/behaviors/chat-cell-base-behaviors.js +29 -0
- package/components/consultation/detail/behaviors/consultation-behaviors.js +60 -0
- package/components/consultation/detail/behaviors/consultation-chat-behaviors.js +321 -0
- package/components/consultation/detail/behaviors/consultation-header-media-behaviors.js +176 -0
- package/components/consultation/detail/behaviors/consultation-header-text-behaviors.js +325 -0
- package/components/consultation/detail/behaviors/consultation-reply-behaviors.js +67 -0
- package/components/consultation/detail/consultation-detail-page.js +219 -0
- package/components/consultation/detail/consultation-detail-page.json +10 -0
- package/components/consultation/detail/consultation-detail-page.wxml +65 -0
- package/components/consultation/detail/consultation-detail-page.wxss +51 -0
- package/components/consultation/detail/widget/case-image-filter.js +47 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.js +31 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.json +4 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxml +17 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxss +9 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +100 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.json +4 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxml +24 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxss +54 -0
- package/components/consultation/detail/widget/chat-bottom/chat-menu-builder.js +131 -0
- package/components/consultation/detail/widget/chat-cell-template/chat-cell-template.wxml +173 -0
- package/components/consultation/detail/widget/chat-cell.wxss +394 -0
- package/components/consultation/detail/widget/detail-media/detail-media.js +47 -0
- package/components/consultation/detail/widget/detail-media/detail-media.json +4 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxml +12 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxss +57 -0
- package/components/consultation/detail/widget/detail-text/detail-text.js +31 -0
- package/components/consultation/detail/widget/detail-text/detail-text.json +4 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxml +6 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxss +14 -0
- package/components/consultation/evaluate/evaluate-page.js +157 -0
- package/components/consultation/evaluate/evaluate-page.json +3 -0
- package/components/consultation/evaluate/evaluate-page.wxml +42 -0
- package/components/consultation/evaluate/evaluate-page.wxss +103 -0
- package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +144 -0
- package/components/consultation/list/consultation-list-page.js +84 -0
- package/components/consultation/list/consultation-list-page.json +5 -0
- package/components/consultation/list/consultation-list-page.wxml +53 -0
- package/components/consultation/list/consultation-list-page.wxss +105 -0
- package/components/consultation/reply/behaviors/reply-base-behaviors.js +175 -0
- package/components/consultation/reply/consultation-reply-page.js +251 -0
- package/components/consultation/reply/consultation-reply-page.json +6 -0
- package/components/consultation/reply/consultation-reply-page.wxml +103 -0
- package/components/consultation/reply/consultation-reply-page.wxss +169 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.js +144 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.json +4 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxml +27 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxss +197 -0
- package/components/hh-doctor.js +36 -0
- package/components/hh-navigation.js +87 -0
- package/components/public/app-config.js +13 -0
- package/components/public/behaviors/order-base-behaviors.js +53 -0
- package/components/public/cache-data.js +134 -0
- package/components/public/doctor-loader.js +60 -0
- package/components/public/im-manager.js +135 -0
- package/components/public/pdf-viewer.js +59 -0
- package/components/public/stat-log.js +13 -0
- package/components/static/Agora_Miniapp_SDK_for_WeChat.js +2 -0
- package/components/static/trtc-wx.js +2 -0
- package/components/uikit/css/common.wxss +23 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.js +37 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.json +4 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxml +9 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxss +79 -0
- package/components/uikit/date-time-picker/date-time-picker.js +115 -0
- package/components/uikit/web-view-page/web-view-page.js +87 -0
- package/components/uikit/web-view-page/web-view-page.json +3 -0
- package/components/uikit/web-view-page/web-view-page.wxml +6 -0
- package/components/uikit/web-view-page/web-view-page.wxss +1 -0
- package/components/utils/checksumUtils.js +56 -0
- package/components/utils/common-utils.js +59 -0
- package/components/utils/dateUtils.js +142 -0
- package/components/utils/eventBus.js +77 -0
- package/components/utils/httpUtils.js +123 -0
- package/components/utils/number-utils.js +48 -0
- package/components/utils/permission-utils.js +164 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.js +106 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.json +4 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +24 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +92 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.json +4 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +22 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-rtc.js +391 -0
- package/components/video-chat/agora-rtc/agora-rtc.json +7 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxml +39 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxss +1 -0
- package/components/video-chat/callback/callback.js +39 -0
- package/components/video-chat/callback/callback.json +4 -0
- package/components/video-chat/callback/callback.wxml +29 -0
- package/components/video-chat/callback/callback.wxss +26 -0
- package/components/video-chat/calling/calling.js +75 -0
- package/components/video-chat/calling/calling.json +4 -0
- package/components/video-chat/calling/calling.wxml +32 -0
- package/components/video-chat/calling/calling.wxss +45 -0
- package/components/video-chat/controller/controller.js +86 -0
- package/components/video-chat/controller/controller.json +4 -0
- package/components/video-chat/controller/controller.wxml +73 -0
- package/components/video-chat/controller/controller.wxss +71 -0
- package/components/video-chat/remote-player/remote-player.js +42 -0
- package/components/video-chat/remote-player/remote-player.json +4 -0
- package/components/video-chat/remote-player/remote-player.wxml +37 -0
- package/components/video-chat/remote-player/remote-player.wxss +1 -0
- package/components/video-chat/video-chat.js +297 -0
- package/components/video-chat/video-chat.json +7 -0
- package/components/video-chat/video-chat.wxml +56 -0
- package/components/video-chat/video-chat.wxss +97 -0
- package/components/video-chat-page/behaviors/chat-files-behaviors.js +243 -0
- package/components/video-chat-page/behaviors/chat-log-behaviors.js +90 -0
- package/components/video-chat-page/behaviors/chat-sound-behaviors.js +60 -0
- package/components/video-chat-page/behaviors/video-chat-behaviors.js +524 -0
- package/components/video-chat-page/case-group-view/case-group-view.js +38 -0
- package/components/video-chat-page/case-group-view/case-group-view.json +4 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxml +32 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxss +44 -0
- package/components/video-chat-page/video-chat-defines.js +39 -0
- package/components/video-chat-page/video-chat-page.js +212 -0
- package/components/video-chat-page/video-chat-page.json +14 -0
- package/components/video-chat-page/video-chat-page.wxml +88 -0
- package/components/video-chat-page/video-chat-page.wxss +45 -0
- package/package.json +18 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
const menuBuilder = require('../../detail/widget/chat-bottom/chat-menu-builder')
|
|
2
|
+
const api = require('../../../apis/order-app-api')
|
|
3
|
+
const checkPermission = require('../../../utils/permission-utils')
|
|
4
|
+
|
|
5
|
+
module.exports = Behavior({
|
|
6
|
+
|
|
7
|
+
behaviors: [require('../../detail/behaviors/consultation-header-media-behaviors')],
|
|
8
|
+
|
|
9
|
+
data: {
|
|
10
|
+
type: null,
|
|
11
|
+
order: null,
|
|
12
|
+
placeHolder: null,
|
|
13
|
+
textareaValue: null,
|
|
14
|
+
mediaFiles: [],
|
|
15
|
+
mediaInfo: [],
|
|
16
|
+
soundKey: null,
|
|
17
|
+
animationValue: 3,
|
|
18
|
+
audioFile: null,
|
|
19
|
+
audioPath: null,
|
|
20
|
+
audioSize: 0,
|
|
21
|
+
audioDuration: 0,
|
|
22
|
+
audioDurationDes: null,
|
|
23
|
+
sendMediaFiles: [],
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
methods: {
|
|
27
|
+
initData(option) {
|
|
28
|
+
const type = option.type || -1
|
|
29
|
+
this._setTitle(type)
|
|
30
|
+
const order = JSON.parse(decodeURIComponent(option.order || ''))
|
|
31
|
+
this.setData({
|
|
32
|
+
type: type,
|
|
33
|
+
order: order,
|
|
34
|
+
})
|
|
35
|
+
this.buildMediaFiles()
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
_setTitle(type) {
|
|
39
|
+
var title = ''
|
|
40
|
+
var placeHolder = ''
|
|
41
|
+
switch (type) {
|
|
42
|
+
case menuBuilder.ChatEventType.eAddSupply:
|
|
43
|
+
title = '填写所需补充内容'
|
|
44
|
+
placeHolder = '请在此填写要求医生补充的内容'
|
|
45
|
+
break
|
|
46
|
+
}
|
|
47
|
+
this.setData({
|
|
48
|
+
placeHolder: placeHolder
|
|
49
|
+
})
|
|
50
|
+
wx.setNavigationBarTitle({
|
|
51
|
+
title: title,
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
_clickTopMedia(event) {
|
|
56
|
+
this.clickMedia({
|
|
57
|
+
detail: event.target.dataset
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
userInput: function () {},
|
|
62
|
+
|
|
63
|
+
clickSend: function () {
|
|
64
|
+
if (this.data.order == null || this.data.order.orderid == null || this.data.order.orderid == '') {
|
|
65
|
+
wx.showToast({
|
|
66
|
+
title: '缺少订单必要参数',
|
|
67
|
+
})
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
var status = 0
|
|
71
|
+
var type = this.data.type
|
|
72
|
+
let nullTip = '发送内容不能为空'
|
|
73
|
+
switch (type) {
|
|
74
|
+
case menuBuilder.ChatEventType.refuse:
|
|
75
|
+
status = 3
|
|
76
|
+
nullTip = '请补充拒绝原因'
|
|
77
|
+
break
|
|
78
|
+
case menuBuilder.ChatEventType.eAddSupply:
|
|
79
|
+
status = 200
|
|
80
|
+
nullTip = '请补充需要补充资料原因'
|
|
81
|
+
break
|
|
82
|
+
case menuBuilder.ChatEventType.reply:
|
|
83
|
+
status = 2
|
|
84
|
+
nullTip = '请补充需要回复的内容'
|
|
85
|
+
break
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var params = {}
|
|
89
|
+
if (type == menuBuilder.ChatEventType.refuse) {
|
|
90
|
+
params['type'] = 3
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var body = {
|
|
94
|
+
'orderId': this.data.order.orderid,
|
|
95
|
+
'comments': this.data.textareaValue ?? '',
|
|
96
|
+
'actionSource': 'wxdoctor',
|
|
97
|
+
'status': status,
|
|
98
|
+
}
|
|
99
|
+
if (type == menuBuilder.ChatEventType.eAddSupply) {
|
|
100
|
+
body['showDoctor'] = true
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.data.soundKey != null) {
|
|
104
|
+
body['contentSound'] = this.data.soundKey
|
|
105
|
+
}
|
|
106
|
+
if (this.data.sendMediaFiles != null && this.data.sendMediaFiles.length > 0) {
|
|
107
|
+
let sendMediaFiles = this.data.sendMediaFiles.map((file, index) => {
|
|
108
|
+
return {
|
|
109
|
+
s3key: file.s3key,
|
|
110
|
+
type: file.type,
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
body['caseImageList'] = sendMediaFiles
|
|
114
|
+
}
|
|
115
|
+
if (body['comments'] == '' && (body['contentSound'] == null || body['contentSound'] == '') && body['caseImageList'] == null) {
|
|
116
|
+
wx.showToast({
|
|
117
|
+
icon: null,
|
|
118
|
+
title: nullTip,
|
|
119
|
+
})
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
wx.showLoading({
|
|
123
|
+
title: '保存中...',
|
|
124
|
+
})
|
|
125
|
+
api.requestReply(type, params, body).then((res) => {
|
|
126
|
+
wx.hideLoading()
|
|
127
|
+
if (res.status == 200 && res.data) {
|
|
128
|
+
wx.showToast({
|
|
129
|
+
title: '发送成功',
|
|
130
|
+
})
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
wx.navigateBack()
|
|
133
|
+
}, 1000);
|
|
134
|
+
}
|
|
135
|
+
}).catch((err) => {
|
|
136
|
+
wx.showToast({
|
|
137
|
+
title: '保存失败',
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
_toRecordAudio: function () {
|
|
142
|
+
checkPermission.checkScopeRecord().then(() => {
|
|
143
|
+
this.selectComponent('#audio-record').show()
|
|
144
|
+
}).catch(() => {
|
|
145
|
+
wx.showToast({
|
|
146
|
+
title: '请先同意使用麦克风权限',
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
clickAudioRecord: function () {
|
|
151
|
+
if (this.data.audioFile != null) {
|
|
152
|
+
wx.showModal({
|
|
153
|
+
title: '删除重录',
|
|
154
|
+
content: '是否要重新录制语音',
|
|
155
|
+
success: (res) => {
|
|
156
|
+
if (res.confirm) {
|
|
157
|
+
this.setData({
|
|
158
|
+
audioFile: null,
|
|
159
|
+
audioPath: null,
|
|
160
|
+
audioSize: 0,
|
|
161
|
+
audioDuration: 0,
|
|
162
|
+
audioDurationDes: null,
|
|
163
|
+
})
|
|
164
|
+
this._toRecordAudio()
|
|
165
|
+
} else if (res.cancel) {
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
this._toRecordAudio()
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
})
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
var audioPlayer
|
|
2
|
+
var audioAnimationInterval
|
|
3
|
+
const fileUpload = require('../../apis/file-upload-api')
|
|
4
|
+
const {
|
|
5
|
+
checkMediaPermission
|
|
6
|
+
} = require('../../utils/permission-utils')
|
|
7
|
+
const checkPermission = require('../../utils/permission-utils')
|
|
8
|
+
|
|
9
|
+
Page({
|
|
10
|
+
|
|
11
|
+
behaviors: [require('../reply/behaviors/reply-base-behaviors')],
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 生命周期函数--监听页面加载
|
|
15
|
+
*/
|
|
16
|
+
onLoad(options) {
|
|
17
|
+
this.initData(options)
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 生命周期函数--监听页面初次渲染完成
|
|
22
|
+
*/
|
|
23
|
+
onReady() {
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 生命周期函数--监听页面显示
|
|
29
|
+
*/
|
|
30
|
+
onShow() {
|
|
31
|
+
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 生命周期函数--监听页面隐藏
|
|
36
|
+
*/
|
|
37
|
+
onHide() {
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 生命周期函数--监听页面卸载
|
|
43
|
+
*/
|
|
44
|
+
onUnload() {
|
|
45
|
+
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 页面相关事件处理函数--监听用户下拉动作
|
|
50
|
+
*/
|
|
51
|
+
onPullDownRefresh() {
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 页面上拉触底事件的处理函数
|
|
57
|
+
*/
|
|
58
|
+
onReachBottom() {
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 用户点击右上角分享
|
|
64
|
+
*/
|
|
65
|
+
onShareAppMessage() {
|
|
66
|
+
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
onAudioRecord: function (e) {
|
|
70
|
+
var fileInfo = e.detail
|
|
71
|
+
if (fileInfo == null) {
|
|
72
|
+
this.setData({
|
|
73
|
+
audioFile: null,
|
|
74
|
+
audioPath: null,
|
|
75
|
+
audioSize: 0,
|
|
76
|
+
audioDuration: 0,
|
|
77
|
+
audioDurationDes: null,
|
|
78
|
+
})
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
var path = fileInfo.tempFilePath
|
|
82
|
+
var fileSize = fileInfo.fileSize
|
|
83
|
+
var duration = parseInt(fileInfo.duration / 1000)
|
|
84
|
+
var durationDes = ''
|
|
85
|
+
var minutes = parseInt(Math.round(duration / 60))
|
|
86
|
+
var seconds = parseInt(duration % 60)
|
|
87
|
+
if (minutes > 0) {
|
|
88
|
+
durationDes = minutes + '′'
|
|
89
|
+
}
|
|
90
|
+
if (seconds > 0) {
|
|
91
|
+
durationDes = durationDes + seconds + '″'
|
|
92
|
+
}
|
|
93
|
+
this.setData({
|
|
94
|
+
audioFile: fileInfo,
|
|
95
|
+
audioPath: path,
|
|
96
|
+
audioSize: fileSize,
|
|
97
|
+
audioDuration: duration,
|
|
98
|
+
audioDurationDes: durationDes,
|
|
99
|
+
})
|
|
100
|
+
this._uploadAudio()
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
_playAudio() {
|
|
104
|
+
const playerUrl = this.data.audioPath
|
|
105
|
+
if (audioPlayer) {
|
|
106
|
+
this._stopAudioAnimation()
|
|
107
|
+
audioPlayer.stop()
|
|
108
|
+
audioPlayer.destroy()
|
|
109
|
+
audioPlayer = null
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
const player = wx.createInnerAudioContext()
|
|
113
|
+
player.src = playerUrl
|
|
114
|
+
player.play()
|
|
115
|
+
player.onEnded(() => {
|
|
116
|
+
this._stopAudioAnimation()
|
|
117
|
+
})
|
|
118
|
+
audioPlayer = player
|
|
119
|
+
audioAnimationInterval = setInterval(() => {
|
|
120
|
+
this._audioAnimation()
|
|
121
|
+
}, 400)
|
|
122
|
+
},
|
|
123
|
+
_audioAnimation() {
|
|
124
|
+
var value = this.data.animationValue
|
|
125
|
+
if (value < 3) {
|
|
126
|
+
value++
|
|
127
|
+
} else if (value == 3) {
|
|
128
|
+
value = 1
|
|
129
|
+
}
|
|
130
|
+
this.setData({
|
|
131
|
+
animationValue: value,
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
_stopAudioAnimation() {
|
|
135
|
+
if (audioAnimationInterval) {
|
|
136
|
+
clearInterval(audioAnimationInterval)
|
|
137
|
+
}
|
|
138
|
+
this.setData({
|
|
139
|
+
animationValue: 3,
|
|
140
|
+
})
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
_uploadFile: function (filePaths) {
|
|
144
|
+
var promise = Promise.all(
|
|
145
|
+
filePaths.map((tempFilePath, index) => {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
fileUpload.upload(tempFilePath, (result, path, fileKey) => {
|
|
148
|
+
let files = this.data.sendMediaFiles
|
|
149
|
+
let index = files.findIndex((element) => {
|
|
150
|
+
return path === element.local
|
|
151
|
+
})
|
|
152
|
+
if (index >= 0) {
|
|
153
|
+
let file = this.data.sendMediaFiles[index]
|
|
154
|
+
file.s3key = fileKey
|
|
155
|
+
file.uploadSuccess = result
|
|
156
|
+
files[index] = file
|
|
157
|
+
this.setData({
|
|
158
|
+
sendMediaFiles: files,
|
|
159
|
+
})
|
|
160
|
+
resolve(file)
|
|
161
|
+
} else {
|
|
162
|
+
reject(null)
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
)
|
|
168
|
+
promise.then((results) => {
|
|
169
|
+
|
|
170
|
+
}).catch(function (err) {
|
|
171
|
+
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
_uploadAudio() {
|
|
176
|
+
if (this.data.audioPath != null && this.data.audioPath != '') {
|
|
177
|
+
fileUpload.upload(this.data.audioPath, (result, path, fileKey) => {
|
|
178
|
+
if (result) {
|
|
179
|
+
this.setData({
|
|
180
|
+
soundKey: fileKey
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
clickTakePhoto() {
|
|
188
|
+
this._takeMedia()
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
clickTakeVideo() {
|
|
192
|
+
this._takeMedia(true)
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
_takeMedia(video = false) {
|
|
196
|
+
checkPermission.checkMediaPermission().then(() => {
|
|
197
|
+
let mediaType = video ? 'video' : 'image'
|
|
198
|
+
wx.chooseMedia({
|
|
199
|
+
count: 9,
|
|
200
|
+
mediaType: [mediaType],
|
|
201
|
+
sourceType: ['camera', 'album'],
|
|
202
|
+
camera: 'back',
|
|
203
|
+
success: (res) => {
|
|
204
|
+
let mediaFiles = res.tempFiles.map((file, index) => {
|
|
205
|
+
return {
|
|
206
|
+
local: file.tempFilePath,
|
|
207
|
+
image: video ? file.thumbTempFilePath : file.tempFilePath,
|
|
208
|
+
isVideo: video,
|
|
209
|
+
type: video ? 14 : -1,
|
|
210
|
+
uploadSuccess: true,
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
let files = this.data.sendMediaFiles.concat(mediaFiles)
|
|
215
|
+
this.setData({
|
|
216
|
+
sendMediaFiles: files,
|
|
217
|
+
})
|
|
218
|
+
let filePaths = mediaFiles.map((file, index) => {
|
|
219
|
+
return file.local
|
|
220
|
+
})
|
|
221
|
+
this._uploadFile(filePaths)
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
// wx.showActionSheet({
|
|
225
|
+
// itemList: [video ? '拍摄' : '拍照', '从相册中选择'],
|
|
226
|
+
// success: (res) => {
|
|
227
|
+
// let sourceType = 'camera'
|
|
228
|
+
// if (res.tapIndex == 0) {
|
|
229
|
+
// sourceType = 'camera'
|
|
230
|
+
// } else if (res.tapIndex == 1) {
|
|
231
|
+
// sourceType = 'album'
|
|
232
|
+
// }
|
|
233
|
+
|
|
234
|
+
// }
|
|
235
|
+
// })
|
|
236
|
+
}).catch(() => {
|
|
237
|
+
wx.statLog.sendStatLog(null, '用户未授权音视频权限直接退出页面')
|
|
238
|
+
})
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
_deleteMedia(event) {
|
|
242
|
+
let index = event.target.dataset.index
|
|
243
|
+
var sendMediaFiles = this.data.sendMediaFiles
|
|
244
|
+
if (index > -1 && sendMediaFiles.length > index) {
|
|
245
|
+
sendMediaFiles.splice(index, 1)
|
|
246
|
+
this.setData({
|
|
247
|
+
sendMediaFiles: sendMediaFiles,
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<view class="page">
|
|
2
|
+
<scroll-view class="page-scroll-view" scroll-y:true>
|
|
3
|
+
<scroll-view scroll-x>
|
|
4
|
+
<view class="order-media-container">
|
|
5
|
+
<block wx:for="{{mediaInfo}}" wx:key="this">
|
|
6
|
+
<view
|
|
7
|
+
class="order-media-item {{index > 0 ? 'margin' : ''}}"
|
|
8
|
+
data-index="{{index}}"
|
|
9
|
+
bind:tap="_clickTopMedia"
|
|
10
|
+
>{{item.label}}</view
|
|
11
|
+
>
|
|
12
|
+
</block>
|
|
13
|
+
</view>
|
|
14
|
+
</scroll-view>
|
|
15
|
+
<!-- <view class="textarea-container"> -->
|
|
16
|
+
<textarea
|
|
17
|
+
class="textarea"
|
|
18
|
+
placeholder="{{placeHolder}}"
|
|
19
|
+
model:value="{{textareaValue}}"
|
|
20
|
+
bindinput="userInput"
|
|
21
|
+
maxlength="-1"
|
|
22
|
+
fixed="true"
|
|
23
|
+
>
|
|
24
|
+
</textarea>
|
|
25
|
+
<!-- </view> -->
|
|
26
|
+
<view class="media-button-container">
|
|
27
|
+
<image
|
|
28
|
+
bind:tap="clickAudioRecord"
|
|
29
|
+
class="media-button"
|
|
30
|
+
src="https://image.hh-medic.com/icon/pacs/hh_icon_reply_voice.png"
|
|
31
|
+
mode="aspectFill"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<image
|
|
35
|
+
bind:tap="clickTakePhoto"
|
|
36
|
+
class="media-button"
|
|
37
|
+
src="https://image.hh-medic.com/icon/pacs/hh_icon_reply_camera.png"
|
|
38
|
+
mode="aspectFill"
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<image
|
|
42
|
+
bind:tap="clickTakeVideo"
|
|
43
|
+
class="media-button"
|
|
44
|
+
src="https://image.hh-medic.com/icon/pacs/hh_icon_reply_video_normal.png"
|
|
45
|
+
mode="aspectFill"
|
|
46
|
+
/>
|
|
47
|
+
</view>
|
|
48
|
+
<view class="line"></view>
|
|
49
|
+
<view class="record-audio-box">
|
|
50
|
+
<view wx:if="{{audioFile}}" class="record-audio-content">
|
|
51
|
+
<view class="msg-sound-container" catch:tap="_playAudio">
|
|
52
|
+
<view
|
|
53
|
+
wx:if="{{animationValue >= 1}}"
|
|
54
|
+
class="sound-icon sender arc1"
|
|
55
|
+
></view>
|
|
56
|
+
<view
|
|
57
|
+
wx:if="{{animationValue >= 2}}"
|
|
58
|
+
class="sound-icon sender arc2"
|
|
59
|
+
></view>
|
|
60
|
+
<view
|
|
61
|
+
wx:if="{{animationValue >= 3}}"
|
|
62
|
+
class="sound-icon sender arc3"
|
|
63
|
+
></view>
|
|
64
|
+
<text class="msg-sound-text sender"
|
|
65
|
+
>{{audioDurationDes}}</text
|
|
66
|
+
>
|
|
67
|
+
</view>
|
|
68
|
+
</view>
|
|
69
|
+
<!-- <view class="re-record-audio">删除重录</view> -->
|
|
70
|
+
</view>
|
|
71
|
+
<view class="media-display">
|
|
72
|
+
<block wx:for="{{sendMediaFiles}}" wx:key="media">
|
|
73
|
+
<view class="display-image-box">
|
|
74
|
+
<image
|
|
75
|
+
class="display-image"
|
|
76
|
+
src="{{item.image}}"
|
|
77
|
+
mode="aspectFill"
|
|
78
|
+
/>
|
|
79
|
+
<image
|
|
80
|
+
wx:if="{{item.isVideo}}"
|
|
81
|
+
class="chat-video-play"
|
|
82
|
+
src="https://imgs.hh-medic.com/icon/wmp/hhdoctor/video-play.png"
|
|
83
|
+
/>
|
|
84
|
+
<image
|
|
85
|
+
data-index="{{index}}"
|
|
86
|
+
catch:tap="_deleteMedia"
|
|
87
|
+
class="display-image-delete"
|
|
88
|
+
src="http://image.hh-medic.com/icon/pacs/hh_del_icon.png"
|
|
89
|
+
/>
|
|
90
|
+
</view>
|
|
91
|
+
</block>
|
|
92
|
+
</view>
|
|
93
|
+
</scroll-view>
|
|
94
|
+
<view class="control-panel">
|
|
95
|
+
<view class="controll-container">
|
|
96
|
+
<button class="submit-control" catch:tap="clickSend">确定</button>
|
|
97
|
+
</view>
|
|
98
|
+
</view>
|
|
99
|
+
</view>
|
|
100
|
+
<audio-record-popup
|
|
101
|
+
id="audio-record"
|
|
102
|
+
bind:audiorecord="onAudioRecord"
|
|
103
|
+
></audio-record-popup>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
@import "../detail/widget/chat-cell.wxss";
|
|
2
|
+
|
|
3
|
+
page {
|
|
4
|
+
background-color: white;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.page {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
border-top: #dcdcdc 1rpx solid;
|
|
13
|
+
padding: 20rpx 0 0 0;
|
|
14
|
+
margin-bottom: constant(safe-area-inset-bottom); /* 兼容 IOS<11.2 */
|
|
15
|
+
margin-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.page-scroll-view {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
margin-bottom: 150rpx;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.control-panel {
|
|
25
|
+
position: fixed;
|
|
26
|
+
left: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 150rpx;
|
|
30
|
+
background-color: white;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.controll-container {
|
|
36
|
+
margin-bottom: constant(safe-area-inset-bottom); /* 兼容 IOS<11.2 */
|
|
37
|
+
margin-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.submit-control {
|
|
41
|
+
margin: 0 30rpx;
|
|
42
|
+
border-radius: 12rpx;
|
|
43
|
+
height: 80rpx;
|
|
44
|
+
background-color: #0096f0;
|
|
45
|
+
color: white;
|
|
46
|
+
font-size: 32rpx;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.order-media-container {
|
|
50
|
+
width: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
margin-left: 30rpx;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.order-media-item {
|
|
57
|
+
color: #0592f5;
|
|
58
|
+
font-size: 30rpx;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.order-media-item.margin {
|
|
62
|
+
margin-left: 50rpx;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.textarea-container {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 200rpx;
|
|
68
|
+
background-color: #f0f0f0;
|
|
69
|
+
margin-top: 30rpx;
|
|
70
|
+
padding: 20rpx;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.textarea {
|
|
74
|
+
width: 100%;
|
|
75
|
+
line-height: 1.5;
|
|
76
|
+
font-size: 32rpx;
|
|
77
|
+
padding: 30rpx;
|
|
78
|
+
margin-top: 30rpx;
|
|
79
|
+
background-color: #f0f0f0;
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
-webkit-box-sizing: border-box;
|
|
82
|
+
-moz-box-sizing: border-box;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.media-button-container {
|
|
86
|
+
width: 100%;
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.media-button {
|
|
92
|
+
width: 60rpx;
|
|
93
|
+
height: 60rpx;
|
|
94
|
+
margin: 15rpx 15rpx;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* .media-button.gray {
|
|
98
|
+
-webkit-filter: grayscale(100%);
|
|
99
|
+
filter: grayscale(100%);
|
|
100
|
+
} */
|
|
101
|
+
|
|
102
|
+
.line {
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 2rpx;
|
|
105
|
+
background-color: #dcdcdc;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.record-audio-box {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
align-items: flex-end;
|
|
112
|
+
margin-top: 20rpx;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.record-audio-content {
|
|
116
|
+
background-color: #c6e2fe;
|
|
117
|
+
margin: 0 0 0 20rpx;
|
|
118
|
+
padding: 10rpx 20rpx 10rpx 20rpx;
|
|
119
|
+
border-radius: 7px;
|
|
120
|
+
width: fit-content;
|
|
121
|
+
min-height: 30rpx;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.re-record-audio {
|
|
125
|
+
font-size: 24rpx;
|
|
126
|
+
color: #0096f0;
|
|
127
|
+
margin-left: 20rpx;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.media-display {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-wrap: wrap;
|
|
133
|
+
margin-top: 30rpx;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.display-image-box {
|
|
137
|
+
position: relative;
|
|
138
|
+
width: 30%;
|
|
139
|
+
margin-left: 2.5%;
|
|
140
|
+
margin-bottom: 10px;
|
|
141
|
+
background: #dcdcdc;
|
|
142
|
+
border-radius: 12rpx;
|
|
143
|
+
height: 100px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.display-image {
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 100%;
|
|
149
|
+
border-radius: 12rpx;
|
|
150
|
+
background: transparent;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.chat-video-play {
|
|
154
|
+
width: 60rpx;
|
|
155
|
+
height: 60rpx;
|
|
156
|
+
position: absolute;
|
|
157
|
+
top: calc(50% - 30rpx);
|
|
158
|
+
left: calc(50% - 30rpx);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.display-image-delete {
|
|
162
|
+
position: absolute;
|
|
163
|
+
/* background-color: rgba(0, 0, 0, 0.5); */
|
|
164
|
+
width: 40rpx;
|
|
165
|
+
height: 40rpx;
|
|
166
|
+
border-radius: 4;
|
|
167
|
+
top: 5rpx;
|
|
168
|
+
right: 5rpx;
|
|
169
|
+
}
|