好友申请通知优化
This commit is contained in:
@@ -10,25 +10,33 @@
|
||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_00.png')" />
|
||||
<view class="info">我的群聊</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-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666" class="anchor" />
|
||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex" @click="toFriend(friendItem.targetId)">
|
||||
<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>
|
||||
<u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666"
|
||||
class="anchor" />
|
||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||
@click="toFriend(friendItem.targetId)">
|
||||
<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>
|
||||
</view>
|
||||
</u-index-item>
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src=" require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span>暂无好友列表~</span>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src=" require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span>暂无好友列表~</span>
|
||||
</view>
|
||||
</u-index-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getFriendsLetter} from '@/apis/interfaces/im';
|
||||
import {
|
||||
getFriendsLetter
|
||||
} from '@/apis/interfaces/im';
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
|
||||
@@ -47,20 +55,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
uni.$on('onNewContactFriends', this.checkNewFriendPending)
|
||||
},
|
||||
onShow() {
|
||||
this.getFriendList()
|
||||
this.checkNewFriendPending()
|
||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("onContactNotification")
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("onNewContactFriends")
|
||||
},
|
||||
methods: {
|
||||
getFriendList() {
|
||||
getFriendsLetter().then(res => {
|
||||
console.log(res)
|
||||
getFriendsLetter().then(res => {
|
||||
this.indexs = res.indexList
|
||||
this.friends = res.itemArr
|
||||
this.friends = res.itemArr
|
||||
})
|
||||
},
|
||||
checkNewFriendPending() {
|
||||
@@ -70,10 +79,7 @@
|
||||
},
|
||||
toGroup() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/group/index',
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
}
|
||||
url: '/pages/im/group/index'
|
||||
})
|
||||
},
|
||||
toFriend(targetId) {
|
||||
@@ -85,13 +91,13 @@
|
||||
toPending() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/pending'
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/search'
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -159,19 +165,20 @@
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
||||
|
||||
Reference in New Issue
Block a user