<template>
<view style="background-color: #FFFFFF;min-height: 100vh;">
<view class="nav_section" v-if="list.length>0">
  <view v-for="(item, index) in list" :key="index" class="nav_section_items">
    <view class="section_cont">
      <view class="section_cont_tel">
        <text class="title">{{item.noticeTitle}}</text>
      </view>
      <view class="section_cont_tel">
        <text class="content">{{item.noticeContent}}</text>
      </view>
      <view class="section_cont_tel">
        <text class="date">{{item.createDate}}</text>
      </view>
  
      
    </view>
  </view>
</view>
<view class="default" v-if="list==null || list.length==0">
  <image src="/static/common/empty.png" mode="heightFix"></image>
  <view>
    <text>没有消息</text>
  </view>
</view>
</view>
</template>

<script>
var util = require("../../../utils/util.js"); //获取app实例
//获取app实例
var app = getApp();

export default {
  data() {
    return {
      list: null
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getNotice();
  },
  methods: {
    //获取公告消息
    getNotice: function () {
      var that = this;
      let params = {};
      params['member_id'] = app.globalData.member.id; //发布目标渠道  1-app 2-小程序,

      params['push_target'] = 2;
      let operation = 'member/getNotices';
      app.globalData.postRequest(params, operation, function (res) {
        console.info("获取结果:" + res.data.result_msg); //获取成功

        if (res.data.result_code == 1) {
          let list = res.data.list;

          for (let i in list) {
            list[i].createDate = util.formatTime(list[i].createDate);
          }

          that.setData({
            list: list
          });
        }
      });
    }
  }
};
</script>
<style>
/* pages/myHome/myHome.wxss */
page{
  overflow-y: scroll;
}
.nav_section {
  width: 100%;
}

.nav_section_items {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 30rpx;
  border-bottom: 2rpx solid #ddd;
  position: relative;
  background: #fff;
}

.nav_section_items:active {
  background: #ddd;
}

.nav_section_items .section_cont .section_cont_sub {
  font-size: 30rpx;
  line-height: 50rpx;
  margin-bottom: 10rpx;
}
.section_cont_tel .title{
  font-size: 28rpx;
  color: #1f1f1f;
}
.section_cont_tel{
  line-height: 60rpx;

}
.section_cont_tel .content{

  font-size: 32rpx;
  color: #080808;
}
.section_cont_tel .date{

  font-size: 24rpx;
  color: #868686;
}

.default {  text-align: center;  position: fixed;  left: 50%;  top: 40%;  transform: translate(-50%, -50%);}.default text{	color: #AAAAAA;}.default image {  height: 250rpx;  display: inline-block;}</style>