index.vue 3.74 KB
<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>