index.html 22 KB

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