hh-doctor-sdk 0.3.0 → 0.3.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.
@@ -41,6 +41,14 @@ const apiPaths = {
41
41
  hostType: hostDefine.hostTypes.order,
42
42
  path: '/orderplan/reply_order'
43
43
  },
44
+ doctorAsk: {
45
+ hostType: hostDefine.hostTypes.order,
46
+ path: '/orderask/ask_order_doctor'
47
+ }, // 医生追问回复
48
+ doctorSupply: {
49
+ hostType: hostDefine.hostTypes.order,
50
+ path: '/orderask/ask_order_doctor'
51
+ }, // 医生补充资料
44
52
  orderList: {
45
53
  hostType: hostDefine.hostTypes.order,
46
54
  path: '/orderlist/doctor_order_task_list'
@@ -149,6 +157,12 @@ function requestReply(type, params, body) {
149
157
  case menuBuilder.ChatEventType.reply:
150
158
  requestPath = apiPaths.expertReply
151
159
  break
160
+ case menuBuilder.ChatEventType.doctorAsk:
161
+ requestPath = apiPaths.doctorAsk
162
+ break
163
+ case menuBuilder.ChatEventType.dAddSupply:
164
+ requestPath = apiPaths.doctorSupply
165
+ break
152
166
  }
153
167
  return httpUtils.post(requestPath, params, body, null)
154
168
  }
@@ -5,6 +5,7 @@ var audioAnimationInterval
5
5
 
6
6
  const hhNavigation = require('../../hh-navigation')
7
7
  const doctorLoader = require('../../public/doctor-loader')
8
+ const permission = require('../../utils/permission-utils')
8
9
 
