hhdoctor-wmp-sdk 3.8.32 → 3.8.34

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 (55) hide show
  1. package/miniprogram_dist/hh-bottom/hh-bottom.js +4 -2
  2. package/miniprogram_dist/hh-calling/hh-calling.js +3 -0
  3. package/miniprogram_dist/hh-im/hh-card.js +5 -1
  4. package/miniprogram_dist/hh-im/hh-im.js +195 -46
  5. package/miniprogram_dist/hh-im/hh-im.json +11 -11
  6. package/miniprogram_dist/hh-im/hh-im.wxss +11 -0
  7. package/miniprogram_dist/hh-rtc/common/order.js +204 -40
  8. package/miniprogram_dist/hh-rtc/hh-rtc.js +79 -10
  9. package/miniprogram_dist/hh-rtc/hh-rtc.wxml +1 -1
  10. package/miniprogram_dist/hh-rtc/phases/phase-2-queue/phase-queue.js +28 -6
  11. package/miniprogram_dist/hh-rtc/phases/phase-3-calling/phase-calling.js +59 -5
  12. package/miniprogram_dist/hh-rtc/phases/phase-3-calling/phase-calling.wxml +6 -3
  13. package/miniprogram_dist/hh-rtc/phases/phase-4-doctorcall/phase-doctorcall.wxml +1 -1
  14. package/miniprogram_dist/hhDoctor.js +1 -1
  15. package/miniprogram_dist/innerpages/ehr-addmember/ehr-addmember.js +117 -56
  16. package/miniprogram_dist/utils/apiUtil.js +243 -173
  17. package/miniprogram_dist/utils/commonUtil.js +13 -0
  18. package/miniprogram_dist/utils/i18n/locales/en.js +12 -0
  19. package/miniprogram_dist/utils/i18n/locales/zh_CN.js +12 -0
  20. package/miniprogram_dist/utils/layoutUtil.js +19 -12
  21. package/miniprogram_dist/utils/msgUtil.js +299 -51
  22. package/miniprogram_dist/utils/validate-history-adapter.js +202 -0
  23. package/miniprogram_dist/utils/validate-im-send.js +188 -0
  24. package/npm-publish.cmd +5 -0
  25. package/package.json +1 -1
  26. package/reports/sdk-build-3.8.33-20261010-1830.md +107 -0
  27. package/reports/sdk-build-3.8.33-20261012-1106.md +87 -0
  28. package/reports/sdk-build-3.8.33-20261012-1142.md +122 -0
  29. package/reports/sdk-build-3.8.33-20261012-1153.md +149 -0
  30. package/reports/sdk-build-3.8.33-20261012-1702.md +179 -0
  31. package/reports/sdk-build-3.8.33-20261012-1755.md +111 -0
  32. package/reports/sdk-build-3.8.34-20261023-1037.md +38 -0
  33. package/src/hh-bottom/hh-bottom.js +4 -2
  34. package/src/hh-calling/hh-calling.js +3 -0
  35. package/src/hh-im/hh-card.js +5 -1
  36. package/src/hh-im/hh-im.js +195 -46
  37. package/src/hh-im/hh-im.json +11 -11
  38. package/src/hh-im/hh-im.wxss +11 -0
  39. package/src/hh-rtc/common/order.js +204 -40
  40. package/src/hh-rtc/hh-rtc.js +79 -10
  41. package/src/hh-rtc/hh-rtc.wxml +1 -1
  42. package/src/hh-rtc/phases/phase-2-queue/phase-queue.js +28 -6
  43. package/src/hh-rtc/phases/phase-3-calling/phase-calling.js +59 -5
  44. package/src/hh-rtc/phases/phase-3-calling/phase-calling.wxml +6 -3
  45. package/src/hh-rtc/phases/phase-4-doctorcall/phase-doctorcall.wxml +1 -1
  46. package/src/hhDoctor.js +1 -1
  47. package/src/innerpages/ehr-addmember/ehr-addmember.js +117 -56
  48. package/src/utils/apiUtil.js +243 -173
  49. package/src/utils/commonUtil.js +13 -0
  50. package/src/utils/i18n/locales/en.js +12 -0
  51. package/src/utils/i18n/locales/zh_CN.js +12 -0
  52. package/src/utils/layoutUtil.js +19 -12
  53. package/src/utils/msgUtil.js +299 -51
  54. package/src/utils/validate-history-adapter.js +202 -0
  55. package/src/utils/validate-im-send.js +188 -0
