11
This commit is contained in:
100
pages/news/newsDetail.vue
Normal file
100
pages/news/newsDetail.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="titlt">
|
||||
<view class="title_left">
|
||||
{{data.title}}
|
||||
</view>
|
||||
<view class="title_time">
|
||||
{{data.createTime}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<rich-text :nodes="nodes"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
noticeDetail
|
||||
} from '@/api/news.js';
|
||||
import parseHtml from '@/untils/html-parser.js'
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: {},
|
||||
data: {},
|
||||
nodes: []
|
||||
}
|
||||
},
|
||||
onLoad({
|
||||
type
|
||||
}) {
|
||||
this.id = type
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.news.data[type].title
|
||||
});
|
||||
uni.$emit('getNewsDetail', (data) => {
|
||||
this.data = data
|
||||
})
|
||||
this.nodes = parseHtml(this.data.content)
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.isRead === 0) {
|
||||
this.$store.dispatch('readNew', {
|
||||
key: this.id,
|
||||
id: this.data.id
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['news']),
|
||||
list() {
|
||||
if (this.id) {
|
||||
return this.news.data[this.id].data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
padding: 10rpx 30rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.title_time {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24rpx;
|
||||
color: #CCCCCC;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.titlt {
|
||||
overflow: hidden;
|
||||
padding: 10rpx 30rpx;
|
||||
|
||||
}
|
||||
|
||||
.title_left {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user