news.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view style="background-color: #FFFFFF;min-height: 100vh;">
  3. <view class="nav_section" v-if="list.length>0">
  4. <view v-for="(item, index) in list" :key="index" class="nav_section_items">
  5. <view class="section_cont">
  6. <view class="section_cont_tel">
  7. <text class="title">{{item.noticeTitle}}</text>
  8. </view>
  9. <view class="section_cont_tel">
  10. <text class="content">{{item.noticeContent}}</text>
  11. </view>
  12. <view class="section_cont_tel">
  13. <text class="date">{{item.createDate}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="default" v-if="list==null || list.length==0">
  19. <image src="/static/common/empty.png" mode="heightFix"></image>
  20. <view>
  21. <text>没有消息</text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. var util = require("../../../utils/util.js"); //获取app实例
  28. //获取app实例
  29. var app = getApp();
  30. export default {
  31. data() {
  32. return {
  33. list: null
  34. };
  35. },
  36. components: {},
  37. props: {},
  38. /**
  39. * 生命周期函数--监听页面加载
  40. */
  41. onLoad: function(options) {
  42. this.getNotice();
  43. },
  44. methods: {
  45. //获取公告消息
  46. getNotice: function() {
  47. var that = this;
  48. let params = {};
  49. params['member_id'] = app.globalData.member.id; //发布目标渠道 1-app 2-小程序,
  50. params['push_target'] = 2;
  51. let operation = 'member/getNotices';
  52. app.globalData.postRequest(params, operation, function(res) {
  53. console.info("获取结果:" + res.data.result_msg); //获取成功
  54. if (res.data.result_code == 1) {
  55. let list = res.data.list;
  56. for (let i in list) {
  57. list[i].createDate = util.formatTime(list[i].createDate);
  58. }
  59. that.setData({
  60. list: list
  61. });
  62. }
  63. });
  64. }
  65. }
  66. };
  67. </script>
  68. <style>
  69. /* pages/myHome/myHome.wxss */
  70. page {
  71. overflow-y: scroll;
  72. }
  73. .nav_section {
  74. width: 100%;
  75. }
  76. .nav_section_items {
  77. display: flex;
  78. flex-direction: row;
  79. justify-content: space-between;
  80. padding: 30rpx;
  81. border-bottom: 2rpx solid #ddd;
  82. position: relative;
  83. background: #fff;
  84. }
  85. .nav_section_items:active {
  86. background: #ddd;
  87. }
  88. .nav_section_items .section_cont .section_cont_sub {
  89. font-size: 30rpx;
  90. line-height: 50rpx;
  91. margin-bottom: 10rpx;
  92. }
  93. .section_cont_tel .title {
  94. font-size: 28rpx;
  95. color: #1f1f1f;
  96. }
  97. .section_cont_tel {
  98. line-height: 60rpx;
  99. }
  100. .section_cont_tel .content {
  101. font-size: 32rpx;
  102. color: #080808;
  103. }
  104. .section_cont_tel .date {
  105. font-size: 24rpx;
  106. color: #868686;
  107. }
  108. .default {
  109. text-align: center;
  110. position: fixed;
  111. left: 50%;
  112. top: 40%;
  113. transform: translate(-50%, -50%);
  114. }
  115. .default text {
  116. color: #AAAAAA;
  117. }
  118. .default image {
  119. height: 160rpx;
  120. display: inline-block;
  121. }
  122. </style>