index.vue 1.46 KB
<template>
<div class='container'>
  <p class="title">{{title}}</p>
  <div class="info">
    <p>{{content}}</p>
  </div>
  <p class="inscribe">{{createDate}}</p>
  <p class="inscribe">{{name}}</p>
</div>
</template>

<script>
export default {
  data() {
    return {
      news: null,
      title: '',
      content: '',
      createDate: '',
      name: ''
    }
  },
  methods: {
    getNewsById()  {
      wx.request({
        url: this.rootUrl + '/message/getSysNewsById',
        data: { sessionID: wx.getStorageSync('sessionID'),
          id: this.$root.$mp.query.id},
        success: res => {
          console.log(res.data)
          this.news = res.data
          this.createDate = this.service.correctTime(res.data.createDate,'full')
          this.title = res.data.title
          this.content = res.data.content
          this.name = res.data.name
        }
      })
    }
  },
  onShow() {
    this.getNewsById()
  }
}
</script>
<style lang="stylus" scoped>
.container
  position absolute
  Height_Width(100%)
  background-color #fff
  padding 30rpx
  box-sizing border-box
.title
  margin-bottom 30rpx
  font-size 34rpx
  color #000
  font-weight bold
  line-height 60rpx
  overflow hidden
  text-overflow ellipsis
  display -webkit-box
  -webkit-line-clamp 2
  -webkit-box-orient vertical
.info
  margin 30rpx 0
  color #333
  font-size 30rpx
  line-height 60rpx
.info p
  text-indent 60rpx
.inscribe
  color #666
  font-size 30rpx
  text-align right
  line-height 60rpx
</style>