index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <div class="Collections">
  3. <div class="ban"></div>
  4. <!-- 面包屑 -->
  5. <div class="pos">
  6. <span class="pos1">Your Position:&nbsp;</span>
  7. <Router-link to="/Layout/Home">Home></Router-link>
  8. <Router-link to="/Layout/Collections/Bronzes">Collections></Router-link>
  9. <span>{{ mbTxt }}></span>
  10. </div>
  11. <!-- 内容 -->
  12. <div class="conten" :class="mbTxt">
  13. <ul>
  14. <li
  15. @click="cutTab(item.url)"
  16. :class="{ active: mbTxt === item.url }"
  17. v-for="(item, index) in tabData"
  18. :key="item.name"
  19. :style="`background-image:url(/data/Collections/tab/${
  20. index + 1
  21. }.png)`"
  22. >
  23. <div class="bac">{{ item.name }}</div>
  24. </li>
  25. </ul>
  26. <!-- 右侧内容 -->
  27. <div class="right">
  28. <div
  29. class="row"
  30. v-for="(item, index) in data"
  31. :key="item.id"
  32. @click="lookBig(item)"
  33. >
  34. <img
  35. class="rowImg"
  36. :src="`/data/Collections/${mbTxt}/${index + 1}.png`"
  37. alt=""
  38. />
  39. <div class="info">
  40. <!-- 箭头 -->
  41. <img src="/data/Collections/arrow.png" alt="" />
  42. <h3 v-html="item.h3"></h3>
  43. <p v-html="item.p"></p>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <!-- 查看详情组件 -->
  49. <CollectionsInfo v-if="isShow" :isShow.sync="isShow" :infoObj="infoObj" />
  50. </div>
  51. </template>
  52. <script>
  53. import CollectionsInfo from "./component/info.vue";
  54. import { Collections } from "@/views/dataAll.js";
  55. export default {
  56. name: "Collections",
  57. components: { CollectionsInfo },
  58. data() {
  59. //这里存放数据
  60. return {
  61. // 点击单个查看图片
  62. isShow: false,
  63. infoObj: {},
  64. // ---------
  65. data: [],
  66. mbTxt: "Bronzes",
  67. tabData: [
  68. { name: "Bronzes", url: "Bronzes" },
  69. { name: "Ceramics", url: "Ceramics" },
  70. { name: "Buddhist Statues", url: "Buddhist" },
  71. { name: "Jadewares", url: "Jadewares" },
  72. { name: "Calligraphies", url: "Calligraphies" },
  73. { name: "Paintings", url: "Paintings" },
  74. { name: "Gold & Silverwares", url: "Gold" },
  75. { name: "Coins & Banknotes", url: "Coins" },
  76. { name: "Brocades & Embroideries", url: "Brocades" },
  77. { name: "Cultural Supplies", url: "Cultural" },
  78. { name: "Miscellaneous", url: "Miscellaneous" },
  79. ],
  80. };
  81. },
  82. //监听属性 类似于data概念
  83. computed: {},
  84. //监控data中的数据变化
  85. watch: {
  86. // 监听地址栏参数变化
  87. $route() {
  88. // 拿到路由参数id
  89. let temp = this.$route.params.id;
  90. this.mbTxt = temp;
  91. this.data = Collections[this.mbTxt];
  92. },
  93. },
  94. //方法集合
  95. methods: {
  96. // 点击单个查看图片
  97. lookBig(item) {
  98. this.infoObj = item;
  99. this.isShow = true;
  100. this.$nextTick(() => {
  101. // 获取body,防止滚动
  102. let body = document.querySelector("body");
  103. body.style.overflow = "hidden";
  104. });
  105. },
  106. cutTab(path) {
  107. this.$router.push(`/Layout/Collections/${path}`).catch(() => {});
  108. },
  109. },
  110. //生命周期 - 创建完成(可以访问当前this实例)
  111. created() {
  112. // 拿到路由参数id
  113. let temp = this.$route.params.id;
  114. this.mbTxt = temp;
  115. this.data = Collections[this.mbTxt];
  116. },
  117. //生命周期 - 挂载完成(可以访问DOM元素)
  118. mounted() {},
  119. beforeCreate() {}, //生命周期 - 创建之前
  120. beforeMount() {}, //生命周期 - 挂载之前
  121. beforeUpdate() {}, //生命周期 - 更新之前
  122. updated() {}, //生命周期 - 更新之后
  123. beforeDestroy() {}, //生命周期 - 销毁之前
  124. destroyed() {}, //生命周期 - 销毁完成
  125. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  126. };
  127. </script>
  128. <style lang='less' scoped>
  129. .Collections {
  130. background-color: #fff;
  131. .ban {
  132. width: 100%;
  133. margin: auto;
  134. background: url("/data/Collections/banner.jpg") no-repeat center top #000000;
  135. height: 300px;
  136. }
  137. .pos {
  138. height: 28px;
  139. line-height: 28px;
  140. font-size: 12px;
  141. margin: 0 auto 10px auto;
  142. width: 1180px;
  143. .pos1 {
  144. color: #c20e11;
  145. }
  146. }
  147. .conten {
  148. display: flex;
  149. width: 1200px;
  150. overflow: hidden;
  151. margin: 0 auto;
  152. padding-bottom: 20px;
  153. zoom: 1;
  154. & > ul {
  155. width: 210px;
  156. & > li {
  157. cursor: pointer;
  158. width: 210px;
  159. height: 48px;
  160. position: relative;
  161. background: #181818 no-repeat right center;
  162. border-bottom: 1px solid #fff;
  163. .bac {
  164. text-indent: 10px;
  165. font-size: 14px;
  166. color: #fff;
  167. line-height: 48px;
  168. z-index: 10;
  169. position: absolute;
  170. top: 0;
  171. left: 0;
  172. width: 100%;
  173. height: 100%;
  174. }
  175. &:hover {
  176. .bac {
  177. background-color: rgba(254, 24, 24, 0.7);
  178. }
  179. }
  180. }
  181. .active {
  182. .bac {
  183. background-color: rgba(254, 24, 24, 0.7);
  184. }
  185. }
  186. }
  187. .right {
  188. border-left: 1px solid #d8d8d8;
  189. flex: 1;
  190. margin-left: 10px;
  191. padding-left: 10px;
  192. position: relative;
  193. .row {
  194. top: 10px;
  195. left: 10px;
  196. position: absolute;
  197. width: 310px;
  198. .rowImg {
  199. width: 310px;
  200. // height: 400px;
  201. vertical-align: middle;
  202. }
  203. .info {
  204. position: relative;
  205. padding: 20px 15px;
  206. & > img {
  207. opacity: 0;
  208. position: absolute;
  209. top: -30px;
  210. left: 30px;
  211. }
  212. h3 {
  213. font-size: 18px;
  214. color: #262626;
  215. line-height: 22px;
  216. padding-bottom: 5px;
  217. font-weight: 700;
  218. /deep/& > i {
  219. font-style: italic;
  220. }
  221. /deep/.smImg {
  222. width: 41px;
  223. height: 32px;
  224. }
  225. }
  226. p {
  227. font-size: 14px;
  228. color: #626262;
  229. }
  230. }
  231. &:hover {
  232. box-shadow: 0 0 10px #000;
  233. .info {
  234. background-color: #ca000a;
  235. & > img {
  236. opacity: 1;
  237. }
  238. h3 {
  239. color: #fff;
  240. }
  241. p {
  242. color: #fff;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. // 第一个页面
  250. .conten {
  251. height: 5291px;
  252. .row {
  253. &:nth-of-type(2) {
  254. left: 330px;
  255. }
  256. &:nth-of-type(3) {
  257. left: 650px;
  258. }
  259. &:nth-of-type(4) {
  260. left: 330px;
  261. top: 369px;
  262. }
  263. &:nth-of-type(5) {
  264. left: 650px;
  265. top: 589px;
  266. }
  267. &:nth-of-type(6) {
  268. top: 609px;
  269. }
  270. &:nth-of-type(7) {
  271. left: 330px;
  272. top: 948px;
  273. }
  274. &:nth-of-type(8) {
  275. left: 650px;
  276. top: 968px;
  277. }
  278. &:nth-of-type(9) {
  279. top: 1166px;
  280. }
  281. &:nth-of-type(10) {
  282. left: 650px;
  283. top: 1325px;
  284. }
  285. &:nth-of-type(11) {
  286. left: 330px;
  287. top: 1507px;
  288. }
  289. &:nth-of-type(12) {
  290. left: 650px;
  291. top: 1724px;
  292. }
  293. &:nth-of-type(13) {
  294. top: 1747px;
  295. }
  296. &:nth-of-type(14) {
  297. left: 330px;
  298. top: 1846px;
  299. }
  300. &:nth-of-type(15) {
  301. left: 330px;
  302. top: 2183px;
  303. }
  304. &:nth-of-type(16) {
  305. left: 650px;
  306. top: 2269px;
  307. }
  308. &:nth-of-type(17) {
  309. top: 2328px;
  310. }
  311. &:nth-of-type(18) {
  312. left: 330px;
  313. top: 2762px;
  314. }
  315. &:nth-of-type(19) {
  316. left: 650px;
  317. top: 2848px;
  318. }
  319. &:nth-of-type(20) {
  320. top: 2887px;
  321. }
  322. &:nth-of-type(21) {
  323. top: 3242px;
  324. }
  325. &:nth-of-type(22) {
  326. left: 330px;
  327. top: 3321px;
  328. }
  329. &:nth-of-type(23) {
  330. left: 650px;
  331. top: 3427px;
  332. }
  333. &:nth-of-type(24) {
  334. top: 3601px;
  335. }
  336. &:nth-of-type(25) {
  337. left: 330px;
  338. top: 3680px;
  339. }
  340. &:nth-of-type(26) {
  341. left: 650px;
  342. top: 3966px;
  343. }
  344. &:nth-of-type(27) {
  345. top: 3980px;
  346. }
  347. &:nth-of-type(28) {
  348. left: 330px;
  349. top: 4101px;
  350. }
  351. &:nth-of-type(29) {
  352. left: 650px;
  353. top: 4365px;
  354. }
  355. &:nth-of-type(30) {
  356. top: 4559px;
  357. }
  358. &:nth-of-type(31) {
  359. left: 330px;
  360. top: 4680px;
  361. }
  362. &:nth-of-type(32) {
  363. left: 650px;
  364. top: 4742px;
  365. }
  366. }
  367. }
  368. .Ceramics {
  369. height: 1603px;
  370. .row {
  371. &:nth-of-type(4) {
  372. top: 411px;
  373. }
  374. &:nth-of-type(7) {
  375. left: 650px;
  376. top: 990px;
  377. }
  378. &:nth-of-type(8) {
  379. left: 330px;
  380. top: 1054px;
  381. }
  382. }
  383. }
  384. .Buddhist {
  385. height: 1870px;
  386. .row {
  387. &:nth-of-type(4) {
  388. top: 347px;
  389. }
  390. &:nth-of-type(5) {
  391. top: 587px;
  392. }
  393. &:nth-of-type(6) {
  394. top: 653px;
  395. }
  396. &:nth-of-type(7) {
  397. top: 944px;
  398. }
  399. &:nth-of-type(8) {
  400. top: 1146px;
  401. }
  402. &:nth-of-type(9) {
  403. top: 1252px;
  404. }
  405. }
  406. }
  407. .Jadewares {
  408. height: 1405px;
  409. .row {
  410. &:nth-of-type(4) {
  411. left: 650px;
  412. top: 382px;
  413. }
  414. &:nth-of-type(5) {
  415. left: 10px;
  416. top: 422px;
  417. }
  418. &:nth-of-type(6) {
  419. left: 330px;
  420. top: 582px;
  421. }
  422. &:nth-of-type(7) {
  423. left: 650px;
  424. top: 732px;
  425. }
  426. &:nth-of-type(8) {
  427. left: 10px;
  428. top: 996px;
  429. }
  430. }
  431. }
  432. .Calligraphies {
  433. height: 2314px;
  434. .row {
  435. &:nth-of-type(4) {
  436. left: 650px;
  437. top: 367px;
  438. }
  439. &:nth-of-type(5) {
  440. left: 10px;
  441. top: 429px;
  442. }
  443. &:nth-of-type(6) {
  444. left: 330px;
  445. top: 609px;
  446. }
  447. &:nth-of-type(7) {
  448. left: 650px;
  449. top: 744px;
  450. }
  451. &:nth-of-type(8) {
  452. left: 10px;
  453. top: 808px;
  454. }
  455. &:nth-of-type(9) {
  456. left: 650px;
  457. top: 1123px;
  458. }
  459. &:nth-of-type(10) {
  460. left: 330px;
  461. top: 1228px;
  462. }
  463. &:nth-of-type(11) {
  464. left: 10px;
  465. top: 1458px;
  466. }
  467. &:nth-of-type(12) {
  468. left: 650px;
  469. top: 1779px;
  470. }
  471. &:nth-of-type(13) {
  472. left: 330px;
  473. top: 1807px;
  474. }
  475. }
  476. }
  477. .Paintings {
  478. height: 2448px;
  479. .row {
  480. &:nth-of-type(4) {
  481. left: 330px;
  482. top: 367px;
  483. }
  484. &:nth-of-type(5) {
  485. left: 10px;
  486. top: 567px;
  487. }
  488. &:nth-of-type(6) {
  489. left: 650px;
  490. top: 589px;
  491. }
  492. &:nth-of-type(7) {
  493. left: 10px;
  494. top: 889px;
  495. }
  496. &:nth-of-type(8) {
  497. left: 650px;
  498. top: 926px;
  499. }
  500. &:nth-of-type(9) {
  501. left: 330px;
  502. top: 966px;
  503. }
  504. &:nth-of-type(10) {
  505. left: 330px;
  506. top: 1323px;
  507. }
  508. &:nth-of-type(11) {
  509. left: 10px;
  510. top: 1486px;
  511. }
  512. &:nth-of-type(12) {
  513. left: 650px;
  514. top: 1503px;
  515. }
  516. &:nth-of-type(13) {
  517. left: 330px;
  518. top: 1829px;
  519. }
  520. &:nth-of-type(14) {
  521. left: 10px;
  522. top: 1845px;
  523. }
  524. }
  525. }
  526. .Gold {
  527. height: 1652px;
  528. .row {
  529. &:nth-of-type(4) {
  530. left: 330px;
  531. top: 367px;
  532. }
  533. &:nth-of-type(5) {
  534. left: 650px;
  535. top: 369px;
  536. }
  537. &:nth-of-type(6) {
  538. left: 10px;
  539. top: 598px;
  540. }
  541. &:nth-of-type(7) {
  542. left: 330px;
  543. top: 746px;
  544. }
  545. &:nth-of-type(8) {
  546. left: 650px;
  547. top: 769px;
  548. }
  549. &:nth-of-type(9) {
  550. left: 650px;
  551. top: 1109px;
  552. }
  553. &:nth-of-type(10) {
  554. left: 330px;
  555. top: 1128px;
  556. }
  557. }
  558. }
  559. .Coins {
  560. height: 2093px;
  561. .row {
  562. &:nth-of-type(4) {
  563. left: 330px;
  564. top: 411px;
  565. }
  566. &:nth-of-type(5) {
  567. left: 10px;
  568. top: 569px;
  569. }
  570. &:nth-of-type(6) {
  571. left: 650px;
  572. top: 611px;
  573. }
  574. &:nth-of-type(7) {
  575. left: 330px;
  576. top: 839px;
  577. }
  578. &:nth-of-type(8) {
  579. left: 10px;
  580. top: 1128px;
  581. }
  582. &:nth-of-type(9) {
  583. left: 650px;
  584. top: 1221px;
  585. }
  586. &:nth-of-type(10) {
  587. left: 330px;
  588. top: 1396px;
  589. }
  590. &:nth-of-type(11) {
  591. left: 10px;
  592. top: 1527px;
  593. }
  594. &:nth-of-type(12) {
  595. left: 650px;
  596. top: 1607px;
  597. }
  598. }
  599. }
  600. .Brocades {
  601. height: 1512px;
  602. .row {
  603. &:nth-of-type(4) {
  604. left: 10px;
  605. top: 409px;
  606. }
  607. &:nth-of-type(5) {
  608. left: 330px;
  609. top: 409px;
  610. }
  611. &:nth-of-type(6) {
  612. left: 650px;
  613. top: 568px;
  614. }
  615. &:nth-of-type(7) {
  616. left: 650px;
  617. top: 945px;
  618. }
  619. &:nth-of-type(8) {
  620. left: 10px;
  621. top: 1027px;
  622. }
  623. }
  624. }
  625. .Cultural {
  626. height: 1451px;
  627. .row {
  628. &:nth-of-type(4) {
  629. left: 650px;
  630. top: 414px;
  631. }
  632. &:nth-of-type(5) {
  633. left: 330px;
  634. top: 563px;
  635. }
  636. &:nth-of-type(6) {
  637. left: 10px;
  638. top: 578px;
  639. }
  640. &:nth-of-type(7) {
  641. left: 650px;
  642. top: 875px;
  643. }
  644. &:nth-of-type(8) {
  645. left: 330px;
  646. top: 930px;
  647. }
  648. }
  649. }
  650. .Miscellaneous{
  651. height: 641px;
  652. }
  653. }
  654. </style>