index.vue
3.74 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<template>
<div class='myrelease'>
<div class='questionbox' v-if='loaded'>
<navigator class='list' v-for='(v,i) in lists' :key='i' :url="'../article/main?LIPID='+v.lipid">
<div class='head'>
<div class='title'>{{v.info_Title}}</div>
</div>
<div class='question-detail'>
<div class='text'>{{v.info_Content}}</div>
<div class='foot'>
<div v-for='(tag,j) in v.info_Tag' :key='j' class='tags'>{{tag}}</div>
<div class='time' v-if='v.is_Top==1'>{{v.createDate}}</div>
<div class='auditing' v-if='v.is_Auditing!=2'>审核中</div>
</div>
</div>
</navigator>
<NoData v-if='lists.length==0' paddingTop=0 />
<!-- <div v-if='lists.length==0' class='no-data'>
暂无内容
<div class='commit' v-if='false'>
<navigator :url="'../releaseArticle/main?type='+type">添加{{type}}
</navigator>
</div>
</div> -->
<!-- <navigator v-else :url="'../releaseArticle/main?type='+type" class='add-button' hover-class='fade'>+</navigator> -->
</div>
</div>
</template>
<script>
import NoData from '@/components/NoData'
export default {
components:{NoData},
data() {
return {
lists: [],
type: '',
loaded: false
}
},
methods: {
loadArticles() {
wx.showLoading({ title: '正在加载' })
wx.request({
url: this.rootUrl + '/pub/getbyliidtype',
method: 'POST',
header: {'content-type': 'application/x-www-form-urlencoded'},
data:{
type: this.type,
sessionID: wx.getStorageSync('sessionID')
},
success: res=> {
if(res.statusCode=='500'){
console.log('eeee')
this.service.getUnionId(this.rootAvatar,this.rootUrl).then(res=>{
console.log(res)
this.loadArticles()
})
}else{
console.log(1,res)
this.lists = []
this.lists = res.data.resquest
this.lists.forEach(v=>{
v.createDate = this.service.correctTime(v.createDate)
v.info_Tag = v.info_Tag.split(',')
v.info_Content = v.info_Content.replace(/(<[^>]+>)|(&[a-z]+sp;)/g,'').replace(/\s+/g,' ')
})
this.loaded = true
wx.hideLoading()
}
},
fail: res=> {
console.log(res)
}
})
}
},
onLoad(){
this.type = this.$root.$mp.query.type
wx.setNavigationBarTitle({title: this.type})
},
onShow() {
this.loadArticles()
},
onUnload(){
this.lists = []
this.loaded = false
}
}
</script>
<style lang="stylus" scoped>
.myrelease
position absolute
Height_Width(100%)
Background()
.questionbox
Background()
.list
padding 26rpx 0
background white
Border(0, 0, 1rpx, 0)
.head
Flex(flex, space-between, center)
padding 0 40rpx 10rpx 40rpx
margin-top -10rpx
.title
Font(32rpx, 50rpx, bold)
.question-detail
background white
.text
margin 0 40rpx
overflow hidden
text-overflow ellipsis
display -webkit-box
-webkit-line-clamp 3
-webkit-box-orient vertical
Font(28rpx, 38rpx)
.foot
Flex(flex, , center)
padding 22rpx 40rpx 0 40rpx
color #777
.tags
background #F5F5F5
Font(24rpx, 34rpx)
padding 0 10rpx
margin-right 10rpx
.time
Font(28rpx)
margin 0 0 0 auto
.auditing
background themeColor
padding 0 10rpx
Font(26rpx, 40rpx)
border-radius 5rpx
color white
margin 0 0 0 auto
.add-button
position fixed
bottom 40rpx
right 40rpx
border-radius 50%
Height_Width(100rpx)
background themeColor
text-align center
Font(100rpx,85rpx)
color white
box-shadow 0 0 10rpx themeColor
</style>