图片消息发送
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" />
|
||||
<show-image v-if="item.objectName === 'RC:ImgMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content.content" />
|
||||
:msg="item.content" />
|
||||
<show-text v-if="item.objectName === 'RC:TxtMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content.content" />
|
||||
:msg="item.content" />
|
||||
<view class="state" v-if="item.messageDirection == 1">
|
||||
<text class="state-text">{{ item.sentStatus == 50 ? '已读': '未读'}}</text>
|
||||
</view>
|
||||
@@ -24,7 +24,7 @@
|
||||
</cell>
|
||||
<cell class="cell-footer" ref="chatBottom"></cell>
|
||||
</list>
|
||||
<!-- footer -->
|
||||
<!-- footer -->
|
||||
<view class="chat-footer">
|
||||
<view class="msg-type" @click="changeMessageType">
|
||||
<image class="msg-type-icon" src="@/static/icon/key-icon.png" v-if="chatType === 0" mode="widthFix">
|
||||
@@ -32,30 +32,34 @@
|
||||
<image class="msg-type-icon" src="@/static/icon/msg-icon.png" v-if="chatType === 1" mode="widthFix">
|
||||
</image>
|
||||
</view>
|
||||
<sent-voice v-if="chatType === 0" :conversationType="conversationType" :targetId="targetId" @success="getMessageList" />
|
||||
<sent-text v-if="chatType === 1" :conversationType="conversationType" :targetId="targetId" @success="getMessageList" />
|
||||
<view class="msg-type msg-push" @click="showPopups = !showPopups">
|
||||
<image class="msg-type-icon" src="@/static/icon/popups-icon.png"></image>
|
||||
<sent-voice v-if="chatType === 0" :conversationType="conversationType" :targetId="targetId"
|
||||
@success="getMessageList" />
|
||||
<sent-text v-if="chatType === 1" :conversationType="conversationType" :targetId="targetId"
|
||||
@success="getMessageList" />
|
||||
<view class="msg-type msg-push" @click="showPopups = !showPopups">
|
||||
<image class="msg-type-icon" src="@/static/icon/popups-icon.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹出层 -->
|
||||
<u-line v-if="showPopups" color="#f5f5f5"></u-line>
|
||||
<sent-popups :show="showPopups" @onVlaue="onValue"></sent-popups>
|
||||
</view>
|
||||
<!-- 弹出层 -->
|
||||
<sent-popups :show="showPopups" :conversationType="conversationType" :targetId="targetId"
|
||||
@success="() => {showPopups = false, getMessageList()}"></sent-popups>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { timeCustomCN } from '@/utils/filters.js'
|
||||
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
||||
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'
|
||||
import showImage from '../components/showImage'
|
||||
import showText from '../components/showText'
|
||||
import sentText from '../components/sentText'
|
||||
import sentVoice from '../components/sentVoice'
|
||||
import sentPopups from '../components/sentPopups'
|
||||
import sentPopups from '../components/sentPopups'
|
||||
|
||||
const ChatList = uni.requireNativePlugin('dom')
|
||||
const ChatList = uni.requireNativePlugin('dom')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -68,7 +72,7 @@
|
||||
userId: '',
|
||||
portraitUrl: ''
|
||||
},
|
||||
chatType: 1 ,// 0 语音,1 文本
|
||||
chatType: 1, // 0 语音,1 文本
|
||||
showPopups: false
|
||||
}
|
||||
},
|
||||
@@ -77,7 +81,7 @@
|
||||
showImage,
|
||||
showText,
|
||||
sentText,
|
||||
sentVoice,
|
||||
sentVoice,
|
||||
sentPopups
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -125,15 +129,15 @@
|
||||
this.chatType = this.chatType === 1 ? 0 : 1
|
||||
},
|
||||
// 获取消息列表
|
||||
getMessageList() {
|
||||
getMessageList() {
|
||||
im.getMessageList(
|
||||
this.conversationType,
|
||||
this.targetId,
|
||||
new Date().getTime(),
|
||||
10,
|
||||
this.targetId,
|
||||
new Date().getTime(),
|
||||
10,
|
||||
true,
|
||||
(messages) => {
|
||||
console.log(messages);
|
||||
(messages) => {
|
||||
console.log('获取到的消息', messages);
|
||||
this.messages = messages.reverse()
|
||||
this.scrollBottom()
|
||||
})
|
||||
@@ -153,11 +157,6 @@
|
||||
animated: false
|
||||
})
|
||||
}, 50)
|
||||
},
|
||||
// 上传文件信息
|
||||
onValue(e){
|
||||
this.showPopups = false
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user