parent
10c5b5ac73
commit
1a71f37e9f
@ -0,0 +1,124 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: ch
|
||||||
|
* @Date: 2022-03-26 14:32:03
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-04-28 23:43:35
|
||||||
|
* @Description: file content
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="msgItem" v-for="item in msgData" :key="item.id">
|
||||||
|
<view class="msgItem--title">
|
||||||
|
<text>{{item.payload.title }} {{item.id}}</text>
|
||||||
|
<text class="msgItem--time">{{item.createTimeStamp}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="msgItem--con">
|
||||||
|
<image class="msgItem--img" src="@/static/message/xt.png" mode="widthFix"/>
|
||||||
|
<view class="msgItem--desc">{{item.payload.content}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore status="loading" v-if="!msgData.length"/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {MsbWebSkt, createUUID} from '@/common/utils';
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed:{
|
||||||
|
curSessionData(){
|
||||||
|
return this.$store.state.sessionData.find(i =>i.id == this.$store.state.sessionMsgId)
|
||||||
|
},
|
||||||
|
msgData (){
|
||||||
|
return this.curSessionData ? this.curSessionData.messageList : [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onReachBottom(){
|
||||||
|
this.getHistoryMsg();
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
if(!this.$store.state.sessionMsgId){
|
||||||
|
this.$Router.back();
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getHistoryMsg();
|
||||||
|
this.readMsg();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
/**
|
||||||
|
* 获取历史消息
|
||||||
|
*/
|
||||||
|
getHistoryMsg(){
|
||||||
|
this.loading = true;
|
||||||
|
const lastMsg = this.msgData[this.msgData.length - 1] || {};
|
||||||
|
MsbWebSkt.send({
|
||||||
|
data : JSON.stringify({
|
||||||
|
traceId : createUUID(),
|
||||||
|
traceType : "2",
|
||||||
|
content: {
|
||||||
|
sessionId : this.$store.state.sessionMsgId,
|
||||||
|
topMessageId : lastMsg.id || null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 已读消息
|
||||||
|
*/
|
||||||
|
readMsg(){
|
||||||
|
MsbWebSkt.send({
|
||||||
|
data : JSON.stringify({
|
||||||
|
traceId : createUUID(),
|
||||||
|
traceType : "6",
|
||||||
|
content: {
|
||||||
|
sessionId : this.$store.state.sessionMsgId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
// 计算页头消息数
|
||||||
|
const count = this.$store.state.sessionMsgCount - this.curSessionData.unreadCount;
|
||||||
|
// 计算会话列表消息数
|
||||||
|
this.curSessionData.unreadCount = 0;
|
||||||
|
this.$store.commit('SET_SESSION_MSG_COUNT', count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.msgItem{
|
||||||
|
padding: 40rpx 0 0 40rpx;
|
||||||
|
&--title{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-right: 40rpx;
|
||||||
|
font-size: $font-size-lg;
|
||||||
|
color: $color-grey6;
|
||||||
|
}
|
||||||
|
&--time{
|
||||||
|
font-size: $font-size-sm;
|
||||||
|
color: $color-grey4;
|
||||||
|
}
|
||||||
|
&--con{
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1px solid $color-grey2;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
&--img{
|
||||||
|
width: 140rpx;
|
||||||
|
height: 140rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-right: 40rpx;
|
||||||
|
}
|
||||||
|
&--desc{
|
||||||
|
width: 455rpx;
|
||||||
|
font-size: $font-size-base;
|
||||||
|
line-height: 39rpx;
|
||||||
|
color: $color-grey5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,2 +1,2 @@
|
|||||||
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.b5ca35a9.js></script></body></html>
|
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.85539f92.js></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue