index.vue 4.41 KB
<template>
  <div class="content">
    <div  v-for='(v,i) in lists' :key='i'>
      <p class="title">{{v.itemtitle}}</p>
      <p class="date">公布日期:{{v.fdatetime}}</p>
      <div class="info">
        <rich-text :nodes="v.itemcontent"></rich-text>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        typeChild: '',
        title: '',
        lists: [],
        loaded: false
      }
    },
    methods: {
      loadArticles () {
        wx.showLoading({ title: '正在加载' })
        wx.request({
          url: this.rootUrl + '/reg/getLawsRegulationsContent',
          method: 'get',
          header: {'content-type': 'application/x-www-form-urlencoded'},
          data:{
            gid: this.gid,
            lib:this.lib,
            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(res)
              this.lists = []
              this.lists = res.data.value
              console.log(res.data.value)
              this.loaded = true
              wx.hideLoading()
            }
          },
          fail: res=> {
            console.log(res)
          }
        })
      },
      getList () {
        var path = ''
        if (this.typeChild == 'gjfl'){
          this.lib = 'zyfl'
        } else if (this.typeChild=='gjfg'){
          this.lib = 'dffl'
        }else if(this.typeChild=='lfzl'){
          this.lib = 'lf'
        }else if(this.typeChild=='sfzl'){
          this.lib = 'sf'
        }
        var TypesOf = this.type
        if (TypesOf == 'flfg') {
          this.typeChild = 'gjfg'
          path = 'reg/getLawsRegulationsList'
        }else if(TypesOf == 'cpws'){
          path = 'reg/getLawReferee'
          this.typeChild = 'ms'
          this.lib = 'cpws_cp'
        }else if(TypesOf == 'cpal'){
          path = 'reg/getLawCase'
          this.typeChild = 'ms'
          this.lib = 'cpws_al'
        }
        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)
              this.lists = []
              this.lists = res.data.value
              this.loaded = true
              wx.hideLoading()
            }
          },
          fail: res=> {
            console.log(res)
          }
        })
      },
      checkedBox: function (index,typeChild) {
        this.changeOne = index
        this.typeChild = typeChild
        this.getList()
      },
      search () {
        this.keyContent = this.keywords
        this.keyTitle = this.keywords
        this.anyou = this.keywords
        this.getList()
      }
    },
    onLoad(){
      this.gid = this.$root.$mp.query.gid
      this.lib = this.$root.$mp.query.lib
      this.title = this.$root.$mp.query.title
      wx.setNavigationBarTitle({title: this.title})
    },
    onShow() {
      this.loadArticles()
    },
    onUnload(){
      this.lists = []
      this.loaded = false
    }
  }
</script>
<style lang="stylus" scoped>
  .clear
    clear both
  .content
    margin 0 3%
    width 94%
    font-size 30rpx
  .title
    margin 30rpx 0
    font-size 34rpx
    color #000
    line-height 60rpx
    overflow hidden
    text-overflow ellipsis
    display -webkit-box
    -webkit-line-clamp 2
    -webkit-box-orient vertical
  .date
    color #999
    font-size 28rpx
    text-align right
    line-height 40rpx
  .info
    margin-top 30rpx
    color #333
    font-size 30rpx
    line-height 60rpx
  .info p
    text-indent 60rpx
</style>