1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<template>
    <view class="im_index">
        <view class="im_item" v-for="(item,index) in imList" :key="index"
            @click="jumpPage(item.user)">
            <view class="im_item_left">
                <image :src="item.user.avatarUrl" mode=""></image>
            </view>
            <view class="im_item_right">
                <view class="im_item_right_item">
                    <view class="title text-ellipsis">{{item.user.nickName}}</view>
                    <view class="time">{{item.newMessage.create_time}}</view>
                </view>
                <view class="im_item_right_item">
                    <view class="content">{{item.newMessage.content}}</view>
                    <view v-if="item.num>0" class="message">{{item.num}}</view>
                </view>
            </view>
        </view>
        <view class="hint" v-if="imList.length==0">
            您当前并没有与任何人聊天哦!
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                imList: [],
            }
        },
        onShow() {
            this.get_im_list();
        },
        onLoad() {
            
        },
        methods: {
            //获取聊天列表
            get_im_list() {
                let self = this;
                self._post('plus.release.chat/index', {
                }, (res) => {
                    self.imList = res.data.list;
                })
            },
            
            jumpPage(user) {
                console.log(user)
                this.gotoPage('/pages3/release/chat/chat?you_user_id=' + user.user_id + '&avatarurl=' + user.avatarUrl +
                    '&nickname=' + user.nickName);
            },
 
 
        }
    }
</script>
 
<style>
    .im_index {
        width: 100%;
    }
 
    .im_item {
        width: 90%;
        height: 120rpx;
        margin: 0 auto;
        display: flex;
        align-items: center;
    }
 
    .im_item_left {
        box-sizing: border-box;
        display: flex;
        justify-content: center;
        align-items: center;
    }
 
    .im_item_left image {
        width: 80rpx;
        height: 80rpx;
        margin: 0 auto;
        margin-top: 5%;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.1);
    }
 
    .im_item_right {
        width: 555rpx;
        padding: 10rpx;
        border-bottom: 1px #dcdcdc solid;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
    }
 
    .message {
        width: 30rpx;
        height: 30rpx;
        border-radius: 50%;
        color: white;
        background-color: red;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 15rpx;
    }
 
    .im_item_right_item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10rpx;
    }
 
    .title {
        font-size: 32rpx;
    }
 
 
    .guangfang {
        font-size: 16rpx;
        color: #F36A24;
        border: 1rpx #F36A24 solid;
        border-radius: 10rpx;
        padding: 5rpx 10rpx;
        box-sizing: border-box;
        position: relative;
        left: -65rpx;
    }
 
    .time {
        font-size: 26rpx;
        color: #999999;
        flex-shrink: 0;
    }
 
    .content {
        font-size: 26rpx;
        color: #999999;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        word-break: break-all;
    }
 
    .hint {
        width: 750rpx;
        text-align: center;
        font-size: 32rpx;
        color: #585858;
        margin-top: 20rpx;
    }
</style>