jiuyiUniapp/jiuyi2/pages/news/group/invite.vue

102 lines
2.1 KiB
Vue

<script setup>
// 邀请加群
// 腾讯云聊天
import TencentCloudChat from '@tencentcloud/chat';
import {
ref,
reactive,
nextTick,
onUnmounted,
onMounted,
computed,
getCurrentInstance,
watch,
} from 'vue'
// api
import api from '@/api/index.js'
// 工具库
import util from '@/common/js/util.js'
import {
onLoad,
onReady,
onPageScroll,
onUnload
} from "@dcloudio/uni-app"
// 群组id
const groupId = ref('')
// 好友列表
const friendList = reactive([])
// 群聊成员列表
const groupMember = reactive([])
// 群成员列表
const memberList = reactive([])
onLoad((option) => {
if (option.groupId) groupId.value = option.groupId
// 获取好友列表
getFriendList()
})
// 获取好友列表
function getFriendList() {
//
api.news.getFriendList().then(rs => {
if (rs.code == 200) {
const result = rs.data
friendList.length = 0
friendList.push(...result)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 获取群成员列表
* https://web.sdk.qcloud.com/im/doc/v3/zh-cn/SDK.html#getGroupMemberList
*/
function getGroupMemberList() {
uni.$chat.getGroupMemberList({
groupID: groupId.value,
count: 100,
}).then(function(rs) {
memberList.length = 0
memberList.push(...rs.data.memberList)
})
}
</script>
<template>
<view class="appbw">
<view class="list pb30">
<view class="item rows mlr20" v-for="(item, index) in friendList" :key="item.userId" :id="item.userId">
<view class="checkBox">
<template>
<uni-icons type="circle" size="40rpx" color="#999" />
</template>
</view>
<view class="child pl30 pr50 f1">
<view class="item rows ptb20">
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
</view>
</view>
</view>
<view class="mtb20 nomore">到底啦~</view>
</view>
<view class="footer plr30 bfff">
<view class="btn colourful">添加</view>
</view>
</view>
</template>
<style>
</style>