Merge branch 'master' of https://git.yuzhankeji.cn/TmOct5/ZhHealth
This commit is contained in:
@@ -6,11 +6,12 @@
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="header">
|
||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3" class='qun'>[群]</text></view>
|
||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
|
||||
class='qun'>[群]</text></view>
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
</view>
|
||||
<message-preview class="preview" :msg="item.latestMessage" :conversationType="item.conversationType"
|
||||
:user="item.latestMessage.userInfo" />
|
||||
<message-preview class="preview" :msg="item.latestMessage" :draft="item.draft"
|
||||
:conversationType="item.conversationType" :user="item.latestMessage.userInfo" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -27,6 +28,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.item);
|
||||
},
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="preview" v-if="draft">
|
||||
<text class="draft">[草稿]</text> {{ draft }}
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="preview" v-if="msg.objectName=='RC:TxtMsg'">
|
||||
<text v-if="conversationType == 3">{{ user.name }}:</text>{{ msg.content || '' }}
|
||||
</view>
|
||||
@@ -27,6 +31,7 @@
|
||||
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">
|
||||
[{{ msg.message }}]
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -41,6 +46,10 @@
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
draft: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
@@ -64,5 +73,10 @@
|
||||
line-height: 32rpx;
|
||||
width: 520rpx;
|
||||
@extend .nowrap;
|
||||
|
||||
.draft {
|
||||
color: $text-price;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view class="chat">
|
||||
<!-- chat -->
|
||||
<scroll-view class="body" scroll-y>
|
||||
<view class="body">
|
||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
||||
<view class="time">{{ customCN(item.sentTime) }}</view>
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
||||
<u-avatar class="avatar" size="40" shape="square" @click="showUser(targetId, item.messageDirection)"
|
||||
:src="contact(item.senderUserId).portraitUrl" />
|
||||
@@ -21,16 +21,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-footer" ref="chatBottom"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
timeCustomCN
|
||||
} from '@/utils/filters.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import showVoice from '../components/showVoice'
|
||||
@@ -38,8 +34,6 @@
|
||||
import showText from '../components/showText'
|
||||
import sentMessageBar from '../components/sentMessageBar'
|
||||
|
||||
const ChatList = uni.requireNativePlugin('dom')
|
||||
|
||||
export default {
|
||||
components: {
|
||||
sentMessageBar,
|
||||
@@ -106,9 +100,6 @@
|
||||
uni.$off('onReadReceiptReceived')
|
||||
},
|
||||
methods: {
|
||||
customCN(val) {
|
||||
return timeCustomCN(val)
|
||||
},
|
||||
getNewMessage() {
|
||||
im.getMessageList(
|
||||
this.conversationType,
|
||||
@@ -117,9 +108,8 @@
|
||||
1,
|
||||
false,
|
||||
(messages) => {
|
||||
console.log(messages);
|
||||
this.messages = this.messages.concat(messages)
|
||||
this.scrollBottom()
|
||||
this.messages.unshift(...messages)
|
||||
// this.scrollBottom()
|
||||
})
|
||||
},
|
||||
// 获取消息列表
|
||||
@@ -131,9 +121,8 @@
|
||||
100,
|
||||
true,
|
||||
(messages) => {
|
||||
console.log(messages);
|
||||
this.messages = messages.reverse()
|
||||
this.scrollBottom()
|
||||
this.messages = messages
|
||||
// this.scrollBottom()
|
||||
})
|
||||
},
|
||||
// 展示好友信息, type 1 是自己, 2 是对方
|
||||
@@ -176,7 +165,10 @@
|
||||
|
||||
.body {
|
||||
flex: 1;
|
||||
overflow: scroll;
|
||||
overflow-y: scroll;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
justify-content: flex-end;
|
||||
|
||||
.cell {
|
||||
padding: 10rpx 30rpx;
|
||||
|
||||
@@ -9,10 +9,6 @@ import store from '@/store/index'
|
||||
// #ifdef APP-NVUE
|
||||
const ROUTES = [{
|
||||
"path": "/pages/im/private/call"
|
||||
}, {
|
||||
"path": "/pages/im/private/chat"
|
||||
}, {
|
||||
"path": "/pages/im/group/chat"
|
||||
}];
|
||||
// #endif
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ const callLibListeners = () => {
|
||||
})
|
||||
// 远端响铃
|
||||
CallLib.onRemoteUserRinging((res) => {
|
||||
console.log('onRemoteUserRinging', res);
|
||||
uni.$emit('onRemoteUserRinging')
|
||||
})
|
||||
// 远端加入
|
||||
|
||||
Reference in New Issue
Block a user