index.html 20 KB

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