新朋友无数据处理,我的群组没数据处理
This commit is contained in:
@@ -6,8 +6,15 @@
|
|||||||
:disabled="true" :show-action="false" />
|
:disabled="true" :show-action="false" />
|
||||||
</view>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view v-for="(item, index) in pendings" :key="index">
|
<block v-if="pendings.length > 0">
|
||||||
<apply-cell :message="item.latestMessage" @success="getPendingList" />
|
<view v-for="(item, index) in pendings" :key="index">
|
||||||
|
<apply-cell :message="item.latestMessage" @success="getPendingList" />
|
||||||
|
</view>
|
||||||
|
</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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,7 +29,8 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pendings: []
|
pendings: [],
|
||||||
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -32,6 +40,11 @@
|
|||||||
methods: {
|
methods: {
|
||||||
getPendingList() {
|
getPendingList() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
|
if (pendings.length > 0) {
|
||||||
|
this.bg = '#f9f9f9'
|
||||||
|
} else {
|
||||||
|
this.bg = '#fff'
|
||||||
|
}
|
||||||
this.pendings = pendings
|
this.pendings = pendings
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -46,7 +59,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.no-lists {
|
.no-lists {
|
||||||
padding-top: $padding * 3;
|
padding-top: $padding * 5;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="group">
|
<view class="group" :style="`background-color:${bg};`">
|
||||||
<view class="title"> 群聊 </view>
|
<block v-if="groups.length > 0">
|
||||||
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
<view class="title"> 群聊 </view>
|
||||||
<u-avatar size="38" shape="square" :src="contact(item.targetId).portraitUrl" />
|
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
||||||
<view class="info">
|
<u-avatar size="38" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||||
<view class="name">{{ item.name }}</view>
|
<view class="info">
|
||||||
|
<view class="name">{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="group-count"> {{groups.length}}个群聊 </view>
|
||||||
|
</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>
|
</view>
|
||||||
<view class="group-count"> {{groups.length}}个群聊 </view>
|
|
||||||
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
|
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
|
||||||
@confirm="onCreateGroup">
|
@confirm="onCreateGroup">
|
||||||
<view class="slot-content">
|
<view class="slot-content">
|
||||||
@@ -28,7 +35,8 @@
|
|||||||
return {
|
return {
|
||||||
groups: [],
|
groups: [],
|
||||||
createModal: false,
|
createModal: false,
|
||||||
groupName: ''
|
groupName: '',
|
||||||
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -48,6 +56,11 @@
|
|||||||
methods: {
|
methods: {
|
||||||
initData() {
|
initData() {
|
||||||
getMyGroups().then((res) => {
|
getMyGroups().then((res) => {
|
||||||
|
if (res.length > 0) {
|
||||||
|
this.bg = '#f9f9f9'
|
||||||
|
} else {
|
||||||
|
this.bg = '#fff'
|
||||||
|
}
|
||||||
this.groups = res
|
this.groups = res
|
||||||
res.map(item => {
|
res.map(item => {
|
||||||
this.$store.dispatch('updateContact', item)
|
this.$store.dispatch('updateContact', item)
|
||||||
@@ -88,12 +101,14 @@
|
|||||||
.group {
|
.group {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: $window-color;
|
background-color: $window-color;
|
||||||
.title{
|
|
||||||
|
.title {
|
||||||
font-size: $title-size-m;
|
font-size: $title-size-m;
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
padding: 10rpx $padding;
|
padding: 10rpx $padding;
|
||||||
}
|
}
|
||||||
.group-count{
|
|
||||||
|
.group-count {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: $title-size;
|
font-size: $title-size;
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
@@ -130,4 +145,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-lists {
|
||||||
|
padding-top: $padding * 5;
|
||||||
|
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>
|
||||||
|
|||||||
Reference in New Issue
Block a user