article.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="diy-article">
  3. <!--文章列表-->
  4. <view class="article-item" v-for="(item, index) in listData" :class="'show-type__'+ itemData.style.display" :key="index"
  5. @click="gotoPageFunc(item)">
  6. <!-- 有图模式 -->
  7. <template v-if="itemData.style.display == 10">
  8. <view class="d-b-c d-stretch d-c flex-1">
  9. <view class="">
  10. <view class="text-ellipsis f32">
  11. {{ item.article_title }}
  12. </view>
  13. <view class="des text-ellipsis mt10 f24 gray6">
  14. {{ item.dec }}
  15. </view>
  16. </view>
  17. <view class="d-s-c gray9 f26">
  18. <text>{{ item.create_time }}</text>
  19. <text class="ml30">阅读量:</text>
  20. <text class="ml10">{{ item.actual_views }}</text>
  21. </view>
  22. </view>
  23. <view class="picture ml20" v-if="item.image!=null&&item.image.file_path!=''">
  24. <image :src="item.image.file_path" mode="aspectFill"></image>
  25. </view>
  26. </template>
  27. <!-- 无图模式-->
  28. <template v-if="itemData.style.display == 20">
  29. <view class="f32 text-ellipsis lh200">
  30. {{ item.article_title }}
  31. </view>
  32. </template>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. /*数据列表*/
  41. listData: []
  42. };
  43. },
  44. props: ['itemData'],
  45. created() {
  46. this.listData = this.itemData.data;
  47. },
  48. methods: {
  49. /*跳转页面*/
  50. gotoPageFunc(e) {
  51. let _url = 'pages/article/detail/detail?article_id=' + e.article_id;
  52. this.gotoPage(_url);
  53. }
  54. }
  55. };
  56. </script>
  57. <style>
  58. .diy-article {
  59. background: #ffffff;
  60. margin: 20rpx;
  61. border-radius: 12rpx;
  62. }
  63. .diy-article .show-type__10,
  64. .diy-article .show-type__20 {
  65. display: flex;
  66. padding: 30rpx;
  67. border-bottom: 1rpx solid #D9D9D9;
  68. }
  69. .diy-article .show-type__10 .picture {
  70. width: 210rpx;
  71. height: 140rpx;
  72. border-radius: 12rpx;
  73. }
  74. .diy-article .show-type__10 .title {
  75. height: 80rpx;
  76. }
  77. .diy-article .show-type__10 .des {
  78. height: 36rpx;
  79. }
  80. .diy-article image {
  81. width: 100%;
  82. height: 100%;
  83. border-radius: 12rpx;
  84. }
  85. </style>