查看附件

This commit is contained in:
shijingjing
2022-04-25 17:51:40 +08:00
parent ee8c4260c3
commit 9bc40cd91f
8 changed files with 100 additions and 924 deletions

View File

@@ -1,11 +1,11 @@
<template>
<div class="news-detail" v-if="pageShow">
<div class="video" v-if="info.videoFile">
<!-- <div class="video" v-if="info.videoFile">
<video :src="info.videoFile.url" :poster="info.coverFile.url"></video>
</div>
</div> -->
<div class="detail-top" :class="[info.videoFile ? 'detail-top__active' : '']">
<h2>{{ info.title }}</h2>
<div class="detail-info">
<!-- <div class="detail-info">
<div class="left">{{ info.areaName }} {{ info.createTime ? info.createTime.split(' ')[0] : '' }} </div>
<div class="right">
<div class="right-item">
@@ -17,13 +17,15 @@
<span :style="{color: info.nowUserStatus === '0' ? '#C41C19' : '#666'}">{{ info.upCount }}</span>
</div>
</div>
</div>
<div class="detail-content" v-if="!info.videoFile">
<!-- <div v-html="info.content" class="articalContent"></div> -->
<!-- <image :src="info.coverFile.url" mode="widthFix" /> -->
<!-- <AiWxparse :imageProp="imageProp" className="articalContent" :content="info.content"/> -->
<!-- <u-parse className="articalContent" :html="info.content"/> -->
</div>
</div> -->
<!-- <div class="detail-content" v-if="!info.videoFile">
<div v-html="info.content" class="articalContent"></div>
<image :src="info.coverFile.url" mode="widthFix" />
<AiWxparse :imageProp="imageProp" className="articalContent" :content="info.content"/>
<u-parse className="articalContent" :html="info.content"/>
</div> -->
<p><span>通知公告</span>{{ info.createTime.substring(0,10) }}</p>
<u-parse :html="info.content" style="margin-top: 20px;"/>
</div>
<!-- <div class="detail-comments">
<h2>全部评论({{ commentsTotal }})</h2>
@@ -119,10 +121,13 @@
</div> -->
<!-- <ai-login ref="login"></ai-login> -->
<div class="accessory-list">
<div class="accessory-list" v-if="info.files.length">
<p><u-icon name="attach" color="#2979ff" size="28"></u-icon>附件</p>
<div class="card-list">
<div class=""></div>
<div class="item" v-for="(item,index) in info.files" :key="index" @click="previewFile(item)">
<img src="./components/files.png" alt="">
<div>{{ item.fileName }}</div>
</div>
</div>
</div>
</div>
@@ -130,15 +135,11 @@
<script>
import {mapState} from 'vuex'
// import AiLogin from '@/components/AiLogin/AiLogin'
export default {
name: 'newsDetail',
computed: {
...mapState(['token'])
},
components: {
// AiLogin
},
data () {
return {
isShowComment: false,
@@ -159,16 +160,13 @@
focus: false,
current: 0,
isMore: false,
commentsTotal: 0
commentsTotal: 0,
fileList: []
}
},
onLoad (params) {
this.$loading()
this.id = params.id
this.areaId = params.areaId
this.type = params.type
this.$nextTick(() => {
this.getDetail()
this.getComments()
@@ -214,26 +212,21 @@
this.$set(this.commentList[index], 'isShow', '1')
},
suport() {
this.$loading()
this.$instance.post('/app/appnewscenterinfo/suportFree?id=' + this.id).then(res => {
this.$hideLoading()
if (res.code === 0) {
this.$set(this.info, 'upCount', this.info.upCount + 1)
this.$set(this.info, 'nowUserStatus', '0')
this.$toast('点赞成功')
}
})
},
// suport() {
// this.$instance.post('/app/appnewscenterinfo/suportFree?id=' + this.id).then(res => {
// if (res.code === 0) {
// this.$set(this.info, 'upCount', this.info.upCount + 1)
// this.$set(this.info, 'nowUserStatus', '0')
// this.$toast('点赞成功')
// }
// })
// },
replySuport (id, index) {
this.$loading()
this.$instance.post('/app/appnewscentercommenthot/suportFree', {
commentId: id,
status: this.commentList[index].status === '0' ? '1' : '0'
}).then(res => {
this.$hideLoading()
if (res.code === 0) {
this.$set(this.commentList[index], 'supportedQuantity', this.commentList[index].supportedQuantity + 1)
this.$set(this.commentList[index], 'status', '0')
@@ -243,16 +236,14 @@
},
getDetail() {
var url = '/app/appnewscenterinfo/queryDetailByIdForWx?id=' + this.id
if(this.type == 5) { //旅游故事
url = '/app/appcountrysidetourism/queryDetailByIdForWX?id=' + this.id
}
this.$instance.post(url).then(res => {
this.$hideLoading()
this.$http.post('/app/apppublicityinfo/queryDetailById',null,{
params: {
id: this.id
}
}).then(res => {
console.log(res);
if (res.code === 0) {
this.info = res.data
this.$hideLoading()
this.$nextTick(() => {
this.pageShow = true
})
@@ -260,12 +251,36 @@
})
},
previewFile(file) {
let fileList = [{
index: 0,
url: file.accessUrl
}]
if(file.postfix == ".png" || file.postfix == "jpg") {
uni.previewImage({
urls: fileList.map(v => v.url),
current: file.accessUrl
})
} else {
wx.downloadFile({
url: file.accessUrl,
success: function (res) {
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功')
}
})
}
})
}
},
onConfirm () {
if (!this.commnet) {
return this.$toast('评论不能为空')
}
this.$loading()
this.$instance.post('/app/appnewscentercomment/addOrUpdateForWX', {
circleId: this.id,
content: this.commnet,
@@ -274,7 +289,6 @@
name: uni.getStorageSync('userInfo').nickName,
areaId: this.areaId
}).then(res => {
this.$hideLoading()
if (res.code === 0) {
this.commnet = ''
this.$toast(this.commentId ? '回复成功' : '评论成功')
@@ -292,7 +306,6 @@
}).catch(() => {
this.commentId = ''
this.placeholder = ''
this.$hideLoading()
})
},
@@ -441,7 +454,6 @@
padding-right: 4rpx;
}
}
.detail-top__active {
padding-top: 30rpx;
@@ -485,7 +497,14 @@
& > h2 {
margin-bottom: 40rpx;
color: #333333;
font-size: 40rpx;
font-size: 40px;
}
p {
font-size: 24px;
span {
margin-right: 15px;
}
}
.detail-info {
@@ -701,4 +720,31 @@
}
}
}
.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;
}
.card-list {
.item{
padding: 16px;
border: 1px solid #CCCCCC;
border-radius: 8px;
display: flex;
margin-bottom: 32px;
img {
width: 96px;
height: 96px;
}
}
}
}
</style>