PaintingList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <div
  3. class="painting-list"
  4. >
  5. <!-- 背景序列帧 -->
  6. <SerialFrames
  7. class="bg-serial-frames-top"
  8. :image-src="require(`@/assets/images/serial-frame-painting-list-top.png`)"
  9. :total-width="13194"
  10. :height="865"
  11. :frame-number="33"
  12. :frame-duration="55"
  13. />
  14. <SerialFrames
  15. class="bg-serial-frames-bottom"
  16. :image-src="require(`@/assets/images/serial-frame-painting-list-bottom.png`)"
  17. :total-width="13194"
  18. :height="865"
  19. :frame-number="33"
  20. :frame-duration="55"
  21. />
  22. <ul
  23. ref="menuEl"
  24. >
  25. <div
  26. v-for="(paintingGroup, ageName) in menuInfo"
  27. :id="`menu-item-${ageName}`"
  28. :key="ageName"
  29. class="menu-item"
  30. >
  31. <div
  32. class="cover"
  33. :style="{
  34. backgroundImage: `url(${ageRenderInfo[ageName].coverBg})`,
  35. }"
  36. @click="onClickAge(ageName)"
  37. >
  38. <img
  39. class="age"
  40. :src="ageRenderInfo[ageName].artFontImg"
  41. alt=""
  42. draggable="false"
  43. >
  44. <div class="age-en">
  45. {{ `${ageRenderInfo[ageName].En} dynasty` }}
  46. </div>
  47. <div class="author-list">
  48. {{ getAuthorList(paintingGroup).join('\\') }}
  49. </div>
  50. </div>
  51. <div
  52. v-if="ageName !== '清' && !expandedAgeNameList.has(ageName)"
  53. class="splitter"
  54. />
  55. <div
  56. class="hidden-content"
  57. :style="{
  58. width: expandedAgeNameList.has(ageName) ? getHiddenContentWidth(paintingGroup, ageName) : '0',
  59. }"
  60. >
  61. <div class="shadow" />
  62. <div
  63. v-if="ageName === '宋'"
  64. class="special-desc"
  65. >
  66. <img
  67. class="title"
  68. src="@/assets/images/painting-menu-special-content-title.png"
  69. alt=""
  70. draggable="false"
  71. >
  72. <p class="desc">
  73. {{ specialDesc }}
  74. </p>
  75. <button
  76. class="see-more"
  77. @click="isShowPaintingStyleDesc = true"
  78. />
  79. </div>
  80. <div
  81. v-for="item in paintingGroup"
  82. :key="item['标题']"
  83. class="painting-item"
  84. @click="router.push({
  85. name: 'PaintingDetailList',
  86. query: {
  87. idx: Number(item['序号']) - 1,
  88. }
  89. })"
  90. >
  91. <div class="top-wrap">
  92. <div
  93. class="author"
  94. :class="{
  95. long: item['作者'].length >= 6,
  96. }"
  97. >
  98. <img
  99. class="bg"
  100. src="@/assets/images/decoration-sun.png"
  101. alt=""
  102. draggable="false"
  103. >
  104. <div
  105. v-if="item['音']"
  106. class="yin-name"
  107. >
  108. <div
  109. v-for="(itemm,index) in item['音']"
  110. :key="index"
  111. >
  112. {{ itemm }}
  113. </div>
  114. </div>
  115. <div
  116. v-else
  117. class="name"
  118. >
  119. {{ item['作者'] }}
  120. </div>
  121. </div>
  122. <div class="title">
  123. {{ item['标题(展示)'].split('\n').join('') }}
  124. </div>
  125. <div class="type">
  126. {{ item['装裱\/材质\/笔类型'] }}
  127. </div>
  128. </div>
  129. <div class="img-wrap">
  130. <img
  131. class="thumb"
  132. :src="`${$env.BASE_URL}configMultiMedia/paintings-thumb/${item['标题']}.jpg`"
  133. alt=""
  134. draggable="false"
  135. >
  136. <img
  137. class="border"
  138. src="@/assets/images/painting-thumb-border.png"
  139. alt=""
  140. draggable="false"
  141. >
  142. </div>
  143. <div class="size">
  144. {{ getPaintingSizeStringForShow(getPaintingSize(item['尺寸'])) }}
  145. </div>
  146. <div class="position">
  147. {{ item['馆藏'] }}
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </ul>
  153. <BtnBack
  154. class="button-back"
  155. @click="router.push({
  156. name: 'MoreContent',
  157. query: {
  158. anchorIdx: 1,
  159. }
  160. })"
  161. />
  162. <OperationTip
  163. class="operation-tip"
  164. direction="h"
  165. :is-show="isShowOperationTip"
  166. />
  167. <Transition name="fade-in-out">
  168. <PaintingStyleDesc
  169. v-if="isShowPaintingStyleDesc"
  170. @close="isShowPaintingStyleDesc = false"
  171. />
  172. </Transition>
  173. </div>
  174. </template>
  175. <script setup>
  176. import { ref, computed, watch, onMounted, inject } from "vue"
  177. import { useRoute, useRouter } from "vue-router"
  178. import { useStore } from "vuex"
  179. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  180. import PaintingStyleDesc from "@/views/PaintingStyleDesc.vue"
  181. const getPaintingSize = utils.getPaintingSize
  182. const route = useRoute()
  183. const router = useRouter()
  184. const store = useStore()
  185. const $env = inject('$env')
  186. const {
  187. windowSizeInCssForRef,
  188. windowSizeWhenDesignForRef,
  189. } = useSizeAdapt()
  190. const menuEl = ref(null)
  191. const menuElScrollLeft = ref(0)
  192. onMounted(() => {
  193. menuEl.value.addEventListener('scroll', (e) => {
  194. menuElScrollLeft.value = menuEl.value.scrollLeft
  195. })
  196. })
  197. const menuInfo = {}
  198. const temp = configExcel['画作'].map((item) => {
  199. return item['朝代']
  200. })
  201. const ageList = Array.from(new Set(temp))
  202. for (const painting of configExcel['画作']) {
  203. if (!menuInfo[painting['朝代']]) {
  204. menuInfo[painting['朝代']] = []
  205. }
  206. menuInfo[painting['朝代']].push(painting)
  207. }
  208. const ageRenderInfo = {
  209. '宋': {
  210. En: 'Song',
  211. artFontImg: require(`@/assets/images/painting-menu-item-title-song.png`),
  212. coverBg: require(`@/assets/images/painting-menu-item-cover-bg-song.png`),
  213. },
  214. '元': {
  215. En: 'Yuan',
  216. artFontImg: require(`@/assets/images/painting-menu-item-title-yuan.png`),
  217. coverBg: require(`@/assets/images/painting-menu-item-cover-bg-yuan.png`),
  218. },
  219. '明': {
  220. En: 'Ming',
  221. artFontImg: require(`@/assets/images/painting-menu-item-title-ming.png`),
  222. coverBg: require(`@/assets/images/painting-menu-item-cover-bg-ming.png`),
  223. },
  224. '清': {
  225. En: 'Qing',
  226. artFontImg: require(`@/assets/images/painting-menu-item-title-qing.png`),
  227. coverBg: require(`@/assets/images/painting-menu-item-cover-bg-qing.png`),
  228. },
  229. }
  230. function getAuthorList(paintingGroup) {
  231. const temp = paintingGroup.map((item) => {
  232. let author = item['作者']
  233. // return author.split('(')[0]
  234. return author
  235. })
  236. return Array.from(new Set(temp))
  237. }
  238. function getPaintingSizeStringForShow({ width, height }) {
  239. return `${width}\u00D7${height} 厘米`
  240. }
  241. const paintingWidthWhenDesign = 240
  242. const paintingMarginWhenDesin = 75
  243. const specialDescWidthWhenDesin = 444
  244. function getHiddenContentWidth(paintingGroup, ageName) {
  245. let temp = paintingGroup.length * (paintingWidthWhenDesign + paintingMarginWhenDesin) + paintingMarginWhenDesin
  246. if (ageName === '宋') {
  247. temp += specialDescWidthWhenDesin
  248. }
  249. return `${temp / windowSizeWhenDesignForRef.value * Number(windowSizeInCssForRef.value.substring(0, windowSizeInCssForRef.value.length - 2))}px`
  250. }
  251. const expandedAgeNameList = ref(new Set())
  252. function onClickAge(ageName) {
  253. if (expandedAgeNameList.value.has(ageName)) {
  254. expandedAgeNameList.value.delete(ageName)
  255. } else {
  256. expandedAgeNameList.value.add(ageName)
  257. const menuItemEl = document.getElementById(`menu-item-${ageName}`)
  258. setTimeout(() => {
  259. menuEl.value.scrollLeft = menuItemEl.offsetLeft
  260. }, 200)
  261. }
  262. }
  263. const specialDesc = configExcel['其他'][4]['修篁树石图'][1]['作品简介'].split('\n')[0]
  264. const isShowPaintingStyleDesc = ref(false)
  265. const isShowOperationTip = ref(true)
  266. const unwatch = watch(menuElScrollLeft, (v) => {
  267. isShowOperationTip.value = false
  268. unwatch()
  269. })
  270. </script>
  271. <style lang="less" scoped>
  272. .painting-list{
  273. position: absolute;
  274. left: 0;
  275. top: 0;
  276. width: 100%;
  277. height: 100%;
  278. background-color: rgba(121, 143, 108, 1);
  279. >.bg-serial-frames-top{
  280. position: absolute;
  281. top: 0;
  282. right: 0;
  283. transform: translate(0, 0) scale(0.8);
  284. transform-origin: top right;
  285. }
  286. >.bg-serial-frames-bottom{
  287. position: absolute;
  288. bottom: 0;
  289. left: 0;
  290. transform: translate(-60%, 10%) scale(1);
  291. transform-origin: bottom left;
  292. }
  293. >ul{
  294. position: absolute;
  295. left: 0;
  296. top: 0;
  297. width: 100vw;
  298. height: 100%;
  299. display: flex;
  300. overflow: auto;
  301. scroll-behavior: smooth;
  302. >.menu-item{
  303. flex: 0 0 auto;
  304. height: 100%;
  305. display: flex;
  306. align-items: center;
  307. >.cover{
  308. flex: 0 0 auto;
  309. height: calc(534 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  310. padding-left: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  311. padding-right: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  312. writing-mode: vertical-lr;
  313. background-size: cover;
  314. background-repeat: no-repeat;
  315. background-position: center center;
  316. >.age{
  317. margin-top: calc(171 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  318. width: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  319. height: calc(44 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  320. }
  321. >.age-en{
  322. margin-top: calc(176 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  323. font-family: KingHwa_OldSong, KingHwa_OldSong;
  324. font-weight: 400;
  325. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  326. color: #FFFFFF;
  327. line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  328. }
  329. >.author-list{
  330. margin-top: calc(176 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  331. font-family: KaiTi, KaiTi;
  332. font-weight: 400;
  333. font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  334. color: #FFFFFF;
  335. line-height: calc(19 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  336. letter-spacing: 0.2em;
  337. height: 20em;
  338. overflow: hidden;
  339. white-space: pre;
  340. text-overflow: ellipsis;
  341. }
  342. }
  343. >.splitter{
  344. height: calc(534 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  345. width: 1px;
  346. background-color: #fff;
  347. }
  348. >.hidden-content{
  349. transition: width 1s;
  350. overflow: hidden;
  351. display: flex;
  352. align-items: flex-end;
  353. background-color: #f9f7f2;
  354. height: 100%;
  355. background-image: url(@/assets/images/bg-paper.jpg);
  356. background-size: auto 100%;
  357. background-repeat: repeat;
  358. position: relative;
  359. >.shadow{
  360. position: absolute;
  361. bottom: 0;
  362. left: 0;
  363. width: 100%;
  364. height: calc(223 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  365. background: linear-gradient( 360deg, rgba(0, 0, 0, 0.2) 0%, rgba(0,0,0,0) 100%);
  366. }
  367. >.special-desc{
  368. flex: 0 0 auto;
  369. align-self: center;
  370. width: calc(v-bind('specialDescWidthWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. >img.title{
  375. flex: 0 0 auto;
  376. width: calc(133 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  377. height: calc(133 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  378. margin-right: calc(12 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  379. }
  380. >p.desc{
  381. writing-mode: vertical-lr;
  382. font-family: KaiTi, KaiTi;
  383. font-weight: 400;
  384. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  385. color: #476446;
  386. line-height: 2;
  387. text-align: justify;
  388. height: calc(552 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  389. letter-spacing: 0.15em;
  390. }
  391. >button.see-more{
  392. width: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  393. height: calc(94 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  394. background-image: url(@/assets/images/see-more-btn.png);
  395. background-size: contain;
  396. background-repeat: no-repeat;
  397. background-position: center center;
  398. margin-left: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  399. transform: translateY(180%);
  400. }
  401. }
  402. >.painting-item:last-of-type {
  403. margin-right: calc(v-bind('paintingMarginWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  404. }
  405. >.painting-item{
  406. flex: 0 0 auto;
  407. margin-left: calc(v-bind('paintingMarginWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  408. width: calc(v-bind('paintingWidthWhenDesign') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. margin-bottom: calc(230 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  413. >.top-wrap{
  414. margin-bottom: calc(29 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  415. position: relative;
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. height:20vh;
  420. >.author{
  421. writing-mode: vertical-lr;
  422. font-family: KingHwa_OldSong, KingHwa_OldSong;
  423. font-weight: 400;
  424. font-size: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  425. color: #474747;
  426. // white-space: pre;
  427. // transform: translateY(-50%);
  428. margin-right: calc(11 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  429. position: relative;
  430. letter-spacing: 0.3em;
  431. >img.bg{
  432. width: calc(27 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  433. position: absolute;
  434. right: 0;
  435. top: 50%;
  436. transform: translate(-24%, -40%);
  437. z-index: 1;
  438. }
  439. >.name{
  440. writing-mode: vertical-lr;
  441. position: relative;
  442. z-index: 2;
  443. }
  444. >.yin-name{
  445. // writing-mode: horizontal-tb;
  446. display: flex;
  447. // flex-direction: column;
  448. position: relative;
  449. z-index: 2;
  450. >div{
  451. writing-mode: horizontal-tb;
  452. }
  453. >div:nth-child(2){
  454. color: rgba(71,71,71,0.7 );
  455. letter-spacing: -1px;
  456. font-size: 20px;
  457. transform: translateX(-20px);
  458. }
  459. }
  460. }
  461. >.author.long{
  462. transform: translateY(0);
  463. letter-spacing: initial;
  464. }
  465. >.title{
  466. writing-mode: vertical-lr;
  467. font-family: KingHwa_OldSong, KingHwa_OldSong;
  468. font-weight: 400;
  469. font-size: calc(13 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  470. color: #474747;
  471. white-space: pre;
  472. margin-right: calc(9 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  473. letter-spacing: 0.2em;
  474. }
  475. >.type{
  476. writing-mode: vertical-lr;
  477. font-family: KingHwa_OldSong, KingHwa_OldSong;
  478. font-weight: 400;
  479. font-size: calc(13 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  480. color: #474747;
  481. white-space: pre;
  482. letter-spacing: 0.2em;
  483. }
  484. }
  485. >.img-wrap{
  486. width: calc(240 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  487. height: calc(240 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  488. border-radius: 50%;
  489. overflow: hidden;
  490. margin-bottom: calc(21 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  491. position: relative;
  492. >img.thumb{
  493. width: 100%;
  494. height: 100%;
  495. object-fit: cover;
  496. }
  497. >img.border{
  498. position: absolute;
  499. left: 0;
  500. top: 0;
  501. width: 100%;
  502. height: 100%;
  503. }
  504. }
  505. >.size{
  506. font-family: KingHwa_OldSong, KingHwa_OldSong;
  507. font-weight: 400;
  508. font-size: 13px;
  509. color: #474747;
  510. line-height: 15px;
  511. margin-bottom: 0.5em;
  512. }
  513. >.position{
  514. font-family: KingHwa_OldSong, KingHwa_OldSong;
  515. font-weight: 400;
  516. font-size: 13px;
  517. color: #474747;
  518. line-height: 15px;
  519. }
  520. }
  521. }
  522. }
  523. }
  524. >.operation-tip{
  525. position: absolute;
  526. right: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  527. bottom: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  528. transform: translateX(-50%);
  529. z-index: 10;
  530. }
  531. }
  532. </style>