好友管理的基础流程,1.0.5

This commit is contained in:
2022-01-21 16:30:06 +08:00
parent 21bee49729
commit 80cd737e39
10 changed files with 378 additions and 205 deletions

View File

@@ -5,7 +5,7 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
im.initIm('lmxuhwaglu76d') im.initIm('lmxuhwaglu76d')
return;
//#ifdef APP-PLUS //#ifdef APP-PLUS
// 获取系统版本号 // 获取系统版本号
getVersions({ getVersions({

View File

@@ -1,46 +1,78 @@
/**
/** * Web唐明明
* Web唐明明 * 匆匆数载恍如梦,岁月迢迢华发增。
* 匆匆数载恍如梦,岁月迢迢华发增 * 碌碌无为枉半生,一朝惊醒万事空
* 碌碌无为枉半生,一朝惊醒万事空。 * moduleName: 聊聊
* moduleName: 聊聊 */
*/
import {
import { request } from '../index' request
} from '../index'
// 获取好友列表 // 获取好友列表
const getFriends = () => { const getFriends = () => {
return request({ return request({
url: 'im/friends', url: 'im/friends',
}, true) }, true)
} }
// 获取融云token // 获取融云token
const getImToken = () => { const getImToken = () => {
return request({ return request({
url: 'im/token', url: 'im/token',
}, true) }, true)
} }
// 获取用户信息 // 获取用户信息
const getUserInfo = (targetId) => { const getUserInfo = (targetId) => {
return request({ return request({
url: 'im/userInfo/' + targetId, url: 'im/userInfo/' + targetId,
}) })
} }
/** /**
* 获取好友申请列表 * 获取好友申请列表
*/ */
const getPedings = () => { const getPedings = () => {
return request({ return request({
url: 'im/friends/pending' url: 'im/friends/pending'
}) })
}
const resolveFriend = (targetId) => {
return request({
method: 'POST',
url: 'im/friends/accept/' + targetId
})
}
const rejectFriend = (targetId) => {
return request({
method: 'DELETE',
url: 'im/friends/accept/' + targetId
})
}
const searchFriend = (mobile) => {
return request({
url: 'im/search?mobile=' + mobile
})
}
const pedingFriend = (recipient) => {
return request({
method: 'POST',
url: 'im/friends/' + recipient
})
} }
export { export {
getImToken, getImToken,
getFriends, getFriends,
getUserInfo, getUserInfo,
getPedings getPedings,
resolveFriend,
rejectFriend,
searchFriend,
pedingFriend
} }

View File

@@ -2,8 +2,8 @@
"name" : "ZH-HEALTH", "name" : "ZH-HEALTH",
"appid" : "__UNI__C29473D", "appid" : "__UNI__C29473D",
"description" : "ZH-HEALTH您手上的健康管理专家", "description" : "ZH-HEALTH您手上的健康管理专家",
"versionName" : "1.0.2", "versionName" : "1.0.5",
"versionCode" : 102, "versionCode" : 105,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@@ -364,7 +364,7 @@
"name": "IM", "name": "IM",
"style": { "style": {
"navigationBarTitleText": "聊聊", "navigationBarTitleText": "聊聊",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#F3F6FB",
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"buttons": [ "buttons": [
@@ -392,7 +392,7 @@
"name": "imPrivate", "name": "imPrivate",
"style": { "style": {
"navigationBarTitleText": "聊天", "navigationBarTitleText": "聊天",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#F3F6FB",
"disableScroll": true, "disableScroll": true,
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
@@ -440,8 +440,8 @@
"path": "pages/im/friends/pending", "path": "pages/im/friends/pending",
"name": "imFriendsPending", "name": "imFriendsPending",
"style": { "style": {
"navigationBarTitleText": "新朋友", "navigationBarTitleText": "新朋友",
"navigationBarBackgroundColor":"#FFFFFF" "navigationBarBackgroundColor":"#F3F6FB"
} }
}, },
{ {
@@ -449,7 +449,7 @@
"name": "imFriendsInfo", "name": "imFriendsInfo",
"style": { "style": {
"navigationBarTitleText": "好友资料", "navigationBarTitleText": "好友资料",
"navigationBarBackgroundColor":"#FFFFFF" "navigationBarBackgroundColor":"#F3F6FB"
} }
}, },
{ {

View File

@@ -7,89 +7,69 @@
</view> </view>
<u-line></u-line> <u-line></u-line>
<view class="list__item" @click="showToast"> <view class="list__item" @click="showToast">
<u-avatar size="35" icon="account-fill" fontSize="26" bg-color="#4cd964"></u-avatar> <u-avatar size="35" icon="account-fill" fontSize="26" bg-color="#4cd964"></u-avatar>
<text class="list__item__user-name">我的群聊</text> <text class="list__item__user-name">我的群聊</text>
</view> </view>
<u-line></u-line> <u-line></u-line>
</view> </view>
<block v-if="friendsArr.length > 0"> <block v-if="friends.length > 0">
<u-index-list activeColor="#34CE98"> <u-list height="auto">
<template v-for="(item, index) in friendsArr"> <u-list-item v-for="(item, index) in friends" :key="index">
<!-- #ifdef APP-NVUE --> <u-cell :title="item.name + item.userId" @click="toInfo(item.userId)">
<u-index-anchor bgColor="#F3F6FB" color="#666" :text="indexList[index]" :key="index"></u-index-anchor> <u-avatar slot="icon" shape="square" size="35" :src="item.portraitUrl"></u-avatar>
<!-- #endif --> </u-cell>
<u-index-item :key="index"> </u-list-item>
<!-- #ifndef APP-NVUE --> </u-list>
<u-index-anchor :text="indexList[index]" bgColor="#F3F6FB" color="#666"></u-index-anchor> </block>
<!-- #endif --> <block v-else>
<view class="list" v-for="(item1, index1) in item" :key="index1"> <u-empty class="pages-null" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" text="暂无好友">
<view class="list__item" @click="toInfo(10047)"> </u-empty>
<image class="list__item__avatar" :src="item1.url"></image> </block>
<!-- <u-avatar size="35" icon="chrome-circle-fill" fontSize="26" randomBgColor></u-avatar> -->
<text class="list__item__user-name">{{item1.name}}</text>
</view>
<u-line></u-line>
</view>
</u-index-item>
</template>
<view slot="footer" class="u-safe-area-inset--bottom">
<text class="list__footer">共305位好友</text>
</view>
</u-index-list>
</block>
<block v-else>
<u-empty
class="pages-null"
mode="data"
icon="http://cdn.uviewui.com/uview/empty/data.png"
text="暂未添加好友"
>
</u-empty>
</block>
</view> </view>
</template> </template>
<script> <script>
import { getFriends } from '@/apis/interfaces/im' import {
getFriends
} from '@/apis/interfaces/im'
export default { export default {
data() { data() {
return { return {
friendsArr: [] friends: []
} }
}, },
onShow() { onShow() {
getFriends().then(res => { getFriends().then(res => {
this.friendsArr = res this.friends = res
console.log(res) })
}) },
},
computed: { computed: {
}, },
methods: { methods: {
// 扫码提示 // 扫码提示
showToast(){ showToast() {
uni.showToast({ uni.showToast({
title: "群聊功能暂未开放,敬请期待", title: "群聊功能暂未开放,敬请期待",
icon : "none" icon: "none"
}) })
}, },
// 新朋友 // 新朋友
toPending() { toPending() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/pending' url: '/pages/im/friends/pending'
}) })
}, },
// 用户资料 // 用户资料
toInfo(targetId) { toInfo(targetId) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/info?targeId=' + targetId url: '/pages/im/friends/info?targetId=' + targetId
}) })
} }
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
this.toPending() this.toPending()
} }
} }
</script> </script>
@@ -99,27 +79,30 @@
@include flex; @include flex;
padding: 6px 12px; padding: 6px 12px;
align-items: center; align-items: center;
&__avatar { &__avatar {
height: 35px; height: 35px;
width: 35px; width: 35px;
border-radius: 50%; border-radius: 50%;
} }
&__user-name { &__user-name {
font-size: 16px; font-size: 16px;
margin-left: 10px; margin-left: 10px;
color: $u-main-color; color: $u-main-color;
} }
} }
&__footer { &__footer {
color: $u-tips-color; color: $u-tips-color;
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
margin: 15px 0; margin: 15px 0;
} }
} }
// 页面空 // 页面空
.pages-null{ .pages-null {
height: 70vh; height: 70vh;
} }
</style> </style>

