PaintingList.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  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. @media screen and (min-width: 600px) {
  359. justify-content: right;
  360. }
  361. >.cover{
  362. flex: 0 0 auto;
  363. height: calc(534 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  364. padding-left: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  365. padding-right: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  366. writing-mode: vertical-lr;
  367. background-size: cover;
  368. background-repeat: no-repeat;
  369. background-position: center center;
  370. >.age{
  371. margin-top: calc(171 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  372. width: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  373. height: calc(44 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  374. }
  375. >.age-en{
  376. margin-top: calc(176 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  377. font-family: KingHwa_OldSong;
  378. font-weight: 400;
  379. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  380. color: #FFFFFF;
  381. line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  382. }
  383. >.author-list{
  384. margin-top: calc(176 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  385. font-family: KaiTi;
  386. font-weight: 400;
  387. font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  388. color: #FFFFFF;
  389. line-height: calc(19 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  390. letter-spacing: 0.2em;
  391. height: 20em;
  392. overflow: hidden;
  393. white-space: pre;
  394. text-overflow: ellipsis;
  395. }
  396. }
  397. >.splitter{
  398. height: calc(534 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  399. width: 1px;
  400. background-color: #fff;
  401. }
  402. .hidden-contentTran{
  403. transition: width 1s;
  404. }
  405. >.hidden-content{
  406. overflow: hidden;
  407. display: flex;
  408. align-items: flex-end;
  409. background-color: #f9f7f2;
  410. height: 100%;
  411. background-image: url(@/assets/images/bg-paper.jpg);
  412. background-size: auto 100%;
  413. background-repeat: repeat;
  414. position: relative;
  415. >.shadow{
  416. position: absolute;
  417. bottom: 0;
  418. left: 0;
  419. width: 100%;
  420. height: calc(223 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  421. background: linear-gradient( 360deg, rgba(0, 0, 0, 0.2) 0%, rgba(0,0,0,0) 100%);
  422. }
  423. >.special-desc{
  424. flex: 0 0 auto;
  425. align-self: center;
  426. width: calc(v-bind('specialDescWidthWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  427. display: flex;
  428. justify-content: center;
  429. align-items: center;
  430. >img.title{
  431. flex: 0 0 auto;
  432. width: calc(133 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  433. height: calc(133 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  434. margin-right: calc(12 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  435. }
  436. >p.desc{
  437. writing-mode: vertical-lr;
  438. font-family: KaiTi;
  439. font-weight: 400;
  440. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  441. color: #476446;
  442. line-height: 2;
  443. text-align: justify;
  444. height: calc(552 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  445. letter-spacing: 0.15em;
  446. }
  447. >button.see-more{
  448. width: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  449. height: calc(94 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  450. background-image: url(@/assets/images/see-more-btn.png);
  451. background-size: contain;
  452. background-repeat: no-repeat;
  453. background-position: center center;
  454. margin-left: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  455. transform: translateY(180%);
  456. }
  457. }
  458. >.painting-item:last-of-type {
  459. margin-right: calc(v-bind('paintingMarginWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  460. }
  461. >.painting-item{
  462. flex: 0 0 auto;
  463. margin-left: calc(v-bind('paintingMarginWhenDesin') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  464. width: calc(v-bind('paintingWidthWhenDesign') / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  465. display: flex;
  466. flex-direction: column;
  467. align-items: center;
  468. margin-bottom: calc(230 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  469. >.top-wrap{
  470. margin-bottom: calc(29 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  471. position: relative;
  472. display: flex;
  473. justify-content: center;
  474. align-items: center;
  475. height:20vh;
  476. >.author{
  477. writing-mode: vertical-lr;
  478. font-family: KingHwa_OldSong;
  479. font-weight: 400;
  480. font-size: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  481. color: #474747;
  482. // white-space: pre;
  483. // transform: translateY(-50%);
  484. margin-right: calc(11 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  485. position: relative;
  486. letter-spacing: 0em;
  487. >img.bg{
  488. width: calc(27 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  489. position: absolute;
  490. right: 0;
  491. top: 50%;
  492. transform: translate(-24%, -40%);
  493. z-index: 1;
  494. }
  495. >.name{
  496. writing-mode: vertical-lr;
  497. position: relative;
  498. z-index: 2;
  499. }
  500. >.yin-name{
  501. // writing-mode: horizontal-tb;
  502. display: flex;
  503. // flex-direction: column;
  504. position: relative;
  505. z-index: 2;
  506. >div{
  507. writing-mode: horizontal-tb;
  508. }
  509. >div:nth-child(2){
  510. color: rgba(71,71,71,0.7 );
  511. letter-spacing: -1px;
  512. font-size: 20px;
  513. transform: translateX(-20px);
  514. }
  515. }
  516. }
  517. >.author.long{
  518. transform: translateY(0);
  519. letter-spacing: initial;
  520. }
  521. >.title{
  522. writing-mode: vertical-lr;
  523. font-family: KingHwa_OldSong;
  524. font-weight: 400;
  525. font-size: calc(13 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  526. color: #474747;
  527. white-space: pre;
  528. margin-right: calc(9 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  529. letter-spacing: 0.2em;
  530. }
  531. >.type{
  532. writing-mode: vertical-lr;
  533. font-family: KingHwa_OldSong;
  534. font-weight: 400;
  535. font-size: calc(13 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  536. color: #474747;
  537. white-space: pre;
  538. letter-spacing: 0.2em;
  539. }
  540. }
  541. >.top-wrap-img{
  542. height:20vh;
  543. >img{
  544. height: 65%;
  545. }
  546. }
  547. >.img-wrap{
  548. width: calc(240 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  549. height: calc(240 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  550. border-radius: 50%;
  551. overflow: hidden;
  552. margin-bottom: calc(21 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  553. position: relative;
  554. >img.thumb{
  555. width: 100%;
  556. height: 100%;
  557. object-fit: cover;
  558. }
  559. >img.border{
  560. position: absolute;
  561. left: 0;
  562. top: 0;
  563. width: 100%;
  564. height: 100%;
  565. }
  566. }
  567. >.size{
  568. font-family: KingHwa_OldSong;
  569. font-weight: 400;
  570. font-size: 13px;
  571. color: #474747;
  572. line-height: 15px;
  573. margin-bottom: 0.5em;
  574. @media screen and (min-width: 600px) {
  575. font-size: 20px;
  576. }
  577. }
  578. >.position{
  579. font-family: KingHwa_OldSong;
  580. font-weight: 400;
  581. font-size: 13px;
  582. color: #474747;
  583. line-height: 15px;
  584. @media screen and (min-width: 600px) {
  585. font-size: 22px;
  586. }
  587. }
  588. }
  589. }
  590. }
  591. }
  592. >.operation-tip{
  593. position: absolute;
  594. right: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  595. bottom: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  596. transform: translateX(-50%);
  597. z-index: 10;
  598. }
  599. >.click-tip{
  600. width: 50px;
  601. position: absolute;
  602. left: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  603. bottom: calc(120 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  604. // transform: translateX(-50%);
  605. z-index: 10;
  606. }
  607. }
  608. </style>