Files
RentWeAppFront/pages-biz/notice/noticeDetail.vue
2026-05-14 14:42:51 +08:00

103 lines
2.1 KiB
Vue

<template>
<view>
<u-navbar :is-back="true" :title="title" :border-bottom="false"></u-navbar>
<view class="u-content">
<u-parse :html="content"
:autosetTitle="true"
:show-with-animation="true"
:selectable="true"></u-parse>
</view>
<u-swiper :list="imgList" @change="change"></u-swiper>
<view v-for="(item,index) in attachments" :key="index">
<text @click="download(item)">{{ item.fileName }}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
id:null,
title:'资讯',
content: ``,
imgList:[],
attachments:[]
}
},
onLoad(option) {
this.id = option.id
this.getDetail()
},
onShow(){
this.recordView(this.id)
},
methods:{
recordView(assetId) {
let token = this.$getToken()
let userInfo = uni.getStorageSync('userInfo')
if(token){
return
}
if (token) {
let url = "/potential/add";
this.$u.get(url, {
assetId: this.id,
assetsName: '查看公告' + this.title,
userType: userInfo.userType
}, {
'WT': this.$getToken()
}).then(obj => {
}).catch(err => {
console.log("记录客户浏览记录失败", err)
})
}
},
getDetail(){
this.$u.get(`/notice/detail?id=${this.id}`,{},{}).then(res=>{
if(res.flag) {
this.title = res.data.noticeTitle;
this.content = res.data.noticeContent;
if(res.data.imgs) {
const _this = this;
res.data.imgs.forEach(img=>{
_this.imgList.push(_this.$config.staticUrl + img)
})
}
this.attachments = res.data.attachments;
this.recordView(this.id)
}
})
},
download(item){
uni.downloadFile({
url: this.$config.staticUrl + item.fileUrl,
success(res) {
uni.openDocument({
filePath: res.tempFilePath
})
}
})
}
}
}
</script>
<style>
page{
background-color: #FFFFFF;
}
</style>
<style lang="scss" scoped>
.u-content{
margin:0 10rpx;
padding: 24rpx;
font-size: 34rpx;
color: $u-main-color;
line-height: 1.8;
white-space: pre-wrap !important;
}
</style>