会话存档记录

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