Files
dtx_store/pages/life/noticeDetails.vue

111 lines
2.8 KiB
Vue

<template>
<view class="content">
<view class="title">{{title}}</view>
<view class="time"><text>{{categorie}}</text>{{time}}</view>
<view class="text">
<rich-text :nodes="content"></rich-text>
</view>
<!-- 分享 -->
<uni-popup ref="popupShare" type="share" background-color="#fff">
<uni-popup-share title="分享到" @select="select"></uni-popup-share>
</uni-popup>
</view>
</template>
<script>
import { info } from '@/apis/interfaces/notice.js'
export default {
data() {
return {
title : '',
content : '',
time : '',
categorie : '',
id : '',
description : ''
};
},
onLoad(e){
info(e.id).then(res => {
this.id = e.id
this.title = res.title
this.description= res.description
this.time = res.created_at
this.content = res.content.replace(/\<img/gi, '<img style="max-width:100%; height:auto; display:block;"');
this.categorie = res.categories[0].title
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods: {
select(e){
switch (e.item.name) {
case 'wxchum':
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 0,
href: 'https://invite.gongli.vip/articles/' + this.id,
title: '共力生态-' + this.title,
summary: this.description,
imageUrl: 'https://gl-ecological.oss-cn-zhangjiakou.aliyuncs.com/images/2022/06/11/3b7e6e330f465ecbf136d15def1039fd.jpg',
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
break;
case 'wxcircle':
uni.share({
provider: 'weixin',
scene: 'WXSceneTimeline',
type: 0,
href: 'https://invite.gongli.vip/articles/' + this.id,
summary: '共力生态-' + this.title,
imageUrl: 'https://gl-ecological.oss-cn-zhangjiakou.aliyuncs.com/images/2022/06/11/3b7e6e330f465ecbf136d15def1039fd.jpg',
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
break;
}
}
},
onNavigationBarButtonTap() {
this.$refs.popupShare.open();
}
}
</script>
<style lang="scss">
.content{
background: white;
min-height: 100vh;
padding: 30rpx;
box-sizing: border-box;
.title{
font-size: 40rpx;
font-weight: bold;
padding: 20rpx 0;
}
.time{
color: gray;
font-size: 28rpx;
padding-bottom: 70rpx;
text{
color: $main-color;
margin-right: 20rpx;
text-align: justify;
}
}
}
</style>