群组基础接口

This commit is contained in:
2022-02-10 18:00:22 +08:00
parent 8656ddef55
commit b9364be40b
5 changed files with 116 additions and 57 deletions

View File

@@ -99,6 +99,20 @@ const getMyGroups = () => {
}) })
} }
const getGroupInfo = (groupId) => {
return request({
url: 'im/groups/' + groupId
})
}
const createGroup = (data) => {
return request({
method: 'POST',
url: 'im/groups',
data: data
})
}
export { export {
getImToken, getImToken,
deleteFriend, deleteFriend,
@@ -111,5 +125,7 @@ export {
rejectFriend, rejectFriend,
searchFriend, searchFriend,
pedingFriend, pedingFriend,
getMyGroups getMyGroups,
createGroup,
getGroupInfo
} }

View File

@@ -68,7 +68,7 @@
}, },
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/group/info' url: '/pages/im/group/info?targetId=' + this.targetId
}) })
}, },
methods: { methods: {

View File

@@ -1,23 +1,48 @@
<template> <template>
<view> <view>
<u--input placeholder="请输入内容" border="surround" v-model="group_name"></u--input>
</view>
</template> <u-button type="primary" text="确定" @click="onCreate"></u-button>
</view>
<script> </template>
export default {
data() { <script>
import {
}, createGroup
onLoad() { } from '@/apis/interfaces/im.js'
}, export default {
methods: { data() {
return {
} group_name: '',
} }
</script> },
onLoad() {
<style>
},
methods: {
onCreate() {
console.log('阿斯利康');
createGroup({
name: this.group_name
}).then(res => {
console.log(res);
uni.showToast({
title: '创建成功'
})
uni.navigateBack()
}).catch(err => {
console.log(err);
uni.showToast({
icon: 'none',
title: err
})
})
}
}
}
</script>
<style>
</style> </style>

View File

@@ -1,33 +1,52 @@
<template> <template>
<view> <view>
<view class=""> <view class="">
</view> </view>
<view> <view>
查看更多群成员 查看更多群成员
</view> </view>
群聊名称 群聊名称
群公告 群公告
<view class=""> <view class="">
置顶 置顶
</view> </view>
<view class=""> <view class="">
免打扰 免打扰
</view> </view>
清空聊天记录 清空聊天记录
删除并退出 删除并退出
解散群聊 解散群聊
</view> </view>
</template> </template>
<script> <script>
export default { import {
getGroupInfo
} } from '@/apis/interfaces/im.js'
</script>
export default {
<style> data() {
return {
targetId: '',
group: {},
members: []
}
},
onLoad(e) {
this.targetId = e.targetId
getGroupInfo(this.targetId).then(res => {
this.info = res.group
this.members = res.members
}).catch(err => {
console.log(err);
})
}
}
</script>
<style>
</style> </style>

View File

@@ -12,7 +12,6 @@ export default {
contactInfo: (state) => (targetId) => { contactInfo: (state) => (targetId) => {
if (state.contacts[targetId]) { if (state.contacts[targetId]) {
const info = state.contacts[targetId] const info = state.contacts[targetId]
console.log(targetId, info);
return { return {
name: info.name, name: info.name,