123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <view class="message">
- <pinapp-empty-page title="暂无消息" v-if="chatList.length === 0"></pinapp-empty-page>
- <view class="message-list" v-else>
- <!-- 消息提示 -->
- <view class="message-item" v-for="(item,index) in chatList" :key="index"
- @click="$navigateTo('/pages/chat/chat?userId='+item.conversationId+'&userName='+item.userInfo.nickname)">
- <image :src="item.userInfo.avatarUrl" class="message-image" mode="aspectFill">
- </image>
- <view class="message-content">
- <view class="message-title">{{item.userInfo.nickname}}</view>
- <view class="message-sub-content">
- {{item.lastMessage.type === 'image'?'[图片]':item.lastMessage.body.text}}
- </view>
- </view>
- <view class="message-date">
- <uni-dateformat class="visitor-time" :date="item.updatedAt" :threshold="[60000,3600000 * 24 * 365]">
- </uni-dateformat>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- YeIMUniSDK,
- YeIMUniSDKDefines
- } from '@/uni_modules/wzJun1-YeIM-Uni-SDK/js_sdk/yeim-uni-sdk.min.js'
- import pinappEmptyPage from "@/components/pinapp-empty-page/pinapp-empty-page.vue"
- export default {
- data() {
- return {
- chatList: []
- }
- },
- onLoad() {
- this.$chat.getConversationList(res => {
- if (res.code == 200) {
- this.chatList = res.data;
- }
- })
- },
- onShow() {
- uni.$on('changeChatList', (res) => {
- this.chatList = res;
- })
- },
- components: {
- pinappEmptyPage
- },
- methods: {
- }
- }
- </script>
- <style lang="scss">
- .message {
- .message-list {
- margin-top: 20rpx;
- .message-item {
- background: #fff;
- display: flex;
- padding: 24rpx 30rpx;
- position: relative;
- }
- .message-image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 16rpx;
- overflow: hidden;
- }
- .message-content {
- flex: 1;
- width: 0;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .message-title {
- font-size: 32rpx;
- font-weight: 600;
- margin-bottom: 10rpx;
- }
- .message-sub-content {
- font-weight: 300;
- color: $uni-secondary-color;
- }
- .message-date {
- position: absolute;
- top: 34rpx;
- right: 30rpx;
- font-size: 24rpx;
- font-weight: 300;
- color: $uni-secondary-color;
- }
- }
- }
- </style>
|