sign.vue 4.1 KB

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