templateA.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="container article-list">
  3. <view
  4. class="section clearfix"
  5. v-for="(item, index) in productList"
  6. :key="index"
  7. @click="navigaitionTo(item)"
  8. >
  9. <image :src="item.appletsImage" class="cover"></image>
  10. <view class="article-text">
  11. <view class="title">{{ item.name }}</view>
  12. <view class="content" v-text="item.content"></view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import caimeiApi from '@/common/config/caimeiApi.js'
  19. export default {
  20. data() {
  21. return {
  22. productList: []
  23. }
  24. },
  25. props: {
  26. pageData: {
  27. type: Object
  28. },
  29. userIdentity: {
  30. type: Number
  31. },
  32. flag: {
  33. type: Boolean,
  34. default: false
  35. }
  36. },
  37. created() {
  38. this.initData(this.pageData)
  39. },
  40. methods: {
  41. initData(data) {
  42. if (this.flag) {
  43. this.productList = data.floorImageList
  44. } else {
  45. this.productList = data.floorImageList.slice(0, 4)
  46. }
  47. },
  48. navigaitionTo(item) {
  49. if(item.link){
  50. uni.navigateTo({
  51. url: `/pages/h5/article/path?link=${item.link}`
  52. })
  53. }
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .article-list {
  60. width: 100%;
  61. height: auto;
  62. box-sizing: border-box;
  63. .section {
  64. width: 702rpx;
  65. height: 250rpx;
  66. background: #ffffff;
  67. margin-bottom: 24rpx;
  68. box-sizing: border-box;
  69. padding: 24rpx;
  70. border-radius: 16rpx;
  71. .cover {
  72. float: left;
  73. width: 202rpx;
  74. height: 202rpx;
  75. margin-right: 20rpx;
  76. }
  77. .article-text {
  78. width: 432rpx;
  79. float: left;
  80. .title {
  81. font-size: 26rpx;
  82. height: 37rpx;
  83. color: #3a3a3a;
  84. margin-bottom: 18rpx;
  85. word-break: break-all;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. display: -webkit-box;
  89. -webkit-line-clamp: 1;
  90. -webkit-box-orient: vertical;
  91. }
  92. .content {
  93. font-size: 24rpx;
  94. line-height: 38rpx;
  95. color: #8a8a8a;
  96. word-break: break-all;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. display: -webkit-box;
  100. -webkit-line-clamp: 4;
  101. -webkit-box-orient: vertical;
  102. }
  103. }
  104. }
  105. }
  106. </style>