index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <div class="Visit">
  3. <div class="ban" ref="ban">
  4. <img src="@/assets/img/Visit/ban.png" alt="" />
  5. <h3>Visit</h3>
  6. </div>
  7. <div class="main">
  8. <div class="mainBox" :class="{ curSorll: menaSon }">
  9. <div class="rowAll">
  10. <div
  11. @click="cutTab(index)"
  12. class="row"
  13. v-for="(item, index) in tabData"
  14. :key="index"
  15. :class="{ active: idMate === index }"
  16. >
  17. {{ item.name }}
  18. </div>
  19. </div>
  20. </div>
  21. <!-- 8 -->
  22. <div id="Visit8">
  23. <DatePanel />
  24. </div>
  25. <!-- 1 -->
  26. <div id="Visit1">
  27. <h3>Hours</h3>
  28. <p>Tuesday - Sunday,9:00 - 17:00</p>
  29. <p>(No admission after 16:00)</p>
  30. <p>Closed on Mondays(Except for holidays)</p>
  31. <h3>Direction</h3>
  32. <p>16 Fuxingmenwai Street, Xicheng District, Beijing 100045</p>
  33. <p class="ttb">Subway</p>
  34. <p>500 meters east to Muxidi Station, Line 1</p>
  35. <p class="ttb">Bus</p>
  36. <p>Baiyun Road Station:</p>
  37. <p>By Bus 26, 45, 80, 114, 308, 843, 844, 937 or 特 19</p>
  38. <p>Gonghui Dalou Station:</p>
  39. <p>By Bus 1 or 52</p>
  40. <h3>Admission</h3>
  41. <p>Capital Museum offers free admission to visitors.</p>
  42. <p>you can book a free ticket in advance.</p>
  43. <img src="@/assets/img/Visit/map.png" alt="" />
  44. </div>
  45. <!-- 2 -->
  46. <div id="Visit2">
  47. <h2 class="title">Reservation</h2>
  48. <p class="aa">9:00 to 17:00 every day</p>
  49. <p class="bb">(Please enter the museum before 16:00.)</p>
  50. <p class="cc">Individual visitors</p>
  51. <p class="dd">+86 (10) 63393339</p>
  52. <p class="cc">Group visitors</p>
  53. <p class="dd">+86 (10) 63370458</p>
  54. <div class="more" @click="$router.push('/Layout/VisitInfo')">
  55. See More
  56. </div>
  57. </div>
  58. <!-- 3 -->
  59. <div id="Visit3">
  60. <div class="top3">
  61. <div class="title">Floor Plans</div>
  62. <div class="xian">
  63. <div
  64. class="xian_son"
  65. @click="xianInd = item"
  66. :class="{ active: item === xianInd }"
  67. v-for="item in xian"
  68. :key="item"
  69. >
  70. <div></div>
  71. <p>{{ item }}</p>
  72. </div>
  73. </div>
  74. </div>
  75. <img
  76. @click="imgLook(index)"
  77. v-for="(item, index) in xian"
  78. :key="index"
  79. v-show="xianInd === item"
  80. :src="require(`@/assets/img/Visit/v${index + 1}.png`)"
  81. alt=""
  82. />
  83. </div>
  84. <!-- 4 -->
  85. <div id="Visit4">
  86. <div class="title">Audio Guide & Tour</div>
  87. <Card keyval="card1" :cardData="cardAudio" />
  88. </div>
  89. <!-- 5 -->
  90. <div id="Visit5">
  91. <div class="title">Accessibility</div>
  92. <Card keyval="card2" :cardData="cardAcc" />
  93. </div>
  94. <!-- 6 -->
  95. <div id="Visit6">
  96. <div class="title">Café & Shop</div>
  97. <Card keyval="card3" :cardData="cardCafe" />
  98. </div>
  99. <!-- 7 -->
  100. <div id="Visit7">
  101. <div class="title">Visitor Guidelines</div>
  102. <div class="conten">
  103. <p><span>01</span>All exhibitions in the museum are free.</p>
  104. <p>
  105. <span>02</span>The museum opens from Tuesday to Sunday, 9:00 - 17:00
  106. (no admission after 16:00), but is closed on Mondays (except for
  107. holidays).
  108. </p>
  109. <p>
  110. <span>03</span>Please make ticket reservations at least one day
  111. before the desired visit and obtain your free ticket with your
  112. reservation number.
  113. </p>
  114. <p>
  115. <span>04</span>Please keep your valid ID (passport) available for
  116. inspection.
  117. </p>
  118. <p>
  119. <span>05</span>Inebriated and improperly-dressed persons will be
  120. refused entry.
  121. </p>
  122. <p>
  123. <span>06</span>Inflammable and explosive materials, knives subject
  124. to control and dangerous articles cannot be brought into the museum.
  125. </p>
  126. <p>
  127. <span>07</span>Photography is permitted, but flash and tripod is not
  128. allowed.
  129. </p>
  130. <p>
  131. <span>08</span>In case of an emergency, please follow the directions
  132. of our museum staff.
  133. </p>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import Card from "@/components/card.vue";
  141. import { ImagePreview } from "vant";
  142. import DatePanel from './datePanel.vue';
  143. export default {
  144. name: "Visit",
  145. components: { Card, DatePanel },
  146. data() {
  147. //这里存放数据
  148. return {
  149. tabData: [
  150. { name: "Calendar", path: "/Layout/Visit/8" },
  151. { name: "Hours, Direction & Admission", path: "/Layout/Visit/1" },
  152. { name: "Reservation", path: "/Layout/Visit/2" },
  153. { name: "Floor Plans", path: "/Layout/Visit/3" },
  154. { name: "Audio Guide & Tour", path: "/Layout/Visit/4" },
  155. { name: "Accessibility", path: "/Layout/Visit/5" },
  156. { name: "Café & Shop", path: "/Layout/Visit/6" },
  157. { name: "Visitor Guidelines", path: "/Layout/Visit/7" },
  158. ],
  159. xianInd: "B1",
  160. xian: ["B1", "F1", "F2", "F3", "F4", "F5", "F6"],
  161. idMate: 0,
  162. // 二级菜单的固定
  163. menaSon: false,
  164. cardAudio: [
  165. {
  166. cover: "/data/Visit/Audio1.jpg",
  167. h3: "Audio Guide",
  168. p: "The museum offers free audio guide. Visitors can get the devices from the audio guide cabinets with 200 RMB refundable deposit. The cabinets can be found at several locations in the museum, such as the east of the main entrance. The service is available in Chinese and English. For further questions, please visit the information desk for help.",
  169. },
  170. {
  171. cover: "/data/Visit/Audio2.jpg",
  172. h3: "Free Commentary Service",
  173. p: "Commentators provide free services on each open day (Tuesday to Sunday). Please check the specific time and exhibition location in the museum on the day of your visit.",
  174. },
  175. {
  176. cover: "/data/Visit/Audio3.jpg",
  177. h3: "Volunteer Guide",
  178. p: "Our museum volunteers offer free explanations and help.",
  179. },
  180. ],
  181. cardAcc: [
  182. {
  183. cover: "/data/Visit/access1.jpg",
  184. h3: "Facilities for the Handicapped",
  185. p: "Wheelchairs are available for visitors with special needs. Professional consultants and guides are on hand to help.<br/>In addition to professional commentators in the exhibition halls, 15 advanced self-service screens and six special ones for people in wheelchairs have been installed in the exhibit areas. Visitors can read and download data, or carry out interactive operations via these screens. A total of 18 card-operated telephones, including six for those in wheelchairs,have also been installed.",
  186. },
  187. {
  188. cover: "/data/Visit/access2.jpg",
  189. h3: "Nursery Room",
  190. p: "Nursery room is available on the 5th floor of the museum. Professional consultants and guides are on hand to help.",
  191. },
  192. {
  193. cover: "/data/Visit/access3.jpg",
  194. h3: "Lockers",
  195. p: "Lockers are available on the 1st floor, the right-hand side of the north entrance. Professional consultants and guides are on hand to help.",
  196. },
  197. ],
  198. cardCafe: [
  199. {
  200. cover: "/data/Visit/cafe1.jpg",
  201. h3: "Cafeteria",
  202. p: "The cafeteria is located on the northeast corner of the round exhibition room at basement level. Covering about 200 square meters, it offers coffee, soft drinks and low alcohol beverages.",
  203. },
  204. {
  205. cover: "/data/Visit/cafe2.jpg",
  206. h3: "Shop",
  207. p: `Located in the southwest of the museum's basement and with a floor space of about 550 square meters, the souvenir shop offers a wide variety of souvenirs including special souvenirs from the museum, books, and audio-visual products. Also on sale here are various arts and crafts with local characteristics, gold and jade ornaments, collotype calligraphic works and paintings of great collecting value, and other arts and crafts with unique features. The thousands of books on sale here mainly have a "Beijing taste" or are books on collecting and connoisseurship.`,
  208. },
  209. ],
  210. };
  211. },
  212. //监听属性 类似于data概念
  213. computed: {},
  214. //监控data中的数据变化
  215. watch: {
  216. $route() {
  217. // 获取地址栏参数id
  218. let id = this.$route.params.id;
  219. id = Number(id);
  220. this.pageSrool(id - 1);
  221. this.erjiTop(id - 1);
  222. },
  223. },
  224. //方法集合
  225. methods: {
  226. // 点击图片预览
  227. imgLook(index) {
  228. ImagePreview({
  229. images: [
  230. require(`@/assets/img/Visit/v1.png`),
  231. require(`@/assets/img/Visit/v2.png`),
  232. require(`@/assets/img/Visit/v3.png`),
  233. require(`@/assets/img/Visit/v4.png`),
  234. require(`@/assets/img/Visit/v5.png`),
  235. require(`@/assets/img/Visit/v6.png`),
  236. require(`@/assets/img/Visit/v7.png`),
  237. ],
  238. startPosition: index,
  239. });
  240. },
  241. cutTab(index) {
  242. this.pageSrool(index);
  243. this.erjiTop(index);
  244. },
  245. // 封装一个二级顶部滑动的方法
  246. erjiTop(index) {
  247. this.$nextTick(() => {
  248. setTimeout(() => {
  249. this.idMate = index;
  250. // 获取二级选中元素距离左侧的距离
  251. let sonScroll = document.querySelectorAll(".rowAll .row");
  252. let sonScrollAll = document.querySelector(".mainBox");
  253. sonScrollAll.scrollTo({
  254. left: sonScroll[index].offsetLeft - 100,
  255. behavior: "smooth",
  256. });
  257. }, 100);
  258. });
  259. },
  260. // 封装一个页面的滚动
  261. pageSrool(index) {
  262. this.$nextTick(() => {
  263. setTimeout(() => {
  264. // 滚动
  265. // 获取元素距离顶部的距离
  266. let dom = document.querySelector(`#Visit${index + 1}`);
  267. // 获取主滚动元素
  268. let domScroll = document.querySelector(".Layout");
  269. domScroll.scrollTo({ top: dom.offsetTop - 70 });
  270. }, 100);
  271. });
  272. },
  273. },
  274. //生命周期 - 创建完成(可以访问当前this实例)
  275. created() {
  276. // if (location.href.indexOf("#reloaded") == -1) {
  277. // location.href = location.href + "#reloaded";
  278. // window.location.reload();
  279. // }
  280. },
  281. //生命周期 - 挂载完成(可以访问DOM元素)
  282. mounted() {
  283. this.$nextTick(() => {
  284. setTimeout(() => {
  285. // 获取顶部元素ban的高度
  286. let banDom = this.$refs.ban;
  287. // 获取滚动的总元素
  288. let scrollDom = document.querySelector(".Layout");
  289. // 获取顶部固定栏
  290. let LayoutTop = document.querySelector(".Layout .top");
  291. // 动态改变idMate高亮效果
  292. let Visit1 = document.querySelector("#Visit1");
  293. let Visit2 = document.querySelector("#Visit2");
  294. let Visit3 = document.querySelector("#Visit3");
  295. let Visit4 = document.querySelector("#Visit4");
  296. let Visit5 = document.querySelector("#Visit5");
  297. let Visit6 = document.querySelector("#Visit6");
  298. let Visit8 = document.querySelector("#Visit8");
  299. let temp;
  300. scrollDom.onscroll = () => {
  301. if (scrollDom.scrollTop > banDom.offsetHeight) {
  302. LayoutTop.style.display = "none";
  303. this.menaSon = true;
  304. } else {
  305. LayoutTop.style.display = "flex";
  306. this.menaSon = false;
  307. }
  308. if (scrollDom.scrollTop < Visit1.offsetTop + Visit1.offsetHeight - 70)
  309. temp = 0;
  310. else if (
  311. scrollDom.scrollTop <
  312. Visit2.offsetTop + Visit2.offsetHeight - 70
  313. )
  314. temp = 1;
  315. else if (
  316. scrollDom.scrollTop <
  317. Visit3.offsetTop + Visit3.offsetHeight - 70
  318. )
  319. temp = 2;
  320. else if (
  321. scrollDom.scrollTop <
  322. Visit4.offsetTop + Visit4.offsetHeight - 70
  323. )
  324. temp = 3;
  325. else if (
  326. scrollDom.scrollTop <
  327. Visit5.offsetTop + Visit5.offsetHeight - 70
  328. )
  329. temp = 4;
  330. else if (
  331. scrollDom.scrollTop <
  332. Visit6.offsetTop + Visit6.offsetHeight - 70
  333. )
  334. temp = 5;
  335. else if (
  336. scrollDom.scrollTop <
  337. Visit8.offsetTop + Visit8.offsetHeight - 70
  338. )
  339. temp = 8;
  340. else temp = 6;
  341. this.erjiTop(temp);
  342. };
  343. // 获取地址栏参数id
  344. let id = this.$route.params.id;
  345. id = Number(id);
  346. this.pageSrool(id - 1);
  347. this.erjiTop(id - 1);
  348. }, 200);
  349. });
  350. },
  351. beforeCreate() {}, //生命周期 - 创建之前
  352. beforeMount() {}, //生命周期 - 挂载之前
  353. beforeUpdate() {}, //生命周期 - 更新之前
  354. updated() {}, //生命周期 - 更新之后
  355. beforeDestroy() {}, //生命周期 - 销毁之前
  356. destroyed() {
  357. // 获取滚动的总元素,删除滚动事件
  358. let scrollDom = document.querySelector(".Layout");
  359. scrollDom.onscroll = null;
  360. // 获取顶部固定栏
  361. let LayoutTop = document.querySelector(".Layout .top");
  362. LayoutTop.style.display = "flex";
  363. }, //生命周期 - 销毁完成
  364. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  365. };
  366. </script>
  367. <style lang='less' scoped>
  368. ::-webkit-scrollbar {
  369. height: 0;
  370. width: 0;
  371. color: transparent;
  372. }
  373. .Visit {
  374. width: 100%;
  375. .ban {
  376. position: relative;
  377. width: 100%;
  378. & > img {
  379. width: 100%;
  380. }
  381. & > h3 {
  382. position: absolute;
  383. font-size: 24px;
  384. color: #fff;
  385. left: 30px;
  386. bottom: 30px;
  387. border-bottom: 1px solid #fff;
  388. }
  389. }
  390. .main {
  391. background: url("../../assets/img/Visit/bg.png");
  392. background-size: 100%, 100%;
  393. .mainBox {
  394. width: 100%;
  395. overflow-x: auto;
  396. z-index: 10;
  397. .rowAll {
  398. width: 1150px;
  399. padding: 20px;
  400. background-color: #f7f6f3;
  401. .row {
  402. display: inline-block;
  403. font-size: 16px;
  404. height: 30px;
  405. line-height: 30px;
  406. margin-right: 10px;
  407. padding: 0 8px;
  408. }
  409. .active {
  410. background-color: #c1aa7b;
  411. border-radius: 15px;
  412. color: #fff;
  413. }
  414. }
  415. }
  416. .title {
  417. height: 30px;
  418. line-height: 30px;
  419. background: url("../../assets/img/Layout/title.png") 20px center no-repeat;
  420. background-size: 41px 29px;
  421. color: #c1aa7b;
  422. font-size: 22px;
  423. padding-left: 70px;
  424. margin-bottom: 20px;
  425. font-weight: 700;
  426. }
  427. #Visit1 {
  428. padding: 0px 0 20px;
  429. & > h3 {
  430. padding: 0 30px;
  431. font-size: 22px;
  432. font-weight: 700;
  433. padding-left: 60px;
  434. background: url("../../assets/img/Layout/chosen.png") 30px center
  435. no-repeat;
  436. background-size: 22px 18px;
  437. margin-bottom: 8px;
  438. margin-top: 20px;
  439. }
  440. & > p {
  441. padding: 0 30px;
  442. color: #6a6a6a;
  443. font-size: 14px;
  444. line-height: 18px;
  445. }
  446. .ttb {
  447. margin-top: 10px;
  448. background: url("../../assets/img/Layout/chosen.png") 30px center
  449. no-repeat;
  450. background-size: 22px 18px;
  451. padding-left: 60px;
  452. font-size: 22px;
  453. font-weight: 700;
  454. color: black;
  455. line-height: 36px;
  456. }
  457. & > img {
  458. width: 100%;
  459. margin-top: 20px;
  460. }
  461. }
  462. #Visit2 {
  463. padding: 20px 0px;
  464. border-bottom: 1px solid #ccc;
  465. width: calc(100% - 20px);
  466. margin: 0 auto;
  467. & > P {
  468. text-align: center;
  469. }
  470. .aa {
  471. font-weight: 700;
  472. color: #000000;
  473. font-size: 18px;
  474. }
  475. .bb {
  476. color: #6a6a6a;
  477. font-size: 14px;
  478. margin-bottom: 20px;
  479. }
  480. .cc {
  481. font-weight: 700;
  482. color: #bc1c24;
  483. font-size: 18px;
  484. }
  485. .dd {
  486. color: #6a6a6a;
  487. font-size: 16px;
  488. margin-bottom: 20px;
  489. }
  490. .more {
  491. margin: 20px auto;
  492. width: 117px;
  493. height: 37px;
  494. background: url("../../assets/img/Layout/see.png");
  495. background-size: 100% 100%;
  496. color: #c1aa7b;
  497. line-height: 40px;
  498. text-align: center;
  499. }
  500. }
  501. #Visit3 {
  502. padding: 40px 0;
  503. .top3 {
  504. padding: 0 10px;
  505. .xian {
  506. margin-top: 40px;
  507. position: relative;
  508. width: 100%;
  509. height: 2px;
  510. background-color: #c1aa7b;
  511. margin-bottom: 30px;
  512. .xian_son {
  513. position: absolute;
  514. top: -8px;
  515. left: 5%;
  516. & > div {
  517. width: 17px;
  518. height: 17px;
  519. border-radius: 50%;
  520. border: 2px solid #c1aa7b;
  521. background-color: #fff;
  522. }
  523. & > p {
  524. color: #1f1f1f;
  525. font-size: 16px;
  526. font-weight: 700;
  527. margin-top: 5px;
  528. }
  529. &:nth-of-type(2) {
  530. left: 18%;
  531. }
  532. &:nth-of-type(3) {
  533. left: 33%;
  534. }
  535. &:nth-of-type(4) {
  536. left: 48%;
  537. }
  538. &:nth-of-type(5) {
  539. left: 63%;
  540. }
  541. &:nth-of-type(6) {
  542. left: 77%;
  543. }
  544. &:nth-of-type(7) {
  545. left: 90%;
  546. }
  547. }
  548. .active {
  549. & > div {
  550. background-color: #c1aa7b;
  551. }
  552. & > p {
  553. color: #bc1c24;
  554. }
  555. }
  556. }
  557. }
  558. & > img {
  559. width: 100%;
  560. margin-top: 20px;
  561. }
  562. }
  563. #Visit4 {
  564. padding: 40px 0px;
  565. width: calc(100% - 20px);
  566. margin: 0 auto;
  567. border-bottom: 1px solid #ccc;
  568. border-top: 1px solid #ccc;
  569. }
  570. #Visit5 {
  571. padding: 40px 0px;
  572. width: calc(100% - 20px);
  573. margin: 0 auto;
  574. border-bottom: 1px solid #ccc;
  575. }
  576. #Visit6 {
  577. padding: 40px 0px;
  578. width: calc(100% - 20px);
  579. margin: 0 auto;
  580. border-bottom: 1px solid #ccc;
  581. }
  582. #Visit7 {
  583. padding: 40px 30px;
  584. .conten {
  585. & > p {
  586. color: #6a6a6a;
  587. font-size: 16px;
  588. margin-bottom: 15px;
  589. & > span {
  590. font-weight: 700;
  591. font-size: 18px;
  592. color: #bc1c24;
  593. margin-right: 15px;
  594. }
  595. }
  596. }
  597. }
  598. .curSorll {
  599. max-width: 500px;
  600. z-index: 99;
  601. position: fixed;
  602. top: 0;
  603. left: 0;
  604. right: 0;
  605. }
  606. }
  607. }
  608. </style>