申请加好友认证信息优化,好友列表无好友状态处理
This commit is contained in:
@@ -2,40 +2,33 @@
|
|||||||
<view>
|
<view>
|
||||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||||
<view class="friend-flex" @click="toPending">
|
<view class="friend-flex" @click="toPending">
|
||||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_01.png')"></u-avatar>
|
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_01.png')" />
|
||||||
<u-badge max="99" absolute :offset="[23, 20]" :value="pendingCount" />
|
<u-badge max="99" absolute :offset="[23, 20]" :value="pendingCount" />
|
||||||
<view class="info">新的朋友</view>
|
<view class="info">新的朋友</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="friend-flex" @click="toGroup">
|
<view class="friend-flex" @click="toGroup">
|
||||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_00.png')"></u-avatar>
|
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_00.png')" />
|
||||||
<view class="info">我的群聊</view>
|
<view class="info">我的群聊</view>
|
||||||
</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="#f9f9f9" height="20" size="12" color="#666"
|
<u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666" class="anchor" />
|
||||||
class="anchor" />
|
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex" @click="toFriend(friendItem.targetId)">
|
||||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
<u-avatar class="avatar-img" size="40" shape="square" :src="contact(friendItem.targetId).portraitUrl" />
|
||||||
@click="toFriend(friendItem.targetId)">
|
<view class="info"> <view class="name">{{ contact(friendItem.targetId).name }}</view> </view>
|
||||||
<u-avatar class="avatar-img" size="40" shape="square"
|
|
||||||
:src="contact(friendItem.targetId).portraitUrl" />
|
|
||||||
<view class="info">
|
|
||||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
|
||||||
<!-- <view class="address">地址:{{ friendItem.address }}</view> -->
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</u-index-item>
|
</u-index-item>
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<view class="no-lists" v-else>
|
||||||
<u-empty class="pages-null" mode="data" text="暂无好友" />
|
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src=" require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||||
</block>
|
<span>暂无好友列表~</span>
|
||||||
|
</view>
|
||||||
</u-index-list>
|
</u-index-list>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {getFriendsLetter} from '@/apis/interfaces/im';
|
||||||
getFriendsLetter
|
|
||||||
} 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'
|
||||||
|
|
||||||
@@ -54,14 +47,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onShow() {
|
||||||
this.getFriendList()
|
this.getFriendList()
|
||||||
this.checkNewFriendPending()
|
this.checkNewFriendPending()
|
||||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||||
},
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.$off("onContactNotification")
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFriendList() {
|
getFriendList() {
|
||||||
getFriendsLetter().then(res => {
|
getFriendsLetter().then(res => {
|
||||||
|
console.log(res)
|
||||||
this.indexs = res.indexList
|
this.indexs = res.indexList
|
||||||
this.friends = res.itemArr
|
this.friends = res.itemArr
|
||||||
})
|
})
|
||||||
@@ -86,18 +83,9 @@
|
|||||||
},
|
},
|
||||||
// 新朋友
|
// 新朋友
|
||||||
toPending() {
|
toPending() {
|
||||||
// if (this.pendingCount > 0) {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/friends/pending'
|
url: '/pages/im/friends/pending'
|
||||||
});
|
});
|
||||||
// } else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: ` 暂无好友申请 ~ `,
|
|
||||||
// icon: "none",
|
|
||||||
// mask: true,
|
|
||||||
// duration: 3000
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
@@ -172,4 +160,18 @@
|
|||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
.no-lists {
|
||||||
|
padding-top: $padding * 3;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
color: $text-gray-m;
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding-top: $padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -209,7 +209,7 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pedingFriend(this.targetId, 'message').then(res => {
|
pedingFriend(this.targetId, '').then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: ` 申请成功,等待审核 `,
|
title: ` 申请成功,等待审核 `,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|||||||
@@ -33,13 +33,14 @@
|
|||||||
bg: '#fff'
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onShow() {
|
||||||
this.getPendingList()
|
this.getPendingList()
|
||||||
uni.$on('onContactNotification', this.getPendingList)
|
uni.$on('onContactNotification', this.getPendingList)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPendingList() {
|
getPendingList() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
|
console.log(pendings,'res......')
|
||||||
if (pendings.length > 0) {
|
if (pendings.length > 0) {
|
||||||
this.bg = '#f9f9f9'
|
this.bg = '#f9f9f9'
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
BIN
static/.DS_Store
vendored
BIN
static/.DS_Store
vendored
Binary file not shown.
Reference in New Issue
Block a user