群组基础接口

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 {
getImToken,
deleteFriend,
@@ -111,5 +125,7 @@ export {
rejectFriend,
searchFriend,
pedingFriend,
getMyGroups
getMyGroups,
createGroup,
getGroupInfo
}

View File

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

View File

@@ -1,23 +1,48 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
},
onLoad() {
},
methods: {
}
}
</script>
<style>
<template>
<view>
<u--input placeholder="请输入内容" border="surround" v-model="group_name"></u--input>
<u-button type="primary" text="确定" @click="onCreate"></u-button>
</view>
</template>
<script>
import {
createGroup
} from '@/apis/interfaces/im.js'
export default {
data() {
return {
group_name: '',
}
},
onLoad() {
},
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>

View File

@@ -1,33 +1,52 @@
<template>
<view>
<view class="">
</view>
<view>
查看更多群成员
</view>
群聊名称
群公告
<view class="">
置顶
</view>
<view class="">
免打扰
</view>
清空聊天记录
删除并退出
解散群聊
</view>
</template>
<script>
export default {
}
</script>
<style>
<template>
<view>
<view class="">
</view>
<view>
查看更多群成员
</view>
群聊名称
群公告
<view class="">
置顶
</view>
<view class="">
免打扰
</view>
清空聊天记录
删除并退出
解散群聊
</view>
</template>
<script>
import {
getGroupInfo
} from '@/apis/interfaces/im.js'
export default {
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>

View File

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