articleList.vue 2.5 KB

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