View File

@@ -2,8 +2,8 @@
<view class="content"> <view class="content">
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="user-info"> <view class="user-info">
<u-avatar :src="userInfo.portraitUrl" size="100"></u-avatar> <u-avatar :src="userInfo.portraitUrl" size="100"></u-avatar>
<view class="nickname">{{ userInfo.name }}</view> <view class="nickname">{{ userInfo.name }}</view>
<!-- <view class="sex"> <!-- <view class="sex">
<u-tag text="男" color="#fff" borderColor="#5db6ee" size="mini" icon="man" bgColor="#5db6ee"></u-tag> <u-tag text="男" color="#fff" borderColor="#5db6ee" size="mini" icon="man" bgColor="#5db6ee"></u-tag>
@@ -40,9 +40,10 @@
}, },
onLoad(e) { onLoad(e) {
this.targetId = e.targetId this.targetId = e.targetId
console.log('获取资料',e.targetId);
getUserInfo(e.targetId).then(res => { getUserInfo(e.targetId).then(res => {
this.userInfo = res this.userInfo = res
console.log('获取资料', res);
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.name title: res.name
}) })
@@ -50,7 +51,7 @@
}, },
methods: { methods: {
toPrivate() { toPrivate() {
uni.navigateTo({ uni.redirectTo({
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
}) })
} }

View File

@@ -1,69 +1,119 @@
<template> <template>
<view> <view>
<!-- 搜索 --> <!-- 搜索 -->
<view class="header-search"> <u-sticky>
<u-search placeholder="输入手机号码搜索" v-model="searchValue"></u-search> <view class="header-search">
</view> <u-search placeholder="输入手机号码搜索" bgColor="white" @custom="search" @search="search"
<!-- 新朋友 --> v-model="searchValue"></u-search>
<view class="lists"> </view>
<view class="lists-item" v-for="(item, index) in 10" :key="index"> </u-sticky>
<image class="lists-item-cover" src="" mode="aspectFill"></image> <u-list height="auto">
<view class="">好友</view> <u-list-item v-for="(item, index) in searchResult" :key="index">
<view class=""> <u-cell :title="item.name">
<text>通过</text> <u-avatar slot="icon" shape="square" size="35" :src="item.portraitUrl"></u-avatar>
<text>拒绝</text>
</view> <div style="width: 50px;" slot="value">
</view> <u-button type="success" size="small" @click="pending(item.userId)">申请</u-button>
</view> </div>
<!-- 空列表 --> </u-cell>
<view class=""> </u-list-item>
空列表 </u-list>
</view> <!-- 新朋友 -->
</view> <u-divider text="好友申请"></u-divider>
</template> <u-list height="auto">
<u-swipe-action>
<script> <u-list-item v-for="(item, index) in pedings" :key="index">
export default{ <u-swipe-action-item autoClose :options="options" @click="action($event, item)">
data(){ <u-cell :title="item.name">
return{ <u-avatar slot="icon" shape="square" size="35" :src="item.portraitUrl"></u-avatar>
searchValue: "", </u-cell>
listsArr: [] </u-swipe-action-item>
} </u-list-item>
} </u-swipe-action>
} </u-list>
</script> </view>
</template>
<style lang="scss" scoped>
.header-search{ <script>
padding: $padding/2 $padding; import {
background: white; getPedings,
} resolveFriend,
// 好友列表 rejectFriend,
.lists{ searchFriend,
.lists-item{ pedingFriend
padding: 20rpx $padding; } from '@/apis/interfaces/im.js'
position: relative;
display: flex; export default {
align-items: center; data() {
return {
&::after{ searchResult: [],
content: " "; searchValue: '',
position: absolute; pedings: [],
left: $margin; options: [{
right: 0; text: '通过',
bottom: 0; style: {
height: 1rpx; backgroundColor: '#3c9cff'
background-color: $border-color; }
} }, {
&:last-child::after{ text: '拒绝',
display: none; style: {
} backgroundColor: '#f56c6c'
.lists-item-cover{ }
width: 98rpx; }]
height: 98rpx; }
border-radius: 50%; },
background: $window-color; onLoad() {
} this.getPeddingList()
} },
} methods: {
search() {
console.log('sousuo');
searchFriend(this.searchValue).then(res => {
console.log(res);
this.searchResult = res
}).catch(err => {
console.log('err', err);
})
},
action(e, item) {
if (e.index == 0) {
resolveFriend(item.userId).then(res => {
this.getPeddingList()
})
} else {
rejectFriend(item.userId).then(res => {
this.getPeddingList()
})
}
},
getPeddingList() {
getPedings().then(res => {
this.pedings = res
})
},
pending(userId) {
uni.showLoading()
pedingFriend(userId).then(res => {
uni.showToast({
title: '申请成功',
success: () => {
this.searchResult = []
}
})
}).catch(err => {
uni.showToast({
icon: 'error',
title: err.message
})
})
}
}
}
</script>
<style lang="scss" scoped>
.header-search {
padding: $padding/2 $padding;
background: $window-color;
}
</style> </style>

View File

@@ -13,7 +13,8 @@
<block v-else> <block v-else>
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了" :show-icon="true"></u-alert> <u-alert type="warning" v-if="connection != 0" description="网络似乎断开了" :show-icon="true"></u-alert>
<view v-for="(item, index) in conversations" :key="index" class="message" @click="toDetail(item)"> <view v-for="(item, index) in conversations" :key="index" :class="['message', { 'is-top': item.isTop }]"
@tap="toDetail(item)" @longpress="onLongPress" :data-item="item">
<view class="avatar"> <view class="avatar">
<u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]" <u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]"
:value="item.unreadMessageCount" /> :value="item.unreadMessageCount" />
@@ -27,11 +28,19 @@
<view class="content"> <view class="content">
<view class="header"> <view class="header">
<view class="name">{{ friend(item.targetId).name || '未知用户' }}</view> <view class="name">{{ friend(item.targetId).name || '未知用户' }}</view>
<view class="time">{{ item.targetId }} | {{ item.sentTime|timeCustomCN }}</view> <view class="time">{{ item.sentTime|timeCustomCN }}</view>
</view> </view>
<view class="preview">{{ item.latestMessage.content || '&nbsp;' }}</view> <view class="preview">{{ item.latestMessage.content || '&nbsp;' }}</view>
</view> </view>
</view> </view>
<view class="shade" @tap="hidePop">
<view class="pop" :style="popStyle" :class="{'show':showPop}">
<view v-for="(item, index) in popButton" :key="index" @tap="pickerMenu" :data-index="index">
{{item}}
</view>
</view>
</view>
</block> </block>
</view> </view>
<!-- 未登录 --> <!-- 未登录 -->
@@ -59,7 +68,16 @@
isShown: true, // 当前页面显示状态 isShown: true, // 当前页面显示状态
conversations: [], // 会话列表 conversations: [], // 会话列表
isImToken: '', // 是否已鉴权 isImToken: '', // 是否已鉴权
connection: 0 connection: 0,
/* 窗口尺寸 */
winSize: {},
/* 显示操作弹窗 */
showPop: false,
/* 弹窗按钮列表 */
popButton: ['置顶聊天', '删除该聊天'],
/* 弹窗定位样式 */
popStyle: "",
pickedItem: {}
} }
}, },
computed: { computed: {
@@ -111,6 +129,48 @@
} }
}, },
methods: { methods: {
hidePop() {
this.showPop = false
this.pickedItem = {}
setTimeout(() => {
this.showShade = false
}, 250)
},
pickerMenu(e) {
const index = Number(e.currentTarget.dataset.index)
if (index == 0) {
RongIMLib.setConversationToTop(this.pickedItem.conversationType, this.pickedItem.targetId, !this
.pickedItem.isTop)
} else {
RongIMLib.removeConversation(this.pickedItem.conversationType, this.pickedItem.targetId)
}
this.getConversationList()
this.hidePop()
},
onLongPress(e) {
let [touches, style, item] = [e.touches[0], "", e.currentTarget.dataset.item]
if (touches.clientY > (this.winSize.height / 2)) {
style = `bottom:${this.winSize.height-touches.clientY}px;`
} else {
style = `top:${touches.clientY}px;`
}
if (touches.clientX > (this.winSize.witdh / 2)) {
style += `right:${this.winSize.witdh-touches.clientX}px`
} else {
style += `left:${touches.clientX}px`
}
this.popButton[0] = item.isTop ? '取消置顶' : '置顶聊天'
this.popStyle = style
this.pickedItem = item
this.$nextTick(() => {
setTimeout(() => {
this.showPop = true;
}, 10)
})
},
// 检查登录 // 检查登录
toLogin() { toLogin() {
if (this.$store.state.token === '') { if (this.$store.state.token === '') {
@@ -120,21 +180,18 @@
} }
return true return true
}, },
getFriend(targetId) {
return this.$store.getters.userInfo(targetId)
},
getConversationList() { getConversationList() {
const count = 1000 const count = 1000
const timestamp = 0 // 会话的时间戳获取这个时间戳之前的会话列表0 表示从最新开始获取)会话类型 const timestamp = 0 // 会话的时间戳获取这个时间戳之前的会话列表0 表示从最新开始获取)会话类型
RongIMLib.getConversationList(undefined, count, timestamp, (res) => { RongIMLib.getConversationList(undefined, count, timestamp, (res) => {
if (res.code === 0 && res.conversations.length > 0) { if (res.code === 0 && res.conversations.length > 0) {
this.conversations = res.conversations this.conversations = res.conversations
console.log(this.conversations);
} }
}) })
}, },
// 进入聊天的详情页面,清理未读消息数量 // 进入聊天的详情页面,清理未读消息数量
toDetail(item) { toDetail(item) {
this.hidePop()
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item
.conversationType .conversationType
@@ -148,7 +205,6 @@
.container { .container {
background-color: $window-color; background-color: $window-color;
min-height: 100vh; min-height: 100vh;
padding-bottom: 200px;
.null-list { .null-list {
height: 100vh; height: 100vh;
@@ -172,6 +228,10 @@
background: white; background: white;
padding: 24rpx 24rpx 20rpx 24rpx; padding: 24rpx 24rpx 20rpx 24rpx;
&.is-top {
background: $window-color;
}
.avatar { .avatar {
position: relative; position: relative;
@@ -198,11 +258,11 @@
} }
} }
.preview { .preview {
width: 520rpx; width: 520rpx;
word-break: break-all; word-break: break-all;
color: $text-gray; color: $text-gray;
font-size: 26rpx; font-size: 26rpx;
@extend .nowrap; @extend .nowrap;
} }
} }
@@ -290,4 +350,42 @@
// } // }
// } // }
} }
/* 遮罩 */
.shade {
.pop {
position: fixed;
z-index: 101;
width: 200rpx;
box-sizing: border-box;
font-size: 28rpx;
text-align: left;
color: #333;
background-color: #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
line-height: 80rpx;
transition: transform 0.15s ease-in-out 0s;
user-select: none;
-webkit-touch-callout: none;
transform: scale(0, 0);
&.show {
transform: scale(1, 1);
}
&>view {
padding: 0 20rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
user-select: none;
-webkit-touch-callout: none;
&:active {
background-color: #f3f3f3;
}
}
}
}
</style> </style>

View File

@@ -99,7 +99,13 @@
if (e.index == 0) { if (e.index == 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/private/setting?targetId=' + this.targetId + url: '/pages/im/private/setting?targetId=' + this.targetId +
'&conversationType=' + this.conversationType '&conversationType=' + this.conversationType,
events: {
messageClear: () => {
this.getMessageList()
console.log('聊天消息被清空');
}
}
}) })
} }
}, },

