This commit is contained in:
2022-02-22 16:51:20 +08:00
13 changed files with 178 additions and 101 deletions

View File

@@ -160,7 +160,7 @@ const deleteGroupAnnouncement = (groupId, announcementId) => {
const topGroupAnnouncement = (groupId, announcementId) => {
return request({
method: 'POST',
url: 'im/groups/' + groupId + '/announcements/' + announcementId+'/top',
url: 'im/groups/' + groupId + '/announcements/' + announcementId + '/top',
})
}
@@ -241,12 +241,13 @@ const removeGroupUser = (groupId, userId) => {
/**
* 邀请群成员
*/
const inviteGroupUser = (groupId, userIds) => {
const inviteGroupUser = (groupId, userIds, allowIds) => {
return request({
method: 'POST',
url: 'im/groups/' + groupId + '/invite',
data: {
userIds
userIds: userIds,
allowIds: allowIds
}
})
}
@@ -283,10 +284,10 @@ const transferGroupOwner = (groupId, userId) => {
// 通过审核验证群成员
const groupMakeSure = (groupId,user) => {
const groupMakeSure = (groupId, user) => {
return request({
url:`im/groups/${groupId}/makesure/${user}`,
method:'POST'
url: `im/groups/${groupId}/makesure/${user}`,
method: 'POST'
})
}

View File

@@ -11,7 +11,7 @@
</view>
<view class="name">{{ item.name }}</view>
</view>
<view class="user" v-if="isAdmin">
<view class="user" v-if="canInvite">
<u-avatar @click="inviteUser" :size="avatarSize" shape="square" icon="plus" bgColor="#f9f9f9"
color="#c7c7c7" />
<view class="name">邀请好友</view>
@@ -55,6 +55,7 @@
users: [],
isOwner: false,
isAdmin: false,
canInvite:false,// 是否可以开启邀请
adminUid: 0,
members: 0,
actionShow: false,
@@ -63,6 +64,8 @@
currentUser: {},
avatarSize: 45,
labelSize: 14,
iconSize: 14
}
},
computed: {
@@ -73,13 +76,14 @@
}
},
created() {
this.avatarSize = utils.rpx2px(84)
this.avatarSize = utils.rpx2px(90)
this.labelSize = utils.rpx2px(24)
this.iconSize = utils.rpx2px(26)
},
mounted() {
this.initGroupInfo()
getGroupUsers(this.targetId, this.count).then(res => {
console.log("res..",res)
this.users = res
res.map(item => {
this.$store.dispatch('updateContact', item)
@@ -93,6 +97,7 @@
this.isAdmin = res.is_admin
this.adminUid = res.user_id
this.members = res.members
this.canInvite = res.can_invite
})
},
initUsers() {

View File

@@ -101,6 +101,7 @@
<style scoped lang="scss">
.send--voice {
.voice {
display: flex;
background: $window-color;
height: 70rpx;
line-height: 70rpx;
@@ -109,7 +110,6 @@
width: 500rpx;
border-radius: 10rpx;
margin-right: 15rpx;
.button {
font-size: 30rpx;
color: #333;
@@ -117,6 +117,7 @@
}
.modal {
display: flex;
background: rgba(0, 0, 0, .6);
position: fixed;
height: 200rpx;
@@ -128,7 +129,6 @@
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
width: 88rpx;
height: 88rpx;

View File

@@ -3,8 +3,8 @@
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
<view class="msg--voice">
<view :class="['voice', isRemote ? 'left': 'right', {'onPlay': onPlay}]" :style="{width: width + 'rpx'}" @click="startPlay">
<image v-if="isRemote" class="icon" src="@/static/icon/audio_green.png" mode="widthFix"></image>
<image v-else class="icon" src="@/static/icon/audio_white.png" mode="widthFix"></image>
<image v-if="isRemote" class="icon" :class="{ 'videoFlicker' : onPlay && msgId == message.messageId }" src="@/static/icon/audio_green.png" mode="widthFix"></image>
<image v-else class="icon" :class="{ 'videoFlicker' : onPlay && msgId == message.messageId }" src="@/static/icon/audio_white.png" mode="widthFix"></image>
<text class="duration">{{ duration }}"</text>
</view>
<u-badge isDot :show="message.content.local =='' && isRemote" />
@@ -33,6 +33,7 @@
return {
onPlay: false,
innerAC: null,
msgId : null
}
},
computed: {
@@ -63,6 +64,11 @@
}
})
},
created() {
console.log(this.message.messageId)
},
methods: {
// 播放语音消息
startPlay() {
@@ -96,9 +102,11 @@
this.innerAC = uni.createInnerAudioContext()
this.innerAC.src = path
this.innerAC.autoplay = false
this.msgId = this.message.messageId
this.innerAC.onCanplay(res => {
this.innerAC.play()
})
this.innerAC.onPlay(res => {
this.onPlay = true
uni.$emit('onVoiceMessagePlay', this.message.messageId)
@@ -110,6 +118,7 @@
this.onPlay = false
this.innerAC.destroy()
this.innerAC = null
this.msgId = null
uni.$emit('onVoiceMessageStop', this.message.messageId)
})
this.innerAC.onError(err => {
@@ -129,6 +138,24 @@
}
</script>
<style>
@keyframes playFlicker{
0%{
opacity: 1;
}
50%{
opacity: .5;
}
100%{
opacity: 1;
}
}
.videoFlicker{
animation: playFlicker 1s infinite;
}
</style>
<style scoped lang="scss">
.name {
font-size: 24rpx;

View File

@@ -12,8 +12,8 @@
</view>
<block v-if="friends.length > 0">
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
<u-index-anchor :text="indexs[fkey]" bgColor="#ededed" height="20" size="12" color="#666"
style="padding:10rpx 30rpx" />
<u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666"
class="anchor" />
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="toFriend(friendItem.targetId)">
<u-avatar class="avatar-img" size="40" shape="square"
@@ -114,6 +114,12 @@
height: 70vh;
}
.anchor {
background-color: #f9f9f9 !important;
padding: 10rpx 30rpx;
border-bottom: none !important;
}
// 好友列表
.friend-flex {
position: relative;
@@ -127,6 +133,8 @@
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
}
.info {
flex: 1;
margin-left: $padding;

View File

@@ -30,8 +30,6 @@
this.targetId = e.targetId
if (e.type) {
this.type = e.type
console.log(this.type)
}
if (e.aId) {
this.aId = e.aId
@@ -46,8 +44,6 @@
})
})
}
},
computed: {
disabled() {

View File

@@ -182,9 +182,10 @@
.item {
background-color: #fff;
padding: $padding $padding + 10;
padding: $padding $padding + 10 10rpx $padding + 10;
border-bottom: $padding solid #f9f9f9;
.user {
display: flex;
flex-direction: row;
@@ -193,6 +194,7 @@
box-sizing: border-box;
font-size: $title-size-m;
color: $text-gray-m;
padding: 10rpx;
.name {
padding-left: 10rpx;
@@ -207,12 +209,14 @@
font-size: $title-size;
color: $text-color;
max-width: 100%;
margin-bottom: $padding;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
line-height: 1.5;
border-bottom: solid 1rpx #F9F9F9;
padding-bottom: 20rpx;
span {
color: #fff;

View File

@@ -144,6 +144,10 @@
im.setNotifyBadge()
}
}
},
onHide() {
// console.log(JSON.stringify(this.$refs))
this.$refs.voice.stopPlay()
}
}
</script>

View File

@@ -98,7 +98,7 @@
font-size: $title-size;
color: $text-gray;
background-color: #fff;
padding: 10rpx $padding $padding $padding;
padding: 10rpx $padding 20rpx $padding;
font-weight: normal;
}
}

View File

@@ -5,8 +5,7 @@
</view>
<u-cell-group class="cells" :border="false">
<u-cell :border="false" class="u-border-bottom" isLink title="群公告"
@click="toAnnouncement" >
<u-cell :border="false" class="u-border-bottom" isLink title="群公告" @click="toAnnouncement">
<view slot="label" class="announcement-label "> {{announcement}} </view>
</u-cell>
<u-cell :border="false" class="u-border-bottom" isLink title="二维码" @click="showGroupQrCode" />
@@ -108,7 +107,7 @@
this.initData()
uni.$on('groupAnnouncementCreated', this.initData)
uni.$on('groupInvitedUser', this.updateUserList)
uni.$on('updateAnnouncement',this.initData)
uni.$on('updateAnnouncement', this.initData)
},
onUnload() {
uni.$off('groupAnnouncementCreated')
@@ -258,8 +257,11 @@
}
return item
})
this.initData()
this.joinType = e.name
this.$nextTick(() => {
this.$refs.userList.initGroupInfo()
this.initData()
})
this.showActions = false
}).catch(err => {
console.log(err);
@@ -341,18 +343,19 @@
.cells {
margin-top: $padding;
background-color: white;
.announcement-label{
.announcement-label {
font-size: $title-size-m + 2;
padding-top: 10rpx;
color: $text-gray-m;
overflow: hidden;
width: 620rpx;
display: inline-block;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:3;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
}

View File

@@ -8,8 +8,8 @@
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#ededed" height="20" size="12"
color="#666" style="padding:10rpx 30rpx" />
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#f9f9f9f" height="20" size="12"
color="#666" style="border:none !important;padding: 10rpx 30rpx;background-color: #f9f9f9 !important;" />
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="addContact(friendItem.targetId)">
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
@@ -102,6 +102,7 @@
})
getGroupUsers(this.targetId).then(res => {
res.map(res => {
console.log(res)
this.checkboxValue.push(String(res.targetId))
this.selectValue.push(String(res.targetId))
})
@@ -122,7 +123,16 @@
},
onInvite() {
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
console.log(this.checkboxValue,'userIds.....')
console.log(this.selectValue,'userIds.....')
let userIds = []
this.checkboxValue.filter(item=>{
if(!utils.inArray(item, this.selectValue)){
userIds.push(item)
}
})
// console.log(userIds)
inviteGroupUser(this.targetId, this.checkboxValue,userIds).then(res => {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',

View File

@@ -4,18 +4,18 @@
<block v-if="pendings.length > 0">
<view class="reviewed-item" v-for="(item, index) in pendings" :key="index">
<u-avatar class="avatar"
:src="JSON.parse(item.latestMessage.extra).portraitUrl || require('@/static/user/cover.png')"
:src="JSON.parse(item.content.extra).portraitUrl || require('@/static/user/cover.png')"
shape="square" size="46" />
<view style="flex:1;" v-if="item.latestMessage.operation == 'GroupPending'">
<view class="nickname">{{ JSON.parse(item.latestMessage.extra).name }} 申请加入群聊</view>
<view> 申请原因{{ item.latestMessage.message }}</view>
<view style="flex:1;" v-if="item.content.operation == 'GroupPending'">
<view class="nickname">{{ JSON.parse(item.content.extra).name }} 申请加入群聊</view>
<view> 申请原因{{ item.content.message }}</view>
</view>
<view style="flex:1;" v-if="item.latestMessage.operation == 'GroupInvite'">
<view style="flex:1;" v-if="item.content.operation == 'GroupInvite'">
<view class="nickname">
<text>{{ contact(item.latestMessage.sourceUserId )}}</text>想邀请<span>{{ JSON.parse(item.latestMessage.extra).name }}</span>加入群聊
<text>{{ contact(item.content.sourceUserId).name }}</text>想邀请<span>{{ JSON.parse(item.content.extra).name }}</span>加入群聊
</view>
</view>
<view class="sure" @click="sure(item.latestMessage.targetUserId,item.latestMessageId)"> 通过 </view>
<view class="sure" @click="sure(item.content.targetUserId,item.messageId)"> 通过 </view>
</view>
</block>
@@ -81,12 +81,27 @@
})
}).catch(err => {
// uni.showToast({
// title: err.message,
// icon: 'none',
// mask: true,
// duration: 2000
// })
RongIMLib.deleteMessagesByIds([latestMessageId], ({
code
}) => {
console.log('code', code)
if (code == 0) {
uni.showToast({
title: err.message,
title:err.message,
icon: 'none',
mask: true,
duration: 2000
})
this.getList()
uni.$emit('groupInvitedUser')
}
})
})
// 直接调用通过或拒绝的接口
}
@@ -138,7 +153,6 @@
}
}
.no-lists {
padding-top: $padding * 5;
display: flex;

View File

@@ -4,7 +4,7 @@
<view class="info-box">
<image src="@/static/user/user_back.png" mode="aspectFill" />
<view class="user-flex">
<image class="cover" @click="$Router.push({ name: 'Setting' })"
<image class="cover" @click="goSetting"
:src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill" />
<view class="user-content">
<block v-if="$store.state.token != ''">
@@ -234,6 +234,11 @@
});
}
},
goSetting(){
if (this.isLogin()) {
this.$Router.push({ name: 'Setting' })
}
},
// 检查登录
isLogin() {
if (this.$store.state.token === '') {