Commit 552ba942 by zujiaozhang

'修改聊天功能医生助手发送图片与链接展示'

parent 25829ed3
...@@ -3,6 +3,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -3,6 +3,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
doctorId: medtap.getRequest('doctorId'), doctorId: medtap.getRequest('doctorId'),
relationId: '', relationId: '',
userId: '', userId: '',
helperId:'',
doctorName: '', doctorName: '',
doctorProfile: '', doctorProfile: '',
helperName: '', helperName: '',
...@@ -198,6 +199,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -198,6 +199,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
chat.userName = res.content.talkRealtion.username; chat.userName = res.content.talkRealtion.username;
chat.userProfile = res.content.talkRealtion.userProfile; chat.userProfile = res.content.talkRealtion.userProfile;
chat.helperName = res.content.talkRealtion.helperName; chat.helperName = res.content.talkRealtion.helperName;
chat.helperId = res.content.talkRealtion.helperId;
chat.helperProfile = res.content.talkRealtion.helperProfile; chat.helperProfile = res.content.talkRealtion.helperProfile;
$('.doctor_profile').attr('src', chat.doctorProfile); $('.doctor_profile').attr('src', chat.doctorProfile);
$('.doctor_name').html(chat.doctorName); $('.doctor_name').html(chat.doctorName);
...@@ -270,7 +272,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -270,7 +272,7 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
}); });
}); });
}, },
// // 点击图片信息预览图片 // 点击图片信息预览图片
previewImg: function() { previewImg: function() {
$('.chat_list').on('click', '.chat_nopadding img', function(e) { $('.chat_list').on('click', '.chat_nopadding img', function(e) {
console.log(e); console.log(e);
...@@ -429,12 +431,16 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -429,12 +431,16 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
'<p class="chat_from_name">' + '<p class="chat_from_name">' +
chat.helperName + chat.helperName +
'</p>' + '</p>' +
'<div class="chat_message chat_message_from">' + '<div class="chat_message chat_message_from chat_message_helper">' +
chat.record[i].content + chat.record[i].content +
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>'; '</div>';
if(chat.record[i].content.includes('http')){
var html1 = '<a href="'+chat.record[i].content+'">'+chat.record[i].content+'</a>'
$('.chat_list .chat_message_helper').html(html1)
}
} }
} else if (type == 10) { } else if (type == 10) {
var content = JSON.parse(chat.record[i].content); var content = JSON.parse(chat.record[i].content);
...@@ -527,6 +533,29 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -527,6 +533,29 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>'; '</div>';
}else if (chat.record[i].senderId == chat.helperId){
html +=
'<div class="chat_item chat_item_left">' +
'<p class="message_time">' +
chat.record[i].createTime.substring(5, 16) +
'</p>' +
'<div class="chat_info_warp clearfix">' +
'<img src="' +
chat.helperProfile +
'" class="chat_profile from_profile">' +
'<div class="chat_message_warp">' +
'<p class="chat_from_name">' +
chat.helperName +
'</p>' +
'<div class="chat_message chat_message_from chat_nopadding">' +
// 图片消息
'<img src="' +
chat.record[i].contentPic[0] +
'" />' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
} }
} }
} }
...@@ -664,12 +693,16 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -664,12 +693,16 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
'<p class="chat_from_name">' + '<p class="chat_from_name">' +
chat.helperName + chat.helperName +
'</p>' + '</p>' +
'<div class="chat_message chat_message_from">' + '<div class="chat_message chat_message_from chat_message_helper">' +
record[i].content + record[i].content +
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>'; '</div>';
if(record[i].content.includes('http')){
var html1 = '<a href="'+record[i].content+'">'+record[i].content+'</a>'
$('.chat_list .chat_message_helper').html(html1)
}
} }
} else if (type == 10) { } else if (type == 10) {
var content = JSON.parse(chat.record[i].content); var content = JSON.parse(chat.record[i].content);
...@@ -762,6 +795,29 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) { ...@@ -762,6 +795,29 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>'; '</div>';
}else if (record[i].senderId == chat.helperId){
html +=
'<div class="chat_item chat_item_left">' +
'<p class="message_time">' +
record[i].createTime.substring(5, 16) +
'</p>' +
'<div class="chat_info_warp clearfix">' +
'<img src="' +
chat.helperProfile +
'" class="chat_profile from_profile">' +
'<div class="chat_message_warp">' +
/* '<p class="chat_from_name">' +
chat.doctorName +
'医生</p>' + */
'<div class="chat_message chat_message_from chat_nopadding">' +
// 图片消息
'<img src="' +
record[i].contentPic[0] +
'" />' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
} }
} }
} }
......
...@@ -6,6 +6,7 @@ define([ 'zepto', 'medtap' ], function($, medtap) { ...@@ -6,6 +6,7 @@ define([ 'zepto', 'medtap' ], function($, medtap) {
doctorName: '', doctorName: '',
doctorProfile: '', doctorProfile: '',
helperName: '', helperName: '',
helperId: '',
helperProfile: '', helperProfile: '',
userName: '', userName: '',
userProfile: '', userProfile: '',
...@@ -323,6 +324,9 @@ define([ 'zepto', 'medtap' ], function($, medtap) { ...@@ -323,6 +324,9 @@ define([ 'zepto', 'medtap' ], function($, medtap) {
chat.doctorProfile = res.content.talkRealtion.doctorProfile; chat.doctorProfile = res.content.talkRealtion.doctorProfile;
chat.userName = res.content.talkRealtion.username; chat.userName = res.content.talkRealtion.username;
chat.userProfile = res.content.talkRealtion.userProfile; chat.userProfile = res.content.talkRealtion.userProfile;
chat.helperName = res.content.talkRealtion.helperName;
chat.helperId = es.content.talkRealtion.helperId;
chat.helperProfile = res.content.talkRealtion.helperProfile;
$('.doctor_profile').attr('src', chat.doctorProfile); $('.doctor_profile').attr('src', chat.doctorProfile);
$('.doctor_name').html(chat.doctorName); $('.doctor_name').html(chat.doctorName);
$('.doctor_title').html(res.content.talkRealtion.technologyProfessional.value); $('.doctor_title').html(res.content.talkRealtion.technologyProfessional.value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment