noticeList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="content">
  3. <view class="list">
  4. <block v-for="(item,index) in pageList" :key="index">
  5. <view class="item vflex">
  6. <view class="hflex acenter">
  7. <!-- <view class="read" v-if="!item.is_read"></view> -->
  8. <view class="name" :class="item.is_read?'':'read'">{{item.title}}</view>
  9. </view>
  10. <view class="container">{{item.summary}}</view>
  11. <view class="hflex acenter jbetween bottom">
  12. <view class="text_style1">{{item.create_time}}</view>
  13. <view class="hflex acenter" @click="toDetail(item.id)">
  14. <view class="text_style2">查看详情</view>
  15. <image src="https://ship-expert.zhousi.hdlkeji.com/common/right.png" mode="widthFix" style="width: 28rpx;"></image>
  16. </view>
  17. </view>
  18. </view>
  19. </block>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. var that = ""
  25. import $api from '@/static/js/api.js'
  26. export default {
  27. data() {
  28. return {
  29. pageList: [
  30. ],
  31. page: 1,
  32. limit: 15,
  33. total: 10
  34. }
  35. },
  36. onLoad() {
  37. that = this
  38. },
  39. onShow() {
  40. var token = uni.getStorageSync('token')
  41. if(!token) {
  42. $api.info('请先登录')
  43. setTimeout(() =>{
  44. $api.jump('/pages/login/code_login')
  45. }, 1000)
  46. }
  47. that.getList()
  48. },
  49. methods: {
  50. getList() {
  51. $api.req({
  52. url: '/data/api.Notice/index',
  53. data: {
  54. page: that.page,
  55. limit: that.limit
  56. }
  57. }, function(res) {
  58. if(res.code == 1) {
  59. if(that.page == 1) {
  60. that.pageList = res.data.data
  61. } else {
  62. that.pageList = that.pageList.concat(res.data.data)
  63. }
  64. that.total = res.data.total
  65. }
  66. })
  67. },
  68. // 打开详情
  69. toDetail(id) {
  70. $api.jump('/page_index/pages/index/noticeDetail?id=' + id)
  71. },
  72. onReachBottom() {
  73. if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
  74. $api.info("没有更多了")
  75. } else {
  76. that.page++
  77. that.getList(that.cid)
  78. }
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .content {
  85. background-color: #f4f4f4;
  86. padding: 20rpx 30rpx 0;
  87. .list {
  88. .item {
  89. margin-bottom: 20rpx;
  90. width: 100%;
  91. background: #fff;
  92. border-radius: 20rpx;
  93. box-sizing: border-box;
  94. padding: 32rpx 20rpx 26rpx;
  95. .read {
  96. position: relative;
  97. }
  98. .read::after {
  99. content: "";
  100. position: absolute;
  101. top: 10rpx;
  102. left: -8rpx;
  103. width: 12rpx;
  104. height: 12rpx;
  105. background-color: #ff4040;
  106. border-radius: 50%;
  107. margin-right: 16rpx;
  108. }
  109. .name {
  110. padding-left: 12rpx;
  111. font-size: 32rpx;
  112. color: #222;
  113. }
  114. .container {
  115. width: 100%;
  116. margin: 24rpx 0 30rpx;
  117. // border-bottom: 1rpx solid #f4f4f4;
  118. font-size: 28rpx;
  119. color: #878787;
  120. line-height: 40rpx;
  121. // margin-bottom: 30rpx;
  122. text-overflow: ellipsis;
  123. overflow: hidden;
  124. display: -webkit-box;
  125. -webkit-box-orient: vertical;
  126. box-orient: vertical;
  127. line-clamp: 2;
  128. -webkit-line-clamp: 2;
  129. }
  130. .bottom {
  131. border-top: 1rpx solid #f4f4f4;
  132. padding-top: 32rpx;
  133. }
  134. .text_style1 {
  135. font-size: 28rpx;
  136. color: #888;
  137. }
  138. .text_style2 {
  139. font-size: 28rpx;
  140. color: #222;
  141. margin-right: 5rpx;
  142. }
  143. }
  144. }
  145. }
  146. </style>