templateD.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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" mode="aspectFit" 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.adsImage === '' && item.linkType === -1) {
  45. return
  46. }else if(item.linkType === -1){
  47. uni.navigateTo({
  48. url:`/h5/pages/activity/activity-detail?adsImage=${item.adsImage}&title=${item.name}`
  49. })
  50. }else{
  51. caimeiApi.FlooryNavigateTo(item)
  52. }
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss">
  58. .article-list {
  59. width: 100%;
  60. height: auto;
  61. box-sizing: border-box;
  62. .section {
  63. width: 339rpx;
  64. height: 412rpx;
  65. background: #ffffff;
  66. box-sizing: border-box;
  67. border-radius: 16rpx;
  68. float: left;
  69. margin-right: 24rpx;
  70. margin-top: 24rpx;
  71. &:nth-child(2n){
  72. margin-right: 0;
  73. }
  74. &:nth-child(1),&:nth-child(2){
  75. margin-top: 0;
  76. }
  77. .cover {
  78. width: 339rpx;
  79. height: 240rpx;
  80. border-radius: 16rpx 16rpx 0 0;
  81. overflow: hidden;
  82. .cover-gg{
  83. width: 339rpx;
  84. height: 240rpx;
  85. }
  86. }
  87. .article-text {
  88. width: 339rpx;
  89. box-sizing: border-box;
  90. padding: 24rpx;
  91. .title {
  92. font-size: 26rpx;
  93. height: 37rpx;
  94. color: #3a3a3a;
  95. margin-bottom: 16rpx;
  96. word-break: break-all;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. display: -webkit-box;
  100. -webkit-line-clamp: 1;
  101. -webkit-box-orient: vertical;
  102. }
  103. .content {
  104. font-size: 24rpx;
  105. line-height: 40rpx;
  106. color: #8a8a8a;
  107. word-break: break-all;
  108. overflow: hidden;
  109. text-overflow: ellipsis;
  110. display: -webkit-box;
  111. -webkit-line-clamp: 2;
  112. -webkit-box-orient: vertical;
  113. }
  114. }
  115. }
  116. }
  117. </style>