zw-waterfall-item.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="card-item" @click="onOpen(dataVal)">
  3. <template v-if="dataVal">
  4. <view class="card-img lazy-falls-img">
  5. <!-- <u-image class="service-img" mode="aspectFill" :lazy-load="true"></u-image> -->
  6. <u-lazy-load threshold="-450" border-radius="10" :image="$getImgPath(dataVal.informationThumbnail)"
  7. height="313rpx" :index="`img_${dataVal.informationTypeId}`"></u-lazy-load>
  8. </view>
  9. <!-- <image :src="dataVal.informationThumbnail" mode="aspectFill"></image> -->
  10. <view class="card-info-box">
  11. <text class="card-title zw-two-row">{{dataVal.informationTitle}}</text>
  12. <view class="card-info">
  13. <!-- <image class="card-info-icon" src="../../logo.png" mode="scaleToFill"></image> -->
  14. <text class="card-info-name zw-one-row">{{dataVal.informationAuthor}}</text>
  15. <view class="card-info-nums" v-if="dataVal.browseNum || dataVal.browseNum === 0">
  16. <text v-if="dataVal.collectStatus" class="card-collect is-ok iconfont_yige">&#xe8c3;</text>
  17. <text v-else class="card-collect iconfont_yige">&#xe8ab;</text>
  18. <text class="card-browse">{{getNums(dataVal.browseNum)}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: "zw-waterfall-item",
  28. props: {
  29. idName: {
  30. type: String,
  31. default: "informationId"
  32. },
  33. dataVal: {
  34. type: Object,
  35. default: null
  36. }
  37. },
  38. data() {
  39. return {
  40. };
  41. },
  42. methods: {
  43. onOpen(item) {
  44. uni.navigateTo({
  45. url: `/pages/government/discoverInfo?informationId=${item[this.idName]}`
  46. })
  47. },
  48. getNums(num) {
  49. let nums = num + ''
  50. if (nums > 10000) {
  51. try {
  52. const w = nums.slice(0, nums.length - 4);
  53. const n = nums.substr(nums.length - 4);
  54. const s = n.slice(0, 1);
  55. nums = `${w}${s >= 1 ? '.' + s : ''}涓嘸
  56. }catch{}
  57. }
  58. return nums
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .card-item {
  65. margin-top: 20rpx;
  66. // width: calc(50% - 10rpx);
  67. width: 100%;
  68. // min-height: 468rpx;
  69. background-color: #fff;
  70. border-radius: 20rpx;
  71. overflow: hidden;
  72. .card-img {
  73. width: 100%;
  74. // height: 313rpx;
  75. }
  76. .card-info-box {
  77. width: 100%;
  78. // height: calc(100% - 313rpx);
  79. height: 175rpx;
  80. padding: 20rpx;
  81. display: flex;
  82. flex-direction: column;
  83. justify-content: space-between;
  84. .card-title {
  85. display: inline-block;
  86. width: 100%;
  87. font-size: 28rpx;
  88. line-height: 1.2;
  89. }
  90. }
  91. .card-info {
  92. width: 100%;
  93. // padding: 0 20rpx ;
  94. display: flex;
  95. flex-direction: row;
  96. justify-content: space-between;
  97. align-items: center;
  98. .card-info-icon {
  99. width: 32rpx;
  100. height: 32rpx;
  101. }
  102. .card-info-name {
  103. flex: 1;
  104. font-size: 24rpx;
  105. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  106. font-weight: 400;
  107. color: #999999;
  108. }
  109. .card-info-nums {
  110. flex-shrink: 0;
  111. display: flex;
  112. align-items: center;
  113. .card-collect {
  114. font-size: 28rpx;
  115. }
  116. .is-ok {
  117. color: red;
  118. }
  119. .card-browse {
  120. padding-left: 10rpx;
  121. font-size: 28rpx;
  122. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  123. font-weight: 400;
  124. color: #999999;
  125. }
  126. }
  127. }
  128. }
  129. </style>