Browse Source

feat(im): 实现学生端聊天功能

- 新增学生端获取好友关系绑定详情、聊天消息列表、发送聊天消息和好友关系列表的接口
- 修改聊天信息页面,支持学生端和员工端的不同接口调用
- 更新消息页面,增加学生端用户信息获取和联系人列表获取的逻辑
master
liutong 10 months ago
parent
commit
b4a5b975ef
  1. 30
      api/apiRoute.js
  2. 37
      pages/common/im_chat_info.vue
  3. 29
      pages/common/my_message.vue

30
api/apiRoute.js

@ -433,6 +433,36 @@ export default {
})
},
//学生端-获取好友关系绑定详情
xy_chatGetChatFriendsInfo(data = {}) {
let url = '/xy/chat/getChatFriendsInfo'
return http.get(url, data).then(res => {
return res;
})
},
//学生端-获取聊天消息列表
xy_chatGetChatMessagesList(data = {}) {
let url = '/xy/chat/getChatMessagesList'
return http.get(url, data).then(res => {
return res;
})
},
//学生端-发送聊天消息
xy_chatSendChatMessages(data = {}) {
let url = '/xy/chat/sendChatMessages'
return http.post(url, data).then(res => {
return res;
})
},
//学生端-好友关系列表
xy_chatGetChatFriendsList(data = {}) {
let url = '/xy/chat/getChatFriendsList'
return http.get(url, data).then(res => {
return res;
})
},

37
pages/common/im_chat_info.vue

@ -200,7 +200,17 @@ export default {
personnel_id: this.chatFriendsInfoParams.personnel_id,//ID
customer_resources_id: this.chatFriendsInfoParams.customer_resources_id,//ID
}
let res = await apiRoute.xs_chatGetChatFriendsInfo(params)
let res
if( this.from_type == 'personnel'){
//
res = await apiRoute.xs_chatGetChatFriendsInfo(params)
}else{
//
res = await apiRoute.xy_chatGetChatFriendsInfo(params)
}
if (res.code != 1){
uni.showToast({
title: res.msg,
@ -253,7 +263,17 @@ export default {
this.tableList = []
}
let res = await apiRoute.xs_chatGetChatMessagesList(data)//
let res
if( this.from_type == 'personnel'){
//
res = await apiRoute.xs_chatGetChatMessagesList(data)//
}else{
//
res = await apiRoute.xy_chatGetChatMessagesList(data)//
}
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
@ -327,7 +347,16 @@ export default {
})
return
}
let res = await apiRoute.xs_chatSendChatMessages(data)
let res
if( this.from_type == 'personnel'){
//
res = await apiRoute.xs_chatSendChatMessages(data)
}else{
//
res = await apiRoute.xy_chatSendChatMessages(data)
}
if (res.code != 1) {
uni.showToast({
title: res.msg,
@ -370,7 +399,7 @@ export default {
this.moreShow = false
},
//
//
uplodeImageRes(resData,extraData){
console.log('上传成功回调',resData,extraData)
//

29
pages/common/my_message.vue

@ -103,11 +103,12 @@ export default {
}else{
//
this.from_type = 'customer'//
await this.getMemberInit()
}
this.getContactList()
},
//
//
async getPersonnelUserInfo(){
let data = {}
let res = await apiRoute.getPersonnelInfo(data);
@ -130,6 +131,20 @@ export default {
this.filteredData.personnel_id = res.data.id
},
//
async getMemberInit() {
let res = await apiRoute.xy_memberInfo({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.member_info = res.data
this.filteredData.customer_resources_id = res.data.id//id
},
//
async getContactList(){
let params = {...this.filteredData}
@ -147,7 +162,17 @@ export default {
this.contactList = []
}
let res = await apiRoute.xs_chatGetChatFriendsList(params)
let res
//1=,2=,3=
if (['1', '2'].includes(String(this.userType))) {
//
res = await apiRoute.xs_chatGetChatFriendsList(params)
}else{
//
res = await apiRoute.xy_chatGetChatFriendsList(params)
}
this.loading = false
this.isReachedBottom = false;

Loading…
Cancel
Save