群组聊天的基础功能,nvue
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
import store from '@/store'
|
||||
import {
|
||||
request
|
||||
} from '../index'
|
||||
|
||||
} from '../index'
|
||||
|
||||
// 获取好友列表
|
||||
const getFriends = () => {
|
||||
return request({
|
||||
@@ -92,62 +92,17 @@ const pedingFriend = (recipient) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 好友申请数量
|
||||
*/
|
||||
const getPendingCount = () => {
|
||||
// 以下是群组相关业务的接口
|
||||
const getMyGroups = () => {
|
||||
return request({
|
||||
url: 'im/friends/pending/count'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传聊天附件
|
||||
* 图片
|
||||
* 语音
|
||||
* 视频
|
||||
*/
|
||||
// 基础配置
|
||||
const config = {
|
||||
apiUrl: 'http://api.zh.shangkelian.cn/api/', // 正式环境
|
||||
timeout: 60000
|
||||
}
|
||||
|
||||
const uploadMessageFile = (file, type) => {
|
||||
config.header = {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': store.getters.getToken || ''
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: config.apiUrl + 'im/upload',
|
||||
filePath: file,
|
||||
name: 'upload',
|
||||
formData: {
|
||||
type
|
||||
},
|
||||
header: config.header || {},
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
let updData = JSON.parse(res.data)
|
||||
if (updData.status_code === 200) {
|
||||
resolve(updData.data)
|
||||
} else {
|
||||
reject(updData)
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('ERR', err);
|
||||
}
|
||||
})
|
||||
url: 'im/groups'
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
getImToken,
|
||||
deleteFriend,
|
||||
getFriends,
|
||||
getFriends,
|
||||
getFriendsLetter,
|
||||
getUserInfo,
|
||||
getFriendInfo,
|
||||
@@ -156,6 +111,5 @@ export {
|
||||
rejectFriend,
|
||||
searchFriend,
|
||||
pedingFriend,
|
||||
getPendingCount,
|
||||
uploadMessageFile
|
||||
getMyGroups
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user