...
This commit is contained in:
@@ -38,8 +38,12 @@
|
|||||||
transferGroupOwner
|
transferGroupOwner
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
targetId: {
|
targetId: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -67,13 +71,6 @@
|
|||||||
iconSize: 14
|
iconSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
this.avatarSize = utils.rpx2px(84)
|
this.avatarSize = utils.rpx2px(84)
|
||||||
this.labelSize = utils.rpx2px(24)
|
this.labelSize = utils.rpx2px(24)
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
<view class="message--cell">
|
<view class="message--cell">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
||||||
<!-- <u-avatar :src="item.portraitUrl !== '' ? contact(item.targetId).portraitUrl : require('@/static/user/cover-s.png')" shape="square" :size="avatarSize" /> -->
|
<u-avatar :src="contact(item.targetId).portraitUrl" shape="square" :size="avatarSize" />
|
||||||
<u-avatar :src="require('@/static/user/cover-s.png')" shape="square" :size="avatarSize" />
|
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
{{ contact(item.targetId).name }} {{item.portraitUrl}}
|
{{ contact(item.targetId).name }}
|
||||||
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
@@ -22,8 +21,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import messagePreview from './messagePreview'
|
import messagePreview from './messagePreview'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -32,21 +35,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
avatarRpx: 84
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
avatarSize() {
|
|
||||||
return utils.rpx2px(this.avatarRpx)
|
|
||||||
},
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
messagePreview
|
messagePreview
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,12 @@
|
|||||||
import showText from './show/showText'
|
import showText from './show/showText'
|
||||||
import showCall from './show/showCall'
|
import showCall from './show/showCall'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
components: {
|
components: {
|
||||||
showCall,
|
showCall,
|
||||||
showVoice,
|
showVoice,
|
||||||
@@ -52,21 +56,6 @@
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
avatarRpx: 84
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
avatarSize() {
|
|
||||||
return utils.rpx2px(this.avatarRpx)
|
|
||||||
},
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
toUser(item) {
|
toUser(item) {
|
||||||
if (item.messageDirection == 1) {
|
if (item.messageDirection == 1) {
|
||||||
|
|||||||
@@ -39,8 +39,12 @@
|
|||||||
} from '@/apis/interfaces/im';
|
} from '@/apis/interfaces/im';
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
indexs: [],
|
indexs: [],
|
||||||
|
|||||||
@@ -36,9 +36,11 @@
|
|||||||
topGroupAnnouncement
|
topGroupAnnouncement
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -21,9 +21,11 @@
|
|||||||
joinGroup
|
joinGroup
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -22,9 +22,11 @@
|
|||||||
import showMessageCell from '../components/showMessageCell'
|
import showMessageCell from '../components/showMessageCell'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<block v-if="groups.length > 0">
|
<block v-if="groups.length > 0">
|
||||||
<view class="title"> 群聊 </view>
|
<view class="title"> 群聊 </view>
|
||||||
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
||||||
<u-avatar size="36" shape="square" :src="item.portraitUrl !== ''?contact(item.targetId).portraitUrl :require('@/static/user/cover-s.png')" />
|
<u-avatar size="36" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">{{ item.name }} <span class="total">共{{ item.members }} 成员</span></view>
|
<view class="name">{{ item.name }} <span class="total">共{{ item.members }} 成员</span></view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
<u-cell-group class="cells" v-if="group.is_admin" :border="false">
|
<u-cell-group class="cells" v-if="group.is_admin" :border="false">
|
||||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群聊名称" :value="groupName"
|
<u-cell :border="false" class="u-border-bottom" isLink title="修改群聊名称" :value="groupName"
|
||||||
@click="onGroupName" />
|
@click="onGroupName" />
|
||||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群头像" @click="onGroupAvatar">
|
<!-- <u-cell :border="false" class="u-border-bottom" isLink title="修改群头像" @click="onGroupAvatar">
|
||||||
<u-avatar slot="value" size="25" shape="square" :src="group.cover" />
|
<u-avatar slot="value" size="25" shape="square" :src="group.cover" />
|
||||||
</u-cell>
|
</u-cell> -->
|
||||||
<u-cell :border="false" class="u-border-bottom" isLink v-if="group.is_owner" title="准入方式" :value="joinType" @click="onChangeJoinType" />
|
<u-cell :border="false" class="u-border-bottom" isLink v-if="group.is_owner" title="准入方式" :value="joinType" @click="onChangeJoinType" />
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
|
|
||||||
@@ -58,12 +58,14 @@
|
|||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
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'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
groupUserList
|
groupUserList
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -47,9 +47,11 @@
|
|||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
@@ -64,13 +66,6 @@
|
|||||||
selectValue: []
|
selectValue: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
this.getFriendList()
|
this.getFriendList()
|
||||||
|
|||||||
@@ -35,9 +35,11 @@
|
|||||||
import im from '@/utils/im/message.js'
|
import im from '@/utils/im/message.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
import onGroupDismiss from '@/utils/im/onGroupDismiss.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
|
imBase,
|
||||||
onGroupDismiss
|
onGroupDismiss
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
<view class="custom-header">
|
<view class="custom-header">
|
||||||
<view class="header-flex">
|
<view class="header-flex">
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<view class="item" @click="tabsClick('all')" :class="activeId === 'all'?'active':''">全部</view>
|
<view class="item active">聊聊</view>
|
||||||
<view class="item" @click="tabsClick('self')" :class="activeId === 'self'?'active':''">私聊</view>
|
|
||||||
<view class="item" @click="tabsClick('group')" :class="activeId === 'group'?'active':''">群聊</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<view class="item" @click="scanQrCode">
|
<view class="item" @click="scanQrCode">
|
||||||
@@ -48,8 +46,7 @@
|
|||||||
return {
|
return {
|
||||||
conversations: [], // 会话列表
|
conversations: [], // 会话列表
|
||||||
connection: 0,
|
connection: 0,
|
||||||
hasNewFriends: 0,
|
hasNewFriends: 0
|
||||||
activeId:'all',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -57,7 +54,6 @@
|
|||||||
connectionStatus
|
connectionStatus
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
// 监听新的好友申请
|
// 监听新的好友申请
|
||||||
uni.$on('onNewContactConversation', () => {
|
uni.$on('onNewContactConversation', () => {
|
||||||
console.log('更新好友申请数量');
|
console.log('更新好友申请数量');
|
||||||
@@ -89,10 +85,6 @@
|
|||||||
uni.$off('onConnectionStatusChange')
|
uni.$off('onConnectionStatusChange')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 切换聊天模式
|
|
||||||
tabsClick(type){
|
|
||||||
this.activeId = type
|
|
||||||
},
|
|
||||||
checkNewFriendPending() {
|
checkNewFriendPending() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
this.hasNewFriends = pendings.length
|
this.hasNewFriends = pendings.length
|
||||||
@@ -107,17 +99,15 @@
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
// 获取私聊的会话列表
|
// 获取会话列表,最新的一千条
|
||||||
getConversationList() {
|
getConversationList() {
|
||||||
const count = 1000
|
const count = 200
|
||||||
const timestamp = 0
|
const timestamp = 0
|
||||||
RongIMLib.getConversationList([1, 3], count, timestamp, ({
|
RongIMLib.getConversationList([1, 3], count, timestamp, ({
|
||||||
code,
|
code,
|
||||||
conversations
|
conversations
|
||||||
}) => {
|
}) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
console.log(conversations)
|
|
||||||
console.log("item.conversationType === 3............")
|
|
||||||
this.conversations = conversations
|
this.conversations = conversations
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,8 +18,12 @@
|
|||||||
import sentMessageBar from '../components/sentMessageBar'
|
import sentMessageBar from '../components/sentMessageBar'
|
||||||
import showMessageCell from '../components/showMessageCell'
|
import showMessageCell from '../components/showMessageCell'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '@/utils/im/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
components: {
|
components: {
|
||||||
sentMessageBar,
|
sentMessageBar,
|
||||||
showMessageCell
|
showMessageCell
|
||||||
@@ -45,11 +49,6 @@
|
|||||||
sentTime: 0
|
sentTime: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
|||||||
24
utils/im/imBase.js
Normal file
24
utils/im/imBase.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
|
const imBase = {
|
||||||
|
onLoad() {
|
||||||
|
console.log('IM BASE MININX');
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
contact() {
|
||||||
|
return function(targetId) {
|
||||||
|
return this.$store.getters.contactInfo(targetId)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
avatarSize() {
|
||||||
|
return utils.rpx2px(84)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default imBase
|
||||||
Reference in New Issue
Block a user