collection.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <ul class="con">
  3. <li class="item" v-for="(item,i) in list" @click="handleClick(item)" :key="i">
  4. <div class="card-img">
  5. <img class="full" :src="$serverName+item.thumb" alt="" />
  6. <img class="real" :src="$serverName+item.thumb" alt="" />
  7. </div>
  8. <div class="card-txt">
  9. <div class="title">
  10. <span :title="item.name">{{ item.name||'名字' }}</span>
  11. <span class="tag">{{$type[item.type]||'暂无类别'}}</span>
  12. </div>
  13. </div>
  14. </li>
  15. <div v-if="list.length<=0" class="no-record">
  16. <img class="bg" :src="require('@/assets/images/icon/norecoedbg.png')" alt="">
  17. <div class="rccon">
  18. <img :src="require('@/assets/images/icon/ic_error_24px.png')" alt="">
  19. <span>暂无数据</span>
  20. </div>
  21. </div>
  22. </ul>
  23. </template>
  24. <script>
  25. export default {
  26. props: ["data"],
  27. data() {
  28. return {
  29. };
  30. },
  31. computed:{
  32. list(){
  33. return this.data
  34. }
  35. },
  36. methods:{
  37. handleClick(item){
  38. this.$showBroadcast({item})
  39. this.$bus.$emit('fadeCollect',false)
  40. }
  41. }
  42. };
  43. </script>
  44. <style lang="less" scoped>
  45. @margin: 36px;
  46. .item {
  47. text-align: center;
  48. display: inline-block;
  49. width: calc((100% - @margin * 3) / 4);
  50. margin-right: @margin;
  51. margin-bottom: @margin;
  52. border-radius: 8px;
  53. overflow: hidden;
  54. cursor: pointer;
  55. &:nth-of-type(4n) {
  56. margin-right: 0;
  57. }
  58. .card-img {
  59. position: relative;
  60. max-height: 190px;
  61. overflow: hidden;
  62. background: linear-gradient(180deg, #AAAAAA 0%, #D1D1D1 100%);
  63. img {
  64. height: 100%;
  65. }
  66. .full {
  67. opacity: 1;
  68. width: 100%;
  69. height: 100%;
  70. filter: blur(0px);
  71. }
  72. .real {
  73. position: absolute;
  74. z-index: 99;
  75. top: 50%;
  76. left: 50%;
  77. transform: translate(-50%, -50%);
  78. }
  79. }
  80. .card-txt {
  81. display: flex;
  82. justify-content: space-between;
  83. align-items: center;
  84. font-size: 14px;
  85. color: #333;
  86. background: #C2C2C2;
  87. width: 100%;
  88. overflow: hidden;
  89. white-space: nowrap;
  90. text-overflow: ellipsis;
  91. >div{
  92. width: 100%;
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. span{
  97. overflow: hidden;
  98. padding: 8px 10px;
  99. text-overflow:ellipsis;
  100. white-space: nowrap;
  101. &:first-of-type{
  102. flex: 3;
  103. }
  104. }
  105. .tag{
  106. flex: 1;
  107. background: #A01C26;
  108. color: rgba(255, 255, 255, 0.5);
  109. }
  110. }
  111. }
  112. }
  113. .no-record{
  114. position: relative;
  115. margin: 10vh auto 0!important;
  116. .bg{
  117. width: 300px;
  118. }
  119. .rccon{
  120. position: absolute;
  121. top: 50%;
  122. left: 50%;
  123. transform: translate(-50%,-50%);
  124. >span{
  125. display: block;
  126. margin-top: 10px;
  127. }
  128. }
  129. }
  130. @media screen and (min-width: 500px) and (max-width: 1400px) {
  131. .item {
  132. width: calc((100% - @margin * 2) / 3);
  133. &:nth-of-type(3n) {
  134. margin-right: 0;
  135. }
  136. &:nth-of-type(4n){
  137. margin-right: @margin;
  138. }
  139. .card-img{
  140. max-height: 150px;
  141. }
  142. }
  143. }
  144. @media screen and (max-width: 500px) {
  145. @gap:15px;
  146. .con{
  147. width: 100%;
  148. .item{
  149. width: calc((100% - @gap) / 2);
  150. margin-right: @gap;
  151. margin-bottom: @gap;
  152. &:nth-of-type(2n) {
  153. margin-right: 0;
  154. }
  155. .card-img{
  156. max-height: 107px;
  157. }
  158. }
  159. }
  160. }
  161. </style>