提交 69d7e404 编写于 作者: huangwensu's avatar huangwensu

群聊接口联调

上级 2dcb1bbe
...@@ -25,7 +25,7 @@ export default [{ ...@@ -25,7 +25,7 @@ export default [{
children: [ children: [
{ {
path: '', path: '',
redirect: '/diagnosisList' redirect: '/diagnosis-list'
},{ },{
path: '/diagnosis-list', path: '/diagnosis-list',
component: diagnosisList component: diagnosisList
......
...@@ -18,7 +18,7 @@ export const envConfig = { ...@@ -18,7 +18,7 @@ export const envConfig = {
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html', innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html',
phomeDemain: 'https://dev-phome.yunqueyi.com', phomeDemain: 'https://dev-phome.yunqueyi.com',
picakfAccId: 'picakf_dev', picakfAccId: 'picaop_dev',
}, },
dev: { dev: {
baseUrl: 'https://dev-sc.yunqueyi.com', baseUrl: 'https://dev-sc.yunqueyi.com',
...@@ -29,7 +29,7 @@ export const envConfig = { ...@@ -29,7 +29,7 @@ export const envConfig = {
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html', innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html',
phomeDemain: 'https://dev-phome.yunqueyi.com', phomeDemain: 'https://dev-phome.yunqueyi.com',
picakfAccId: 'picakf_dev', picakfAccId: 'picaop_dev',
}, },
test: { test: {
baseUrl: 'https://test1-sc.yunqueyi.com', baseUrl: 'https://test1-sc.yunqueyi.com',
...@@ -40,7 +40,7 @@ export const envConfig = { ...@@ -40,7 +40,7 @@ export const envConfig = {
innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html', innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html',
phomeDemain: 'https://test1-phome.yunqueyi.com', phomeDemain: 'https://test1-phome.yunqueyi.com',
picakfAccId: 'picakf_test', picakfAccId: 'picaop_test',
}, },
uat: { uat: {
baseUrl: 'https://uat-sc.yunqueyi.com', baseUrl: 'https://uat-sc.yunqueyi.com',
...@@ -53,7 +53,7 @@ export const envConfig = { ...@@ -53,7 +53,7 @@ export const envConfig = {
innerLoginUrl: 'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html', innerLoginUrl: 'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html',
phomeDemain: 'https://uat-phome.yunqueyi.com', phomeDemain: 'https://uat-phome.yunqueyi.com',
picakfAccId: 'picakf_uat', picakfAccId: 'picaop_uat',
}, },
pro: { pro: {
baseUrl: 'https://sc.yunqueyi.com', baseUrl: 'https://sc.yunqueyi.com',
...@@ -64,6 +64,6 @@ export const envConfig = { ...@@ -64,6 +64,6 @@ export const envConfig = {
innerLoginUrl: 'https://sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html', innerLoginUrl: 'https://sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html',
phomeDemain: 'https://phome.yunqueyi.com', phomeDemain: 'https://phome.yunqueyi.com',
picakfAccId: 'picakf', picakfAccId: 'picaop',
} }
} }
...@@ -2,15 +2,11 @@ ...@@ -2,15 +2,11 @@
<div class="current-session-wrap"> <div class="current-session-wrap">
<section class="component-content screenSet" id="screenSet"> <section class="component-content screenSet" id="screenSet">
<article <article
v-show="sessionListData.sessionList.length"
class="center" class="center"
v-loadmore="getOldMSGHistory" v-loadmore="getOldMSGHistory"
> >
<section class="c-header"> <section class="c-header">
<div class="c-header-l"> <div class="c-header-l">
<!-- <img :src="currentSession.avatarImageUrl" alt />
<span class="name">{{doctorInfo.name}}</span>
<span class="time-tip">当前会话时长:{{currentContinueTimes | continueTimesFilter}}</span> -->
<span class="time-tip">问诊医生XX医生的问诊群聊</span> <span class="time-tip">问诊医生XX医生的问诊群聊</span>
</div> </div>
</section> </section>
...@@ -18,16 +14,15 @@ ...@@ -18,16 +14,15 @@
<section id="msgContentId" class="msg-content scroll-box"> <section id="msgContentId" class="msg-content scroll-box">
<article <article
v-for="(item, index) in messageList" v-for="(item, index) in messageList"
:key="index" :key="index">
:style="{'text-align': item.sendOrReceive ? 'right' : 'left'}"
>
<div class="split-line" v-if="item.sessionFlag">本次会话结束</div> <div class="split-line" v-if="item.sessionFlag">本次会话结束</div>
<!-- sendOrReceive 为true在右边 -->
<div class="msg-item" :class="{'cr': item.sendOrReceive}"> <div class="msg-item" :class="{'cr': item.sendOrReceive}">
<div class="msg-item-img"> <div class="msg-item-img">
<img :src="item.avatarImg" alt /> <img :src="item.avatarImg" alt />
</div> </div>
<div class="msg-item-detail"> <div class="msg-item-detail">
<span class="mid-time">{{item.timestampStr}}</span> <span class="mid-time">{{item.name}} {{item.timestampStr}}</span>
<div class="send-warpper"> <div class="send-warpper">
<img <img
v-if="item.sendOrReceive && item.isShowErrorIcon" v-if="item.sendOrReceive && item.isShowErrorIcon"
...@@ -168,14 +163,12 @@ ...@@ -168,14 +163,12 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapMutations } from "vuex";
import BreadCrumb from "@/components/breadcrumb.vue"; import BreadCrumb from "@/components/breadcrumb.vue";
import { doUpload, getFilePath } from "@/utils/qiniu-util"; import { doUpload, getFilePath } from "@/utils/qiniu-util";
import { openLoading, closeLoading, betaHandle } from "@/utils/utils"; import { openLoading, closeLoading, betaHandle } from "@/utils/utils";
import { getPicaKFAccid, getPhomeDemain } from "@/utils"; import { getPicaKFAccid, getPhomeDemain } from "@/utils";
const CONTAINER_HEIGHT = 700; const CONTAINER_HEIGHT = 700;
let forwardMsgIntervalId = null, let forwardMsgIntervalId = null,
sessionIntervalId = null,
continueIntervalId = null, continueIntervalId = null,
autoCompletionIntervalId = null, autoCompletionIntervalId = null,
cacheMap = {}; cacheMap = {};
...@@ -204,11 +197,6 @@ export default { ...@@ -204,11 +197,6 @@ export default {
picakfAccId: "", picakfAccId: "",
historyTimestamp: 0, historyTimestamp: 0,
realTimestamp: 0, realTimestamp: 0,
doctorInfo: {
name: "",
mobilePhone: "",
isShowCopyBtn: true
},
containerHeight: CONTAINER_HEIGHT, containerHeight: CONTAINER_HEIGHT,
showSelectDialog: false, showSelectDialog: false,
linkForm: { linkForm: {
...@@ -216,8 +204,7 @@ export default { ...@@ -216,8 +204,7 @@ export default {
info: "", info: "",
url: "" url: ""
}, },
linkList: [], linkList: [], // 消息列表 showType 1: 文本; 2: 图片; 3: PDF; 4: 链接; 5: 不支持类型;
// 消息列表 showType 1: 文本; 2: 图片; 3: PDF; 4: 链接; 5: 不支持类型;
messageList: [], messageList: [],
rules: { rules: {
info: [ info: [
...@@ -229,11 +216,12 @@ export default { ...@@ -229,11 +216,12 @@ export default {
imgHeight: 0, imgHeight: 0,
imgProportion: 0, imgProportion: 0,
hasNoHistoryData: false, hasNoHistoryData: false,
tid: '',
teamMemberList: []
}; };
}, },
computed: { computed: {
// ...mapGetters(["isFromAssignTask"]),
canSend() { canSend() {
return !!this.sendText; return !!this.sendText;
} }
...@@ -262,15 +250,10 @@ export default { ...@@ -262,15 +250,10 @@ export default {
created() { created() {
_this = this; _this = this;
this.picakfAccId = getPicaKFAccid(); this.picakfAccId = getPicaKFAccid();
this.tid = this.$route.query.tid || '';
this.kfAvatar = require("../../../assets/image/IM/kf-avatar.png"); this.kfAvatar = require("../../../assets/image/IM/kf-avatar.png");
this.getSessionList();
sessionIntervalId && clearInterval(sessionIntervalId);
sessionIntervalId = setInterval(() => {
this.getSessionList();
}, 3000);
this.getFiveContentList(); this.getFiveContentList();
autoCompletionIntervalId && clearInterval(autoCompletionIntervalId); autoCompletionIntervalId && clearInterval(autoCompletionIntervalId);
autoCompletionIntervalId = setInterval(() => { autoCompletionIntervalId = setInterval(() => {
this.autoCompletionInterval(); this.autoCompletionInterval();
...@@ -289,28 +272,19 @@ export default { ...@@ -289,28 +272,19 @@ export default {
mounted() { mounted() {
cacheMap = {}; cacheMap = {};
this.$nextTick(() => { this.$nextTick(() => {
_this.containerHeight = document.body.clientHeight - 80; _this.containerHeight = document.body.clientHeight - 80;
_this.getElmByID("screenSet").style.height = _this.getElmByID("screenSet").style.height = _this.containerHeight - 76 + "px";
_this.containerHeight - 76 + "px"; _this.getElmByID("msgContentId").style.height = _this.containerHeight - 211 + "px";
// console.log('_this.containerHeight', _this.containerHeight);
// _this.getElmByID("sessionListId").style.height =
// _this.containerHeight - 176 + "px";
// _this.getElmByID("userInfoId").style.height =
// _this.containerHeight - 76 + "px";
_this.getElmByID("msgContentId").style.height =
_this.containerHeight - 211 + "px";
}); });
this.getMembersList(); // 获取群聊成员信息
this.getMSGHistory(); // 查询群聊历史消息
}, },
methods: { methods: {
//
// ...mapMutations(["SET_IS_FROM_ASSIGN_TASK"]),
// 含有敏感信息的消息,自行补全提示文案 // 含有敏感信息的消息,自行补全提示文案
// 每30秒监测敏感信息 // 每30秒监测敏感信息
autoCompletionInterval() { autoCompletionInterval() {
if (!this.messageList.length) return; if (!this.messageList.length) return;
// console.log('in autoCompletionInterval');
// 将带有loading的消息转成失败的 // 将带有loading的消息转成失败的
this.messageList.forEach(item => { this.messageList.forEach(item => {
if (item.isShowLoadingIcon) { if (item.isShowLoadingIcon) {
...@@ -318,8 +292,7 @@ export default { ...@@ -318,8 +292,7 @@ export default {
item.isShowErrorIcon = true; item.isShowErrorIcon = true;
} }
}); });
let flag = false, let flag = false, msg;
msg;
for (let i = 0; i < this.messageList.length; i++) { for (let i = 0; i < this.messageList.length; i++) {
msg = this.messageList[i]; msg = this.messageList[i];
if (msg.isShowErrorIcon && !msg.isShowErrorMsg) { if (msg.isShowErrorIcon && !msg.isShowErrorMsg) {
...@@ -332,20 +305,24 @@ export default { ...@@ -332,20 +305,24 @@ export default {
} }
}, },
// 查询群组成员列表
getMembersList() {
this.GET("/im/team/member/list", {tid: this.tid}).then(res => {
if (res.code === "000000") {
this.teamMemberList = res.data;
}
});
},
// 查询医生和居民的消息 - 向前查找 // 查询医生和居民的消息 - 向前查找
getMSGForwardForAC(msg) { getMSGForwardForAC(msg) {
let session = this.currentSession;
let params = { let params = {
doctorAccId: this.currentToAccId,
includeFlag: 0, includeFlag: 0,
lastClientIdServer: session.lastMsgIdClient,
lastMsgIdServer: session.lastMsgIdServer,
lastMsgTimestamp: msg.realTimestamp, lastMsgTimestamp: msg.realTimestamp,
limit: 50, limit: 50,
patientAccId: this.picakfAccId, tid: this.tid
unionId: ""
}; };
this.POST("/im/msg/forward", params).then(res => { this.POST("/im/team/message/forward", params).then(res => {
if (res.code === "000000") { if (res.code === "000000") {
this.contactForwardMessage(res.data, false); this.contactForwardMessage(res.data, false);
} }
...@@ -357,11 +334,12 @@ export default { ...@@ -357,11 +334,12 @@ export default {
return document.getElementById(elmId); return document.getElementById(elmId);
}, },
// 处理发送消息 /* 处理发送消息
// 1: 先将消息体直接显示在对话框中 1: 先将消息体直接显示在对话框中
// 2: 设置一个时间戳,以便再次找回 2: 设置一个时间戳,以便再次找回
// 3: 保存再次发送的数据 3: 保存再次发送的数据
// 4: 设置各种状态(1:isShowErrorIcon; 2:isShowLoadingIcon; 3:isShowErrorMsg) 4: 设置各种状态(1:isShowErrorIcon; 2:isShowLoadingIcon; 3:isShowErrorMsg)
*/
handleSendMsg(params, sendId) { handleSendMsg(params, sendId) {
let text = ""; let text = "";
let msg = Object.assign({}, params); let msg = Object.assign({}, params);
...@@ -382,14 +360,12 @@ export default { ...@@ -382,14 +360,12 @@ export default {
msg.isShowErrorIcon = false; msg.isShowErrorIcon = false;
msg.isShowErrorMsg = false; // 只有在下次拉取新数据时才有可能是为ture msg.isShowErrorMsg = false; // 只有在下次拉取新数据时才有可能是为ture
msg.extData = Object.assign({}, params); // 再将发送时的数据 msg.extData = Object.assign({}, params); // 再将发送时的数据
msg.sendId = sendId; // msg.sendId = sendId;
msg.sendOrReceive = true; msg.sendOrReceive = false;
msg.avatarImg = this.kfAvatar; msg.avatarImg = this.kfAvatar;
msg.timestampStr = new Date().format("hh:mm"); msg.timestampStr = new Date().format("hh:mm");
msg.realTimestamp = this.realTimestamp; msg.realTimestamp = this.realTimestamp;
msg.taskLogId = this.currentTaskLogId; msg.taskLogId = this.currentTaskLogId;
console.log("####msg####", msg);
//
if(msg.type == 1) { if(msg.type == 1) {
this.imgSizeHandleNew(msg, msg.width, msg.height); this.imgSizeHandleNew(msg, msg.width, msg.height);
} }
...@@ -402,20 +378,14 @@ export default { ...@@ -402,20 +378,14 @@ export default {
// 查询医生和居民的消息历史(下拉刷新时调用) // 查询医生和居民的消息历史(下拉刷新时调用)
getOldMSGHistory() { getOldMSGHistory() {
console.log('this.hasNoHistoryData', this.hasNoHistoryData);
if(this.hasNoHistoryData) return; if(this.hasNoHistoryData) return;
let session = this.currentSession;
let params = { let params = {
doctorAccId: this.currentToAccId,
includeFlag: 0, // 不带本条消息 includeFlag: 0, // 不带本条消息
lastClientIdServer: session.lastMsgIdClient,
lastMsgIdServer: session.lastMsgIdServer,
lastMsgTimestamp: this.historyTimestamp, lastMsgTimestamp: this.historyTimestamp,
limit: 20, limit: 20,
patientAccId: this.picakfAccId, tid: this.tid
unionId: ""
}; };
this.POST("/im/msg/history", params).then(res => { this.POST("/im/team/message/history", params).then(res => {
if (res.code === "000000") { if (res.code === "000000") {
// 将新消息合并到之前的消息中, 并且重置最后一条消息 // 将新消息合并到之前的消息中, 并且重置最后一条消息
if(res.data && res.data.length > 0) { if(res.data && res.data.length > 0) {
...@@ -435,16 +405,11 @@ export default { ...@@ -435,16 +405,11 @@ export default {
// 查询医生和居民的消息历史(第一次进来时就调用) // 查询医生和居民的消息历史(第一次进来时就调用)
getMSGHistory(session) { getMSGHistory(session) {
let params = { let params = {
doctorAccId: this.currentToAccId,
includeFlag: 1, // 带本条消息 includeFlag: 1, // 带本条消息
lastClientIdServer: session.lastMsgIdClient,
lastMsgIdServer: session.lastMsgIdServer,
lastMsgTimestamp: session.lastMsgTime,
limit: 20, limit: 20,
patientAccId: this.picakfAccId, tid: this.tid
unionId: ""
}; };
this.POST("/im/msg/history", params).then(res => { this.POST("/im/team/message/history", params).then(res => {
if (res.code === "000000") { if (res.code === "000000") {
this.convertMessageList(res.data, 1); this.convertMessageList(res.data, 1);
} else { } else {
...@@ -459,23 +424,15 @@ export default { ...@@ -459,23 +424,15 @@ export default {
// 查询医生和居民的消息 - 向前查找 // 查询医生和居民的消息 - 向前查找
// 将获取消息列表插入到当前消息列表的最后 // 将获取消息列表插入到当前消息列表的最后
getMSGForward() { getMSGForward() {
let session = this.currentSession;
let params = { let params = {
doctorAccId: this.currentToAccId,
includeFlag: 0, includeFlag: 0,
lastClientIdServer: session.lastMsgIdClient,
lastMsgIdServer: session.lastMsgIdServer,
lastMsgTimestamp: this.realTimestamp, lastMsgTimestamp: this.realTimestamp,
limit: 20, limit: 20,
patientAccId: this.picakfAccId, tid: this.tid
unionId: ""
}; };
this.POST("/im/msg/forward", params).then(res => { this.POST("/im/team/message/forward", params).then(res => {
if (res.code === "000000") { if (res.code === "000000") {
this.convertMessageList(res.data, 2); this.convertMessageList(res.data, 2);
if (res.data.length) {
this.readAllMsg();
}
} else { } else {
this.$message({ this.$message({
message: res.message, message: res.message,
...@@ -485,12 +442,13 @@ export default { ...@@ -485,12 +442,13 @@ export default {
}); });
}, },
// 转换消息格式 /* 转换消息格式
// 处理的消息类型只有5种: 处理的消息类型只有5种:
// type == TEXT(showType:1) type == TEXT(showType:1)
// type == image 或 picture(showType:2) type == image 或 picture(showType:2)
// type == custom时,18: PDF文件(showType:3); 19: 链接信息(showType:4); 1 ~ 17: 不支持的消息类型(showType:5); type == custom时,18: PDF文件(showType:3); 19: 链接信息(showType:4); 1 ~ 17: 不支持的消息类型(showType:5);
// directFlag 1: 第一次取数据; 2: 拼接实时消息(push); 3: 拼接历史消息(unshift); directFlag 1: 第一次取数据; 2: 拼接实时消息(push); 3: 拼接历史消息(unshift);
*/
convertMessageList(messageList, directFlag = 1) { convertMessageList(messageList, directFlag = 1) {
messageList.sort((a, b) => { messageList.sort((a, b) => {
return a.timestamp - b.timestamp; return a.timestamp - b.timestamp;
...@@ -510,40 +468,41 @@ export default { ...@@ -510,40 +468,41 @@ export default {
size = 0; size = 0;
url = ""; url = "";
msg = Object.assign({}, rawMsg); msg = Object.assign({}, rawMsg);
msg.sendOrReceive = rawMsg.fromAccId !== this.currentToAccId; msg.sendOrReceive = rawMsg.fromAccId === this.picakfAccId; // 判断消息是显示在左边还是右边, true 右
msg.avatarImg = msg.sendOrReceive //msg.avatarImg = msg.sendOrReceive ? this.kfAvatar : this.currentSession.avatarImageUrl;
? this.kfAvatar for(let i = 0; i < this.teamMemberList.length; i++) {
: this.currentSession.avatarImageUrl; if(rawMsg.fromAccId == this.teamMemberList[i].accId) {
msg.avatarImg = this.teamMemberList[i].avatarImageUrl;
msg.name = this.teamMemberList[i].name;
break
}
}
if (msg.type.toLowerCase() == "custom") { if (msg.type.toLowerCase() == "custom") {
content = JSON.parse(msg.content); content = JSON.parse(msg.content);
text = content.content; text = content.content;
// 系统消息:消息由于违规未发送成功(可以不处理) if (content.bizType == -1) { // 系统消息:消息由于违规未发送成功(可以不处理)
if (content.bizType == -1) {
showType = -1; showType = -1;
text = content.content; text = content.content;
} else if (content.bizType == 18) { } else if (content.bizType == 18) { // PDF
showType = 3; showType = 3;
text = content.name; text = content.name;
size = content.size; size = content.size;
url = content.url; url = content.url;
} else if (content.bizType == 19) { } else if (content.bizType == 19) { // 链接
showType = 4; showType = 4;
text = content.content; text = content.content;
suffix = content.suffix; suffix = content.suffix;
} else { } else {
showType = 5; showType = 5;
} }
} else if ( } else if( msg.type.toLowerCase() == "image" || msg.type.toLowerCase() == "picture") { // 图片
msg.type.toLowerCase() == "image" ||
msg.type.toLowerCase() == "picture"
) {
content = JSON.parse(msg.content); content = JSON.parse(msg.content);
url = content.url; url = content.url;
text = content.name; text = content.name;
showType = 2; showType = 2;
this.imgSizeHandleNew(msg, content.w, content.h); this.imgSizeHandleNew(msg, content.w, content.h);
} else { } else {
showType = 1; showType = 1; // 文本
text = msg.content; text = msg.content;
} }
msg.text = text; msg.text = text;
...@@ -567,9 +526,7 @@ export default { ...@@ -567,9 +526,7 @@ export default {
scrollBoxDom.scrollTop = scrollBoxDom.scrollHeight; scrollBoxDom.scrollTop = scrollBoxDom.scrollHeight;
}); });
}, 100); }, 100);
this.currentContinueTimes = this.currentContinueTimes = this.sessionListData.currentTimestamp - this.currentSession.handleStartTime;
this.sessionListData.currentTimestamp -
this.currentSession.handleStartTime;
continueIntervalId && clearInterval(continueIntervalId); continueIntervalId && clearInterval(continueIntervalId);
continueIntervalId = setInterval(() => { continueIntervalId = setInterval(() => {
this.currentContinueTimes += 1000; this.currentContinueTimes += 1000;
...@@ -658,115 +615,6 @@ export default { ...@@ -658,115 +615,6 @@ export default {
window.open(item.url, "__blank"); window.open(item.url, "__blank");
}, },
// 获取会话列表
getSessionList() {
this.GET("/im/session/kf/list").then(res => {
if (res.code === "000000") {
this.sessionListData = res.data || {
currentTimestamp: 0,
myTaskCount: 0,
sessionList: [],
waitingTaskCount: 0
};
let sLength = this.sessionListData.sessionList.length;
let cIndex = sLength - 1;
// if (!this.isFromAssignTask) {
// this.SET_IS_FROM_ASSIGN_TASK(false);
// cIndex = 0;
// }
// 第一次进入页面
if (sLength && !this.currentTaskLogId) {
// this.currentSession = this.sessionListData.sessionList[0];
// this.currentSessionIndex = 0;
this.currentSession = this.sessionListData.sessionList[cIndex];
this.currentSessionIndex = cIndex;
this.sendText = cacheMap[this.currentSession.id];
this.currentTaskLogId = this.currentSession.taskLogId;
this.currentToAccId = this.currentSession.toAccId;
this.getDoctorInfo(this.currentToAccId);
this.getMSGHistory(this.currentSession);
this.readAllMsg();
// 如果是点击“再来一个”或“给我一个任务吧”按钮分配的任务,则要滚动到最后
// if (this.isFromAssignTask) {
// this.$nextTick(() => {
// let element = this.getElmByID("sessionListId");
// if (element) {
// element.scrollTop = element.scrollHeight;
// }
// });
// }
}
if (sLength) {
//this.convertSessions(this.sessionListData.sessionList);
this.$forceUpdate();
}
} else {
this.$message({
message: res.message,
type: "error"
});
}
});
},
// 将会话列表的数据进行处理,主要是显示文本(text)字段
// convertSessions(sessions) {
// let convertSessionList = [];
// let text = "",
// cc;
// sessions.forEach((session, index) => {
// if (session.lastMsgType.toLowerCase() == "custom") {
// cc = JSON.parse(session.lastMsgContent);
// text = cc.suffix || cc.content || cc.title || cc.name;
// } else if (
// session.lastMsgType.toLowerCase() == "image" ||
// session.lastMsgType.toLowerCase() == "picture"
// ) {
// text = "[图片]";
// } else {
// text = session.lastMsgContent;
// }
// session.text = text;
// convertSessionList.push(session);
// });
// this.sessionListData.sessionList = convertSessionList;
// },
// 根据云信id获取医生信息
getDoctorInfo(accId) {
this.GET(`/im/account/accid/doctorinfo?accId=${accId}`).then(res => {
if (res.code === "000000") {
this.doctorInfo = res.data || {};
} else {
this.$message({
message: res.message,
type: "error"
});
}
});
},
// 设置全部消息已读
readAllMsg() {
let fromAccount = this.currentToAccId,
toAccount = this.picakfAccId;
let params = {
fromAccount,
toAccount
};
this.POST(`/im/msg/read/all`, params).then(res => {
if (res.code === "000000") {
this.currentSession.unreadCount = 0;
} else {
this.$message({
message: res.message,
type: "error"
});
}
});
},
// 根据字段名及其值,从数组中查找对象 // 根据字段名及其值,从数组中查找对象
findItemByKeyAndVal(arr, key, value, flag = 0) { findItemByKeyAndVal(arr, key, value, flag = 0) {
if (flag == 0) { if (flag == 0) {
...@@ -895,12 +743,10 @@ export default { ...@@ -895,12 +743,10 @@ export default {
forwardMsgIntervalId && clearInterval(forwardMsgIntervalId); forwardMsgIntervalId && clearInterval(forwardMsgIntervalId);
let sendId = new Date().getTime(); let sendId = new Date().getTime();
this.handleSendMsg(params, sendId); this.handleSendMsg(params, sendId);
// console.log("sendMsgParams", params); await this.POST("/im/team/message/sendMessage", params)
await this.POST("/im/msg/sendMessage", params)
.then(res => { .then(res => {
if (res.code === "000000") { if (res.code === "000000") {
// 校验结果:1校验通过 2校验不通过 // 校验结果:1校验通过 2校验不通过
// console.log(res.data.checkFlag);
let msg = this.messageList[this.messageList.length - 1]; let msg = this.messageList[this.messageList.length - 1];
if (msg.sendId !== sendId) { if (msg.sendId !== sendId) {
msg = this.getMsgBySendId(sendId); msg = this.getMsgBySendId(sendId);
...@@ -961,7 +807,6 @@ export default { ...@@ -961,7 +807,6 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
sessionIntervalId && clearInterval(sessionIntervalId);
forwardMsgIntervalId && clearInterval(forwardMsgIntervalId); forwardMsgIntervalId && clearInterval(forwardMsgIntervalId);
autoCompletionIntervalId && clearInterval(autoCompletionIntervalId); autoCompletionIntervalId && clearInterval(autoCompletionIntervalId);
} }
......
...@@ -311,7 +311,7 @@ export default { ...@@ -311,7 +311,7 @@ export default {
}, },
// 发送消息 // 发送消息
sendMessage(row) { sendMessage(row) {
this.$router.push('/diagnosis-im') this.$router.push({path: '/diagnosis-im', query: {tid: row.imTeamId}})
}, },
// 选择 // 选择
selectBtn(row) { selectBtn(row) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册