@@ -268,7 +277,7 @@ export default {
this.$refs.chatSetting.doClose();
} else {
this.firstClick && this.$nextTick(() => {
- this.userRole == 'AUDIENCE' && this.isAudienceInitData();
+ this.isAudienceInitData();
if (this.$refs.tree) {
this.$refs.tree.filter(this.queryMember);
}
@@ -303,7 +312,7 @@ export default {
startConversition(this.group, this.memberIdList).then(resp => {
this.conversitionId = resp.data.id;
this.conversitionMemberList = resp.data.memberList;
- this.messageList = resp.data.messageList;
+ this.messageList = [];
this.userString = '';
this.isConversitionCreator = true;
this.$message.success('创建会话成功!');
@@ -470,7 +479,17 @@ export default {
this.conversitionId = data.id;
this.conversitionMemberList = data.memberList;
this.isConversitionCreator = false;
- this.messageList = data.messageList;
+ this.messageList = [];
+ if (data.messageList && data.messageList) {
+ data.messageList.forEach(message => {
+ const member = this.memberData[message.memberId];
+ message.src = `/audio/${message.audioPath}`;
+ if (member) {
+ message.self = this.$store.state.userId == member.userId;
+ }
+ this.messageList.push(message);
+ });
+ }
},
connectMember(val) {
this.conversitionMemberList.forEach(member => {
@@ -479,19 +498,55 @@ export default {
}
});
},
+ sortByMessageTime(message1, message2) {
+ const time1 = new Date(message1.time).valueOf();
+ const time2 = new Date(message2.time).valueOf();
+ return time1 - time2;
+ },
isAudienceInitData() {
getAllConversition(this.group).then(resp => {
if (resp.data && resp.data.length) {
- let messageList = [];
+ const messageList = [];
resp.data.forEach(conversation => {
- messageList = [...messageList, ...conversation.messageList];
+ if (this.userRole == 'AUDIENCE') {
+ (conversation.messageList || []).forEach(message => {
+ const member = this.memberData[message.memberId];
+ message.src = `/audio/${message.audioPath}`;
+ message.members = conversation.memberList;
+ if (member) {
+ message.self = this.$store.state.userId == member.userId;
+ }
+ messageList.push(message);
+ });
+ } else {
+ const user = this.simulationUsers[this.$store.state.user.id];
+ !conversation.over && conversation.memberList.forEach(member =>{
+ if (member.memberId == user.memberId) {
+ this.conversitionMemberList = conversation.memberList;
+ this.conversitionId = conversation.id;
+ this.messageList = [];
+ conversation.messageList.forEach(message => {
+ const member = this.memberData[message.memberId];
+ message.src = `/audio/${message.audioPath}`;
+ if (member) {
+ message.self = this.$store.state.userId == member.userId;
+ }
+ this.messageList.push(message);
+ });
+ }
+ });
+ }
});
+ this.messageList = messageList.sort(this.sortByMessageTime);
}
});
this.conversitionMemberList = [];
this.$store.state.training.memberList.forEach(item =>{
this.conversitionMemberList.push({memberId: item.id, connect:true });
});
+ },
+ changeMessageList(data) {
+ this.messageList.push(data);
}
}
};
diff --git a/src/views/newMap/jointTrainingNew/newChatView/chatContent.vue b/src/views/newMap/jointTrainingNew/newChatView/chatContent.vue
index 29187bc07..04b43dfc6 100644
--- a/src/views/newMap/jointTrainingNew/newChatView/chatContent.vue
+++ b/src/views/newMap/jointTrainingNew/newChatView/chatContent.vue
@@ -5,15 +5,15 @@
- {{ covertName(chatContent.targetUser,true) }}
+ {{ covertName(chatContent,true) }}
- {{ chatContent.message }}
+ {{ chatContent.content }}
@@ -39,6 +39,14 @@ export default {
conversitionId: {
type: String,
required: true
+ },
+ conversitionMemberList: {
+ type: Array,
+ required: true
+ },
+ simulationUsers: {
+ type: Object,
+ required: true
}
},
data() {
@@ -54,10 +62,15 @@ export default {
watch:{
'$store.state.socket.conversationInfo':function (val, old) { // 仿真聊天
const conversationInfo = this.$store.state.socket.conversationInfo;
+ const member = this.$store.state.training.memberData[val.message.memberId];
+ conversationInfo.message.src = `/audio/${conversationInfo.message.audioPath}`;
+ if (member) {
+ conversationInfo.message.self = this.$store.state.userId == member.userId;
+ }
if (this.conversitionId == val.id) {
- this.chatContentList.push(conversationInfo);
- if (simulationText.userId != this.$store.state.user.id) {
- this.currentAudioList.push(this.baseUrl + conversationInfo.src);
+ this.$emit('changeMessageList', conversationInfo.message);
+ if (member && member.userId != this.$store.state.user.id) {
+ this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) {
this.isPlay = true;
this.playAllAudio();
@@ -65,9 +78,9 @@ export default {
}
this.scrollTop();
} else if (this.userRole === 'AUDIENCE') {
- this.messageList.push(conversationInfo.data);
- if (simulationText.userId != this.$store.state.user.id) {
- this.currentAudioList.push(this.baseUrl + conversationInfo.src);
+ this.$emit('changeMessageList', conversationInfo.message);
+ if (member && member.userId != this.$store.state.user.id) {
+ this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) {
this.isPlay = true;
this.playAllAudio();
@@ -109,9 +122,9 @@ export default {
document.querySelector('.chatcontentIn').scrollTop = scrollTop;
});
},
- formatTime(time) {
- return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
- },
+ // formatTime(time) {
+ // return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
+ // },
playAllAudio() {
this.playEachAudio(this.currentAudioList[this.currentAudioIndex]);
},
@@ -132,41 +145,29 @@ export default {
});
},
covertName(data, status) {
- if (data != 'All') {
- if (data instanceof Array) {
- let result = '';
- data.forEach(each=>{
- result += this.covertEachName(each, status);
- });
- return result;
- } else {
- return this.covertEachName(data, status);
- }
+ if (status) {
+ let result = '';
+ const members = data.members || this.conversitionMemberList;
+ (members || []).forEach(member => {
+ if (member.memberId != data.memberId) {
+ result += ('@' + this.covertEachName(member.memberId));
+ }
+ });
+ return result;
} else {
- return '@All';
+ return this.covertEachName(data.memberId);
}
},
- covertEachName(data, status) {
- const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
- roleTypeList.forEach(function(element) {
- const rolename = element.value;
- if (Cookies.get('user_lang') == 'en') {
- if (rolename == data.role) {
- data.role = element.enLabel;
- }
- } else {
- if (rolename == data.role) {
- data.role = element.label;
- }
- }
- });
- const deviceName = data.deviceName ? '-' + data.deviceName : '';
- const memberName = data.name ? '-' + data.name : '';
- if (status) {
- return '@' + data.role + deviceName + memberName;
- } else {
- return data.role + deviceName + memberName;
+ covertEachName(memberId) {
+ let name = '';
+ const member = this.$store.state.training.memberData[memberId];
+ if (member && member.userId) {
+ const user = this.simulationUsers[member.userId];
+ name = member.label + '(' + user.nickName + ')';
+ } else if (member) {
+ name = member.label;
}
+ return name;
},
playAudio(audioUrl) {
document.querySelector('#audioPlay').src = audioUrl;
diff --git a/src/views/studentManage/index.vue b/src/views/studentManage/index.vue
index 90ea21845..67ae2fad0 100644
--- a/src/views/studentManage/index.vue
+++ b/src/views/studentManage/index.vue
@@ -331,30 +331,30 @@ export default {
item.scores.forEach(elem => {
if (elem.prdType === '01') {
this.showLocal = true;
- localExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
- localLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
+ localExamSocreRadio = elem.examSocreRadio * 60 / item.scores.length;
+ localLessonPassRate = elem.lessonPassRate * 30 / item.scores.length;
totolScore += localExamSocreRadio * 100;
totolScore += localLessonPassRate * 100;
} else if (elem.prdType === '02') {
this.showCenter = true;
- centerExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
- centerLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
+ centerExamSocreRadio = elem.examSocreRadio * 60 / item.scores.length;
+ centerLessonPassRate = elem.lessonPassRate * 30 / item.scores.length;
totolScore += centerExamSocreRadio * 100;
totolScore += centerLessonPassRate * 100;
}
});
- totolScore += item.attendance * 100 * 10 / 100 * 100;
+ totolScore += item.attendance * 100 * 10;
this.tableData.push(
{
index: index + 1,
name: item.name,
studentID: item.studentID,
- attendance: item.attendance * 100 * 10 / 100,
- localExamSocreRadio:localExamSocreRadio,
- localLessonPassRate: localLessonPassRate,
- centerExamSocreRadio: centerExamSocreRadio,
- centerLessonPassRate: centerLessonPassRate,
- totolScore: totolScore / 100
+ attendance: Math.round(item.attendance * 10) / 10,
+ localExamSocreRadio: Math.round(localExamSocreRadio * 10) / 10,
+ localLessonPassRate: Math.round(localLessonPassRate * 10) / 10,
+ centerExamSocreRadio: Math.round(centerExamSocreRadio * 10) / 10,
+ centerLessonPassRate: Math.round(centerLessonPassRate * 10) / 10,
+ totolScore: Math.round(totolScore) / 100
});
});
}).catch(() =>{