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

View File

@@ -143,7 +143,7 @@ const createGroupAnnouncement = (groupId, content) => {
}) })
} }
// 查看该公告详情 // 查看该公告详情
const getGroupAnnouncement = (groupId, announcementId) => { const getGroupAnnouncement = (groupId, announcementId) => {
return request({ return request({
method: 'GET', method: 'GET',
url: 'im/groups/' + groupId + '/announcements/' + announcementId url: 'im/groups/' + groupId + '/announcements/' + announcementId
@@ -157,10 +157,10 @@ const deleteGroupAnnouncement = (groupId, announcementId) => {
}) })
} }
// 置顶群公告 // 置顶群公告
const topGroupAnnouncement = (groupId, announcementId) => { const topGroupAnnouncement = (groupId, announcementId) => {
return request({ return request({
method: 'POST', 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({ return request({
method: 'POST', method: 'POST',
url: 'im/groups/' + groupId + '/invite', url: 'im/groups/' + groupId + '/invite',
data: { data: {
userIds userIds: userIds,
allowIds: allowIds
} }
}) })
} }
@@ -283,10 +284,10 @@ const transferGroupOwner = (groupId, userId) => {
// 通过审核验证群成员 // 通过审核验证群成员
const groupMakeSure = (groupId,user) => { const groupMakeSure = (groupId, user) => {
return request({ return request({
url:`im/groups/${groupId}/makesure/${user}`, url: `im/groups/${groupId}/makesure/${user}`,
method:'POST' method: 'POST'
}) })
} }

View File

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

View File

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

View File

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

View File

@@ -12,8 +12,8 @@
</view> </view>
<block v-if="friends.length > 0"> <block v-if="friends.length > 0">
<u-index-item v-for="(item, fkey) in friends" :key="fkey"> <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" <u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666"
style="padding:10rpx 30rpx" /> class="anchor" />
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex" <view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="toFriend(friendItem.targetId)"> @click="toFriend(friendItem.targetId)">
<u-avatar class="avatar-img" size="40" shape="square" <u-avatar class="avatar-img" size="40" shape="square"
@@ -87,9 +87,9 @@
// 新朋友 // 新朋友
toPending() { toPending() {
// if (this.pendingCount > 0) { // if (this.pendingCount > 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/pending' url: '/pages/im/friends/pending'
}); });
// } else { // } else {
// uni.showToast({ // uni.showToast({
// title: ` 暂无好友申请 ~ `, // title: ` 暂无好友申请 ~ `,
@@ -114,6 +114,12 @@
height: 70vh; height: 70vh;
} }
.anchor {
background-color: #f9f9f9 !important;
padding: 10rpx 30rpx;
border-bottom: none !important;
}
// 好友列表 // 好友列表
.friend-flex { .friend-flex {
position: relative; position: relative;
@@ -127,6 +133,8 @@
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2); box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
} }
.info { .info {
flex: 1; flex: 1;
margin-left: $padding; margin-left: $padding;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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