index.vue
3.96 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
151
152
153
<template>
<div class='content'>
<!--分类跳转-->
<div class="classify">
<navigator v-for='(v,i) in typeArray' :key='i' @click="checkedBox(i,v.type,v.title)" v-bind:class="{ checked:changeOne == i}">{{v.title}}</navigator>
</div>
<!--分类跳转-->
<!--搜索-->
<div class="search_box">
<input placeholder="请输入关键词..." class="search" v-model="keywords">
<span class="search_icon" @click="searchOf()"><img src='/static/imgs/search_icon.png'></span>
</div>
<!--搜索-->
</div>
</template>
<script>
import NoData from '@/components/NoData'
export default {
components:{NoData},
data() {
return {
keywords: '',
lists: [],
type: 'flfg',
title: '法律法规',
changeOne: 0,
typeArray: [
{type:'flfg', title: '法律法规' },
{ type:'cpws',title: '裁判文书' },
{ type:'cpal',title: '裁判案例' }
],
valid: false,
loaded: false
}
},
methods: {
loadArticles () {
wx.request({
url: this.rootUrl + 'reg/getAll',
method: 'get',
header: { 'content-type': 'application/x-www-form-urlencoded' },
data: { sessionID: wx.getStorageSync('sessionID') },
success: res => {
console.log(res.data)
if (res.statusCode == '500') {
this.service.getUnionId(this.rootAvatar, this.rootUrl).then(res => this.getSchedule(showLoading))
} else {
this.valid = res.data
}
}
})
},
checkedBox: function (index,type,title) {
this.changeOne = index
this.type = type
this.title = title
console.log(this.keywords)
// this.getList()
},
searchOf: function () {
let valid = this.valid
if(valid === true){
wx.navigateTo({
url: '../lawlist/main?keywords='+this.keywords+'&title='+this.title+'&type='+this.type,
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
acceptDataFromOpenedPage: function(data) {
console.log(data)
},
someEvent: function(data) {
console.log(data)
}
},
success: function(res) {
// 通过eventChannel向被打开页面传送数据
}
})
}else{
wx.showModal({
title:'',
content: '该功能试用期已到,请联系管理员',
showCancel: false,
confirmText: '知道了'
})
}
}
},
onLoad(){
// this.title = this.$root.$mp.query.title
// this.type = this.$root.$mp.query.type
// wx.setNavigationBarTitle({title: this.title})
this.keywords = ''
this.changeOne = 0
this.lib = ''
},
onShow() {
this.loadArticles()
},
onUnload(){
this.lists = []
this.keywords = ''
this.loaded = false
}
}
</script>
<style lang="stylus" scoped>
.content
margin 0 3%
width 94%
font-size 30rpx
.search_box
margin 30rpx 0
height 80rpx
padding 0 20rpx
background #eee
border-radius 40rpx
.search_icon
float right
display inline-block
width 80rpx
height 80rpx
.search_icon img
width 100%
height 100%
.search
float left
width 80%
height 80rpx
padding 0 10rpx
line-height 80rpx
color #333
.classify
margin 50rpx 10%
width 80%
padding 25rpx 0
.classify navigator
margin-right 1%
display inline-block
width 32%
height 80rpx
background-color #eee
color #333
line-height 80rpx
text-align center
border-radius 8rpx
.classify navigator.checked
background-color #aa001a !important
color #fff !important
.classify navigator:last-child
border-right none !important
</style>