PaintingList.vue 20 KB

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