sign.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <a-card hoverable class="room-card">
  3. <template #cover>
  4. <div class="room-cover">
  5. <img alt="example" :src="room.cover" />
  6. <div class="action">
  7. <!-- <a-button
  8. class="botton"
  9. shape="round"
  10. type="ghost"
  11. size="large"
  12. @click="$emit('miniSync')"
  13. >
  14. 小程序带看
  15. </a-button> -->
  16. <a-button
  17. class="botton"
  18. shape="round"
  19. type="ghost"
  20. size="large"
  21. @click="$emit('webSync')"
  22. >
  23. 网页带看
  24. </a-button>
  25. <div class="more">
  26. <span style="--hover-color: #0076f6" @click="$emit('edit')">
  27. <i class="iconfont icon-works_editor" />编辑
  28. <!-- <edit-outlined /> -->
  29. </span>
  30. <span
  31. style="--hover-color: rgba(255, 255, 255, 0.5)"
  32. @click="$emit('share')"
  33. >
  34. <i class="iconfont icon-works_share" />分享
  35. </span>
  36. <span style="--hover-color: #fa5555" @click="$emit('delete')">
  37. <i class="iconfont icon-works_delete" />删除
  38. </span>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <div class="room-meta">
  44. <a-popover v-if="room.title.length > 14" placement="bottom">
  45. <template #content>
  46. <div class="room-title">{{ room.title }}</div>
  47. </template>
  48. <h4>{{ room.title }}</h4>
  49. </a-popover>
  50. <h4 v-else>{{ room.title }}</h4>
  51. <div class="desc">
  52. <span>{{ room.time }}</span>
  53. <span><eye-outlined /> {{ room.viewCount }}</span>
  54. </div>
  55. </div>
  56. </a-card>
  57. </template>
  58. <script lang="ts" setup>
  59. import type { Room } from '@/store'
  60. type RoomSignProps = { room: Room }
  61. type RoomSignEmit = {
  62. (e: 'share'): void
  63. (e: 'edit'): void
  64. (e: 'delete'): void
  65. (e: 'miniSync'): void
  66. (e: 'webSync'): void
  67. }
  68. defineProps<RoomSignProps>()
  69. defineEmits<RoomSignEmit>()
  70. </script>
  71. <style scoped lang="scss">
  72. .room-cover {
  73. height: 240px;
  74. position: relative;
  75. overflow: hidden;
  76. img {
  77. width: 100%;
  78. height: 100%;
  79. object-fit: cover;
  80. }
  81. .action {
  82. transition: all 0.3s ease;
  83. position: absolute;
  84. top: 100%;
  85. left: 0;
  86. right: 0;
  87. height: 100%;
  88. background: rgba(0, 0, 0, 0.7);
  89. opacity: 0;
  90. z-index: 1;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. justify-content: center;
  95. .botton {
  96. width: 130px;
  97. text-align: center;
  98. color: #fff;
  99. margin: 5px;
  100. &:hover {
  101. background-color: #0076f6;
  102. border-color: #0076f6;
  103. }
  104. }
  105. .more {
  106. position: absolute;
  107. bottom: 0;
  108. left: 0;
  109. right: 0;
  110. display: flex;
  111. justify-content: space-between;
  112. padding: 10px;
  113. > span {
  114. font-size: 13px;
  115. color: #fff;
  116. transition: color 0.3s ease;
  117. i {
  118. margin-right: 4px;
  119. }
  120. &:hover {
  121. color: var(--hover-color);
  122. }
  123. }
  124. }
  125. }
  126. }
  127. .room-meta {
  128. h4 {
  129. font-size: 16px;
  130. color: #323233;
  131. line-height: 1em;
  132. margin-bottom: 10px;
  133. overflow: hidden;
  134. text-overflow: ellipsis;
  135. white-space: nowrap;
  136. }
  137. .desc {
  138. font-size: 14px;
  139. color: #969799;
  140. display: flex;
  141. justify-content: space-between;
  142. }
  143. }
  144. .room-title {
  145. word-wrap: break-word;
  146. max-width: 200px;
  147. }
  148. .room-card,
  149. .room-cover .action {
  150. transition: all 0.3s ease;
  151. }
  152. .room-card.active,
  153. .room-card:hover {
  154. transform: translateY(-10px);
  155. .room-cover .action {
  156. top: 0;
  157. opacity: 1;
  158. }
  159. }
  160. </style>
  161. <style lang="scss">
  162. .room-card {
  163. .ant-card-body {
  164. padding: 16px 14px;
  165. }
  166. }
  167. </style>