用户资料更新规则,基础流程

This commit is contained in:
2022-02-08 17:04:35 +08:00
parent 03fdc9b9d0
commit 56c212d9ad
8 changed files with 179 additions and 134 deletions

View File

@@ -14,28 +14,20 @@
</view>
</view>
<block v-if="friends.length > 0">
<template v-for="(item, friend) in friends">
<template v-for="(item, fkey) in friends">
<!-- #ifdef APP-NVUE -->
<u-index-anchor :text="indexs[friend]" bgColor="#F3F6FB" height="20" size="12" color="#666">
<u-index-anchor :text="indexs[fkey]" bgColor="#F3F6FB" height="20" size="12" color="#666">
</u-index-anchor>
<!-- #endif -->
<u-index-item>
<!-- #ifndef APP-NVUE -->
<u-index-anchor :text="indexs[friend]" bgColor="#F3F6FB" height="20" size="12" color="#666">
<u-index-anchor :text="indexs[fkey]" bgColor="#F3F6FB" height="20" size="12" color="#666">
</u-index-anchor>
<!-- #endif -->
<view v-for="(friendItem, index) in item" :key="friendItem.userId"
class="friend-flex u-border-bottom"
@click="$Router.push({ name: 'imFriendsInfo', params: { targetId: friendItem.userId } })">
<block v-if="friendItem.portraitUrl != ''">
<u-avatar class="cover" size="40" shape="square" :src="friendItem.portraitUrl || ''"
:default-url="require('@/static/user/cover.png')"></u-avatar>
</block>
<block v-else>
<u-avatar class="cover" size="40" shape="square"
:src="require('@/static/user/cover.png')"></u-avatar>
</block>
<view class="name">{{ friendItem.name }}</view>
class="friend-flex u-border-bottom" @click="toFriend(friendItem.userId)">
<u-avatar size="40" shape="square" :src="friend(friendItem.userId).portraitUrl" />
<view class="name">{{ friend(friendItem.userId).name }}</view>
</view>
</u-index-item>
</template>
@@ -50,7 +42,7 @@
<script>
import {
getFriends,
getFriendsLetter,
getPendingCount
} from '@/apis/interfaces/im';
@@ -62,12 +54,19 @@
pendingCount: 0
};
},
onShow() {
getFriends().then(res => {
computed: {
friend() {
return function(targetId) {
return this.$store.getters.userInfo(targetId)
}
}
},
onLoad() {
getFriendsLetter().then(res => {
this.indexs = res.indexList
this.friends = res.itemArr
})
getPendingCount().then(res => {
getPendingCount().then(res => {
console.log(res);
this.pendingCount = res
})
@@ -79,6 +78,11 @@
icon: 'none'
});
},
toFriend(targetId) {
uni.navigateTo({
url: '/pages/im/friends/info?targetId=' + targetId
})
},
// 新朋友
toPending() {
uni.navigateTo({
@@ -108,7 +112,6 @@
flex-direction: row;
align-items: center;
// .cover
.name {
flex: 1;
padding-left: $padding;

View File

@@ -2,7 +2,8 @@
<view class="content">
<!-- 用户信息 -->
<view class="info-flex">
<u-avatar :src="userInfo.portraitUrl || require('@/static/user/cover.png')" shape="square" size="50" bg-color="#fff"></u-avatar>
<u-avatar :src="userInfo.portraitUrl || require('@/static/user/cover.png')" shape="square" size="50"
bg-color="#fff"></u-avatar>
<view class="info-text">
<view class="nickname">{{userInfo.name}}</view>
<view class="address" @longpress="copyAddress">地址{{userInfo.address}}</view>
@@ -104,11 +105,12 @@
callShow: false
}
},
onLoad(e) {
console.log(e);
onLoad(e) {
this.targetId = e.targetId
getFriendInfo(e.targetId).then(res => {
this.userInfo = res
this.userInfo = res
// 获取到用户信息之后,去检查一下要不要更新
this.$store.dispatch('updateFriend', res)
uni.setNavigationBarTitle({
title: res.name
})
@@ -313,14 +315,16 @@
background: white;
margin: $margin;
border-radius: $radius;
.u-border-bottom{
.u-border-bottom {
border-bottom: solid 1rpx #f9f9f9 !important;
}
.item {
line-height: 100rpx;
display: flex;
align-items: center;
padding:10rpx $padding;
padding: 10rpx $padding;
justify-content: space-between;
font-size: $title-size-lg;

View File

@@ -40,8 +40,7 @@
<view class="avatar" @click="toFriend(item.targetId)">
<u-badge numberType="ellipsis" max="99" shape="horn" absolute :offset="[-5, -5]"
:value="item.unreadMessageCount" />
<u-avatar :src="friend(item.targetId).portraitUrl || require('@/static/user/cover.png')"
shape="square" size="44" />
<u-avatar :src="friend(item.targetId).portraitUrl" shape="square" size="44" />
</view>
<view class="content u-border-bottom">
<view class="header">
@@ -125,7 +124,7 @@
// todo ,不知道这个获取未读数量的,有没有办法能获取私聊的,还有群组的
// RongIMLib.getTotalUnreadCount(({
// count
// }) => {
// }) => {
// this.privateUnread = count
// })
})

View File

@@ -41,7 +41,8 @@
</view>
</view>
<!-- 弹出层 -->
<sent-popups :show="showPopups" :conversationType="conversationType" :targetId="targetId" @success="() => {showPopups = false, getMessageList()}"></sent-popups>
<sent-popups :show="showPopups" :conversationType="conversationType" :targetId="targetId"
@success="() => {showPopups = false, getMessageList()}"></sent-popups>
</view>
</template>
@@ -89,6 +90,7 @@
this.conversationType = e.conversationType // 会话类型
this.userInfo = this.$store.getters.userInfo(this.targetId)
console.log(this.userInfo);
// 获取消息列表
this.initMessageList()
@@ -147,13 +149,13 @@
})
},
// 滚动到底部
scrollBottom(type) {
if(type === 'msgPopups'){
this.showPopups = !this.showPopups
}
scrollBottom(type) {
if (type === 'msgPopups') {
this.showPopups = !this.showPopups
}
setTimeout(() => {
let el = this.$refs.chatBottom
ChatList.scrollToElement(el, {
ChatList.scrollToElement(el, {
offset: 0,
animated: false
})
@@ -168,14 +170,18 @@
.chat {
background: $window-color;
flex: 1;
.body {
flex: 1;
.cell {
.body {
flex: 1;
.cell {
padding: 10rpx 30rpx;
.time {
justify-content: center;
align-items: center;
padding-bottom: 20rpx;
padding-bottom: 20rpx;
.text {
background: #fff;
font-size: 24rpx;
@@ -236,10 +242,12 @@
padding: 20rpx 30rpx;
display: flex;
justify-content: space-between;
flex-direction: row;
flex-direction: row;
.msg-type {
width: 70rpx;
height: 70rpx;
.icon {
margin: 5rpx;
width: 60rpx;