Files
dvcp_v2_wxcp_app/library/apps/AppInfotainment/newsDetail.vue

569 lines
10 KiB
Vue
Raw Normal View History

2022-04-24 14:19:20 +08:00
<template>
<div class="news-detail" v-if="pageShow">
<div class="detail-top" :class="[info.videoFile ? 'detail-top__active' : '']">
<h2>{{ info.title }}</h2>
2022-07-08 11:22:57 +08:00
<p><span>{{ info.categoryName }}</span>{{ $dateFormat(info.createTime) }}</p>
2022-04-25 17:51:40 +08:00
<u-parse :html="info.content" style="margin-top: 20px;"/>
2022-04-24 14:19:20 +08:00
</div>
2022-04-25 17:51:40 +08:00
<div class="accessory-list" v-if="info.files.length">
2022-04-29 18:52:18 +08:00
<p>
<u-icon name="attach" color="#2979ff" size="28"></u-icon>
附件
</p>
2022-04-24 17:42:09 +08:00
<div class="card-list">
2022-05-07 11:24:50 +08:00
<div class="item" v-for="(item,index) in info.files" :key="index" @click="prevFile(item)">
2022-04-25 17:51:40 +08:00
<img src="./components/files.png" alt="">
<div>{{ item.fileName }}</div>
</div>
2022-04-24 17:42:09 +08:00
</div>
</div>
2022-04-24 14:19:20 +08:00
</div>
</template>
<script>
2022-05-07 11:24:50 +08:00
import { mapState, mapActions } from 'vuex'
2022-04-29 18:52:18 +08:00
export default {
name: 'newsDetail',
data() {
return {
isShowComment: false,
info: {files: []},
imageProp: {
mode: 'widthFix',
padding: 0,
lazyLoad: false,
domain: ''
2022-04-24 14:19:20 +08:00
},
2022-04-29 18:52:18 +08:00
bottom: 0,
placeholder: '',
pageShow: false,
commnet: '',
commentList: [],
commnetId: '',
areaId: '',
focus: false,
current: 0,
isMore: false,
commentsTotal: 0,
fileList: []
}
},
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
onLoad(params) {
this.id = params.id
this.$nextTick(() => {
this.getDetail()
this.getComments()
})
},
methods: {
getDetail() {
this.$http.post('/app/apppublicityinfo/queryDetailById', null, {
params: {
id: this.id
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
}).then(res => {
if (res?.data) {
this.info = res.data
this.$nextTick(() => {
this.pageShow = true
})
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
})
},
2022-05-07 10:53:56 +08:00
...mapActions(['previewFile']),
2022-05-07 11:24:50 +08:00
prevFile(e) {
2022-05-07 10:53:56 +08:00
if ([".jpg", ".png", ".gif"].includes(e.postfix.toLowerCase())) {
2022-04-25 17:51:40 +08:00
uni.previewImage({
2022-05-07 10:53:56 +08:00
current: e.url,
urls: [e.url]
2022-04-25 17:51:40 +08:00
})
} else {
2022-05-07 10:53:56 +08:00
this.previewFile({...e})
2022-04-25 17:51:40 +08:00
}
},
2022-04-29 18:52:18 +08:00
onConfirm() {
if (!this.commnet) {
return this.$toast('评论不能为空')
}
this.$http.post('/app/appnewscentercomment/addOrUpdateForWX', {
circleId: this.id,
content: this.commnet,
type: this.commentId ? 2 : 1,
commentId: this.commentId,
name: uni.getStorageSync('userInfo').nickName,
areaId: this.areaId
}).then(res => {
if (res.code === 0) {
this.commnet = ''
this.$toast(this.commentId ? '回复成功' : '评论成功')
this.current = 0
this.isMore = false
this.getComments()
this.commentId = ''
this.placeholder = ''
} else {
this.commentId = ''
this.placeholder = ''
this.$toast(res.msg)
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
this.isShowComment = false
}).catch(() => {
this.commentId = ''
this.placeholder = ''
})
},
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
getComments() {
this.$http.post('/app/appnewscentercomment/listForWX?size=5&circleId=' + this.id + '&current=' + (this.current + 1)).then(res => {
if (res?.data) {
this.commentsTotal = res.data.total
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
if (this.current === 0) {
this.commentList = []
}
if (!res.data.records.length) {
this.isMore = true
this.isLoading = false
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
this.$nextTick(() => {
this.pageShow = true
})
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
return false
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
const data = res.data.records.map(item => {
item.isShow = '0'
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
return item
})
this.commentList.push(...data)
this.current = this.current + 1
}
})
}
},
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
onReachBottom() {
this.getComments()
},
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
onShareAppMessage() {
return {
title: this.info.title,
imageUrl: this.info.coverFile.url,
path: `/subPages/live/newsDetail?id=${this.id}&areaId=${this.$areaId}`
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
</script>
<style lang="scss">
2022-04-29 18:52:18 +08:00
.news-detail {
padding-bottom: 120px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
div {
box-sizing: border-box;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.comments {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1111;
.mask {
position: absolute;
2022-04-24 14:19:20 +08:00
top: 0;
2022-04-29 18:52:18 +08:00
left: 0;
2022-04-24 14:19:20 +08:00
width: 100%;
height: 100%;
2022-04-29 18:52:18 +08:00
background: rgba(0, 0, 0, 0.3);
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.comments-wrapper {
position: absolute;
bottom: 0;
z-index: 1;
width: 100%;
padding: 32px 32px 16px;
background: #FFFFFF;
.textarea {
position: relative;
2022-04-24 14:19:20 +08:00
width: 100%;
2022-04-29 18:52:18 +08:00
margin-bottom: 24px;
padding: 16px;
background: #F7F7F7;
border-radius: 8px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
textarea {
2022-04-24 14:19:20 +08:00
width: 100%;
2022-04-29 18:52:18 +08:00
height: 94px;
color: #666;
font-size: 26px;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
.textarea-bottom {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
justify-content: space-between;
2022-04-29 18:52:18 +08:00
padding: 16px;
color: #999999;
font-size: 26px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
.comments-bottom {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
2022-04-29 18:52:18 +08:00
justify-content: space-between;
padding-left: 16px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
span {
color: #666666;
font-size: 26px;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
div {
width: 144px;
height: 64px;
line-height: 64px;
text-align: center;
color: #fff;
font-size: 28px;
background: #135AB8;
border-radius: 32px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.icon-img {
width: 32px;
height: 32px;
margin-right: 8px;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.video-item {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
color: #666;
font-size: 28px;
i {
padding-right: 4px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
.detail-top__active {
padding-top: 30px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
h2 {
margin-bottom: 28px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
.video {
width: 100%;
height: 396px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
video {
display: block;
width: 100%;
height: 396px;
2022-04-25 17:51:40 +08:00
}
2022-04-29 18:52:18 +08:00
}
}
2022-04-25 17:51:40 +08:00
2022-04-29 18:52:18 +08:00
.no-more {
margin-top: 20px;
text-align: center;
color: #999;
image {
width: 400px;
height: 240px;
}
p {
text-align: center;
color: #999;
font-size: 28px;
}
}
.detail-top {
padding: 10px 30px 26px;
background: #fff;
& > h2 {
margin-bottom: 40px;
color: #333333;
font-size: 40px;
}
p {
font-size: 24px;
span {
margin-right: 15px;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
}
.detail-info {
display: flex;
align-items: center;
justify-content: space-between;
color: #333333;
font-size: 24px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.right {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
2022-04-29 18:52:18 +08:00
& > div {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
2022-04-29 18:52:18 +08:00
&:first-child {
margin-right: 60px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
i {
margin-right: 10px;
font-size: 32px;
2022-04-24 14:19:20 +08:00
}
}
}
2022-04-29 18:52:18 +08:00
.detail-content {
margin-top: 46px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
image {
display: block;
width: 100%;
height: 400px;
margin: 0 auto;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
}
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.detail-comments {
margin-top: 20px;
padding: 0 30px 20px;
background: #fff;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
& > h2 {
padding-top: 16px;
font-size: 30px;
color: #333333;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.comments-list {
.item {
display: flex;
margin-top: 35px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
image {
flex-shrink: 1;
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 22px;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.item-right {
flex: 1;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.item-right__top {
display: flex;
justify-content: space-between;
height: 50px;
.item-right__top--right {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
2022-04-29 18:52:18 +08:00
padding-left: 20px;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
i {
margin-right: 10px;
color: #666;
font-size: 28px;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
span {
2022-04-24 14:19:20 +08:00
color: #333333;
2022-04-29 18:52:18 +08:00
font-size: 24px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.item-right__content {
line-height: 46px;
color: #333333;
font-size: 28px;
text-align: justify;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.item-right__info {
display: flex;
align-items: center;
margin: 10px 0;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
span {
margin-right: 20px;
color: #999999;
font-size: 24px;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
i {
color: #333333;
font-size: 24px;
}
}
.item-replay {
padding: 30px;
background: #F0F0F0;
.item-replay__item {
display: flex;
line-height: 1.3;
margin-bottom: 10px;
h3 {
color: #333333;
font-size: 26px;
font-weight: 600;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
span {
font-size: 26px;
2022-04-24 14:19:20 +08:00
}
}
2022-04-29 18:52:18 +08:00
.item-replay__more {
color: #999999;
font-size: 26px;
}
2022-04-24 14:19:20 +08:00
}
}
}
}
2022-04-29 18:52:18 +08:00
}
.footer-bar {
display: flex;
position: fixed;
align-items: center;
justify-content: space-between;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
padding: 0 30px;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.2);
background: #fff;
input {
width: 460px;
height: 58px;
background: #F0F0F0;
border-radius: 30px;
font-size: 26px;
text-align: center;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.footer-bar__right {
2022-04-24 14:19:20 +08:00
display: flex;
align-items: center;
2022-04-29 18:52:18 +08:00
i {
font-size: 30px;
color: #666;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.count {
position: relative;
text-align: right;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
span {
position: absolute;
top: -18px;
right: -11px;
z-index: 21;
padding: 3px 7px;
font-size: 20px;
color: #fff;
border-radius: 12px;
background: #C41C19;
2022-04-24 14:19:20 +08:00
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
.count, & > i {
margin-right: 40px;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
button {
padding: 0 !important;
font-size: 26px !important;
color: #666 !important;
line-height: 1 !important;
background: transparent !important;
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
&::after {
border: none;
}
2022-04-24 14:19:20 +08:00
2022-04-29 18:52:18 +08:00
&:last-child {
border-right: none;
2022-04-24 14:19:20 +08:00
}
}
}
2022-04-29 18:52:18 +08:00
}
.accessory-list {
margin-top: 16px;
background: #FFF;
padding: 0 32px 30px 32px;
box-sizing: border-box;
p {
font-size: 32px;
height: 112px;
line-height: 112px;
}
2022-04-25 17:51:40 +08:00
2022-04-29 18:52:18 +08:00
.card-list {
.item {
padding: 16px;
border: 1px solid #CCCCCC;
border-radius: 8px;
display: flex;
margin-bottom: 32px;
img {
width: 96px;
height: 96px;
}
div {
align-self: center;
2022-04-25 17:51:40 +08:00
}
}
}
2022-04-29 18:52:18 +08:00
}
2022-04-24 14:19:20 +08:00
</style>