会话存档记录

This commit is contained in:
liuye
2023-06-13 16:34:06 +08:00
parent bcf0d45308
commit 57b76d549b

View File

@@ -17,7 +17,8 @@
</div>
</div>
</AiTopFixed>
<div class="conversation-list" v-if="list.length">
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scroll="scroll" v-if="list.length" :style="{height: scrollHeight+'px'}">
<div class="conversation-list">
<div v-for="(item, index) in list" :key="index">
<div class="item" :class="item.userId == user.wxUserId ? 'item-right' : 'item-left'">
@@ -112,6 +113,7 @@
</div>
</div>
</div>
</scroll-view>
<AiEmpty v-else/>
<u-calendar v-model="isShowDate" @change="onDateChange" mode="range"></u-calendar>
<!-- <div class="footer" @click="toGroup">{{type == 1 ? '群详情' : '个人信息'}}</div> -->
@@ -122,7 +124,6 @@
import {mapState, mapActions} from "vuex";
export default {
name: "conversationDetail",
enablePullDownRefresh: true,
data() {
return {
tabList: [
@@ -151,9 +152,9 @@ export default {
type: '',
isShowDate: false,
dateList: [],
amrPlay: '',
amrPlayStatus: false,
scrollTop: 0,
scrollHeight: '',
preveHeight: ''
};
},
computed: {
@@ -167,23 +168,36 @@ export default {
}
this.type = option.type
this.getList()
console.log()
this.scrollHeight = uni.getSystemInfoSync().windowHeight - 150
},
onShow() {
document.title = '会话详情'
},
onPullDownRefresh() {
// onPullDownRefresh() {
// if(this.current > this.pages) {
// uni.stopPullDownRefresh()
// return this.$u.toast('已加载完成,没有更多数据')
// }else {
// this.current ++
// this.getList()
// setTimeout(() => {
// uni.stopPullDownRefresh()
// }, 1000)
// }
// },
methods: {
scroll(e) {
console.log(e)
if(e.detail.scrollTop == 0) {
if(this.current > this.pages) {
uni.stopPullDownRefresh()
return this.$u.toast('已加载完成,没有更多数据')
}else {
this.current ++
this.getList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000)
}
}
},
methods: {
toGroup() {
if(this.type == 1) {
uni.navigateTo({url: `./groupDetail`})
@@ -212,6 +226,12 @@ export default {
this.getList()
},
getList() {
if(this.current > 1) {
uni.createSelectorQuery().select(".conversation-list").boundingClientRect((res) => {
console.log('old', res.height, uni.getSystemInfoSync().windowHeight)
this.preveHeight = res.height
}).exec();
}
this.$http.post(`/app/appsessionarchiveinfo/listByUser`, null, {
params: {
current: this.current,
@@ -243,6 +263,18 @@ export default {
})
this.list = this.current > 1 ? [ ...res.data.records, ...this.list]: res.data.records
this.pages = res.data.pages
this.$nextTick(() => {
uni.createSelectorQuery().select(".conversation-list").boundingClientRect((res) => {
console.log(this.scrollTop, res.height)
if(this.current == 1) {
this.scrollTop = res.height - this.scrollHeight
}else {
this.scrollTop = res.height - this.preveHeight
}
console.log(this.current, this.scrollTop, res.height)
}).exec();
})
}
})
},