PaintingList.vue 20 KB

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