buy.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="buy-page">
  3. <view class="list-wrap">
  4. <view class="flex item" v-for="item in list" :key="item.report_id" @click="goDetail(item)">
  5. <view class="img">
  6. <text class="num" v-if="item.stage">{{item.stage}}</text>
  7. </view>
  8. <view class="content-box">
  9. <view class="van-ellipsis title">{{item.title}}</view>
  10. <view class="van-ellipsis intro">{{item.content}}</view>
  11. </view>
  12. <view class="time">{{item.time|showTime}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. const moment=require('@/utils/moment-with-locales.min')
  19. moment.locale('zh-cn');
  20. import {apiBuyList} from '@/api/buy.js'
  21. export default {
  22. filters: {
  23. showTime(e){
  24. // 判断是否为今年
  25. const isYear=moment(e).isBefore(new Date(), 'year');
  26. if(isYear){
  27. return moment(e).format("YYYY年MM月DD日");
  28. }else{
  29. const isDay=moment(e).isBefore(new Date(), 'day');
  30. if(isDay){
  31. return moment(e).format("MM月DD日");
  32. }else{
  33. const hour=moment(e).hour()
  34. return hour<12?`上午 ${moment(e).format('hh:mm')}`:`下午 ${moment(e).format('hh:mm')}`
  35. }
  36. }
  37. }
  38. },
  39. data () {
  40. return {
  41. list:[
  42. {
  43. "report_id": 1631,
  44. "report_chapter_id": 0,
  45. "activity_id": 0,
  46. "classify_id_first": 75,
  47. "classify_name_first": "双周报",
  48. "classify_id_second": 76,
  49. "classify_name_second": "橡胶双周报",
  50. "title": "橡胶双周报",
  51. "content": "【第1期|FICC| 橡胶双周报】双周报",
  52. "stage": 1,
  53. "time": "2022-03-09T13:19:13+08:00",
  54. "unread": 3
  55. },
  56. {
  57. "report_id": 0,
  58. "report_chapter_id": 0,
  59. "activity_id": 253,
  60. "classify_id_first": 0,
  61. "classify_name_first": "",
  62. "classify_id_second": 0,
  63. "classify_name_second": "",
  64. "title": "防守打法发水电费",
  65. "content": "主讲:秦钏",
  66. "stage": 0,
  67. "time": "2022-03-09T09:59:47+08:00",
  68. "unread": 0
  69. },
  70. {
  71. "report_id": 836,
  72. "report_chapter_id": 0,
  73. "activity_id": 0,
  74. "classify_id_first": 52,
  75. "classify_name_first": "行业调研",
  76. "classify_id_second": 53,
  77. "classify_name_second": "寻根知本",
  78. "title": "寻根知本(10月第一期)",
  79. "content": "【第1期|FICC| 寻根知本】行业调研",
  80. "stage": 1,
  81. "time": "2022-03-03T14:18:24+08:00",
  82. "unread": 4
  83. },
  84. {
  85. "report_id": 1073,
  86. "report_chapter_id": 0,
  87. "activity_id": 0,
  88. "classify_id_first": 56,
  89. "classify_name_first": "权益研报",
  90. "classify_id_second": 57,
  91. "classify_name_second": "近期路演精华",
  92. "title": "短保早餐行业龙头商业模式分析",
  93. "content": "【第1期|FICC| 近期路演精华】权益研报",
  94. "stage": 1,
  95. "time": "2022-03-02T15:41:29+08:00",
  96. "unread": 1
  97. }
  98. ]
  99. }
  100. },
  101. onLoad(){},
  102. onShow() {
  103. // this.getList()
  104. },
  105. methods: {
  106. async getList(){
  107. const res=await apiBuyList()
  108. },
  109. goDetail(item){
  110. uni.navigateTo({ url: `/pages-buy/detail?classify_id_first=${item.classify_id_first}&activity_id=${item.activity_id}` })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .buy-page{
  117. .list-wrap{
  118. padding: 30rpx 34rpx;
  119. .item{
  120. padding: 30rpx 0;
  121. border-bottom: 1px solid $global-border-color;
  122. align-items: center;
  123. .img{
  124. flex-shrink: 0;
  125. margin-right: 28rpx;
  126. width: 120rpx;
  127. height: 120rpx;
  128. background-color: $global-bg-color-grey;
  129. position: relative;
  130. border-radius: 14rpx;
  131. .num{
  132. position: absolute;
  133. top: 0;
  134. right: 0;
  135. transform: translate(50%,-50%);
  136. display: inline-block;
  137. box-sizing: border-box;
  138. min-width: 20rpx;
  139. padding: var(--van-badge-padding);
  140. color: #fff;
  141. font-size: $global-font-size-mini;
  142. line-height: 1.2;
  143. text-align: center;
  144. background: #ee0a24;
  145. border-radius: 28rpx;
  146. padding: 2rpx 4rpx;
  147. }
  148. }
  149. .content-box{
  150. flex: 1;
  151. overflow: hidden;
  152. .title{
  153. font-size: 14px;
  154. font-weight: bold;
  155. margin-bottom: 18rpx;
  156. }
  157. .intro{
  158. color: $global-text-color-grey;
  159. }
  160. }
  161. .time{
  162. font-size: $global-font-size-sm;
  163. color: $global-text-color-grey;
  164. flex-shrink: 0;
  165. margin-left: 20rpx;
  166. }
  167. }
  168. }
  169. }
  170. </style>