noticeList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.shipcc.cn/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. that.getList()
  41. },
  42. methods: {
  43. getList() {
  44. $api.req({
  45. url: '/data/api.Notice/index',
  46. data: {
  47. page: that.page,
  48. limit: that.limit
  49. }
  50. }, function(res) {
  51. if(res.code == 1) {
  52. if(that.page == 1) {
  53. that.pageList = res.data.data
  54. } else {
  55. that.pageList = that.pageList.concat(res.data.data)
  56. }
  57. that.total = res.data.total
  58. }
  59. })
  60. },
  61. // 打开详情
  62. toDetail(id) {
  63. var token = uni.getStorageSync('token')
  64. if(!token) {
  65. $api.info('请先登录')
  66. setTimeout(() =>{
  67. $api.jump('/pages/login/password_login')
  68. }, 1000)
  69. } else {
  70. $api.jump('/page_index/pages/index/noticeDetail?id=' + id)
  71. }
  72. },
  73. onReachBottom() {
  74. if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
  75. $api.info("没有更多了")
  76. } else {
  77. that.page++
  78. that.getList(that.cid)
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .content {
  86. background-color: #f4f4f4;
  87. padding: 20rpx 30rpx 0;
  88. .list {
  89. .item {
  90. margin-bottom: 20rpx;
  91. width: 100%;
  92. background: #fff;
  93. border-radius: 20rpx;
  94. box-sizing: border-box;
  95. padding: 32rpx 20rpx 26rpx;
  96. .read {
  97. position: relative;
  98. }
  99. .read::after {
  100. content: "";
  101. position: absolute;
  102. top: 10rpx;
  103. left: -8rpx;
  104. width: 12rpx;
  105. height: 12rpx;
  106. background-color: #ff4040;
  107. border-radius: 50%;
  108. margin-right: 16rpx;
  109. }
  110. .name {
  111. padding-left: 12rpx;
  112. font-size: 32rpx;
  113. color: #222;
  114. }
  115. .container {
  116. width: 100%;
  117. margin: 24rpx 0 30rpx;
  118. // border-bottom: 1rpx solid #f4f4f4;
  119. font-size: 28rpx;
  120. color: #878787;
  121. line-height: 40rpx;
  122. // margin-bottom: 30rpx;
  123. text-overflow: ellipsis;
  124. overflow: hidden;
  125. display: -webkit-box;
  126. -webkit-box-orient: vertical;
  127. box-orient: vertical;
  128. line-clamp: 2;
  129. -webkit-line-clamp: 2;
  130. }
  131. .bottom {
  132. border-top: 1rpx solid #f4f4f4;
  133. padding-top: 32rpx;
  134. }
  135. .text_style1 {
  136. font-size: 28rpx;
  137. color: #888;
  138. }
  139. .text_style2 {
  140. font-size: 28rpx;
  141. color: #222;
  142. margin-right: 5rpx;
  143. }
  144. }
  145. }
  146. }
  147. </style>