flList.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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_input[0]" 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 = data;
  40. // this.list.forEach(e =>{
  41. // e.add_time = getTime(e.add_time)
  42. // })
  43. })
  44. },
  45. navToList(id) {
  46. uni.navigateTo({
  47. url: '/pages/category/detail?id=' + id
  48. });
  49. }
  50. }
  51. };
  52. </script>
  53. <style lang="scss">
  54. page,
  55. .content {
  56. height: auto;
  57. min-height: 100%;
  58. background: #f5f5f5;
  59. }
  60. .main {
  61. margin-top: 20rpx;
  62. background: #ffffff;
  63. .first {
  64. padding: 50rpx 0 18rpx;
  65. margin: 0 22rpx;
  66. border-bottom: 1px solid #e0e0e0;
  67. .title {
  68. font-size: 32rpx;
  69. font-family: PingFang SC;
  70. font-weight: bold;
  71. color: #333333;
  72. }
  73. .image {
  74. width: 710rpx;
  75. height: 400rpx;
  76. background: #4cd964;
  77. margin-top: 20rpx;
  78. image {
  79. width: 100%;
  80. height: 100%;
  81. }
  82. }
  83. .time {
  84. margin-top: 20rpx;
  85. font-size: 26rpx;
  86. font-family: PingFang SC;
  87. font-weight: 500;
  88. color: #666666;
  89. }
  90. }
  91. .item {
  92. padding: 26rpx 0 18rpx;
  93. margin: 0 22rpx;
  94. justify-content: flex-start;
  95. align-items: flex-start;
  96. border-bottom: 1px solid #e0e0e0;
  97. .item-left {
  98. width: 224rpx;
  99. height: 160rpx;
  100. background: #DC4D46;
  101. image {
  102. width: 100%;
  103. height: 100%;
  104. }
  105. }
  106. .item-right {
  107. width: 458rpx;
  108. height: 160rpx;
  109. margin-left: 24rpx;
  110. padding: 18rpx 0;
  111. display: flex;
  112. flex-direction: column;
  113. justify-content: space-between;
  114. .item-font {
  115. font-size: 32rpx;
  116. font-family: PingFang SC;
  117. font-weight: bold;
  118. color: #333333;
  119. }
  120. .item-time {
  121. font-size: 28rpx;
  122. font-family: PingFang SC;
  123. font-weight: 500;
  124. color: #666666;
  125. }
  126. }
  127. }
  128. }
  129. </style>