村长coplite

This commit is contained in:
liuye
2024-01-09 14:08:35 +08:00
parent f02efa3733
commit 35933f9a3f

View File

@@ -1,6 +1,6 @@
<template>
<div class="AppResidentAssistant">
<div class="statistics-content">
<!-- <div class="statistics-content">
<div class="title">2024年1月12日居民群日报</div>
<div class="mini-title">
<span></span>宣发情况
@@ -23,11 +23,11 @@
<div class="info">活跃居民<span>21</span></div>
</div>
<div class="info">居民热点话题交通天气红包吃什么活动拜年</div>
</div>
</div> -->
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scroll="scroll" v-if="messageList.length" :style="{height: scrollHeight+'px'}">
<div class="list-content">
<div :class="item.userType == 1 ? 'item-left' : 'item-right'" v-for="(item, index) in messageList" :key="index">
<div class="item">
<div class="item" :class="'item'+index">
<div class="img-div" v-if="item.sdkFileUrl">
<u-icon name="play-circle" :color="item.userType == 0 ? '#fff' : '#A8ADAE'" size="52" v-if="!item.isPlay" @click="play(item.sdkFileUrl, index)"></u-icon>
<u-icon name="pause-circle" :color="item.userType == 0 ? '#fff' : '#A8ADAE'" size="52" v-else @click="playStop(index)"></u-icon>
@@ -98,8 +98,12 @@ export default {
...mapState(['user']),
},
onLoad() {
// this.sendVoice()
this.scrollHeight = uni.getSystemInfoSync().windowHeight - 150
this.getHistoryList()
// var res = ["http://test87ftp.cunwuyun.cn/20240109/filename-20240109111547.mp3;0678a73c50b74bdcb8398e14ffbb35e5"]
// this.voiceUrl = res[0].split(';')[0]
// this.voiceId = res[0].split(';')[1]
// this.sendVoice()
},
onShow() {
document.title = '村长coplite'
@@ -126,7 +130,6 @@ export default {
}).then((res) => {
uni.hideLoading()
if (res?.data) {
["http://test87ftp.cunwuyun.cn/20240109/filename-20240109111547.mp3;0678a73c50b74bdcb8398e14ffbb35e5"]
this.voiceUrl = res.data[0].split(';')[0]
this.voiceId = res.data[0].split(';')[1]
this.sendVoice()
@@ -163,7 +166,6 @@ export default {
}
}
},
sendMsg() {
this.$loading()
this.$http.post("/app/appaigccopilotinfo/add", {content: this.content, appType: 1}).then(res => {
@@ -171,11 +173,10 @@ export default {
this.content = ''
this.messageList.push(res.data[0])
this.messageList.push(res.data[1])
this.$nextTick(() => {
uni.pageScrollTo({
duration: 300,
selector: `.item${this.messageList.length-1}`
});
this.$nextTick(() => {
uni.createSelectorQuery().select(".list-content").boundingClientRect((res) => {
this.scrollTop = res.height - this.scrollHeight
}).exec();
})
this.$hideLoading()
}
@@ -194,16 +195,20 @@ export default {
})
this.messageList.push(res.data[0])
this.messageList.push(res.data[1])
uni.pageScrollTo({
duration: 300,
selector: `.item${this.messageList.length-1}`
});
this.$nextTick(() => {
uni.createSelectorQuery().select(".list-content").boundingClientRect((res) => {
this.scrollTop = res.height - this.scrollHeight
}).exec();
})
this.$hideLoading()
}
})
},
getHistoryList() {
this.$loading()
uni.createSelectorQuery().select(".list-content").boundingClientRect((res) => {
this.preveHeight = res.height
}).exec();
this.$http.post(`/app/appaigccopilotinfo/list?current=${this.current}&size=10`).then(res => {
if(res.code == 0 && res.data.records.length) {
res.data.records.map((item) => {
@@ -212,14 +217,18 @@ export default {
}
})
this.messageList = this.current == 1 ? res.data.records : [...res.data.records, ...this.messageList]
var idPage = res.data.records.length-1
this.$nextTick(() => {
uni.pageScrollTo({
duration: 300,
selector: this.current == 1 ? `.item${this.messageList.length-1}` : `.item${idPage}`
});
})
this.pages = res.data.pages
this.$nextTick(() => {
uni.createSelectorQuery().select(".list-content").boundingClientRect((res) => {
if(this.current == 1) {
this.scrollTop = res.height - this.scrollHeight
}else {
this.scrollTop = res.height - this.preveHeight
}
}).exec();
})
this.$hideLoading()
}
})
@@ -254,7 +263,7 @@ export default {
<style lang="scss" scoped>
.AppResidentAssistant {
height: 100vh;
padding-top: 32px;
// padding-top: 32px;
background-color: #fff;
.service-content {
width: 100%;
@@ -352,8 +361,11 @@ export default {
justify-content: space-between;
}
}
.scroll-Y {
height: calc(100vh - 364px);
}
.list-content {
padding: 0 32px 364px;
padding: 32px 32px 364px;
overflow: hidden;
background-color: #fff;
.item {