flList.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <view v-for="(item, index) in list">
  5. <view class="item flex" @click="navToList(item.id)">
  6. <view class="item-left"><image :src="item.image" mode=""></image></view>
  7. <view class="item-right">
  8. <view class="item-font clamp">{{item.title}}</view>
  9. <view class="item-time">更新时间:{{item.add_time}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { article } from '@/api/user.js';
  18. import { getTime } from '@/utils/rocessor.js';
  19. export default {
  20. data() {
  21. return {
  22. list: [],
  23. id:'',
  24. };
  25. },
  26. onLoad(option) {
  27. this.id = option.id
  28. this.loadData();
  29. },
  30. methods: {
  31. // 载入数据
  32. async loadData() {
  33. let obj = this;
  34. article({page:1,limit:1000},obj.id).then(({data}) =>{
  35. this.list = data.filter(e => {
  36. console.log(e.id,'123456789')
  37. return (e.id !== 0 && e.id !== 4 )
  38. })
  39. this.list.forEach(e =>{
  40. e.add_time = getTime(e.add_time)
  41. })
  42. })
  43. },
  44. navToList(id) {
  45. uni.navigateTo({
  46. url: '/pages/category/detail?id=' + id
  47. });
  48. }
  49. }
  50. };
  51. </script>
  52. <style lang="scss">
  53. page,
  54. .content {
  55. height: auto;
  56. min-height: 100%;
  57. background: #f5f5f5;
  58. }
  59. .main {
  60. margin-top: 20rpx;
  61. background: #ffffff;
  62. .first {
  63. padding: 50rpx 0 18rpx;
  64. margin: 0 22rpx;
  65. border-bottom: 1px solid #e0e0e0;
  66. .title {
  67. font-size: 32rpx;
  68. font-family: PingFang SC;
  69. font-weight: bold;
  70. color: #333333;
  71. }
  72. .image {
  73. width: 710rpx;
  74. height: 400rpx;
  75. background: #4cd964;
  76. margin-top: 20rpx;
  77. image {
  78. width: 100%;
  79. height: 100%;
  80. }
  81. }
  82. .time {
  83. margin-top: 20rpx;
  84. font-size: 26rpx;
  85. font-family: PingFang SC;
  86. font-weight: 500;
  87. color: #666666;
  88. }
  89. }
  90. .item {
  91. padding: 26rpx 0 18rpx;
  92. margin: 0 22rpx;
  93. justify-content: flex-start;
  94. align-items: flex-start;
  95. border-bottom: 1px solid #e0e0e0;
  96. .item-left {
  97. width: 224rpx;
  98. height: 160rpx;
  99. background: #DC4D46;
  100. image {
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. .item-right {
  106. width: 458rpx;
  107. height: 160rpx;
  108. margin-left: 24rpx;
  109. padding: 18rpx 0;
  110. display: flex;
  111. flex-direction: column;
  112. justify-content: space-between;
  113. .item-font {
  114. font-size: 32rpx;
  115. font-family: PingFang SC;
  116. font-weight: bold;
  117. color: #333333;
  118. }
  119. .item-time {
  120. font-size: 28rpx;
  121. font-family: PingFang SC;
  122. font-weight: 500;
  123. color: #666666;
  124. }
  125. }
  126. }
  127. }
  128. </style>