2020-07-16 06:23:12 +00:00
|
|
|
|
<template>
|
|
|
|
|
<!-- login页面 -->
|
2020-08-08 08:32:37 +00:00
|
|
|
|
<view :style="{'height':swiperHeight + 'px'}">
|
2020-08-07 07:07:45 +00:00
|
|
|
|
<!-- <view class="border_serach">
|
2020-07-16 06:23:12 +00:00
|
|
|
|
<view class="u-search">
|
|
|
|
|
<u-search :show-action="false" input-align="left" shape="round" placeholder="搜索" v-model="keyword"></u-search>
|
|
|
|
|
</view>
|
2020-08-07 07:07:45 +00:00
|
|
|
|
</view> -->
|
2020-07-16 06:23:12 +00:00
|
|
|
|
<!-- 消息列表 -->
|
2020-08-08 08:32:37 +00:00
|
|
|
|
<u-empty text="并没有什么消息" mode="message" v-if="Object.keys(list).length == 0" style="margin: auto"></u-empty>
|
2020-08-07 06:44:11 +00:00
|
|
|
|
<view class="massage_list" v-for="(item,index) in list" :key="index" @click="gochat(item)">
|
2020-07-16 06:23:12 +00:00
|
|
|
|
<view class="images">
|
2020-08-07 06:44:11 +00:00
|
|
|
|
<image :src="item.avatar" ></image>
|
2020-07-16 06:23:12 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view class="names">{{item.name}}</view>
|
2020-08-07 06:44:11 +00:00
|
|
|
|
<view class="content u-line-1">{{item.text}}</view>
|
2020-07-16 06:23:12 +00:00
|
|
|
|
<view class="times">{{item.time}}</view>
|
2020-08-07 08:55:00 +00:00
|
|
|
|
<view class="tishi" v-if="item.unReadMessage"></view>
|
2020-07-16 06:23:12 +00:00
|
|
|
|
</view>
|
2020-07-30 02:12:27 +00:00
|
|
|
|
<u-toast ref="uToast" />
|
2020-07-16 06:23:12 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
keyword: '搜索',
|
2020-08-07 06:44:11 +00:00
|
|
|
|
list: [
|
|
|
|
|
|
2020-07-16 06:23:12 +00:00
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2020-08-07 06:44:11 +00:00
|
|
|
|
gochat(id){
|
|
|
|
|
console.log(id)
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url:"/pages/messages/privateChat",
|
|
|
|
|
params:{
|
|
|
|
|
id:JSON.stringify(id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onFriendListChange(onlineFriends) {
|
|
|
|
|
//todo:比较垃圾的处理方式,因为Uniapp的基于MAP的双向绑定在H5端不稳定,H5端偶尔会抽风
|
|
|
|
|
// 下边这一行删掉,有时候页面可以更新,有时候不行,大家有优雅的方式,也欢迎跟我们沟通
|
|
|
|
|
console.log(onlineFriends,121212)
|
|
|
|
|
this.information_dl = onlineFriends;
|
|
|
|
|
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
onShow(){
|
2020-08-08 08:32:37 +00:00
|
|
|
|
// this.list = this.imService.friends;
|
2020-08-07 06:44:11 +00:00
|
|
|
|
this.imService.onFriendListChange=this.onFriendListChange;
|
|
|
|
|
},
|
|
|
|
|
onLoad(){
|
2020-08-08 08:32:37 +00:00
|
|
|
|
const res = uni.getSystemInfoSync();
|
|
|
|
|
this.swiperHeight = res.windowHeight;
|
2020-08-07 07:07:45 +00:00
|
|
|
|
this.list = this.imService.friends;
|
2020-07-16 06:23:12 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-08-07 08:55:00 +00:00
|
|
|
|
.tishi{
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 30rpx;
|
|
|
|
|
right: 30rpx;
|
|
|
|
|
width: 12rpx;
|
|
|
|
|
height: 12rpx;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: #FF0000;
|
|
|
|
|
}
|
2020-07-16 06:23:12 +00:00
|
|
|
|
.u-search{
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
padding: 14rpx;
|
|
|
|
|
}
|
|
|
|
|
.border_serach{
|
|
|
|
|
border-top: 1px solid #EDEDED;
|
|
|
|
|
}
|
|
|
|
|
.massage_list{
|
|
|
|
|
padding: 25rpx 18rpx 25rpx 31rpx;
|
|
|
|
|
position: relative;
|
|
|
|
|
border-bottom: 1px #ECECEC solid;
|
|
|
|
|
overflow: hidden;
|
2020-08-07 08:55:00 +00:00
|
|
|
|
position: relative;
|
2020-07-16 06:23:12 +00:00
|
|
|
|
zoom: 1;
|
|
|
|
|
.images{
|
|
|
|
|
width: 84rpx;
|
|
|
|
|
height: 84rpx;
|
|
|
|
|
margin-right: 28rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.massage_list image{
|
|
|
|
|
width: 84rpx;
|
|
|
|
|
height: 84rpx;
|
|
|
|
|
.names{
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content{
|
|
|
|
|
margin-bottom: 19rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.content , .names{
|
|
|
|
|
width: 480rpx;
|
|
|
|
|
}
|
|
|
|
|
.content{
|
|
|
|
|
margin-top: 19rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: #666666;
|
|
|
|
|
height: 30rpx;
|
2020-08-11 10:27:31 +00:00
|
|
|
|
line-height: 30rpx;
|
2020-07-16 06:23:12 +00:00
|
|
|
|
}
|
|
|
|
|
.times{
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 29rpx;
|
|
|
|
|
top: 29rpx;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
.massage_list > view{
|
|
|
|
|
float: left;
|
|
|
|
|
}
|
|
|
|
|
</style>
|