index.vue
1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<template>
<div class='container'>
<div class='title'>{{news.info_Title}}</div>
<div class='subhead'>
<div class='tags'>{{news.info_Tag}}</div>
<span>浏览{{news.read_Count}}</span>
<span class='time'>{{news.timeFull}}</span>
</div>
<img v-if='news.title_Pic' :src='rootAvatar + news.title_Pic' mode='widthFix'>
<div class='main'>
<wxParse :content='news.info_Content' noData='加载中……' :imageProp='imageProp'/>
<!-- <rich-text :nodes='content' /> -->
</div>
<div style='width:100%;height:130rpx;'/>
</div>
</template>
<script>
import wxParse from 'mpvue-wxparse'
export default {
components: {
wxParse
},
data() {
return {
news:{},
imageProp:{}
}
},
methods: {
loadNews(i) {
const news = wx.getStorageSync('newsList')[i]
this.news = news
this.addReadTimes(news.jpubid)
},
addReadTimes(jpubid){
wx.request({
url: this.rootUrl + '/jpub/read',
method: 'POST',
header: {'content-type': 'application/x-www-form-urlencoded'},
data:{ jpubid }
})
}
},
onLoad() {
this.imageProp = {mode:'aspectFit', padding: 0, lazyLoad:false, domain:this.rootAvatar.replace('https:','')}
this.loadNews(this.$root.$mp.query.index)
},
onUnload() {
this.news = {}
}
}
</script>
<style lang="stylus" scoped>
@import url('~mpvue-wxparse/src/wxParse.css')
.container
padding 40rpx 30rpx 0 30rpx
.title
Font(40rpx, 60rpx, bold)
.subhead
margin-top 20rpx
Font(28rpx, 40rpx)
Flex(flex,, center)
color #777
.tags
Font(24rpx, 32rpx)
border-radius 8rpx
border 1rpx solid themeColor
color themeColor
padding 0 8rpx
margin-right 20rpx
.time
margin 0 0 0 auto
img
width 100%
margin 30rpx 0
.main
width 100%
Font(30rpx, 40rpx)
text-align justify
</style>