designList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view>
  3. <navigator class="list-item" url="#" v-for="(item, index) in list " hover-class="navigator-hover"
  4. :key="item.sat_coursewareid" @click="onClick(index)">
  5. <view style="position: relative;">
  6. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
  7. <block v-if="showStatus">
  8. <view v-if="item.status == '发布'" class="status" style="background: #FFF0F2;color: #E3041F;">
  9. 已审核
  10. </view>
  11. <view v-else class="status">
  12. 未审核
  13. </view>
  14. </block>
  15. <view class="createby-box">
  16. <image class="headpic"
  17. :src="item.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202406011717209838416B6150695f.webp'"
  18. mode="aspectFill" lazy-load="true" />
  19. <view class="name u-line-1">{{ item.createby }}</view>
  20. </view>
  21. </view>
  22. <view class="tips">
  23. <view class="label u-line-1">{{ item.title_c || item.title }}</view>
  24. <view class="iconfont-box">
  25. <text class="iconfont icon-pinglun-hui">
  26. <text style="padding-left: 2px;" />{{ item.commentcount }}
  27. </text>
  28. <text class="iconfont icon-yidianzan">
  29. <text style="padding-left: 2px;" />{{ item.likecount }}
  30. </text>
  31. <text class="iconfont icon-yishoucang">
  32. <text style="padding-left: 2px;" />{{ item.collectcount }}
  33. </text>
  34. </view>
  35. </view>
  36. </navigator>
  37. </view>
  38. </template>
  39. <script>
  40. import { formattedFiles } from "../utils/settleFiles"
  41. export default {
  42. props: {
  43. list: {
  44. type: Array,
  45. },
  46. toDetail: {
  47. type: Function
  48. },
  49. showStatus: {
  50. type: Boolean
  51. }
  52. },
  53. methods: {
  54. handleList(list) {
  55. return list.map(v => {
  56. v.attinfos = formattedFiles(v.attinfos);
  57. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "sat_sharematerial" && s.fileType == 'image') || v.attinfos.find(s => s.fileType == 'image')) : uni.getStorageSync("site").logo || ''
  58. return v
  59. })
  60. },
  61. onClick(index) {
  62. this.$emit("toDetail", index)
  63. }
  64. },
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .list-item {
  69. width: 355px;
  70. margin: 0 auto 20px;
  71. border-radius: 5px;
  72. overflow: hidden;
  73. .image {
  74. position: relative;
  75. width: 355px;
  76. height: 240px;
  77. border-radius: 5px;
  78. overflow: hidden;
  79. }
  80. .status {
  81. position: absolute;
  82. top: 10px;
  83. right: 0;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. width: 56px;
  88. height: 24px;
  89. background: #E3041F;
  90. border-radius: 12px 0px 0px 12px;
  91. font-family: Source Han Sans SC, Source Han Sans SC;
  92. font-size: 12px;
  93. color: #FFFFFF;
  94. }
  95. .createby-box {
  96. position: absolute;
  97. display: flex;
  98. height: 24px;
  99. line-height: 24px;
  100. background: rgba($color: #333333, $alpha: 0.8);
  101. border-radius: 12px;
  102. bottom: 10px;
  103. left: 10px;
  104. padding-right: 10px;
  105. .headpic {
  106. width: 24px;
  107. height: 24px;
  108. border-radius: 50%;
  109. margin-left: -1px;
  110. }
  111. .name {
  112. font-family: Source Han Sans SC, Source Han Sans SC;
  113. font-size: 12px;
  114. color: #FFFFFF;
  115. margin-left: 5px;
  116. max-width: 200px;
  117. }
  118. }
  119. .tips {
  120. display: flex;
  121. height: 20px;
  122. line-height: 20px;
  123. justify-content: space-between;
  124. .title {
  125. flex: 1;
  126. font-family: PingFang SC, PingFang SC;
  127. font-size: 14px;
  128. color: #333333;
  129. margin-top: 10px;
  130. margin-bottom: 20px;
  131. }
  132. .iconfont-box {
  133. .iconfont {
  134. font-family: Source Han Sans SC, Source Han Sans SC;
  135. font-size: 12px;
  136. color: #999999;
  137. margin-right: 15px;
  138. }
  139. .iconfont:last-child {
  140. margin-right: 0;
  141. }
  142. }
  143. }
  144. }
  145. </style>