index.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <script src="./vue.min.js"></script>
  7. <!-- 引入样式 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  9. <!-- 引入组件库 -->
  10. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  11. <title>珠海市自然资源局倾斜建筑展示</title>
  12. <style>
  13. body {
  14. margin: 0;
  15. }
  16. * {
  17. box-sizing: border-box;
  18. margin: 0;
  19. padding: 0;
  20. }
  21. #app {
  22. min-width: 100vw;
  23. height: 100vh;
  24. box-sizing: border-box;
  25. overflow: hidden;
  26. }
  27. #bg-video {
  28. width: 100%;
  29. height: 100%;
  30. object-fit: cover;
  31. position: absolute;
  32. top: 0;
  33. left: 0;
  34. }
  35. #bg-audio {
  36. position: absolute;
  37. top: 0;
  38. left: 0;
  39. }
  40. .welcome-btn {
  41. padding: 15px 40px;
  42. background: url(./img/beginBg.png);
  43. background-size: 100% 100%;
  44. position: absolute;
  45. bottom: 15vh;
  46. left: 50%;
  47. transform: translateX(-50%);
  48. display: flex;
  49. justify-content: center;
  50. align-items: center;
  51. font-size: 1.2em;
  52. letter-spacing: 5px;
  53. cursor: pointer;
  54. color: #cbb18e;
  55. }
  56. .page2-box {
  57. width: 100%;
  58. height: 100%;
  59. position: absolute;
  60. top: 0;
  61. left: 0;
  62. z-index: 2;
  63. }
  64. .page2-box>.info-box {
  65. max-width: 250px;
  66. /* min-width: 12vw; */
  67. position: absolute;
  68. top: 10px;
  69. left: 10px;
  70. }
  71. .info-title-box {
  72. max-width: 250px;
  73. /* min-width: 12vw; */
  74. padding: 10px;
  75. background: url(./img/info-title-bg.png);
  76. background-size: 100% 100%;
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. color: white;
  81. cursor: pointer;
  82. }
  83. .info-title-box>.text {
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. color: white;
  88. max-width: 55%;
  89. }
  90. .info-title-box>.text>.scroll-wrap {
  91. max-width: 100%;
  92. display: inline-block;
  93. vertical-align: top;
  94. overflow: hidden;
  95. white-space: nowrap;
  96. }
  97. .info-title-box>.text>.scroll-wrap>.scroll-item {
  98. animation: scroll linear 7s alternate infinite;
  99. float: left;
  100. }
  101. @keyframes scroll {
  102. 0% {
  103. margin-left: 0;
  104. transform: translateX(0);
  105. }
  106. 10% {
  107. margin-left: 0;
  108. transform: translateX(0);
  109. }
  110. 90% {
  111. margin-left: 100%;
  112. transform: translateX(-100%);
  113. }
  114. 100% {
  115. margin-left: 100%;
  116. transform: translateX(-100%);
  117. }
  118. }
  119. .info-title-box>.line {
  120. width: 1px;
  121. height: 20px;
  122. margin: auto 20px;
  123. background: white;
  124. }
  125. .info-title-box>img {
  126. width: 20px;
  127. /* height: 25px; */
  128. }
  129. .info-desc-box {
  130. width: 100%;
  131. background: rgba(94, 27, 19, .6431372549019608);
  132. backdrop-filter: blur(10px);
  133. border-radius: 10px 10px;
  134. color: white;
  135. padding: 30px;
  136. text-indent: 2em;
  137. letter-spacing: 2px;
  138. transition: opacity 1s ease;
  139. margin-top: 10px;
  140. opacity: 0;
  141. }
  142. .options-box {
  143. width: 100%;
  144. height: 50px;
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. position: absolute;
  149. bottom: 30px;
  150. left: 0;
  151. padding: 0 20px;
  152. z-index: 2;
  153. }
  154. /* .guide-options-box>img{
  155. opacity: 0.5;
  156. } */
  157. .guide-options-box>.left-box>.option-item>img {
  158. opacity: 0.4;
  159. }
  160. .guide-options-box>.left-box>.option-item>.el-image {
  161. opacity: 0.4;
  162. }
  163. .guide-options-box>.right-box>.option-item>img {
  164. opacity: 0.4;
  165. }
  166. .options-box>.left-box>.option-item {
  167. cursor: pointer;
  168. position: relative;
  169. }
  170. .options-box>.right-box>.option-item {
  171. cursor: pointer;
  172. position: relative;
  173. }
  174. .options-box>.left-box>.option-item>.tip-box {
  175. background: url(./img/tip-bg.png);
  176. background-size: 100% 100%;
  177. pointer-events: none;
  178. transition: all .5s;
  179. opacity: 0;
  180. position: absolute;
  181. left: 50%;
  182. transform: translateX(-50%);
  183. top: -40px;
  184. width: 80px;
  185. height: 37px;
  186. line-height: 30px;
  187. text-align: center;
  188. font-size: 14px;
  189. color: #fff;
  190. }
  191. .options-box>.left-box>.option-item>.guide-tip-box {
  192. position: absolute;
  193. bottom: 55px;
  194. left: 50%;
  195. transform: translateX(-50%);
  196. font-size: 18px;
  197. white-space: nowrap;
  198. z-index: 70;
  199. color: #cbb18e;
  200. display: flex;
  201. flex-direction: column;
  202. align-items: center;
  203. justify-content: center;
  204. }
  205. .options-box>.left-box>.option-item>.guide-tip-box>.play-text {
  206. transform: translateX(25%);
  207. }
  208. .options-box>.left-box>.option-item>.guide-tip-box>.guide-cicle {
  209. width: 20px !important;
  210. height: 20px !important;
  211. }
  212. .options-box>.left-box>.option-item>.guide-tip-box>.guide-line {
  213. width: 5px !important;
  214. }
  215. .options-box>.right-box>.option-item>.guide-tip-box {
  216. position: absolute;
  217. bottom: 55px;
  218. left: 50%;
  219. transform: translateX(-50%);
  220. font-size: 18px;
  221. white-space: nowrap;
  222. z-index: 70;
  223. color: #cbb18e;
  224. display: flex;
  225. flex-direction: column;
  226. align-items: center;
  227. justify-content: center;
  228. }
  229. .options-box>.right-box>.option-item>.guide-tip-box>.play-text {
  230. transform: translateX(25%);
  231. }
  232. .options-box>.right-box>.option-item>.guide-tip-box>.guide-cicle {
  233. width: 20px !important;
  234. height: 20px !important;
  235. }
  236. .options-box>.right-box>.option-item>.guide-tip-box>.guide-line {
  237. width: 5px !important;
  238. }
  239. .options-box>.right-box>.option-item>.tip-box {
  240. background: url(./img/tip-bg.png);
  241. background-size: 100% 100%;
  242. pointer-events: none;
  243. transition: all .5s;
  244. opacity: 0;
  245. position: absolute;
  246. left: 50%;
  247. transform: translateX(-50%);
  248. top: -40px;
  249. width: 80px;
  250. height: 37px;
  251. line-height: 30px;
  252. text-align: center;
  253. font-size: 14px;
  254. color: #fff;
  255. }
  256. .options-box>.right-box>.option-item {
  257. cursor: pointer;
  258. }
  259. .options-box>.left-box>.option-item>img {
  260. width: 45px;
  261. }
  262. .options-box>.left-box>.option-item>.el-image {
  263. width: 45px;
  264. }
  265. .options-box>.right-box>.option-item>img {
  266. width: 45px;
  267. }
  268. .options-box>.left-box {
  269. display: flex;
  270. }
  271. .options-box>.right-box {
  272. display: flex;
  273. }
  274. .el-image-viewer__img {
  275. /* transform: scale(0.8) rotate(0deg) !important; */
  276. height: 75vh;
  277. }
  278. .guide-box {
  279. width: 100%;
  280. height: 100%;
  281. position: absolute;
  282. left: 0;
  283. top: 0;
  284. background: rgba(0, 0, 0, 0.7);
  285. color: #ffe794;
  286. }
  287. .guide-box>.begin-btn {
  288. padding: 15px 40px;
  289. background: url(./img/beginBg.png);
  290. background-size: 100% 100%;
  291. position: absolute;
  292. bottom: 15vh;
  293. left: 50%;
  294. transform: translateX(-50%);
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. font-size: 1.2em;
  299. letter-spacing: 5px;
  300. cursor: pointer;
  301. color: #cbb18e;
  302. }
  303. .progress-bar {
  304. width: 100%;
  305. height: 20px;
  306. background: #911212;
  307. position: absolute;
  308. left: 0;
  309. bottom: 0;
  310. padding: 10px;
  311. display: flex;
  312. justify-content: center;
  313. align-items: center;
  314. }
  315. .progress-bar>.content-box {
  316. width: 100%;
  317. height: 5px;
  318. background: white;
  319. }
  320. .progress-bar>.content-box>.progress-bar-passed {
  321. background: #d6b970;
  322. height: 5px;
  323. transition: width 0.1s ease;
  324. position: relative;
  325. }
  326. .progress-bar>.content-box>.progress-bar-passed>.cicle-box {
  327. width: 15px;
  328. height: 15px;
  329. border-radius: 50px;
  330. border: 1px #d6b970 solid;
  331. background: white;
  332. position: absolute;
  333. right: 0;
  334. top: 0;
  335. transform: translate(50%, -25%);
  336. cursor: pointer;
  337. }
  338. @media screen and (max-width: 768px) {
  339. .page2-box>.info-box {
  340. max-width: 250px;
  341. /* min-width: 12vw; */
  342. position: absolute;
  343. top: 10px;
  344. left: 50%;
  345. transform: translateX(-50%);
  346. }
  347. .options-box>.left-box {
  348. flex-direction: column;
  349. }
  350. .options-box {
  351. align-items: end;
  352. }
  353. .options-box>.left-box>.option-item {
  354. width: 35px;
  355. }
  356. .options-box>.left-box>.option-item>img {
  357. width: 35px;
  358. }
  359. .options-box>.left-box>.option-item>.el-image {
  360. width: 35px;
  361. margin-top: 10px;
  362. }
  363. .options-box>.right-box>.option-item>img {
  364. width: 35px;
  365. }
  366. .options-box>.left-box>.option-item>.tip-box {
  367. display: none !important;
  368. }
  369. .options-box>.right-box>.option-item>.tip-box {
  370. display: none !important;
  371. }
  372. .el-image-viewer__img {
  373. /* transform: scale(0.8) rotate(0deg) !important; */
  374. height: auto;
  375. }
  376. .guide-box>.begin-btn {
  377. bottom: 50vh;
  378. }
  379. .options-box>.left-box>.option-item>.guide-tip-box {
  380. bottom: 50%;
  381. transform: translateY(50%);
  382. left: 110%;
  383. flex-direction: row-reverse;
  384. }
  385. .options-box>.left-box>.option-item>.guide-tip-box>.guide-line {
  386. height: auto !important;
  387. transform: rotate(90deg);
  388. margin: 0 10px;
  389. }
  390. .options-box>.left-box>.option-item>.guide-tip-box>.guide-line {
  391. width: 10px !important;
  392. }
  393. .options-box>.right-box>.option-item>.guide-tip-box {
  394. bottom: 50%;
  395. transform: translate(-110%, 50%);
  396. left: 0;
  397. flex-direction: row;
  398. }
  399. .options-box>.right-box>.option-item>.guide-tip-box>.guide-line {
  400. height: auto !important;
  401. transform: rotate(90deg);
  402. margin: 0 10px;
  403. }
  404. .options-box>.right-box>.option-item>.guide-tip-box>.guide-line {
  405. width: 10px !important;
  406. }
  407. }
  408. </style>
  409. </head>
  410. <body>
  411. <div id="app">
  412. <!-- 视频背景 -->
  413. <video @timeupdate="timeUpdate" id="bg-video" :src="`${baseUrl}/video/${curModel.name}.mp4`" muted loop></video>
  414. <audio id="bg-audio" :src="`${baseUrl}/audio/${curModel.name}.mp3`" loop></audio>
  415. <!-- 开始探索 -->
  416. <div @click="goCurIndex2" class="welcome-btn" v-if="curPage == 1">开始探索</div>
  417. <!-- 左侧简介 -->
  418. <div class="page2-box" v-else>
  419. <div class="info-box" v-show="!isClearing">
  420. <div class="info-title-box" @click="isShowDescBox = !isShowDescBox">
  421. <div class="text">
  422. <div class="scroll-wrap">
  423. <div class="scroll-item">
  424. {{curModel.name}}
  425. </div>
  426. </div>
  427. </div>
  428. <div class="line"></div><img src="./img/icon-down.png" alt="">
  429. </div>
  430. <div class="info-desc-box" :style="{opacity: isShowDescBox ? 1:0}">{{curModel.desc}}</div>
  431. </div>]
  432. <!-- 下面功能按钮去 -->
  433. <div class="options-box " :class="{'guide-options-box': isGuideOpen}">
  434. <div class="left-box">
  435. <div class="option-item" @mousemove="hoverIndex = 1" @mouseleave="hoverIndex = -1"
  436. :style="{opacity: !isClearing ? 1:0,marginRight: '20px'}" @click="videoPlayChange()">
  437. <div class="tip-box" :style="{opacity: hoverIndex == 1 && !isGuideOpen ?1:0}">{{isPlayingVideo ?'暂停':'播放'}}
  438. </div>
  439. <div class="guide-tip-box" v-if="isGuideOpen && guideStep == 1">
  440. <div>播放/暂停</div>
  441. <img class="guide-line" style="height: 8vh" src="./img/guide-line.png" alt="" />
  442. <img class="guide-cicle" src="./img/guide-cicle.png" alt="" />
  443. </div>
  444. <img v-if="!isPlayingVideo" src="./img/icon-manyou-1.png" alt=""><img v-else src="./img/icon-manyou.png"
  445. alt="">
  446. </div>
  447. <div class="option-item" @mousemove="hoverIndex = 2 " @mouseleave="hoverIndex = -1"
  448. :style="{opacity: !isClearing ? 1:0}">
  449. <div class="tip-box" :style="{opacity: hoverIndex == 2 && !isGuideOpen ?1:0}">图片预览</div>
  450. <div class="guide-tip-box" v-if="isGuideOpen && guideStep == 1">
  451. <div>点击查看图片</div>
  452. <img class="guide-line" style="height: 4vh" src="./img/guide-line.png" alt="" />
  453. <img class="guide-cicle" src="./img/guide-cicle.png" alt="" />
  454. </div>
  455. <el-image @wheel="handleWheel" src="./img/icon-images.png" @click="openViewer"
  456. :preview-src-list="imagesList" :initial-zoom-num="0.5" alt=""></el-image>
  457. </div>
  458. </div>
  459. <div class="right-box">
  460. <div class="option-item" @mousemove="hoverIndex = 3" @mouseleave="hoverIndex = -1" @click="clearingChange()">
  461. <div class="tip-box" :style="{opacity: hoverIndex == 3 && !isGuideOpen?1:0}">{{isClearing ? '取消':'清屏'}}
  462. </div>
  463. <div class="guide-tip-box" v-if="isGuideOpen && guideStep == 2">
  464. <div>点击清屏</div>
  465. <img class="guide-line" style="height: 8vh" src="./img/guide-line.png" alt="" />
  466. <img class="guide-cicle" src="./img/guide-cicle.png" alt="" />
  467. </div>
  468. <img v-if="!isClearing" src="./img/icon-qingping.png" alt=""><img v-else src="./img/icon-qingping-1.png"
  469. alt="">
  470. </div>
  471. </div>
  472. </div>
  473. <!-- 提示指引 -->
  474. <div v-show="isGuideOpen" class="guide-box">
  475. <div class="begin-btn" @click="guideStep == 2 ? (isGuideOpen = false) : (guideStep ++) ">
  476. {{ guideStep != 2 ? "下一步" : "我知道了" }}
  477. </div>
  478. </div>
  479. <!-- 进度条 -->
  480. <div class="progress-bar">
  481. <div class="content-box" id="progress-track">
  482. <!-- <div class="progress-bar-passed" :style="{width: `${curModel.progress}%`}"></div>" ></div> -->
  483. <div class="progress-bar-passed" :style="{width:`${curProgressValue}%`}">
  484. <div class="cicle-box" id="progress-thumb" @mousedown="startDrag" @touchstart="startDrag"></div>
  485. </div>
  486. </div>
  487. </div>
  488. </div>
  489. </div>
  490. <script src="./staticData/data.js"></script>
  491. <script>
  492. var app = new Vue({
  493. el: "#app",
  494. data() {
  495. return {
  496. dataAll: dataAll,
  497. baseUrl: './staticData/data',
  498. curModel: null,
  499. curPage: 1,
  500. isShowDescBox: false,
  501. isPlayingVideo: true,
  502. isClearing: false,
  503. imagesList: [],
  504. hoverIndex: 0,
  505. guideStep: 1,
  506. isGuideOpen: true,
  507. curProgressValue: 0, // 当前进度值
  508. dragPosition: '', // 拖动位置(百分比)
  509. isDragging: false, // 是否正在拖动
  510. };
  511. },
  512. mounted() {
  513. const m = this.handleQueryParams().m
  514. const res = this.dataAll.list.filter((item) => {
  515. return item.id == m || item.name == m
  516. })
  517. this.curModel = res[0]
  518. // 初始化大图列表
  519. this.imagesList = res[0].images.map((item) => {
  520. return `${this.baseUrl}/images/${res[0].name}/${item}`
  521. })
  522. if (localStorage.getItem("isGuided") == "true") {
  523. this.isGuideOpen = false;
  524. this.guideStep = null;
  525. } else {
  526. this.isGuideOpen = true;
  527. this.guideStep = 1;
  528. localStorage.setItem("isGuided", "true");
  529. }
  530. },
  531. created() { },
  532. beforeDestroy() {
  533. },
  534. watch: {
  535. },
  536. methods: {
  537. handleQueryParams() {
  538. var queryParams = {};
  539. console.log(window.location.href)
  540. if (!window.location.href.includes('?')) {
  541. alert('请输入参数')
  542. return {}
  543. }
  544. window.location.href.split('?')[1].split('&').forEach(function (item) {
  545. var parts = item.split('=');
  546. queryParams[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
  547. });
  548. return queryParams;
  549. },
  550. goCurIndex2() {
  551. this.curPage = 2;
  552. const audioDom = document.getElementById('bg-audio');
  553. const videoDom = document.getElementById('bg-video');
  554. if (audioDom && videoDom) {
  555. audioDom.play()
  556. videoDom.play()
  557. }
  558. setTimeout(() => {
  559. this.isShowDescBox = true
  560. setTimeout(() => {
  561. this.isShowDescBox = false
  562. }, 3000)
  563. }, 200)
  564. },
  565. videoPlayChange() {
  566. const videoDom = document.getElementById('bg-video')
  567. const audioDom = document.getElementById('bg-audio')
  568. if (!videoDom.paused && !videoDom.ended && videoDom.readyState > 2) {
  569. videoDom.pause()
  570. audioDom.pause()
  571. this.isPlayingVideo = false
  572. } else {
  573. videoDom.play()
  574. audioDom.play()
  575. this.isPlayingVideo = true
  576. }
  577. },
  578. clearingChange() {
  579. this.isClearing = !this.isClearing
  580. },
  581. openViewer() {
  582. },
  583. handleWheel() {
  584. },
  585. timeUpdate(event) {
  586. this.curProgressValue = event.target.currentTime / event.target.duration * 100
  587. },
  588. getRelativePosition(event) {
  589. // const track = document.querySelector('#progress-track');
  590. // console.log('有没有',track)
  591. const trackRect = document.querySelector('#progress-track').getBoundingClientRect();
  592. let pos;
  593. if (event.type.includes('touch')) {
  594. pos = event.touches[0].clientX - trackRect.left;
  595. } else {
  596. pos = event.clientX - trackRect.left;
  597. }
  598. return Math.min(Math.max(pos / trackRect.width * 100, 0), 100);
  599. },
  600. startDrag(event) {
  601. console.log('被拖动了')
  602. this.isDragging = true
  603. this.curProgressValue = this.getRelativePosition(event);
  604. document.addEventListener('mousemove', this.moveDrag);
  605. document.addEventListener('touchmove', this.moveDrag);
  606. document.addEventListener('mouseup', this.stopDrag);
  607. document.addEventListener('touchend', this.stopDrag);
  608. },
  609. moveDrag(event) {
  610. if (!this.isDragging) return;
  611. this.curProgressValue = this.getRelativePosition(event);
  612. this.updateProgress();
  613. },
  614. stopDrag() {
  615. this.isDragging = false;
  616. document.removeEventListener('mousemove', this.moveDrag);
  617. document.removeEventListener('touchmove', this.moveDrag);
  618. document.removeEventListener('mouseup', this.stopDrag);
  619. document.removeEventListener('touchend', this.stopDrag);
  620. },
  621. updateProgress() {
  622. this.curProgressValue = Math.round(this.curProgressValue)
  623. const videoDom = document.getElementById('bg-video')
  624. // const audioDom = document.getElementById('bg-audio')
  625. // videoDom.pause()
  626. // audioDom.pause()
  627. // this.isPlayingVideo = false
  628. const progressTrack = document.getElementById('progress-track')
  629. if (videoDom && progressTrack) {
  630. let clickProgress = this.curProgressValue / 100
  631. videoDom.currentTime = videoDom.duration * clickProgress;
  632. }
  633. }
  634. },
  635. });
  636. </script>
  637. </body>
  638. </html>