templateD.vue 2.1 KB

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