Files
dvcp_v2_wechat_app/src/project/biaopin/AppVillageHead/AppVillageHead.vue
2024-01-03 16:31:33 +08:00

374 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="AppResidentAssistant">
<!-- <u-navbar :is-back="false" title="村长coplite" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar"></u-navbar> -->
<!-- <div class="service-content">
<div class="text-content">
<div class="text-left">
<div>你好呀</div>
<p>我是您的<span>专属助手</span></p>
<p>有什么问题都可以问我哟~</p>
</div>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/service.png" alt="" class="service-img">
</div>
</div> -->
<div class="statistics-content">
<div class="title">2024年1月12日居民群日报</div>
<div class="mini-title">
<span></span>宣发情况
</div>
<div class="info">宣发数据<span>4</span></div>
<div class="info">宣发内容燃气安全交通安全天气情況春节倒计时信息</div>
<div class="flex-info">
<div class="info">触达居民群数<span>821</span></div>
<div class="info">触达居民<span>8762</span></div>
</div>
<div class="mini-title">
<span></span>AI问答
</div>
<div class="flex-info">
<div class="info">居民累计提问<span>2456</span></div>
<div class="info">群提问数<span>8</span>/</div>
</div>
<div class="flex-info">
<div class="info">最活跃群提问<span>821</span></div>
<div class="info">活跃居民<span>21</span></div>
</div>
<div class="info">居民热点话题交通天气红包吃什么活动拜年</div>
</div>
<div class="list-content">
<div class="item-right">
<div class="item">
<div class="img-div">
<u-icon name="play-circle" color="#fff" size="52"></u-icon>
<!-- <u-icon name="pause-circle" color="#fff" size="52"></u-icon> -->
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/recording-white.png" alt="">
</div>
<p>你好你好~</p>
</div>
</div>
<div class="item-left">
<div class="item">
<div class="img-div">
<u-icon name="play-circle" color="#656668" size="52"></u-icon>
<!-- <u-icon name="pause-circle" color="#656668" size="52"></u-icon> -->
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/recording-gray.png" alt="">
</div>
<p>你好有什么可以帮助你的吗你好有什么可以帮助你的吗你好有什么可以帮助你的吗</p>
</div>
</div>
</div>
<div class="fixed-bottom">
<div class="type-text" v-if="type == 'text'">
<u-input type="text" placeholder="输入您的问题…" height="80" input-align="left" :clearable="false" placeholder-style="color:#666;" v-model="content"></u-input>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/microphone-btn.png" alt="" @click="microPhone">
</div>
<div class="type-record" v-else>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/keyboard-btn.png" alt="" class="keyboard-btn" @click="keyboardClick">
<div v-if="!isStart" @click="startRecord">
<p>点击开始录音</p>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/record-btn.png" alt="" class="record-btn">
</div>
<div v-else @click="endRecord">
<p>正在录音中</p>
<div class="tips-text">点击下方停止录音</div>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/recording.png" alt="" class="recording">
</div>
</div>
</div>
</div>
</template>
<script>
import {mapState} from "vuex";
export default {
name: 'AppVillageHead',
appName: '村长coplite',
data() {
return {
backgroundNavbar: {
background: 'url(https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/header-bg.png) no-repeat',
backgroundSize: 'cover',
},
recorderManager: null,
type: 'text',
isStart: false,
content: ''
}
},
computed: {
...mapState(['user']),
},
onLoad() {
},
onShow() {
},
methods: {
startRecord() {
console.log(111)
uni.authorize({
scope: 'scope.record',
success() {
console.log(222)
this.recorderManager = uni.getRecorderManager()
const options = {
duration: 10000,
sampleRate: 44100,
numberOfChannels: 1,
encodeBitRate: 192000,
format: 'aac',
frameSize: 50
}
this.recorderManager.start(options)
this.recorderManager.onStart(() => {
this.isStart = true
})
this.recorderManager.onError((err) => {
alert(err)
})
},
fail(err) {
console.log(err)
uni.showModal({
title: "提示",
content: "您的录音权限未开启",
})
}
})
},
endRecord() {
this.recorderManager.stop()
this.recorderManager.onStop((res)=> {
console.log('录音结束');
alert('recorder stop' + JSON.stringify(res.tempFilePath));
// self.voicePath = res.tempFilePath;
this.isStart = false
});
},
microPhone() {
this.type = 'voice'
this.isStart = false
},
keyboardClick() {
this.type = 'text'
this.content = ''
}
},
}
</script>
<style lang="scss" scoped>
@import "~dvcp-wui/common";
page {
height: 100%;
}
.AppResidentAssistant {
height: 100vh;
padding-top: 32px;
background-color: #fff;
.service-content {
width: 100%;
height: 420px;
background-image: url("https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/content-top-bg.png");
background-size: 100vw;
background-repeat: no-repeat;
padding-top: 20px;
box-sizing: border-box;
.text-content {
margin: 0 0 0 32px;
width: 686px;
height: 260px;
background-image: url("https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/service-content-bg.png");
background-size: 100vw;
background-repeat: no-repeat;
padding: 32px;
box-sizing: border-box;
border-radius: 32px;
display: flex;
justify-content: space-between;
.text-left {
width: calc(100% - 192px);
div {
line-height: 54px;
font-family: SourceHanSansCN-Bold;
font-weight: 700;
font-size: 36px;
background: linear-gradient(to bottom, #2A6EE9, #58A5F7);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 16px;
}
p {
color: #222;
font-size: 28px;
font-family: SourceHanSansCN;
line-height: 44px;
span {
display: inline-block;
font-weight: 700;
}
}
}
.service-img {
display: inline-block;
width: 192px;
height: 170px;
}
}
}
.statistics-content {
width: 686px;
background: #F1F4F8;
border-radius: 12px 12px 12px 0;
padding: 32px;
box-sizing: border-box;
color: #222;
margin: 0 0 32px 32px;
.title {
line-height: 44px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32px;
margin-bottom: 24px;
}
.mini-title {
line-height: 44px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32px;
margin-bottom: 16px;
span {
display: inline-block;
width: 8px;
height: 32px;
background: #3975C6;
border-radius: 4px;
margin-right: 16px;
vertical-align: middle;
}
}
.info {
font-size: 28px;
font-family: PingFangSC;
line-height: 40px;
margin-bottom: 18px;
span {
color: #0D63F2;
}
}
.flex-info {
display: flex;
justify-content: space-between;
}
}
.list-content {
padding: 0 32px 364px;
overflow: hidden;
.item {
max-width: 600px;
border-radius: 24px 24px 0 24px;
padding: 24px 32px;
box-sizing: border-box;
margin-bottom: 32px;
.img-div {
margin-bottom: 4px;
img {
width: 136px;
height: 28px;
margin-left: 26px;
}
}
p {
word-break: break-all;
line-height: 48px;
font-family: SourceHanSansCN-Regular;
font-size: 32px;
}
}
.item-right {
display: flex;
justify-content: flex-end;
.item {
background-image: linear-gradient(-76deg, #569EF0 0%, #276FEC 100%);
}
p {
color: #fff;
}
}
.item-left {
.item {
background-color: #F1F4F8;
}
p {
color: #222;
}
}
}
.fixed-bottom {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding-bottom: 64px;
border-top: 1px solid #eee;
background-color: #fff;
.type-text {
padding: 24px 0 24px 32px;
display: flex;
u-input {
width: calc(100% - 80px);
height: 80px;
background: #F4F6FA;
border-radius: 40px;
padding-left: 32px;
}
img {
width: 48px;
height: 48px;
padding: 16px 32px 0;
}
}
.type-record {
position: relative;
text-align: center;
padding-top: 36px;
.keyboard-btn {
width: 48px;
height: 36px;
position: absolute;
top: 32px;
right: 32px;
}
p {
line-height: 58px;
font-family: SourceHanSansCN-Medium;
font-weight: 500;
font-size: 40px;
color: #222;
}
.record-btn {
width: 156px;
height: 156px;
margin-top: 24px;
}
.tips-text {
line-height: 40px;
font-family: SourceHanSansCN-Regular;
font-size: 28px;
color: #999;
margin-top: 16px;
}
.recording {
padding-top: 48px;
width: 112px;
height: 68px;
}
}
}
}
</style>