同步
This commit is contained in:
@@ -69,8 +69,10 @@
|
||||
// 不管是通过还是拒绝,都要把相关的信息清理
|
||||
clearMessages() {
|
||||
RongIMLib.deleteMessages(RongIMLib.ConversationType.SYSTEM, this.message.sourceUserId)
|
||||
this.$emit('success')
|
||||
uni.$emit('onContactNotification')
|
||||
this.$emit('success')
|
||||
uni.$emit('onNewContactConversation', message)
|
||||
uni.$emit('onNewContactFriends', message)
|
||||
uni.$emit('onNewContactPendings', message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
return {
|
||||
users: [],
|
||||
isOwner: false,
|
||||
isAdmin: false,
|
||||
canInvite:false,// 是否可以开启邀请
|
||||
isAdmin: false,
|
||||
canInvite: false, // 是否可以开启邀请
|
||||
adminUid: 0,
|
||||
members: 0,
|
||||
actionShow: false,
|
||||
@@ -82,8 +82,7 @@
|
||||
},
|
||||
mounted() {
|
||||
this.initGroupInfo()
|
||||
getGroupUsers(this.targetId, this.count).then(res => {
|
||||
console.log("res..",res)
|
||||
getGroupUsers(this.targetId, this.count).then(res => {
|
||||
this.users = res
|
||||
res.map(item => {
|
||||
this.$store.dispatch('updateContact', item)
|
||||
@@ -96,7 +95,7 @@
|
||||
this.isOwner = res.is_owner
|
||||
this.isAdmin = res.is_admin
|
||||
this.adminUid = res.user_id
|
||||
this.members = res.members
|
||||
this.members = res.members
|
||||
this.canInvite = res.can_invite
|
||||
})
|
||||
},
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="header">
|
||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
|
||||
class='qun'>[群]</text></view>
|
||||
<view class="name">
|
||||
{{ contact(item.targetId).name }}
|
||||
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||
</view>
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
</view>
|
||||
<message-preview class="preview" :msg="item.latestMessage" :draft="item.draft"
|
||||
@@ -80,10 +82,8 @@
|
||||
.name {
|
||||
font-size: $title-size + 2;
|
||||
color: #454545;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.qun {
|
||||
.group {
|
||||
color: $main-color;
|
||||
font-size: $title-size-m - 4;
|
||||
margin-left: 4px;
|
||||
|
||||
@@ -45,44 +45,28 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
previewImage() {
|
||||
if (this.content.local) {
|
||||
uni.previewImage({
|
||||
urls: [
|
||||
this.content.local
|
||||
],
|
||||
success: (e) => {
|
||||
console.log(e);
|
||||
},
|
||||
fail: (er) => {
|
||||
console.log(er);
|
||||
}
|
||||
})
|
||||
methods: {
|
||||
showImage(path) {
|
||||
uni.previewImage({
|
||||
urls: [
|
||||
path
|
||||
]
|
||||
})
|
||||
},
|
||||
previewImage() {
|
||||
if (this.content.local && this.content.local.indexOf('///data/user/') < 0) {
|
||||
this.showImage(this.content.local)
|
||||
} else {
|
||||
RongIMLib.downloadMediaMessage(this.messageId, {
|
||||
RongIMLib.downloadMediaMessage(this.message.messageId, {
|
||||
success: (path) => {
|
||||
this.content.local = path
|
||||
uni.previewImage({
|
||||
urls: [
|
||||
path
|
||||
],
|
||||
success: (e) => {
|
||||
console.log(e);
|
||||
},
|
||||
fail: (er) => {
|
||||
console.log(er);
|
||||
}
|
||||
this.showImage(path)
|
||||
},
|
||||
error: (errorCode, messageId) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: errorCode
|
||||
})
|
||||
},
|
||||
progress: (progress, messageId) => {
|
||||
console.log('progress', progress);
|
||||
},
|
||||
cancel: (messageId) => {
|
||||
console.log('cancel', messageId);
|
||||
},
|
||||
error: (errorCode, messageId) => {
|
||||
console.log('errorCode', errorCode);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -75,11 +75,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
created() {
|
||||
console.log(this.message.messageId)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 播放语音消息
|
||||
startPlay() {
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("onContactNotification")
|
||||
uni.$off("onContactNotification")
|
||||
},
|
||||
methods: {
|
||||
getFriendList() {
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
getFriendInfo(e.targetId).then(res => {
|
||||
console.log(res, "获取朋友的信息")
|
||||
this.userInfo = res
|
||||
// 获取到用户信息之后,去检查一下要不要更新
|
||||
this.$store.dispatch('updateContact', res)
|
||||
@@ -148,7 +147,7 @@
|
||||
})
|
||||
},
|
||||
toPrivate() {
|
||||
uni.redirectTo({
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/chat?targetId=' + this.targetId
|
||||
});
|
||||
},
|
||||
@@ -228,8 +227,9 @@
|
||||
})
|
||||
},
|
||||
singleCall(e) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type + '&isCall=true'
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type +
|
||||
'&isCall=true'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,13 @@
|
||||
},
|
||||
onShow() {
|
||||
this.getPendingList()
|
||||
uni.$on('onContactNotification', this.getPendingList)
|
||||
uni.$on('onNewContactPendings', this.getPendingList)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('onNewContactPendings')
|
||||
},
|
||||
methods: {
|
||||
getPendingList() {
|
||||
getPendingList() {
|
||||
im.getPendingList((pendings) => {
|
||||
console.log(pendings,'res......')
|
||||
if (pendings.length > 0) {
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
createGroupAnnouncement,
|
||||
getGroupAnnouncement
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
|
||||
@@ -35,8 +35,12 @@
|
||||
deleteGroupAnnouncement,
|
||||
topGroupAnnouncement
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
@@ -54,8 +58,8 @@
|
||||
name: '置顶该公告',
|
||||
disabled: false
|
||||
}],
|
||||
actionTitle: '请选择操作',
|
||||
bg:'#fff'
|
||||
actionTitle: '请选择操作',
|
||||
bg: '#fff'
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -84,11 +88,11 @@
|
||||
methods: {
|
||||
// 获取公告信息
|
||||
initData() {
|
||||
getGroupAnnouncements(this.targetId).then(res => {
|
||||
if(res.length>0){
|
||||
this.bg = '#f9f9f9'
|
||||
}else{
|
||||
this.bg = '#fff'
|
||||
getGroupAnnouncements(this.targetId).then(res => {
|
||||
if (res.length > 0) {
|
||||
this.bg = '#f9f9f9'
|
||||
} else {
|
||||
this.bg = '#fff'
|
||||
}
|
||||
this.announcements = res
|
||||
this.loading = false
|
||||
@@ -183,8 +187,8 @@
|
||||
.item {
|
||||
background-color: #fff;
|
||||
padding: $padding $padding + 10 10rpx $padding + 10;
|
||||
border-bottom: $padding solid #f9f9f9;
|
||||
|
||||
border-bottom: $padding solid #f9f9f9;
|
||||
|
||||
|
||||
.user {
|
||||
display: flex;
|
||||
@@ -193,7 +197,7 @@
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
color: $text-gray-m;
|
||||
padding: 10rpx;
|
||||
|
||||
.name {
|
||||
@@ -214,8 +218,8 @@
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
line-height: 1.5;
|
||||
border-bottom: solid 1rpx #F9F9F9;
|
||||
line-height: 1.5;
|
||||
border-bottom: solid 1rpx #F9F9F9;
|
||||
padding-bottom: 20rpx;
|
||||
|
||||
span {
|
||||
|
||||
@@ -20,8 +20,12 @@
|
||||
joinGroupPre,
|
||||
joinGroup
|
||||
} from '@/apis/interfaces/im.js'
|
||||
|
||||
export default {
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
@@ -45,7 +49,7 @@
|
||||
mask: true,
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
toGroupChat() {
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
import sentMessageBar from '../components/sentMessageBar'
|
||||
import showMessageCell from '../components/showMessageCell'
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
components: {
|
||||
sentMessageBar,
|
||||
showMessageCell
|
||||
@@ -59,11 +63,9 @@
|
||||
})
|
||||
// 获取历史消息列表
|
||||
this.getMessageList()
|
||||
// 监听收到本群的消息,追加消息
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
this.getNewMessage()
|
||||
}
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||
this.getNewMessage()
|
||||
})
|
||||
uni.$on('onReceiptRequest', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
@@ -101,6 +103,7 @@
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('onReceiveMessage_' + this.targetId)
|
||||
uni.$off('onRecallMessage')
|
||||
uni.$off('onReceiptRequest')
|
||||
uni.$off('onReceiptResponse')
|
||||
@@ -164,7 +167,7 @@
|
||||
},
|
||||
onHide() {
|
||||
// console.log(JSON.stringify(this.$refs))
|
||||
this.$refs.voice.stopPlay()
|
||||
// this.$refs.voice.stopPlay()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -64,12 +64,16 @@
|
||||
uploads
|
||||
} from '@/apis/interfaces/uploading'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import groupUserList from '../components/groupUserList'
|
||||
import groupUserList from '../components/groupUserList'
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
groupUserList
|
||||
},
|
||||
},
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
@@ -133,7 +137,6 @@
|
||||
return item.key == res.join_type
|
||||
})[0].name
|
||||
}).catch(err => {
|
||||
console.log('getGroupInfo ERR', err);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '群不存在'
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
<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="#f9f9f9f" height="20" size="12"
|
||||
color="#666" style="border:none !important;padding: 10rpx 30rpx;background-color: #f9f9f9 !important;" />
|
||||
<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"
|
||||
@@ -44,10 +45,13 @@
|
||||
getGroupUsers
|
||||
} from '@/apis/interfaces/im';
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
searchTxt: '',
|
||||
@@ -80,11 +84,11 @@
|
||||
})
|
||||
return resList
|
||||
})
|
||||
this.indexs = this.orignalIndexs.map((t, i) => {
|
||||
if (this.friends[i].length > 0) {
|
||||
return t
|
||||
}
|
||||
})
|
||||
this.indexs = this.orignalIndexs.map((t, i) => {
|
||||
if (this.friends[i].length > 0) {
|
||||
return t
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.friends = this.orignalFriends
|
||||
this.indexs = this.orignalIndexs
|
||||
@@ -101,7 +105,7 @@
|
||||
this.orignalIndexs = res.indexList
|
||||
})
|
||||
getGroupUsers(this.targetId).then(res => {
|
||||
res.map(res => {
|
||||
res.map(res => {
|
||||
console.log(res)
|
||||
this.checkboxValue.push(String(res.targetId))
|
||||
this.selectValue.push(String(res.targetId))
|
||||
@@ -122,17 +126,17 @@
|
||||
}
|
||||
|
||||
},
|
||||
onInvite() {
|
||||
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)
|
||||
}
|
||||
})
|
||||
onInvite() {
|
||||
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 => {
|
||||
inviteGroupUser(this.targetId, this.checkboxValue, userIds).then(res => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
animationType: 'pop-out',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="reviewed">
|
||||
<block v-if="pendings.length > 0">
|
||||
<view class="reviewed-item" v-for="(item, index) in pendings" :key="index">
|
||||
<u-avatar class="avatar"
|
||||
<u-avatar class="avatar"
|
||||
:src="JSON.parse(item.content.extra).portraitUrl || require('@/static/user/cover.png')"
|
||||
shape="square" size="46" />
|
||||
<view style="flex:1;" v-if="item.content.operation == 'GroupPending'">
|
||||
@@ -34,9 +34,12 @@
|
||||
} from "@/apis/interfaces/im.js"
|
||||
import im from '@/utils/im/message.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
@@ -86,21 +89,21 @@
|
||||
// icon: 'none',
|
||||
// mask: true,
|
||||
// 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')
|
||||
}
|
||||
// })
|
||||
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')
|
||||
}
|
||||
})
|
||||
})
|
||||
// 直接调用通过或拒绝的接口
|
||||
@@ -153,6 +156,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 5;
|
||||
display: flex;
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
|
||||
<script>
|
||||
import groupUserList from '../components/groupUserList'
|
||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
components: {
|
||||
groupUserList
|
||||
},
|
||||
|
||||
@@ -57,24 +57,28 @@
|
||||
// 好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
// 监听新的好友申请
|
||||
uni.$on('onContactNotification', () => {
|
||||
this.checkNewFriendPending()
|
||||
})
|
||||
uni.$on('onNewContactConversation', this.checkNewFriendPending)
|
||||
},
|
||||
onShow() {
|
||||
if (this.$store.state.token !== '') {
|
||||
this.getConversationList()
|
||||
}
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
})
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
this.getConversationList()
|
||||
})
|
||||
// 监听网络状态变化
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
if (status == 0) {
|
||||
this.getConversationList()
|
||||
}
|
||||
})
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏的时候,不监听了,性能可能会好一点
|
||||
uni.$off('onReceiveMessage')
|
||||
uni.$off('onConnectionStatusChange')
|
||||
},
|
||||
methods: {
|
||||
checkNewFriendPending() {
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
} else {
|
||||
IMLib.insertIncomingMessage(1, targetId, targetId, sentStatus, messageContent, sentTime)
|
||||
}
|
||||
uni.$emit('onReceiveMessage', {
|
||||
uni.$emit('onReceiveMessage_' + this.targetId, {
|
||||
targetId: this.targetId
|
||||
})
|
||||
},
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<!-- chat -->
|
||||
<view class="body">
|
||||
<view class="scroll">
|
||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||
<show-message-cell :message="message" />
|
||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||
<show-message-cell :message="message" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -60,6 +60,10 @@
|
||||
})
|
||||
// 获取消息列表
|
||||
this.getMessageList()
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||
this.getNewMessage()
|
||||
})
|
||||
// 监听消息已读状态
|
||||
uni.$on('onReadReceiptReceived', (data) => {
|
||||
if (data.targetId == this.targetId) {
|
||||
@@ -72,25 +76,20 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
// 监听收到新消息,判断是否是当前会话,更新会话内容
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
this.getNewMessage()
|
||||
uni.$on('onRecallMessage', (res) => {
|
||||
if (res.targetId == this.targetId) {
|
||||
this.messages = this.messages.map(item => {
|
||||
if (res.messageId == item.messageId) {
|
||||
return res
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
uni.$on('onRecallMessage', (res) => {
|
||||
if (res.targetId == this.targetId) {
|
||||
this.messages = this.messages.map(item => {
|
||||
if (res.messageId == item.messageId) {
|
||||
return res
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
onUnload() {
|
||||
uni.$off('onReceiveMessage_' + this.targetId)
|
||||
uni.$off('onRecallMessage')
|
||||
uni.$off('onReadReceiptReceived')
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user