info.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div class="ExhibitionsInfo">
  3. <div class="topImg">
  4. <img
  5. :src="`/data/Exhibitions/${dataUrl}/infoTop${data.topImg}.jpg`"
  6. alt=""
  7. />
  8. </div>
  9. <!-- 面包屑 -->
  10. <div class="pos">
  11. <div>
  12. <span class="pos1">Your Position:&nbsp;</span>
  13. <Router-link to="/Layout/Home">Home></Router-link>
  14. <Router-link to="/Layout/Exhibitions/1">Exhibitions></Router-link>
  15. <i @click="backExh(topTxt)">{{ topTxt }} Exhibitions></i>
  16. </div>
  17. </div>
  18. <!-- 内容-->
  19. <div class="conten">
  20. <!-- Exhibition Overview -->
  21. <div class="y_box" ref="Overview">
  22. <div class="title_2">{{ data.title }}</div>
  23. <div class="info">
  24. <span class="info_1">{{ data.date }}</span>
  25. <span class="info_2">{{ data.time }}</span>
  26. <span class="info_3">{{ data.loc }}</span>
  27. </div>
  28. <div class="content_2">
  29. <div class="title_3">——<span>Exhibition Overview</span>——</div>
  30. <div
  31. v-show="index === pageInd"
  32. v-for="(item, index) in data.page"
  33. :key="index"
  34. >
  35. <p class="one" v-html="item.tit"></p>
  36. <div class="fuTxt" v-html="item.article"></div>
  37. </div>
  38. <!-- 分页 -->
  39. <div class="paging">
  40. <span v-show="pageInd !== 0" @click="pageCut(pageInd - 1)">
  41. &lt;
  42. </span>
  43. <span
  44. :class="{ active: index === pageInd }"
  45. v-for="(item, index) in data.page"
  46. :key="index"
  47. @click="pageCut(index)"
  48. >{{ index + 1 }}</span
  49. >
  50. <span
  51. v-if="data.page"
  52. v-show="pageInd !== data.page.length - 1"
  53. @click="pageCut(pageInd + 1)"
  54. >
  55. &gt;
  56. </span>
  57. </div>
  58. </div>
  59. </div>
  60. <!-- Exhibition Objects -->
  61. <div class="picpart" ref="Objects" :class="{ null: data.objects === 0 }">
  62. <div class="title_3">——<span>Exhibition Objects</span>——</div>
  63. <!-- 图片 -->
  64. <div class="row" :class="{ show: showObjects }">
  65. <div class="rowOne" :title="i" v-for="i in data.objects" :key="i">
  66. <img
  67. :src="`/data/Exhibitions/${dataUrl}/objects${data.topImg}/objects${i}${data.imgLast}`"
  68. />
  69. <!-- 输入移入的查看和下载按钮 -->
  70. <div class="mask">
  71. <a
  72. class="el-icon-download"
  73. :href="`/data/Exhibitions/${dataUrl}/objects${data.topImg}/big${i}.png`"
  74. download
  75. ><i> Download</i></a
  76. >
  77. <span class="el-icon-search" @click="imgBig(i)"
  78. ><i> Enlarge</i></span
  79. >
  80. </div>
  81. </div>
  82. </div>
  83. <div class="more">
  84. <span @click="showObjects = !showObjects">{{
  85. showObjects ? "Hide" : "See More"
  86. }}</span>
  87. </div>
  88. </div>
  89. <!-- Exhibition Galleries -->
  90. <div
  91. class="other"
  92. ref="Galleries"
  93. :class="{ nullG: data.galleries === 0 }"
  94. >
  95. <div class="title_3">——<span>Exhibition Galleries</span>——</div>
  96. <!-- 图片 -->
  97. <div class="box" :class="{ show: showGalleries }">
  98. <img
  99. :title="i"
  100. :src="`/data/Exhibitions/${dataUrl}/galleries${data.topImg}/galleries${i}${data.imgLast}`"
  101. alt=""
  102. v-for="i in data.galleries"
  103. :key="i"
  104. />
  105. </div>
  106. <div class="more" v-show="data.galleries>3">
  107. <span @click="showGalleries = !showGalleries">{{
  108. showGalleries ? "Hide" : "See More"
  109. }}</span>
  110. </div>
  111. </div>
  112. </div>
  113. <!-- 回到顶部 -->
  114. <div class="back_btn" @click="backExh(topTxt)">Back to top</div>
  115. <!-- 点击预览大图 -->
  116. <ElImageViewer
  117. v-if="viewImgDialog"
  118. :on-close="closeViewer"
  119. :url-list="srcList"
  120. />
  121. <!-- 滚动 -->
  122. <ul class="navBarItem" :class="{ gunShow: gunShow }">
  123. <li :class="{ cur: gunInd === 1 }" @click="cutGun(1)">
  124. <span></span> Exhibition Overview
  125. </li>
  126. <li :class="{ cur: gunInd === 2 }" @click="cutGun(2)">
  127. <span></span> Exhibition Objects
  128. </li>
  129. <li :class="{ cur: gunInd === 3 }" @click="cutGun(3)">
  130. <span></span> Exhibition Galleries
  131. </li>
  132. </ul>
  133. </div>
  134. </template>
  135. <script>
  136. import { dataAll } from "@/views/dataAll.js";
  137. import ElImageViewer from "element-ui/packages/image/src/image-viewer";
  138. export default {
  139. name: "ExhibitionsInfo",
  140. components: { ElImageViewer },
  141. data() {
  142. //这里存放数据
  143. return {
  144. showObjects: false,
  145. showGalleries: false,
  146. viewImgDialog: false, // 是否显示预览
  147. srcList: [""],
  148. // 固定滚动
  149. gunInd: 1,
  150. gunShow: false,
  151. data: {},
  152. topTxt: "", //最后的一个面包屑文字
  153. pageInd: 0, //分页的切换
  154. // 数据的路径
  155. dataUrl:''
  156. };
  157. },
  158. //监听属性 类似于data概念
  159. computed: {},
  160. //监控data中的数据变化
  161. watch: {},
  162. //方法集合
  163. methods: {
  164. // 切换文字分页
  165. pageCut(val) {
  166. this.pageInd = val;
  167. },
  168. // 点击面包屑的最后一个
  169. backExh(txt) {
  170. if (txt === "Current") this.$router.push("/Layout/Exhibitions/1");
  171. else if (txt === "Permanent") this.$router.push("/Layout/Exhibitions/2");
  172. else if (txt === "Past") this.$router.push("/Layout/Exhibitions/3");
  173. else if (txt === "Overseas") this.$router.push("/Layout/Exhibitions/4");
  174. },
  175. // 固定滚动的切换
  176. cutGun(val) {
  177. // setTimeout(() => {
  178. // this.gunInd = val;
  179. // }, 200);
  180. // 获取 Overview 距离浏览器顶部的距离
  181. let Overview = this.$refs.Overview;
  182. let Objects = this.$refs.Objects;
  183. let Galleries = this.$refs.Galleries;
  184. if (val === 1)
  185. window.scrollTo({ top: Overview.offsetTop, behavior: "smooth" });
  186. else if (val === 2)
  187. window.scrollTo({ top: Objects.offsetTop, behavior: "smooth" });
  188. else if (val === 3)
  189. window.scrollTo({ top: Galleries.offsetTop, behavior: "smooth" });
  190. },
  191. // 点击放大镜预览图片
  192. imgBig(i) {
  193. this.srcList = [
  194. `/data/Exhibitions/${this.dataUrl}/objects${this.data.topImg}/big${i}.png`,
  195. ];
  196. this.viewImgDialog = true;
  197. // 给遮罩层绑定点击关闭事件
  198. this.$nextTick(() => {
  199. // 获取body,防止滚动
  200. let body = document.querySelector("body");
  201. body.style.overflow = "hidden";
  202. let mask = document.querySelector(".el-image-viewer__close");
  203. mask.onclick = () => {
  204. this.closeViewer();
  205. };
  206. });
  207. },
  208. // 关闭查看器
  209. closeViewer() {
  210. this.viewImgDialog = false;
  211. // 获取body,恢复滚动
  212. let body = document.querySelector("body");
  213. body.style.overflow = "auto";
  214. },
  215. },
  216. //生命周期 - 创建完成(可以访问当前this实例)
  217. created() {},
  218. //生命周期 - 挂载完成(可以访问DOM元素)
  219. mounted() {
  220. this.$eventBus.$emit('request-read', `You've reached the tertiary exhibition page. There is one navigation section, eight window sections, and one interactive section on this page. To choose a section, please hit the shortcut key.`)
  221. let { id, k } = this.$route.query;
  222. id = Number(id);
  223. k = Number(k);
  224. let temp;
  225. if (k === 1) {
  226. (temp = dataAll.Exhibitions.Current), (this.topTxt = "Current");
  227. } else if (k === 2) {
  228. (temp = dataAll.Exhibitions.Permanent), (this.topTxt = "Permanent");
  229. } else if (k === 3) {
  230. (temp = dataAll.Exhibitions.Past), (this.topTxt = "Past");
  231. } else if (k === 4) {
  232. (temp = dataAll.Exhibitions.Overseas), (this.topTxt = "Overseas");
  233. }
  234. // 对重复的展览的处理
  235. if(k===4) this.dataUrl ='Past'
  236. else this.dataUrl =this.topTxt
  237. temp.forEach((v) => {
  238. if (v.id === id) this.data = v.info;
  239. });
  240. // console.log("--------", this.data);
  241. // 监听滚动
  242. window.onscroll = () => {
  243. // console.log(window.scrollY, window.pageYOffset)
  244. if (scrollY > 400) this.gunShow = true;
  245. else this.gunShow = false;
  246. // 切换固定滚动的高亮状态
  247. // let Overview = this.$refs.Overview;
  248. let Objects = this.$refs.Objects;
  249. let Galleries = this.$refs.Galleries;
  250. if (scrollY >= 0 && scrollY < Objects.offsetTop) this.gunInd = 1;
  251. else if (scrollY >= Objects.offsetTop && scrollY < Galleries.offsetTop)
  252. this.gunInd = 2;
  253. else this.gunInd = 3;
  254. };
  255. },
  256. beforeCreate() {}, //生命周期 - 创建之前
  257. beforeMount() {}, //生命周期 - 挂载之前
  258. beforeUpdate() {}, //生命周期 - 更新之前
  259. updated() {}, //生命周期 - 更新之后
  260. beforeDestroy() {}, //生命周期 - 销毁之前
  261. destroyed() {
  262. // 删除滚动事件
  263. window.onscroll = null;
  264. }, //生命周期 - 销毁完成
  265. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  266. };
  267. </script>
  268. <style lang='less' scoped>
  269. .ExhibitionsInfo {
  270. .more {
  271. font-size: 16px;
  272. color: #bf2323;
  273. text-align: center;
  274. padding-top: 30px;
  275. & > span {
  276. cursor: pointer;
  277. }
  278. }
  279. .title_3 {
  280. font-size: 12px;
  281. color: #939393;
  282. text-align: center;
  283. & > span {
  284. font-weight: 700;
  285. font-size: 24px;
  286. color: #bf2323;
  287. text-align: center;
  288. padding: 0 20px;
  289. }
  290. }
  291. .topImg {
  292. width: 100%;
  293. margin: auto;
  294. height: 300px;
  295. text-align: center;
  296. & > img {
  297. max-width: 100%;
  298. max-height: 100%;
  299. }
  300. }
  301. .pos {
  302. height: 56px;
  303. width: 100%;
  304. font-size: 12px;
  305. background: url("../../assets/images/Visit/bg_3.png") left bottom repeat-x
  306. #f1f1f1;
  307. overflow: hidden;
  308. zoom: 1;
  309. & > div {
  310. height: 56px;
  311. line-height: 50px;
  312. width: 1180px;
  313. overflow: hidden;
  314. zoom: 1;
  315. margin: 0 auto;
  316. .pos1 {
  317. color: #c20e11;
  318. }
  319. & > i {
  320. cursor: pointer;
  321. }
  322. }
  323. }
  324. .conten {
  325. padding-top: 35px;
  326. width: 1180px;
  327. margin: 0 auto;
  328. .y_box {
  329. background: #fff;
  330. border: 1px solid #e0e0e0;
  331. .title_2 {
  332. font-size: 30px;
  333. line-height: 44px;
  334. font-weight: bold;
  335. margin-bottom: 10px;
  336. padding: 40px 210px 0 40px;
  337. }
  338. .info {
  339. font-size: 14px;
  340. line-height: 36px;
  341. color: #666;
  342. overflow: hidden;
  343. zoom: 1;
  344. margin-bottom: 20px;
  345. padding-left: 40px;
  346. & > span {
  347. padding: 0 30px;
  348. display: block;
  349. float: left;
  350. }
  351. .info_1 {
  352. background: url("../../assets/images/bg_5.png") left 8px no-repeat;
  353. }
  354. .info_2 {
  355. background: url("../../assets/images/bg_6.png") left 8px no-repeat;
  356. }
  357. .info_3 {
  358. background: url("../../assets/images/bg_7.png") left 8px no-repeat;
  359. }
  360. }
  361. .content_2 {
  362. background: none;
  363. border-top: 1px solid #e0e0e0;
  364. padding: 30px 40px;
  365. .fuTxt {
  366. /deep/span {
  367. display: block;
  368. font-size: 18px;
  369. line-height: 26px;
  370. text-align: center;
  371. }
  372. }
  373. /deep/p {
  374. font-size: 18px;
  375. line-height: 26px;
  376. color: #1f1d1d;
  377. margin-top: 24px;
  378. }
  379. /deep/.one {
  380. font-weight: 700;
  381. }
  382. .paging {
  383. text-align: center;
  384. margin: 30px 0 0;
  385. & > span {
  386. cursor: pointer;
  387. margin-right: 5px;
  388. }
  389. .active {
  390. color: #bf2323;
  391. }
  392. }
  393. }
  394. }
  395. .picpart {
  396. height: auto;
  397. background: #fff;
  398. border: 1px solid #e0e0e0;
  399. margin: 40px 0;
  400. padding: 30px 0;
  401. .row {
  402. display: flex;
  403. flex-wrap: wrap;
  404. margin-top: 30px;
  405. height: 410px;
  406. overflow: hidden;
  407. .rowOne {
  408. position: relative;
  409. width: 226px;
  410. height: 410px;
  411. margin-right: 12px;
  412. margin-bottom: 2px;
  413. & > img {
  414. width: 100%;
  415. height: 100%;
  416. object-fit: cover;
  417. }
  418. &:nth-of-type(5n) {
  419. margin-right: 0;
  420. }
  421. .mask {
  422. display: none;
  423. position: absolute;
  424. width: 100%;
  425. height: 100%;
  426. top: 0;
  427. left: 0;
  428. background-color: rgba(0, 0, 0, 0.7);
  429. text-align: center;
  430. color: #fff;
  431. font-size: 20px;
  432. /deep/.el-icon-download {
  433. font-size: 26px;
  434. }
  435. /deep/.el-icon-search {
  436. font-size: 26px;
  437. }
  438. & > span {
  439. margin-top: 50px;
  440. display: block;
  441. cursor: pointer;
  442. }
  443. & > a {
  444. margin-top: 150px;
  445. display: block;
  446. color: #fff;
  447. }
  448. i {
  449. font-size: 18px;
  450. }
  451. }
  452. &:hover {
  453. .mask {
  454. display: block;
  455. }
  456. }
  457. }
  458. }
  459. .show {
  460. height: auto;
  461. }
  462. }
  463. .null {
  464. height: 0px;
  465. overflow: hidden;
  466. padding: 0;
  467. margin-top: 0;
  468. border: none;
  469. }
  470. .other {
  471. background: #fff;
  472. border: 1px solid #e0e0e0;
  473. padding: 30px 0;
  474. .box {
  475. height: 260px;
  476. overflow: hidden;
  477. margin-top: 30px;
  478. & > img {
  479. width: 390px;
  480. height: 260px;
  481. margin: 0 4px 2px 0;
  482. &:nth-child(3n) {
  483. margin-right: 0;
  484. }
  485. }
  486. }
  487. .show {
  488. height: auto;
  489. }
  490. }
  491. .nullG {
  492. height: 0px;
  493. overflow: hidden;
  494. padding: 0;
  495. margin-top: 0;
  496. border: none;
  497. }
  498. }
  499. .back_btn {
  500. height: 38px;
  501. width: 160px;
  502. margin: 30px auto;
  503. border: 1px solid #000;
  504. font-size: 16px;
  505. line-height: 38px;
  506. text-align: center;
  507. font-weight: bold;
  508. cursor: pointer;
  509. display: block;
  510. background: #f1f1f1;
  511. }
  512. .navBarItem {
  513. margin-left: 385px;
  514. position: absolute;
  515. left: 50%;
  516. top: 410px;
  517. z-index: 99;
  518. & > li {
  519. font-size: 14px;
  520. color: #fff;
  521. line-height: 50px;
  522. background-color: #333;
  523. margin-bottom: 1px;
  524. padding: 0 25px 0 25px;
  525. cursor: pointer;
  526. & > span {
  527. display: inline-block;
  528. width: 8px;
  529. height: 8px;
  530. border: 1px solid #fff;
  531. border-radius: 50%;
  532. margin-right: 10px;
  533. }
  534. }
  535. .cur {
  536. background-color: #bf2323;
  537. & > span {
  538. background-color: #fff;
  539. }
  540. }
  541. }
  542. .gunShow {
  543. position: fixed;
  544. top: 0;
  545. }
  546. }
  547. </style>