9
10
  Page({
10
11
 
@@ -204,6 +205,10 @@ Page({
204
205
 
205
206
  },
206
207
 
208
+ tapSetDate() {
209
+ permission.subscriptionVideoTime()
210
+ },
211
+
207
212
  changeDateTime(e) {
208
213
  this._changeDateTime(e)
209
214
  },
@@ -1,7 +1,7 @@
1
1
  const menuBuilder = require('./chat-menu-builder')
2
2
  const cache = require('../../../../public/cache-data')
3
- const base = require('../../../../hh-doctor')
4
3
  const hhNavigation = require('../../../../hh-navigation')
4
+ const permission = require('../../../../utils/permission-utils')
5
5
 
6
6
  Component({
7
7
 
@@ -67,6 +67,9 @@ Component({
67
67
  case menuBuilder.ChatEventType.reply:
68
68
  this._forwart2Reply(menuBuilder.ChatEventType.reply)
69
69
  break
70
+ case menuBuilder.ChatEventType.doctorAsk:
71
+ this._forwart2Reply(menuBuilder.ChatEventType.doctorAsk)
72
+ break
70
73
  }
71
74
  },
72
75
 
@@ -95,6 +98,10 @@ Component({
95
98
  */
96
99
  changeDateTimeColumn(e) {
97
100
  this.triggerEvent('changeDateTimeColumn', e)
101
+ },
102
+
103
+ tapSetDate() {
104
+ permission.subscriptionVideoTime()
98
105
  }
99
106
  }
100
107
  })
@@ -11,6 +11,7 @@
11
11
  mode="multiSelector"
12
12
  value="{{dateTime}}"
13
13
  bindchange="changeDateTime"
14
+ bind:tap="tapSetDate"
14
15
  bindcolumnchange="changeDateTimeColumn"
15
16
  range="{{dateTimeArray}}"
16
17
  >
@@ -45,10 +45,3 @@
45
45
  .chat-menu-item.border {
46
46
  border-left: 1rpx #dcdcdcff solid;
47
47
  }
48
-
49
- .menu-border {
50
- width: 1rpx;
51
- background-color: #dcdcdcff;
52
- /* border-left: 1rpx #dcdcdcff solid; */
53
- margin: 8rpx 0;
54
- }
@@ -7,6 +7,9 @@ const OrderState = {
7
7
  rejected: 3,
8
8
  timeout: 4,
9
9
  addSupplement: 15,
10
+ giveUp: 9,
11
+ giveUpComplete: 10,
12
+ confirm: 12,
10
13
  }
11
14
 
12
15
  const ChatEventType = {
@@ -18,7 +21,11 @@ const ChatEventType = {
18
21
  startVideo: 'startVideo',
19
22
  videoMore: 'videoMore',
20
23
  visitConfirm: 'visitConfirm',
21
- visitReject: 'visitReject'
24
+ visitReject: 'visitReject',
25
+
26
+ cancel: 'cancel',
27
+ doctorAsk: 'doctorAsk',
28
+ dAddSupply: 'dAddSupply'
22
29
  }
23
30
 
24
31
  function orderMenus(order) {
@@ -27,7 +34,7 @@ function orderMenus(order) {
27
34
  }
28
35
  const isRequest = cache.isRequest(order.doctorid)
29
36
  if (isRequest) {
30
- return []
37
+ return _doctorNormalMenu(order)
31
38
  }
32
39
  const provideType = order.provideType
33
40
  if (!isRequest && provideType && provideType.length > 0 && provideType != 'normal') {
@@ -41,6 +48,9 @@ function orderMenus(order) {
41
48
  return _normalMenus(order)
42
49
  }
43
50
 
51
+ /**
52
+ * 专家视频订单菜单
53
+ * */
44
54
  function _videoMenus(order) {
45
55
  var menus = []
46
56
  const state = order.state
@@ -63,6 +73,9 @@ function _videoMenus(order) {
63
73
  return menus
64
74
  }
65
75
 
76
+ /**
77
+ * 专家飞刀订单菜单
78
+ * */
66
79
  function _feidaoMenus(order) {
67
80
  var menus = []
68
81
  const state = order.state
@@ -82,6 +95,9 @@ function _feidaoMenus(order) {
82
95
  return menus
83
96
  }
84
97
 
98
+ /**
99
+ * 专家普通订单菜单
100
+ * */
85
101
  function _normalMenus(order) {
86
102
  var menus = []
87
103
  const state = order.state
@@ -107,17 +123,62 @@ function _normalMenus(order) {
107
123
  if (haveInvite) {
108
124
  menus.push(_menu(ChatEventType.discuss, '内部讨论'))
109
125
  menus.push(_menu(ChatEventType.reply, '回复意见', 1))
110
- } else {
111
- menus.push(_menu(ChatEventType.reply, '回复意见', 1))
112
126
  }
113
127
  break
114
128
  default:
115
- menus.push(_menu(ChatEventType.reply, '回复意见', 1))
129
+ // menus.push(_menu(ChatEventType.reply, '回复意见', 1))
116
130
  break;
117
131
  }
118
132
  return menus
119
133
  }
120
134
 
135
+ /**
136
+ * 提单医生普通菜单
137
+ * @param {*} order 订单
138
+ */
139
+ function _doctorNormalMenu(order) {
140
+ var menus = []
141
+ const state = order.state
142
+ console.error(`order state => ${state}`)
143
+ const isPaySuccess = (order.needPayMoney || 0) <= 0
144
+ const canFeedback = order.orderMessage && (order.orderMessage.needDoctorFeedback || false)
145
+ const canAsk = (order.isask || 0) == 1
146
+ switch (state) {
147
+ case OrderState.timeout:
148
+ case OrderState.rejected:
149
+ menus.push(_menu(ChatEventType.cancel, '直接退款'))
150
+ break
151
+ case OrderState.giveUp:
152
+ case OrderState.giveUpComplete:
153
+ break
154
+ case OrderState.submit:
155
+ if (isPaySuccess) {
156
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
157
+ }
158
+ break
159
+ case OrderState.finished:
160
+ if (canAsk && !canFeedback) {
161
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
162
+ }
163
+ break
164
+ case OrderState.confirm:
165
+ if (canFeedback) {
166
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
167
+ }
168
+ break
169
+ case OrderState.accepted:
170
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
171
+ break
172
+ case OrderState.addSupplement:
173
+ menus.push(_menu(ChatEventType.dAddSupply, '补充资料'))
174
+ menus.push(_menu(ChatEventType.doctorAsk, '讨论交流'))
175
+ break
176
+ default:
177
+ break
178
+ }
179
+ return menus
180
+ }
181
+
121
182
  function _menu(type, text, style = 0) {
122
183
  return {
123
184
  type: type,
@@ -153,6 +153,7 @@
153
153
  mode="multiSelector"
154
154
  value="{{dateTime}}"
155
155
  bindchange="changeDateTime"
156
+ bind:tap="tapSetDate"
156
157
  bindcolumnchange="changeDateTimeColumn"
157
158
  range="{{dateTimeArray}}"
158
159
  >
@@ -158,6 +158,6 @@ module.exports = Behavior({
158
158
  clickOrderItem: function (event) {
159
159
  var orderId = event.currentTarget.dataset.orderid
160
160
  hhNavigation.orderDetail(orderId.trim(), cache.doctorId(), cache.isTest())
161
- }
161
+ },
162
162
  }
163
163
  })
@@ -1,4 +1,3 @@
1
- const hhDoctor = require('../../hh-doctor')
2
1
  const doctorLoader = require('../../public/doctor-loader')
3
2
  const cache = require('../../public/cache-data')
4
3
 
@@ -40,9 +39,11 @@ Page({
40
39
  if (judgeLogin) {
41
40
  wx.statLog.sendStatLog(null, '打开咨询单列表界面')
42
41
  const doctorId = wx.getStorageSync('doctorId') || ''
42
+ console.error(`doctorId => ${doctorId}`)
43
43
  const isTest = (getApp().globalData.profileName || 'prod') == 'test'
44
44
  cache.cache({
45
- isTest: isTest
45
+ isTest: isTest,
46
+ doctorId: doctorId
46
47
  })
47
48
  if (!doctorId) {
48
49
  wx.showModal({
@@ -84,16 +85,9 @@ Page({
84
85
  complete: (res) => {
85
86
  if (wx.loginConfig && wx.loginConfig.judgeLogin) {
86
87
  if (res.cancel) {
87
- // wx.switchTab({
88
- // url: '/pages/recommend/recommend',
89
- // })
90
88
  wx.loginConfig.directLogin(false)
91
89
  }
92
-
93
90
  if (res.confirm) {
94
- // wx.navigateTo({
95
- // url: '/pkgMine/pages/mine/loginpage',
96
- // })
97
91
  wx.loginConfig.directLogin(true)
98
92
  }
99
93
  }
@@ -121,18 +115,4 @@ Page({
121
115
  onPullDownRefresh() {
122
116
  this.loadList()
123
117
  },
124
-
125
- /**
126
- * 页面上拉触底事件的处理函数
127
- */
128
- onReachBottom() {
129
-
130
- },
131
-
132
- /**
133
- * 用户点击右上角分享
134
- */
135
- onShareAppMessage() {
136
-
137
- }
138
118
  })
@@ -1,10 +1,14 @@
1
1
  <view class="match-parent">
2
- <view wx:if="{{!showEmpty}}" class="chatting-body">
2
+ <view wx:if="{{!showEmpty}}" class="order-list-body">
3
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
4
+ <view
5
+ id="{{group.sectionId}}"
6
+ wx:if="{{group.showSection}}"
7
+ class="order-group"
6
8
  >
7
- <view class="chatting-body">
9
+ {{group.title}}
10
+ </view>
11
+ <view class="order-list">
8
12
  <block
9
13
  wx:for="{{group.list}}"
10
14
  wx:key="order"
@@ -6,17 +6,32 @@ page {
6
6
  height: 100%;
7
7
  }
8
8
 
9
- .chatting-body {
10
- display: flex;
11
- flex-direction: column;
9
+ .order-list-body {
10
+ width: 100%;
12
11
  padding-bottom: constant(safe-area-inset-bottom); /* 兼容 IOS<11.2 */
13
12
  padding-bottom: env(safe-area-inset-bottom); /* 兼容 IOS>11.2 */
14
13
  }
15
14
 
15
+ .order-list {
16
+ width: 100%;
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+
16
21
  .order-group {
22
+ display: flex;
23
+ flex-direction: row;
24
+ width: calc(100% - 30rpx);
25
+ position: sticky;
26
+ top: 0;
27
+ height: 80rpx;
17
28
  font-size: 32rpx;
29
+ font-weight: bold;
18
30
  color: #333333;
19
- padding: 20rpx 0 20rpx 30rpx;
31
+ padding: 0 0 0 30rpx;
32
+ background-color: #f3f5fb;
33
+ align-items: center;
34
+ z-index: 2;
20
35
  }
21
36
 
22
37
  .order-item {
@@ -1,6 +1,7 @@
1
1
  const menuBuilder = require('../../detail/widget/chat-bottom/chat-menu-builder')
2
2
  const api = require('../../../apis/order-app-api')
3
3
  const checkPermission = require('../../../utils/permission-utils')
4
+ const cache = require('../../../public/cache-data')
4
5
 
5
6
  module.exports = Behavior({
6
7
 
@@ -48,6 +49,7 @@ module.exports = Behavior({
48
49
  placeHolder = '请在此填写拒绝原因'
49
50
  break
50
51
  case menuBuilder.ChatEventType.reply:
52
+ case menuBuilder.ChatEventType.doctorAsk:
51
53
  title = '填写回复内容'
52
54
  placeHolder = '请在此填回复内容'
53
55
  break
@@ -88,9 +90,14 @@ module.exports = Behavior({
88
90
  nullTip = '请补充需要补充资料原因'
89
91
  break
90
92
  case menuBuilder.ChatEventType.reply:
93
+ case menuBuilder.ChatEventType.doctorAsk:
91
94
  status = 2
92
95
  nullTip = '请补充需要回复的内容'
93
96
  break
97
+ case menuBuilder.ChatEventType.dAddSupply:
98
+ status = 200
99
+ nullTip = '请补充资料'
100
+ break
94
101
  }
95
102
 
96
103
  var params = {}
@@ -104,6 +111,12 @@ module.exports = Behavior({
104
111
  'actionSource': 'wxdoctor',
105
112
  'status': status,
106
113
  }
114
+
115
+ if (this.isRequest()) {
116
+ body['role'] = 1
117
+ body['userid'] = this.data.order.doctorid
118
+ }
119
+
107
120
  if (type == menuBuilder.ChatEventType.eAddSupply) {
108
121
  body['showDoctor'] = true
109
122
  }
@@ -119,7 +132,9 @@ module.exports = Behavior({
119
132
  }
120
133
  })
121
134
  body['caseImageList'] = sendMediaFiles
135
+
122
136
  }
137
+
123
138
  if (body['comments'] == '' && (body['contentSound'] == null || body['contentSound'] == '') && body['caseImageList'] == null) {
124
139
  wx.showToast({
125
140
  icon: null,
@@ -130,6 +145,9 @@ module.exports = Behavior({
130
145
  wx.showLoading({
131
146
  title: '保存中...',
132
147
  })
148
+
149
+ console.error(JSON.stringify(body))
150
+
133
151
  api.requestReply(type, params, body).then((res) => {
134
152
  wx.hideLoading()
135
153
  if (res.status == 200 && res.data) {
@@ -179,5 +197,9 @@ module.exports = Behavior({
179
197
  }
180
198
  this._toRecordAudio()
181
199
  },
200
+
201
+ isRequest() {
202
+ return cache.doctorId() == this.data.order.doctorid
203
+ },
182
204
  }
183
205
  })
@@ -1,6 +1,6 @@
1
1
  function cache(data) {
2
2
  var doctorOptions = wx.doctorOptions || {}
3
- if (data.doctorId && data.doctorId !== null && data.doctorId !== '') {
3
+ if (data.doctorId && data.doctorId != null && data.doctorId != '') {
4
4
  generateSessionId()
5
5
  }
6
6
  // if (data.doctor != null) {
@@ -36,7 +36,7 @@ function _request(request, method, params, data) {
36
36
  fullParams.sdkProductId = appConfig.appID
37
37
  fullParams.pid = appConfig.appID
38
38
  fullParams.app_version = appConfig.appVersion
39
- fullParams.actionSource = 'wxApp'
39
+ fullParams.actionSource = 'wxdoctor'
40
40
  fullParams.device_token = ''
41
41
  if (doctorId) {
42
42
  fullParams.doctor_id = doctorId
@@ -68,6 +68,11 @@ function _request(request, method, params, data) {
68
68
  'CurTime': curTime,
69
69
  'CheckSum': checkSum
70
70
  }
71
+
72
+ if (data && !data.actionSource) {
73
+ data['actionSource'] = 'wxdoctor'
74
+ }
75
+
71
76
  if (request.download) {
72
77
  wx.downloadFile({
73
78
  url: url,
@@ -157,8 +157,46 @@ function showPermissionTip(error, ...scopes) {
157
157
  })
158
158
  }
159
159
 
160
+ function subscriptionVideoTime() {
161
+ const id = 'D8X5Vg3T0MmqA_uie9kyTEmfUoaHreWq4d9KoeM1UCg'
162
+ wx.getSetting({
163
+ withSubscriptions: true,
164
+ success(res) {
165
+ // console.log(res)
166
+ if (res.subscriptionsSetting.mainSwitch) { // 用户打开了订阅消息总开关
167
+ if (res.subscriptionsSetting.itemSettings) { // 用户同意总是保持是否推送消息的选择, 这里表示以后不会再拉起推送消息的授权
168
+ let moIdState = res.subscriptionsSetting.itemSettings[id]; // 用户同意的消息模板id
169
+ if (moIdState === 'accept') {
170
+ // console.log('接受了消息推送');
171
+ } else if (moIdState === 'reject') {
172
+ // console.log('拒绝了消息推送');
173
+ wx.requestSubscribeMessage({
174
+ tmplIds: [id],
175
+ success(res) {},
176
+ })
177
+ } else if (moIdState === 'ban') {
178
+ // console.log("已被后台封禁");
179
+ }
180
+ } else {
181
+ wx.requestSubscribeMessage({
182
+ tmplIds: [id],
183
+ success(res) {},
184
+ })
185
+ }
186
+ }
187
+ // else {
188
+ // wx.openSetting({
189
+ // withSubscriptions: true,
190
+ // })
191
+
192
+ // }
193
+ }
194
+ })
195
+ }
196
+
160
197
  module.exports = {
161
198
  checkMediaPermission: checkMediaPermission,
162
199
  checkScopeRecord: checkScopeRecord,
163
- checkScopeCamera: checkScopeCamera
200
+ checkScopeCamera: checkScopeCamera,
201
+ subscriptionVideoTime: subscriptionVideoTime,
164
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"