PaintingInfoBox.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <script setup>
  2. import { ref } from "vue"
  3. // 1-作品简介 2-作者简介
  4. const curState = ref(1)
  5. const props = defineProps({
  6. title: {
  7. type: String,
  8. required: true,
  9. },
  10. author: {
  11. type: String,
  12. required: true,
  13. },
  14. subtitle: {
  15. type: String,
  16. required: true,
  17. },
  18. age: {
  19. type: String,
  20. required: true,
  21. },
  22. location: {
  23. type: String,
  24. required: true,
  25. },
  26. paintingDesc: {
  27. type: String,
  28. default: "",
  29. },
  30. authorDesc: {
  31. type: String,
  32. default: "",
  33. },
  34. canClose: {
  35. type: Boolean,
  36. default: true,
  37. },
  38. size: {
  39. type: Object,
  40. default: () => {
  41. return {
  42. width: 1,
  43. height: 1,
  44. }
  45. },
  46. },
  47. })
  48. </script>
  49. <template>
  50. <div class="info-box">
  51. <img
  52. class="close-btn"
  53. src="@/assets/images/painting-box-back.png"
  54. alt=""
  55. >
  56. <div class="detail-box">
  57. <div class="top">
  58. <div class="title">
  59. {{ curState == 1 ? props.title : "作者简介" }}
  60. </div>
  61. <div
  62. class="exchange"
  63. @click="curState == 1 ? (curState = 2) : (curState = 1)"
  64. >
  65. <img
  66. src="@/assets/images/icon_change.png"
  67. alt=""
  68. >
  69. {{ curState == 1 ? "作者" : "作品" }}
  70. </div>
  71. </div>
  72. <div class="line" />
  73. <div
  74. v-if="curState == 1"
  75. class="bottom"
  76. >
  77. <p>{{ props.author }}</p>
  78. <p>{{ props.size.width }} x {{ props.size.height }} 厘米</p>
  79. <p>{{ props.subtitle }}</p>
  80. <p>{{ props.location }}</p>
  81. <br>
  82. <p>{{ props.paintingDesc }}</p>
  83. </div>
  84. <div
  85. v-else-if="curState == 2"
  86. class="bottom"
  87. >
  88. <p>{{ props.authorDesc.length >0? props.authorDesc:'暂无信息' }}</p>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <style lang="less" scoped>
  94. .info-box {
  95. width: 60%;
  96. height: 100%;
  97. background: url(@/assets/images/painting-box-bg.png);
  98. background-size: 100% 100%;
  99. position: relative;
  100. .close-btn {
  101. position: absolute;
  102. top: 50%;
  103. left: 1.5%;
  104. transform: translateY(-50%);
  105. cursor: pointer;
  106. }
  107. .detail-box {
  108. width: 95%;
  109. height: 100%;
  110. position: absolute;
  111. // background: rgba(153, 205, 50, 0.39);
  112. right: 0;
  113. padding: 7% 7% 0;
  114. .top {
  115. width: 100%;
  116. height: 65px;
  117. display: flex;
  118. align-items: center;
  119. justify-content: space-between;
  120. .title {
  121. color: #ffecb0;
  122. font-size: 44px;
  123. font-family: "KingHwa_OldSong";
  124. white-space: pre-wrap;
  125. }
  126. .exchange {
  127. display: flex;
  128. align-items: center;
  129. color: #e1edd9;
  130. font-size: 20px;
  131. font-family: "KaiTi";
  132. cursor: pointer;
  133. }
  134. }
  135. .line {
  136. width: 100%;
  137. height: 1px;
  138. background: #ffffff;
  139. margin-top: 20px;
  140. }
  141. .bottom {
  142. width: 100%;
  143. margin-top: 20px;
  144. height: 89%;
  145. overflow: auto;
  146. font-size: 30px;
  147. line-height: 35px;
  148. padding: 10px 40px 0 0 ;
  149. color: #E1EDD9;
  150. font-family: 'KaiTi';
  151. p{
  152. white-space: pre-wrap;
  153. }
  154. &::-webkit-scrollbar {
  155. width: 4px;
  156. }
  157. /* 滚动条轨道(track)的样式 */
  158. &::-webkit-scrollbar-track {
  159. background: #f1f1f100; /* 轨道的背景颜色 */
  160. }
  161. /* 滚动条滑块(thumb)的样式 */
  162. &::-webkit-scrollbar-thumb {
  163. background: #e1edd942; /* 滑块的背景颜色 */
  164. border-radius: 50px;
  165. }
  166. }
  167. }
  168. }
  169. </style>