index.vue 3.79 KB
<template>
<div class='myrelease'>
<navigator class='lecture-item' v-for='(v, i) in lectures' :key='i' :url="'../lectureDetail/main?lrid='+v.lrid" hover-class='hover'>
  <div class='title'>{{v.lecture_title}}</div>
  <div class='abstract'>{{v.lecture_content}}</div>
  <div class='foot'>
    <div class='left'><img src='/static/imgs/time.png'>{{v.lecture_date}}</div>
    <div class='left'><img src='/static/imgs/locate.png'>{{v.comm_Name}}</div>
    <div class='status' v-if='v.is_auditing==0'>审核中</div>
    <div class='status' v-else style='background: tan'>已通过</div>
  </div>
</navigator>
<NoData v-if='loaded && lectures.length==0' paddingTop=0 />
</div>
</template>

<script>
import NoData from '@/components/NoData'
export default {
  components:{NoData},
  data () {
    return {
      lectures:[],
      loaded: false
    }
  },
  methods: {
    loadLectures(){
      this.loaded = false
      wx.showLoading({ title: '正在加载' })
      wx.request({
        url: this.rootUrl + '/lecture/allLecture',
        data: {sessionID: wx.getStorageSync('sessionID')},
        success: res => {
          if(res.statusCode=='500'){
            this.service.getUnionId(this.rootAvatar,this.rootUrl).then(res=>{
              console.log(res)
              this.loadLectures()
            })
          }else{
            this.lectures = []
            this.lectures = res.data
            this.lectures.forEach(v=>{
              v.lecture_date = this.service.correctTime(v.lecture_date)
              v.lecture_content = v.lecture_content.replace(/(<[^>]+>)|(&[a-z]+sp;)/g,'').replace(/\s+/g,' ')
            })
            this.loaded = true
            wx.hideLoading()
          }
        },
        fail: res => {
          wx.hideLoading()
          wx.showToast({ title: '加载失败', icon: 'none' })
        }
      })
    }
  },
  onLoad(){
    this.loadLectures()
  }
}
</script>
<style lang="stylus" scoped>
.myrelease
  position absolute
  min-height 100%
  width 100%
  Background()
.select-box
  position relative
  Flex(flex, center, center)
  Font(30rpx, 56rpx)
  height 100rpx
  .select
    BorderBox()
    border 1px solid #EFEFEF
    border-radius 8rpx
    Flex(flex, space-between, center)
    padding 0 20rpx
    width 70%
    background white
    img
      Height_Width(20rpx)
      transition transform 0.3s
/* .select_img_rotate{
  transform:rotate(180deg); 
} */
.option-box
  position absolute
  top 78rpx
  Height_Width(0, 70%)
  BorderBox()
  overflow-y auto
  border-top 1px solid #EFEFEF
  background white
  transition height 0.2s
  div
    display block
    Border(0, 1px, 1px, 1px)
    padding 5rpx
.list-item
  margin-bottom 20rpx
  padding 0 30rpx
  BorderBox()
  background white
  Border(1px, 0, 1px, 0)
  .title
    Font(30rpx)
    color themeColor
    margin-top 35rpx
  .intro
    Font(26rpx, 35rpx)
    margin 15rpx 0
  .foot
    Flex(flex, , center)
    Font(24rpx)
    color grey
    margin-bottom 30rpx
    .view
      margin-left 30rpx
    .status
      margin 0 0 0 auto
      line-height 35rpx
      border-radius 6rpx
      padding 0 10rpx
      color white
      background themeColor



.lecture-item
  padding-top 20rpx
  background white
  .title
    Font(32rpx, 50rpx, bold)
    margin 0 20rpx 10rpx 20rpx
  .abstract
    margin 0 20rpx
    overflow hidden
    text-overflow ellipsis
    display -webkit-box
    -webkit-line-clamp 3
    -webkit-box-orient vertical
    Font(28rpx, 38rpx)
  .foot
    display flex
    margin 20rpx 20rpx 0 20rpx
    padding-bottom 20rpx
    Border(0,0,1rpx,0)
    .left
      margin-right 20rpx
      Flex(flex,,center)
      Font(28rpx)
      color grey
      img
        Height_Width(34rpx)
        margin-right 10rpx
    .status
      background themeColor
      color white
      Font(26rpx, 38rpx)
      padding 0 10rpx
      margin 0 0 0 auto
      border-radius 5rpx
</style>