@@ -255,9 +255,11 @@ Component({
255
255
  inputText: e.detail.value
256
256
  })
257
257
  },
258
- /** 发送文本消息 */
258
+ /** 发送文本消息(空内容 / 纯空格不发送) */
259
259
  _sendTextMsg(e) {
260
- that.triggerEvent('sendTextMsg', that.data.inputText)
260
+ const text = String(that.data.inputText || '').trim()
261
+ if (!text) return
262
+ that.triggerEvent('sendTextMsg', text)
261
263
  that.setData({
262
264
  inputText: ''
263
265
  })
@@ -163,6 +163,9 @@ Component({
163
163
  },
164
164
  _requestComplete() {
165
165
  console.log("calling-request", this.data._request)
166
+ // 兼容时序:hhStarter 的 request property observer 可能早于 attached 触发本方法,
167
+ // 此时模块级 that 还未赋值,that.getMember() / that._checkSceneNum() 会抛 TypeError
168
+ that = this
166
169
  this.setData({ windowInfo: wx.getWindowInfo() })
167
170
  console.log("系统信息", this.data.windowInfo, this.data.msgPanelTop)
168
171
  //that._getLiveListCycle()
@@ -49,7 +49,11 @@ Component({
49
49
  msgChange(newVal) {
50
50
  if (!newVal) return
51
51
  if ('card' == newVal.type && 'welcomeTips' == newVal.body.command) newVal.type = 'text'
52
- for (let key in newVal) this.setData({ [key]: newVal[key] })
52
+ // 微信 setData 不接受 undefined(赋值会告警且不生效,如卡片消息 body 无 patientUuid 时的 patient 字段),
53
+ // 统一转空串覆盖,避免残留旧值;同时把逐字段 setData 合并成一次,减少渲染层通信
54
+ const values = {}
55
+ for (let key in newVal) values[key] = undefined === newVal[key] ? '' : newVal[key]
56
+ this.setData(values)
53
57
  },
54
58
  requestChange(newVal) {
55
59
  if (!newVal) return
@@ -30,6 +30,9 @@ var reloadMsg = false,
30
30
  lastMsgTime, scrollToBottom = true;
31
31
  var pageIsShowing = false;
32
32
  var firstShow = true;
33
+ // 已拉取区间的最早时间(毫秒):RS 的 listByCommon 返回 IM ∪ 卡片,总有一些行会被适配层判为脏数据剔除,
34
+ // 下拉加载更早时若只用列表首条消息时间做边界,会一直请求同一区间、取不到更早的消息
35
+ var historyEndTime = 0;
33
36
  var intervalHandler = {
34
37
  liveList: null,
35
38
  resize: null,
@@ -164,6 +167,9 @@ Component({
164
167
  pageLifetimes: {
165
168
  show() {
166
169
  pageIsShowing = true;
170
+ // 从二级页/半屏页返回时,本次列表刷新不把视图拉到底部,保持离开前的阅读位置;
171
+ // 首屏进入(列表为空)仍由 _applyMsgList 滚到最新一条
172
+ if (this.data.msgList && this.data.msgList.length) scrollToBottom = false
167
173
  wx.setKeepScreenOn({
168
174
  keepScreenOn: true
169
175
  })
@@ -190,6 +196,10 @@ Component({
190
196
  },
191
197
  hide() {
192
198
  pageIsShowing = false;
199
+ // 清空滚动锚点:scroll-into-view 是受控属性,lastMsgId 残留会让页面重新显示时
200
+ // 再次滚到该条(表现为「从二级页返回后跳到最新消息」);滚动位置本身由 scroll-view 保留,
201
+ // 清空(而非改成其它 id)不会引起滚动
202
+ this.setData({ lastMsgId: '' })
193
203
  self.setData({ isAuthBox: false, licenseConfig: { position: 'center', rejectType: 'exit', mode: '', type: '', showSkip: false, cancelText: '', confirmText: '', hideTitle: false } })
194
204
  wx.offNetworkStatusChange();
195
205
  this._removeSunshineStore()
@@ -270,6 +280,9 @@ Component({
270
280
  methods: {
271
281
  _requestComplete() {
272
282
  console.log('初始化参数完成,准备启动IM...');
283
+ // 兼容时序:hhStarter 的 request property observer 可能早于 attached 触发本方法,
284
+ // 此时模块级 self 还未赋值,后续 self._onImMsg / self._parseMsgHis 会抛 TypeError
285
+ self = this
273
286
  hasSubscribed()
274
287
  hhDoctor.off('chatMessage');
275
288
  hhDoctor.on('chatMessage', self._onImMsg);
@@ -460,7 +473,7 @@ Component({
460
473
  }, 500)
461
474
  //let lastTime = self.data.msgList.length ? self.data.msgList[self.data.msgList.length - 1].time : ''
462
475
  if (isFirst) uiUtil.loading(i18n.t('im.fetchingMsg'), 5000)
463
- apiUtil.getHistoryMsg(asst.uuid, isFirst, endTime ? '' : lastMsgTime, endTime || '', msgLimit)
476
+ this._requestHistoryMsg(endTime)
464
477
  .then((res) => {
465
478
  //self.data.msgList = [];
466
479
  self._parseMsgHis(res);
@@ -472,6 +485,39 @@ Component({
472
485
  uiUtil.hideLoading()
473
486
  })
474
487
  },
488
+ /**
489
+ * 请求历史消息,统一返回 { status: 200, data: HistoryMessage[] }
490
+ *
491
+ * 直连 family-order RS 的 /web/v1/informationFlow/listByCommon 拉信息流列表,
492
+ * 再由 msgUtil.adaptInformationFlowToHistory 适配成原 HistoryMessage 结构。
493
+ *
494
+ * isFirst 语义保留:本地决定 loading 与首屏标记(firstShow),并通过 beginTime 影响请求范围——
495
+ * 首屏或未记录 lastMsgTime 时不带 beginTime(等价全量),否则以 lastMsgTime 作为 beginTime 做增量。
496
+ * RS 的 listByCommon 不接收 isFirst,范围差异统一由 beginTime/endTime 表达。
497
+ */
498
+ _requestHistoryMsg(endTime) {
499
+ const beginTime = endTime ? '' : lastMsgTime
500
+ return apiUtil.getInformationFlowList({
501
+ beginTime: beginTime,
502
+ endTime: endTime || '',
503
+ pageSize: msgLimit
504
+ }).then(res => {
505
+ const rawList = (res && res.data) || []
506
+ // 记录本批数据里真实的最早时间(含被适配层判为脏数据剔除的行),供下拉加载更早时分页
507
+ const earliest = rawList.reduce((min, item) => {
508
+ const time = parseInt(item && item.createTime, 10) || 0
509
+ return time && (!min || time < min) ? time : min
510
+ }, 0)
511
+ if (earliest) historyEndTime = earliest
512
+ return {
513
+ status: res && res.status,
514
+ data: msgUtil.adaptInformationFlowToHistory(rawList, {
515
+ sdkProductId: this.data._request.sdkProductId,
516
+ limit: msgLimit
517
+ })
518
+ }
519
+ })
520
+ },
475
521
  /** 获取未注册用户的历史消息 */
476
522
  _getUnregHistoryMsg() {
477
523
  apiUtil.getUnregHistoryMsg()
@@ -509,13 +555,25 @@ Component({
509
555
  }
510
556
  console.log('获取历史消息结果:', res.data)
511
557
  let uuid = parseInt(hhDoctor.getUserId());
558
+ // RS 的 listByCommon 身份只出 userToken(IM 行与卡片行的 from 都是参与人 userToken),
559
+ // 判断「这条是不是我发的」必须优先按 userToken 比,数字 uuid 作为历史结构回退
560
+ let userToken = this.data._request.userToken
512
561
  let asst = hhDoctor.getAsstInfo();
513
562
  let msgList = msgUtil.parseMsgHistory(res, asst.uuid);
514
- if (!msgList || !msgList.length) return;
563
+ if (!msgList || !msgList.length) {
564
+ // 本批数据里没有可展示的消息(时间窗内既没有卡片、IM 行也都被判为脏数据)。
565
+ // 必须复位下拉刷新状态:否则 refresher-triggered 一直为 true,下拉将永久失效。
566
+ uiUtil.hideLoading()
567
+ return this.setData({ msgTrigger: false })
568
+ }
515
569
  for (let i = 0; i < msgList.length; i++) {
570
+ // from 必须归一成 'c'/'d':消息模板按 from 决定左右对齐、头像与昵称,
571
+ // 保留原始 uuid/userToken 时既不等于 'c' 也不等于 'd',消息会渲染成错的一侧。
572
+ // userToken 是十六进制串,只在 from 为纯数字(老结构/未注册链路的 uuid)时才做数字比较
573
+ let from = String(msgList[i].from || '')
574
+ let isUser = !!from && ((userToken && from === String(userToken)) || (/^\d+$/.test(from) && parseInt(from, 10) == uuid));
575
+ msgList[i].from = isUser ? 'c' : 'd';
516
576
  if (!msgList[i].head || !msgList[i].name) {
517
- let isUser = parseInt(msgList[i].from) == uuid;
518
- msgList[i].from = isUser ? 'c' : 'd';
519
577
  msgList[i].head = isUser ? hhDoctor.getUserPhoto() : asst.photo;
520
578
  msgList[i].name = isUser ? '' : asst.name;
521
579
  }
@@ -524,18 +582,22 @@ Component({
524
582
  },
525
583
  /** 将收到的消息加入数组 */
526
584
  _addToMsgList(msgList, reload) {
527
- //let list = []
528
- let lastMsgLength = this.data.msgList.length
585
+ const current = this.data.msgList || []
586
+ let lastMsgLength = current.length
529
587
  if (!msgList || 0 == msgList.length) {
530
588
  return uiUtil.hideLoading();
531
589
  }
532
590
  var msgId = '';
533
- // var list = this.data.msgList;
534
- // if (reload || !lastMsgTime) {
535
- // list = [];
536
- // }
537
- if (reload || !lastMsgTime) _msgList = [];
538
- else _msgLength += msgList.length
591
+ // 仅 reload 时清空列表;刷新(lastMsgTime 为 null,如从二级页返回)不再清空,
592
+ // 交由 _applyMsgList 差量写回,避免整表重建导致列表闪烁、滚动位置丢失
593
+ if (reload) {
594
+ _msgList = []
595
+ } else {
596
+ // _msgList 与 this.data.msgList 通常是同一引用:先拷贝再累积,
597
+ // 否则下面的 push 会直接改动「正在渲染的数据」,使 _applyMsgList 失去差量比较基准
598
+ if (_msgList === current) _msgList = current.slice()
599
+ _msgLength += msgList.length
600
+ }
539
601
 
540
602
  for (var i = 0; i < msgList.length; i++) {
541
603
  var msg = this._precessMsg(msgList[i]);
@@ -567,31 +629,92 @@ Component({
567
629
  _msgList = this._filterLocalMsg(_msgList)
568
630
  let newMsgCount = _msgList.length - lastMsgLength
569
631
  if (newMsgCount) hhDoctor.addLog('1', `信息流添加${newMsgCount}条消息`)
570
- this.setData({ msgList: _msgList, msgTrigger: false },
571
- () => {
572
- if (scrollToBottom && _msgList.length > 4) this.setData({ lastMsgId: msgId })
573
- else scrollToBottom = true
574
- uiUtil.hideLoading()
575
- console.log('>>> msgList:', this.data.msgList)
576
- })
632
+ this._applyMsgList(_msgList, msgId, reload)
577
633
  self._checkCallBtnDisabled()
578
634
  },
635
+ /**
636
+ * 差量写回消息列表
637
+ *
638
+ * 背景:进入二级页返回后会重新拉取整份列表以刷新卡片最新状态,若直接整表 setData,
639
+ * scroll-view 内容整体重建,表现为「闪一次」并丢失原滚动位置/焦点。
640
+ *
641
+ * 策略:
642
+ * - reload(明确要求重置)或目标列表与当前列表 id 顺序不一致(中间插入/删除等)→ 整表 setData 兜底;
643
+ * - 否则按索引差分:只把内容真正变化的项写回 msgList[i],未变化的项复用原对象、不参与 setData;
644
+ * - 完全没有变化时仅复位下拉刷新状态(msgTrigger),列表与滚动位置保持不动。
645
+ *
646
+ * @param {Array} target 合并并经后处理的目标列表(_msgList)
647
+ * @param {String} msgId 滚动锚点(最新消息 id)
648
+ * @param {Boolean} reload 是否要求整表重置
649
+ */
650
+ _applyMsgList(target, msgId, reload) {
651
+ const current = this.data.msgList || []
652
+ // 本次是否新增了消息:只有新增时才考虑滚动到底,纯状态刷新不得改变滚动位置
653
+ const hasAppend = target.length > current.length
654
+ const done = () => {
655
+ if (hasAppend && scrollToBottom && target.length > 4) this.setData({ lastMsgId: msgId })
656
+ else scrollToBottom = true
657
+ uiUtil.hideLoading()
658
+ }
659
+ // 仅当 target 的前 current.length 项与 current 同 id 同序时,才可安全按索引差分
660
+ let sameOrder = target.length >= current.length
661
+ if (sameOrder) {
662
+ for (let i = 0; i < current.length; i++) {
663
+ if (!target[i] || String(target[i].id) !== String(current[i].id)) {
664
+ sameOrder = false
665
+ break
666
+ }
667
+ }
668
+ }
669
+ if (reload || !sameOrder || 0 === current.length || hasAppend) {
670
+ // 首屏、明确重置、顺序不一致(中间插入/删除)、有新增消息 → 整表更新。
671
+ // 新增项不再走 setData 的「数组越界索引」写法:不同基础库行为不一致,静默失败会导致新消息不显示;
672
+ // 且该场景通常需要滚到最新消息
673
+ this.setData({ msgList: target, msgTrigger: false }, done)
674
+ return
675
+ }
676
+ const patch = {}
677
+ let changed = 0
678
+ for (let i = 0; i < target.length; i++) {
679
+ const prev = current[i]
680
+ if (prev === target[i]) continue
681
+ if (prev && this._sameMsg(prev, target[i])) continue
682
+ patch['msgList[' + i + ']'] = target[i]
683
+ changed++
684
+ }
685
+ if (!changed) {
686
+ this.setData({ msgTrigger: false }, done)
687
+ return
688
+ }
689
+ patch.msgTrigger = false
690
+ this.setData(patch, done)
691
+ },
692
+ /** 两条消息内容是否一致(差量比较用;序列化失败按「不一致」处理,宁可多更新一次) */
693
+ _sameMsg(a, b) {
694
+ try {
695
+ return JSON.stringify(a) === JSON.stringify(b)
696
+ } catch (e) {
697
+ return false
698
+ }
699
+ },
579
700
  /** 更新预约专家按钮 */
580
701
  _refreshMsgText(force = false) {
581
702
  //console.error('>>> _refreshMsgText')
582
703
  let update = false
583
- this.data.msgList.forEach(msg => {
704
+ const patch = {}
705
+ this.data.msgList.forEach((msg, index) => {
706
+ let changed = false
584
707
  if (msg.type == 'card' && msg.bodyContent && msg.bodyContent.command == 'appointmentExpertSuccess' &&
585
708
  msg.bodyContent.time && (force || parseInt(msg.bodyContent.time) > new Date().getTime())) {
586
- update = true
709
+ changed = true
587
710
  msg.bodyContent.btnText = this.formatBtnText(parseInt(msg.bodyContent.time), msg.bodyContent.serviceType)
588
711
  }
589
- if ('card' == msg.type && 'command_appoint_doctor' == msg.bodyContent.command &&
712
+ if ('card' == msg.type && msg.bodyContent && 'command_appoint_doctor' == msg.bodyContent.command &&
590
713
  msg.bodyContent.startTime && msg.bodyContent.endTime && msg.bodyContent.timeTips) {
591
- update = true
714
+ changed = true
592
715
  msg.bodyContent.timeTips = this.formatDoctorWorkTime(msg.bodyContent.startTime, msg.bodyContent.endTime);
593
716
  }
594
- if ('card' == msg.type && msg.bodyContent.command == 'hospitalInsureOrderRegSuccess' &&
717
+ if ('card' == msg.type && msg.bodyContent && msg.bodyContent.command == 'hospitalInsureOrderRegSuccess' &&
595
718
  msg.bodyContent.expireTime) {
596
719
  var expireDate = new Date(msg.bodyContent.expireTime.replace(/-/g, '/'))
597
720
  var remaining = Math.max(0, Math.floor((expireDate.getTime() - new Date().getTime()) / 1000))
@@ -602,16 +725,22 @@ Component({
602
725
  msg.bodyContent._tipsAfter = ''
603
726
  msg.bodyContent.footButton.isAllow = 0
604
727
  msg.bodyContent.tips = ''
605
- update = true
728
+ changed = true
606
729
  }
607
730
  } else if (msg.bodyContent._tipsBefore !== undefined) {
608
731
  msg.bodyContent.tips = (msg.bodyContent._tipsBefore || '') + remaining.toString() + (msg.bodyContent._tipsAfter || '')
609
732
  msg.bodyContent._tipsSeconds = remaining.toString()
610
- update = true
733
+ changed = true
611
734
  }
612
735
  }
736
+ // 只把被改动的卡片按路径写回:show() 每次返回页面都会以 force=true 调用本方法,
737
+ // 原来无条件整表 setData 会把整个消息列表重新传输/渲染,是「返回后闪一次」的另一来源
738
+ if (changed) {
739
+ update = true
740
+ patch['msgList[' + index + '].bodyContent'] = msg.bodyContent
741
+ }
613
742
  })
614
- this.setData({ msgList: this.data.msgList })
743
+ if (update) this.setData(patch)
615
744
  this._checkCallBtnDisabled()
616
745
  if (update) intervalHandler.msg = setTimeout(() => this._refreshMsgText(), 1000);
617
746
  },
@@ -620,13 +749,24 @@ Component({
620
749
  if (!msg || !msg.type || 'card' != msg.type && !msg.id || !msg.body || !msg.body.command || !cardEa[msg.body.command]) return
621
750
  hhDoctor.addPoint(7, { ec: 'video_doctor', ea: cardEa[msg.body.command], ev: msg.id })
622
751
  },
623
- /** 对消息去重 */
752
+ /**
753
+ * 对消息去重:同一 id 保留**最后**一条(最新拉取的数据)
754
+ *
755
+ * 全量刷新时 _msgList 里已存在旧对象,而 refreshInformation 拉回的同 id 卡片状态已更新;
756
+ * 若像原先那样「先到先得」,新对象会被丢弃,_applyMsgList 的差量比较判定无变化,
757
+ * 表现为接口数据已更新但界面仍显示旧状态。
758
+ */
624
759
  _distincMsg(msgList) {
625
- let idList = [],
760
+ let idIndex = {},
626
761
  list = []
627
762
  msgList.forEach(msg => {
628
- if (idList[msg.id]) return false
629
- idList[msg.id] = 1
763
+ const key = String(msg.id)
764
+ if (Object.prototype.hasOwnProperty.call(idIndex, key)) {
765
+ // 同 id 用后到的对象覆盖先到的,保持该消息首次出现的位置
766
+ list[idIndex[key]] = msg
767
+ return
768
+ }
769
+ idIndex[key] = list.length
630
770
  list.push(msg)
631
771
  })
632
772
  list.sort((a, b) => { return a.time - b.time })
@@ -766,7 +906,11 @@ Component({
766
906
  showMoreMsg() {
767
907
  console.log('>>> length:', _msgList.length, _msgLength)
768
908
  if (!this.data.msgList || !this.data.msgList.length) return
769
- let endTime = this.data.msgList[0].time
909
+ // 分页边界优先用「上一批响应里真实的最早时间 - 1ms」:
910
+ // RS 返回 IM ∪ 卡片,被剔除的脏数据行不进入列表,只按列表首条消息时间取边界会原地打转、拉不到更早的消息
911
+ const listEarliest = this.data.msgList[0].time
912
+ let endTime = historyEndTime ? Math.max(0, historyEndTime - 1) : listEarliest
913
+ if (endTime >= listEarliest) endTime = listEarliest
770
914
  uiUtil.loading(i18n.t('im.fetchingMsg'), 5000)
771
915
  this._getHistoryMsg(false, endTime)
772
916
  },
@@ -1475,12 +1619,15 @@ Component({
1475
1619
  },
1476
1620
  /** 发送文本消息 */
1477
1621
  bindSendTextMsg(e) {
1622
+ //空内容(含纯空格)不上送、也不插入本地消息,避免产生空白气泡与无意义请求
1623
+ const text = String((e && e.detail) || '').trim()
1624
+ if (!text) return uiUtil.toast(i18n.t('im.msgEmpty'))
1478
1625
  let from = parseInt(hhDoctor.getUserId());
1479
1626
  let asst = hhDoctor.getAsstInfo();
1480
1627
  let fileType = 'text',
1481
1628
  fileInfo = { id: msgUtil.generateId() }
1482
- this.addLocalMsgToMsgList(fileInfo, fileType, '', e.detail)
1483
- msgUtil.sendText(fileInfo.id, from, asst.uuid, e.detail, self.data._request.appointedOrderId)
1629
+ this.addLocalMsgToMsgList(fileInfo, fileType, '', text)
1630
+ msgUtil.sendText(fileInfo.id, from, asst.uuid, text)
1484
1631
  .then(res => {
1485
1632
  console.log('>>> sendTextMsg:', res, e)
1486
1633
  if (res && res.data && res.data.success) {
@@ -1510,8 +1657,7 @@ Component({
1510
1657
  fileType,
1511
1658
  tempFilePath: e.detail.tempFilePath,
1512
1659
  fileInfo,
1513
- duration: e.detail.duration,
1514
- appointedOrderId: self.data._request.appointedOrderId
1660
+ duration: e.detail.duration
1515
1661
  })
1516
1662
  this.uploadFileByQueue()
1517
1663
  },
@@ -1530,8 +1676,7 @@ Component({
1530
1676
  fileType,
1531
1677
  tempFilePath: images[index].tempFilePath,
1532
1678
  fileInfo,
1533
- duration: null,
1534
- appointedOrderId: self.data._request.appointedOrderId
1679
+ duration: null
1535
1680
  })
1536
1681
  this.sendImages(images, index + 1)
1537
1682
  }).catch(err => {})
@@ -1563,7 +1708,7 @@ Component({
1563
1708
  uploadFileByQueue() {
1564
1709
  let item = uploadFileQueue.shift()
1565
1710
  if (!item) return
1566
- msgUtil.sendFile(item.from, item.uuid, item.fileType, item.tempFilePath, item.fileInfo, item.duration, item.appointedOrderId)
1711
+ msgUtil.sendFile(item.from, item.uuid, item.fileType, item.tempFilePath, item.fileInfo, item.duration)
1567
1712
  .then(res => {
1568
1713
  if (res && res.data && res.data.success) {
1569
1714
  console.log('发送文件成功', res)
@@ -1614,6 +1759,10 @@ Component({
1614
1759
  wx.removeStorageSync('doctor')
1615
1760
  },
1616
1761
  _doViewUrl(url) {
1762
+ // 进入二级页/半屏页前清空 lastMsgTime:返回时 pageLifetimes.show 会重新拉取整份列表,
1763
+ // 以拿到卡片的最新状态(二级页内可能有操作改变卡片状态,如查看处方、完成实名等)。
1764
+ // 刷新不再导致列表闪烁/滚动位置丢失——_addToMsgList 已改为差量写回,
1765
+ // 只更新内容真正变化的卡片,未变化的项不参与 setData。
1617
1766
  lastMsgTime = null
1618
1767
  scrollToBottom = false
1619
1768
  this._viewUrl(url);
@@ -1783,11 +1932,11 @@ Component({
1783
1932
  let { orderId, time, name } = data
1784
1933
  hhDoctor.addLog('1', '用户点击接受预约医生')
1785
1934
  try {
1786
- let res = await apiUtil.acceptOrder(orderId)
1935
+ // 只调接口,不在这里手动刷新:服务端会立即推送 refreshInformation,
1936
+ // 由 _onImMsg → _getHistoryMsg 统一做全量刷新,避免重复请求与状态覆盖
1937
+ await apiUtil.acceptOrder(orderId)
1787
1938
  if (time && (parseInt(time) - new Date().getTime() > 300000)) this._addPhoneCalendar(time, name)
1788
1939
  else hhDoctor.addLog('1', `不满足添加日历条件,时间差:${(parseInt(time) - new Date().getTime()) / 1000}秒`)
1789
- lastMsgTime = null
1790
- this._getHistoryMsg(true)
1791
1940
  } catch (error) { error && uiUtil.toast(error.message || i18n.t('im.pleaseRetry')) }
1792
1941
  },
1793
1942
  /** 取消预约医生 */
@@ -1801,12 +1950,12 @@ Component({
1801
1950
  cancelText = i18n.t('common.cancel')
1802
1951
  }
1803
1952
  try {
1804
- let res = await uiUtil.modal('', content, confirmText, '#0592f5', true, cancelText, '#646464')
1953
+ await uiUtil.modal('', content, confirmText, '#0592f5', true, cancelText, '#646464')
1805
1954
  uiUtil.loading(i18n.t('im.canceling'))
1806
- res = await apiUtil.cancelOrder(orderId, point)
1807
- lastMsgTime = null
1955
+ // 只调接口,不在这里手动刷新:服务端会立即推送 refreshInformation,
1956
+ // 由 _onImMsg → _getHistoryMsg 统一做全量刷新,避免重复请求与状态覆盖
1957
+ await apiUtil.cancelOrder(orderId, point)
1808
1958
  uiUtil.toast('accept_fail' == point ? i18n.t('im.rejectedOrder') : i18n.t('im.canceledOrder'))
1809
- this._getHistoryMsg(true)
1810
1959
  } catch (error) { error && uiUtil.toast(error.message || i18n.t('im.pleaseRetry')) }
1811
1960
  },
1812
1961
  _viewHealthReport(e) {
@@ -1,11 +1,11 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "hh-Modal": "../hh-modal/hh-modal",
5
- "hh-calling": "../hh-calling/hh-calling",
6
- "hh-bottom": "../hh-bottom/hh-bottom",
7
- "hh-license": "../hh-license/hh-license",
8
- "hh-card": "./hh-card",
9
- "hh-privacy": "../hh-privacy/hh-privacy"
10
- }
11
- }
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "hh-Modal": "../hh-modal/hh-modal",
5
+ "hh-calling": "../hh-calling/hh-calling",
6
+ "hh-bottom": "../hh-bottom/hh-bottom",
7
+ "hh-license": "../hh-license/hh-license",
8
+ "hh-card": "./hh-card",
9
+ "hh-privacy": "../hh-privacy/hh-privacy"
10
+ }
11
+ }
@@ -1784,6 +1784,17 @@ image {
1784
1784
  margin-top: 49rpx;
1785
1785
  }
1786
1786
 
1787
+ /* 拒绝/接受双按钮:重置 .show-more-btn 的 margin-bottom,避免 flex 交叉轴居中时
1788
+ 首个子元素被 margin 挤偏(两个按钮垂直错位 10rpx);同时用 flex 居中文字,
1789
+ 消除【拒绝】按钮 1px 边框带来的文字基线偏移,保证两按钮文字严格对齐 */
1790
+ .accpet-btn-wrap .show-more-btn {
1791
+ display: flex;
1792
+ align-items: center;
1793
+ justify-content: center;
1794
+ margin-top: 0;
1795
+ margin-bottom: 0;
1796
+ }
1797
+
1787
1798
  .ai-wrap {
1788
1799
  width: 100%;
1789
1800
  display: flex;