encyclopedia-list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="material-wrapper">
  3. <view class="encyclopedia-list">
  4. <view class="encyclopedia-item" v-for="item in list" :key="item.productId" @click="onToDetail(item)">
  5. <view class="cover"><image :src="item.image"></image></view>
  6. <view class="content">
  7. <view class="title" v-text="item.name"></view>
  8. <view class="description" v-text="item.discription"></view>
  9. <view class="question">
  10. <template v-for="(querytion, index) in item.questionList">
  11. <view class="item" v-text="querytion" :key="index"></view>
  12. </template>
  13. </view>
  14. <view class="tag-list">
  15. <view class="tag">常见问题</view>
  16. <view class="tag">效果展示</view>
  17. <view class="tag">技术原理</view>
  18. <view class="tag">术前术后</view>
  19. </view>
  20. <view class="foot">
  21. <text class="date">{{ item.publishTime | dateFormat }}</text>
  22. <text class="view">浏览量:{{ item.pv }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. list: {
  33. type: Array,
  34. default: () => []
  35. }
  36. },
  37. created() {
  38. console.log('encyclopedia-list')
  39. },
  40. methods: {
  41. onToDetail(item) {
  42. let URL_CONFIG = ''
  43. if (process.env.NODE_ENV === 'development') {
  44. URL_CONFIG = 'http://zzjtest.gz.aeert.com'
  45. } else {
  46. URL_CONFIG = 'https://www.caimei365.com/'
  47. }
  48. const link = `${URL_CONFIG}/encyclopedia/instrument-${item.productId}.html`
  49. this.$api.navigateTo(`/pages/h5/activity/activity?link=${link}&title=${item.name}`)
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. /* scss中可以用mixin来扩展 */
  56. @mixin ellipsis($line: 1) {
  57. overflow: hidden;
  58. text-overflow: ellipsis;
  59. display: -webkit-box;
  60. -webkit-line-clamp: $line;
  61. -webkit-box-orient: vertical;
  62. }
  63. .material-wrapper {
  64. .encyclopedia-item {
  65. display: flex;
  66. padding: 32rpx;
  67. border-top: 1rpx solid #e1e1e1;
  68. &:first-child {
  69. border-top: 0;
  70. }
  71. .cover {
  72. width: 220rpx;
  73. height: 220rpx;
  74. flex-shrink: 0;
  75. image {
  76. display: block;
  77. width: 100%;
  78. height: 100%;
  79. }
  80. }
  81. .content {
  82. flex: 1;
  83. margin-left: 24rpx;
  84. .title {
  85. @include ellipsis(1);
  86. font-size: 28rpx;
  87. color: #333;
  88. line-height: 40rpx;
  89. height: 40rpx;
  90. font-weight: bold;
  91. }
  92. .description {
  93. @include ellipsis(2);
  94. font-size: 24rpx;
  95. color: #666666;
  96. margin-top: 15rpx;
  97. margin-bottom: 28rpx;
  98. line-height: 32rpx;
  99. height: 64rpx;
  100. }
  101. .question {
  102. .item {
  103. @include ellipsis(1);
  104. font-size: 22rpx;
  105. color: #999999;
  106. line-height: 30rpx;
  107. height: 30rpx;
  108. margin-top: 8rpx;
  109. }
  110. }
  111. .tag-list {
  112. display: flex;
  113. align-items: center;
  114. margin-top: 20rpx;
  115. .tag {
  116. height: 40rpx;
  117. padding: 0 8rpx;
  118. color: #F3B574;
  119. font-size: 22rpx;
  120. background: #fef6f3;
  121. margin-right: 8rpx;
  122. line-height: 40rpx;
  123. &:last-child {
  124. margin-right: 0;
  125. }
  126. }
  127. }
  128. .foot {
  129. display: flex;
  130. justify-content: space-between;
  131. color: #999999;
  132. font-size: 22rpx;
  133. margin-top: 24rpx;
  134. }
  135. }
  136. }
  137. }
  138. </style>