|
@@ -163,11 +163,18 @@ var render = function () {
|
|
|
index == 0 || item.time - _vm.list[index - 1].time >= 300000
|
|
|
? _vm.formatDate(item.time)
|
|
|
: null
|
|
|
- var g0 = item.speaker && item.speaker.icon.length > 0
|
|
|
+ var g0 =
|
|
|
+ item.speaker_type == "Nurse"
|
|
|
+ ? _vm.doctorInfo.icon && _vm.doctorInfo.icon.length > 0
|
|
|
+ : null
|
|
|
+ var g1 = !(item.speaker_type == "Nurse")
|
|
|
+ ? item.speaker && item.speaker.icon.length > 0
|
|
|
+ : null
|
|
|
return {
|
|
|
$orig: $orig,
|
|
|
m0: m0,
|
|
|
g0: g0,
|
|
|
+ g1: g1,
|
|
|
}
|
|
|
})
|
|
|
_vm.$mp.data = Object.assign(
|
|
@@ -247,6 +254,8 @@ var _default = {
|
|
|
userId: '',
|
|
|
user: {},
|
|
|
config: {},
|
|
|
+ // 医生信息
|
|
|
+ doctorInfo: {},
|
|
|
// 聊天列表数据
|
|
|
list: [],
|
|
|
total: 0,
|
|
@@ -267,6 +276,8 @@ var _default = {
|
|
|
is_bottom: true,
|
|
|
// 判断是否下拉刷新复位
|
|
|
triggered: false,
|
|
|
+ // 是否发送消息
|
|
|
+ is_send: true,
|
|
|
//实时通信
|
|
|
client: null,
|
|
|
subscription: null
|
|
@@ -349,7 +360,6 @@ var _default = {
|
|
|
if (res) {
|
|
|
var user = that.$jwt(res);
|
|
|
that.$set(that, "user", user);
|
|
|
- if (user.role == 'Nurse') that.$set(that, "userId", user.doctor);else that.$set(that, "userId", user._id);
|
|
|
}
|
|
|
} catch (e) {}
|
|
|
},
|
|
@@ -381,9 +391,10 @@ var _default = {
|
|
|
case 4:
|
|
|
res = _context3.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
- list = [].concat((0, _toConsumableArray2.default)(res.data.reverse()), (0, _toConsumableArray2.default)(that.list));
|
|
|
+ if (that.is_send) list = [].concat((0, _toConsumableArray2.default)(res.data.reverse()), (0, _toConsumableArray2.default)(that.list));else list = (0, _toConsumableArray2.default)(res.data.reverse());
|
|
|
that.$set(that, "list", list);
|
|
|
that.$set(that, "total", res.total);
|
|
|
+ that.$set(that, "is_send", true);
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.errmsg,
|
|
@@ -489,15 +500,6 @@ var _default = {
|
|
|
console.log('uploadImage fail', err);
|
|
|
}
|
|
|
});
|
|
|
- var mess = {
|
|
|
- type: 'record',
|
|
|
- voice: Math.round(res.duration / 1000),
|
|
|
- // 时长
|
|
|
- content: res.tempFilePath,
|
|
|
- time: new Date() - 0
|
|
|
- };
|
|
|
- // 写在上传回调内
|
|
|
- that.toSend(mess);
|
|
|
});
|
|
|
that.record.onError(function (err) {
|
|
|
that.global.toast('获取录音失败');
|
|
@@ -572,6 +574,7 @@ var _default = {
|
|
|
case 5:
|
|
|
res = _context4.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
+ that.$set(that, "is_send", false);
|
|
|
that.search();
|
|
|
that.$set(that, "isRecorder", false);
|
|
|
that.poalast(); // 定位消息最后一行
|
|
@@ -629,7 +632,33 @@ var _default = {
|
|
|
},
|
|
|
// 处理已读未读
|
|
|
searchOther: function searchOther() {
|
|
|
- var that = this;
|
|
|
+ var _this3 = this;
|
|
|
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
|
+ var that, res;
|
|
|
+ return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
|
+ while (1) {
|
|
|
+ switch (_context5.prev = _context5.next) {
|
|
|
+ case 0:
|
|
|
+ that = _this3;
|
|
|
+ _context5.next = 3;
|
|
|
+ return that.$api("/doctor/".concat(that.doctorId), 'GET', {});
|
|
|
+ case 3:
|
|
|
+ res = _context5.sent;
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ that.$set(that, "doctorInfo", res.data);
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ case 5:
|
|
|
+ case "end":
|
|
|
+ return _context5.stop();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, _callee5);
|
|
|
+ }))();
|
|
|
}
|
|
|
}
|
|
|
};
|