109 lines
2.3 KiB
Vue
109 lines
2.3 KiB
Vue
<template>
|
|
<view class="news_info_warp">
|
|
<Header
|
|
leftTitle=""
|
|
left-path-type="navigateTo"
|
|
left-path="/pages/news/news"
|
|
style="background-color: #FFFFFF;"
|
|
/>
|
|
<view class="news_info_header_warp">
|
|
<view class="title_">{{newsDetail.title}}</view>
|
|
<view class="avatar_">
|
|
<view>
|
|
<up-image :src="newsDetail.avatar_url" width="40" height="40" bgColor="#f1f6ff00" shape="circle"></up-image>
|
|
</view>
|
|
<view style="margin-left: 12rpx;">{{newsDetail.name}}</view>
|
|
</view>
|
|
<view class="time_">
|
|
<view>{{formatDate(newsDetail.ctdate)}}</view>
|
|
<view class="browses_">
|
|
<view>
|
|
<up-image src="/static/login/show.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
|
</view>
|
|
<view style="margin-left: 8rpx;">{{newsDetail.browses}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="news_info_fg_warp"></view>
|
|
<view class="news_info_content_warp" v-html="newsDetail.content"></view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Header from '@/components/header.vue';
|
|
import { getNewsDetail } from '@/api/news.js';
|
|
import { formatDate } from '@/utils/index.js';
|
|
|
|
export default {
|
|
components:{Header},
|
|
data() {
|
|
return {
|
|
id:0,
|
|
newsDetail:{}
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
const id = option.id;
|
|
if(id && id !=="null"){
|
|
this.id = id;
|
|
this.fetchData();
|
|
}
|
|
},
|
|
methods: {
|
|
formatDate,
|
|
async fetchData() {
|
|
const id = this.id;
|
|
const params = {
|
|
id,
|
|
}
|
|
const resp = await getNewsDetail(params);
|
|
if(resp && resp.bizcode === 100){
|
|
this.newsDetail = resp.data || {};
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.news_info_warp{
|
|
overflow: hidden;
|
|
}
|
|
.news_info_header_warp{
|
|
padding: 30rpx;
|
|
.title_{
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
}
|
|
.avatar_{
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: 20rpx;
|
|
}
|
|
.time_{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #666666;
|
|
margin-top: 10rpx;
|
|
.browses_{
|
|
display: flex;
|
|
}
|
|
}
|
|
}
|
|
.news_info_fg_warp{
|
|
height: 10rpx;
|
|
background-color: $app-bj;
|
|
width: 100%;
|
|
}
|
|
.news_info_content_warp{
|
|
padding: 30rpx;
|
|
height: calc(100vh - 524rpx);
|
|
overflow: auto;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
}
|
|
</style>
|