View File

@@ -2,18 +2,18 @@
<view class="content"> <view class="content">
<!-- 聊天信息 --> <!-- 聊天信息 -->
<view class="set-user" @click="showFriend"> <view class="set-user" @click="showFriend">
<u-avatar :src="userInfo.portraitUrl" size="48"></u-avatar> <u-avatar :src="friend(targetId).portraitUrl" size="48"></u-avatar>
<view class="set-user-nickname">{{ userInfo.name }}</view> <view class="set-user-nickname">{{ friend(targetId).name }}</view>
</view> </view>
<!-- 聊天设置 --> <!-- 聊天设置 -->
<view class="set-group"> <view class="set-group">
<view class="group-flex"> <view class="group-flex">
<label>消息免打扰</label> <label>消息免打扰</label>
<u-switch activeColor="#34CE98" size="22"></u-switch> <u-switch v-model="status" activeColor="#34CE98" size="22" @change="setStatus"></u-switch>
</view> </view>
<view class="group-flex"> <view class="group-flex">
<label>置顶会话</label> <label>消息置顶</label>
<u-switch v-model="isTop" activeColor="#34CE98" size="22"></u-switch> <u-switch v-model="isTop" activeColor="#34CE98" size="22" @change="setTop"></u-switch>
</view> </view>
</view> </view>
<view class="set-group"> <view class="set-group">
@@ -35,22 +35,26 @@
export default { export default {
data() { data() {
return { return {
userInfo: {}, eventChannel: null,
targetId: '', targetId: '',
conversationType: 1, conversationType: 1,
isTop: false, isTop: false,
status: 0 // 0 是免打扰1是正常通知 status: false // 0 是免打扰1是正常通知
}
},
computed: {
friend() {
return function(targetId) {
return this.$store.getters.userInfo(targetId)
}
} }
}, },
onLoad(e) { onLoad(e) {
this.eventChannel = this.$scope.eventChannel
this.targetId = e.targetId this.targetId = e.targetId
this.conversationType = e.conversationType this.conversationType = e.conversationType
getUserInfo(e.targetId).then(res => {
console.log(res);
this.userInfo = res
})
RongIMLib.getConversation(this.conversationType, this.targetId, ({ RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation conversation
}) => { }) => {
@@ -60,29 +64,27 @@
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({ RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
status status
}) => { }) => {
this.status = status this.status = !Boolean(status)
}) })
}, },
methods: { methods: {
showFriend() { showFriend() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/info?targetId=' + this.targetId url: '/pages/im/friends/info?targetId=' + this.targetId
}) })
}, },
setStatus() { setStatus() {
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({ RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
status status
}) => { }) => {
this.status = status this.status = !Boolean(status)
}) })
}, },
setTop() { setTop() {
RongIMLib.setConversationToTop(this.conversationType, this.targetId, !this.isTop, (res) => { RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
console.log(res);
RongIMLib.getConversation(this.conversationType, this.targetId, ({ RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation conversation
}) => { }) => {
console.log(conversation.isTop);
this.isTop = conversation.isTop this.isTop = conversation.isTop
}) })
}) })
@@ -97,6 +99,7 @@
code code
}) => { }) => {
if (code === 0) { if (code === 0) {
this.eventChannel.emit('messageClear')
uni.showToast({ uni.showToast({
title: '聊天记录已清空' title: '聊天记录已清空'
}) })