Blame view

src/pages/lawlist/index.vue 8.6 KB
ce4c83ff   wxy   初始提交
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
  <template>
    <div class="content">
      <!--搜索-->
      <div class="search_box">
        <input placeholder="请输入关键词..." class="search" v-model="keywords">
        <!--<navigator class="mic_icon"><img src='/static/imgs/mic_icon.png'></navigator>-->
      </div>
      <span class="search_btn"  @click="search">搜索</span>
      <div class="clear"></div>
      <!--搜索-->
      <!--类别-->
      <div class="tab_box" v-if="type == 'flfg'">
          <div v-for='(v,i) in FGArray' :key='i' class="tab " @click="checkedBox(i,v.type)" v-bind:class="{ checked:changeOne == i}">{{v.title}}</div>
      </div>
      <div class="tab_box" v-if="type == 'cpal'">
         <div  v-for='(v,i) in AlArray' :key='i' class="tab5 "  @click="checkedBox(i,v.type)" v-bind:class="{ checked:changeOne == i}">{{v.title}}</div>
      </div>
      <div class="tab_box" v-if="type == 'cpws'">
        <div  v-for='(v,i) in WsArray' :key='i' class="tab6 "  @click="checkedBox(i,v.type)" v-bind:class="{ checked:changeOne == i}">{{v.title}}</div>
      </div>
      <!--类别-->
      <!--列表-->
      <div class="list_box">
        <navigator v-for='(v,i) in lists' :key='i' :url="'../lawinfo/main?title='+title+'&gid='+v.itemgid+'&lib='+lib">
          <div class="list">
            <p v-if="v.itemvalue =='' || v.itemvalue ==null"><rich-text :nodes="v.itemtitle"></rich-text></p>
            <p v-else><rich-text :nodes="v.itemvalue"></rich-text></p>
            <span>{{v.itemftitle}}</span>
          </div>
        </navigator>
      </div>
      <!--列表-->
      <div v-if='lists.length>0 && !all_data_loaded' class='three-dot-box'>
        <div class="dot-flashing"></div>
      </div>
      <div v-else-if='lists.length>0' class='all-load-foot'>已经到底了……</div>
    </div>
  </template>
  
  
  <script>
    export default {
      data() {
        return {
          all_data_loaded: false,
          keywords: '',
          lib: '',
          changeOne: 0,
          lists: [],
          type: '',
          typeChild: '',
          title: '',
          pagenum: 0,
          pagesize: 20,
          keyTitle: '',
          keyContent: '',
          anyou: '',
          Fdate_b: '',
          Fdate_e: '',
          FGArray: [
            { type:'gjfl', title: '国家法律'},
            { type:'dffg',title: '地方法规'},
            { type:'lfzl',title: '立法资料'},
            { type:'sfzl',title: '司法资料'}
          ],
          WsArray: [
            { type:'ms', title: '民事'},
            { type:'xs',title: '刑事' },
            { type:'xz',title: '行政' },
            { type:'zx',title: '执行' },
            { type:'pc',title: '赔偿' },
            { type:'zscq',title: '知识产权' }
          ],
          AlArray : [
            { type:'ms', title: '民事'},
            { type:'xs',title: '刑事' },
            { type:'xz',title: '行政' },
            { type:'zx',title: '执行' },
            { type:'pc',title: '赔偿' }
          ],
          loaded: false
        }
      },
      methods: {
        loadArticles () {
          this.pagenum = 1
          this.getList(this.pagenum)
        },
        getList (pagenum) {
          this.keyContent = this.keywords
          this.keyTitle = this.keywords
          this.anyou = this.keywords
          var path = ''
          console.log(this.typeChild)
          var TypesOf = this.type
          if (TypesOf == 'flfg') {
            if(this.typeChild == ''){
              this.typeChild = 'gjfl'
            }
            path = 'reg/getLawsRegulationsList'
          }else if(TypesOf == 'cpws'){
            path = 'reg/getLawReferee'
            if(this.typeChild == ''){
              this.typeChild = 'ms'
            }
            this.lib = 'cpws_cp'
          }else if(TypesOf == 'cpal'){
            path = 'reg/getLawCase'
            if(this.typeChild == ''){
              this.typeChild = 'ms'
            }
            this.lib = 'cpws_al'
          }
          if (this.typeChild == 'gjfl'){
            this.lib = 'zyfl'
          } else if (this.typeChild=='dffg'){
            this.lib = 'dffl'
          }else if(this.typeChild=='lfzl'){
            this.lib = 'lf'
          }else if(this.typeChild=='sfzl'){
            this.lib = 'sf'
          }
          console.log(this.lib)
          wx.showLoading({ title: '正在加载' })
          wx.request({
            url: this.rootUrl + path,
            method: 'get',
            header: {'content-type': 'application/x-www-form-urlencoded'},
            data:{
              pagenum: ++this.pagenum,
              pagesize: this.pagesize,
              keyTitle: this.keyTitle,
              keyContent: this.keyContent,
              anyou: this.anyou,
              type: this.typeChild,
              Fdate_b: this.Fdate_b,
              Fdate_e: this.Fdate_e,
              sessionID: wx.getStorageSync('sessionID')
            },
            success: res=> {
              if(res.statusCode=='500'){
                this.service.getUnionId(this.rootAvatar,this.rootUrl).then(res=>{
                  console.log(res)
                  this.loadArticles()
                })
              }else{
                console.log(1,res)
                if(res.data.value.length>0){
                  if(res.data.value.length<this.pagesize){
                    this.all_data_loaded = true
                  }else{
                    this.all_data_loaded = false
                  }
                }else {
                  this.all_data_loaded = true
                }
                console.log(this.pagenum)
                this.setLawyerData(res.data.value)
              }
            },
            fail: res=> {
              console.log(res)
            }
          })
        },
        setLawyerData(arr){
          const lists = [...this.lists,...arr]
          console.log(lists)
          console.log(this.lists)
          this.lists = []
          this.lists = lists
          this.loaded = true
          wx.hideLoading()
        },
        checkedBox: function (index,typeChild) {
          this.changeOne = index
          this.typeChild = typeChild
          this.lists = []
          this.pagenum = 1
          this.getList(this.pagenum)
        },
        search () {
          this.pagenum = 1
          this.lists = []
          this.getList(this.pagenum)
        }
      },
      onLoad(){
        this.title = this.$root.$mp.query.title
        this.type = this.$root.$mp.query.type
        this.keywords = this.$root.$mp.query.keywords
        console.log(this.keywords)
        wx.setNavigationBarTitle({title: this.title})
      },
      onReachBottom() {
        if(!this.all_data_loaded){
        const pagenum=++this.pagenum
          this.getList(pagenum)
        }
      },
      onShow() {
        this.loadArticles()
      },
      onUnload(){
        this.lists = []
        this.typeChild = ''
        this.keywords=''
        this.changeOne = 0
        this.lib = ''
        this.pagenum=0
        this.loaded = false
      }
    }
  </script>
  <style lang="stylus" scoped>
    .clear
      clear both
    .content
      margin 0 3%
      width 94%
      font-size 30rpx
    .search_box
      float left
      width 80%
      margin 30rpx 0
      height 80rpx
      padding 0 20rpx
      background #eee
      border-radius 40rpx
    .mic_icon
      float right
      width 80rpx
      height 80rpx
    .mic_icon img
      width 100%
      height 100%
    .search
      float left
      width 80%
      height 80rpx
      padding 0 10rpx
      line-height 80rpx
      color #333
    .search_btn
      margin 30rpx 0
      float right
      line-height 80rpx
    .tab_box
      width 100%
    .tab_box div
      margin 0 5rpx 8rpx 0
      display inline-flex
      background-color #dedede
      justify-content center
      align-items center
      line-height 80rpx
      border-radius 8rpx
    .tab
      width 24%
    .tab5
      width 19%
    .tab6
      width 16%
      font-size 25rpx
    .checked
      background-color #aa001a !important
      color #fff !important
    .list_box
      width 100%
      background-color #fff
    .list
      padding 20rpx 0
      border-bottom 1px solid #dedede
    .list p
      margin-bottom 10rpx
      line-height 40rpx
      overflow hidden
      text-overflow ellipsis
      display -webkit-box
      -webkit-line-clamp 2
      -webkit-box-orient vertical
    .list span
      font-size 28rpx
      color #999
    .line
      margin 0 20rpx
      color #999
   /* .three-dot-box .dot-flashing
        position relative
        height 15rpx
        width 15rp
        border-radius 10rpx
        background #aa001a
        color #aa001a
        animation dotFlashing 1s infinite linear alternate
        animation-delay 0.5s
    .three-dot-box .dot-flashing::before,
    .three-dot-box .dot-flashing::after
      content ''
      display inline-block
      position absolute
      height 15rpx
      width 15rpx
      top 0
      border-radius 10rpx
      background #aa001a
      color #aa001a
      animation dotFlashing 1s infinite alternate
      background #aa001a
    .three-dot-box .dot-flashing::before
      left -30rpx
      animation-delay 0
    .three-dot-box .dot-flashing::after
      left 30rpx
      animation-delay: 1s*/
    .all-load-foot
      width 100%
      font 30rpx/70rpx false
      text-align center
      color #999
  
  </style>