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