hookehuyr

细节调整

1 +<!--
2 + * @Date: 2023-05-31 16:10:33
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2023-07-10 13:24:19
5 + * @FilePath: /map-demo/index.html
6 + * @Description: 文件描述
7 +-->
1 <!DOCTYPE html> 8 <!DOCTYPE html>
2 <html lang='zh'> 9 <html lang='zh'>
3 <head> 10 <head>
...@@ -12,7 +19,7 @@ ...@@ -12,7 +19,7 @@
12 <script type="module" src="/src/main.js"></script> 19 <script type="module" src="/src/main.js"></script>
13 <script type="text/javascript"> 20 <script type="text/javascript">
14 window._AMapSecurityConfig = { 21 window._AMapSecurityConfig = {
15 - securityJsCode:'8602057c4c8dae5bed9a240c0582c46f', 22 + serviceHost:'https://oa-dev.onwall.cn/_AMapService',
16 } 23 }
17 </script> 24 </script>
18 <script src="https://webapi.amap.com/maps?v=2.0&key=381c6763e1fefd810fbab697f470149c&plugin=AMap.ElasticMarker,AMap.ImageLayer,AMap.ToolBar"></script> 25 <script src="https://webapi.amap.com/maps?v=2.0&key=381c6763e1fefd810fbab697f470149c&plugin=AMap.ElasticMarker,AMap.ImageLayer,AMap.ToolBar"></script>
......
...@@ -121,6 +121,7 @@ export default { ...@@ -121,6 +121,7 @@ export default {
121 play_time: '00:00', 121 play_time: '00:00',
122 isActive: 0, 122 isActive: 0,
123 nav_scroll: false, 123 nav_scroll: false,
124 + play_timer: null,
124 } 125 }
125 }, 126 },
126 methods: { 127 methods: {
...@@ -141,9 +142,9 @@ export default { ...@@ -141,9 +142,9 @@ export default {
141 return `${minutes}:${second}`; 142 return `${minutes}:${second}`;
142 }, 143 },
143 calculateCurrentValue(currentTime) { 144 calculateCurrentValue(currentTime) {
144 - var current_hour = parseInt(currentTime / 3600) % 24, 145 + var current_hour = parseInt(+currentTime / 3600) % 24,
145 - current_minute = parseInt(currentTime / 60) % 60, 146 + current_minute = parseInt(+currentTime / 60) % 60,
146 - current_seconds_long = currentTime % 60, 147 + current_seconds_long = +currentTime % 60,
147 current_seconds = current_seconds_long.toFixed(), 148 current_seconds = current_seconds_long.toFixed(),
148 current_time = (current_minute < 10 ? "0" + current_minute : current_minute) + ":" + (current_seconds < 10 ? "0" + current_seconds : current_seconds); 149 current_time = (current_minute < 10 ? "0" + current_minute : current_minute) + ":" + (current_seconds < 10 ? "0" + current_seconds : current_seconds);
149 150
...@@ -161,6 +162,8 @@ export default { ...@@ -161,6 +162,8 @@ export default {
161 this.isActive = 0; 162 this.isActive = 0;
162 // 滚动状态 163 // 滚动状态
163 this.nav_scroll = false; 164 this.nav_scroll = false;
165 + // 清空播放计时
166 + this.play_timer = null;
164 }, 167 },
165 showDetail() { 168 showDetail() {
166 this.show_popup = true; 169 this.show_popup = true;
...@@ -196,8 +199,12 @@ export default { ...@@ -196,8 +199,12 @@ export default {
196 setTimeout(() => { // 后续操作(同为播放完成) 199 setTimeout(() => { // 后续操作(同为播放完成)
197 this.ind = 0 200 this.ind = 0
198 }, this.audio.duration * 1000) // audio.duration 为音频的时长单位为秒 201 }, this.audio.duration * 1000) // audio.duration 为音频的时长单位为秒
199 - setInterval(() => { 202 + this.play_timer = setInterval(() => {
200 - this.play_time = this.calculateCurrentValue(this.audio.duration - this.audio.currentTime); 203 + let timer = this.audio.duration - this.audio.currentTime;
204 + if (isNaN(timer)) {
205 + timer = 0
206 + }
207 + this.play_time = this.calculateCurrentValue(timer)
201 }, 1000); 208 }, 1000);
202 }).catch((e) => { 209 }).catch((e) => {
203 // 失败 210 // 失败
...@@ -208,6 +215,7 @@ export default { ...@@ -208,6 +215,7 @@ export default {
208 voice_pause() { 215 voice_pause() {
209 this.audio.pause(); 216 this.audio.pause();
210 this.is_play = false; 217 this.is_play = false;
218 + this.changeAudioStatus('pause');
211 }, 219 },
212 goToUrl(url) { 220 goToUrl(url) {
213 location.href = this.info.details[this.isActive].url; 221 location.href = this.info.details[this.isActive].url;
......
...@@ -214,7 +214,11 @@ export default { ...@@ -214,7 +214,11 @@ export default {
214 this.ind = 0 214 this.ind = 0
215 }, this.audio.duration * 1000) // audio.duration 为音频的时长单位为秒 215 }, this.audio.duration * 1000) // audio.duration 为音频的时长单位为秒
216 setInterval(() => { 216 setInterval(() => {
217 - this.play_time = this.calculateCurrentValue(this.audio.duration - this.audio.currentTime) 217 + let timer = this.audio.duration - this.audio.currentTime;
218 + if (isNaN(timer)) {
219 + timer = 0
220 + }
221 + this.play_time = this.calculateCurrentValue(timer)
218 }, 1000); 222 }, 1000);
219 }).catch((e) => { 223 }).catch((e) => {
220 // 失败 224 // 失败
......
1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-07-07 13:25:46 4 + * @LastEditTime: 2023-07-10 13:31:34
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 地图主体页面 6 * @Description: 地图主体页面
7 --> 7 -->
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
41 style="vertical-align: middle;" /> 41 style="vertical-align: middle;" />
42 </div> --> 42 </div> -->
43 <div v-if="open_safe_route" class="item" @click="handleSafeRoute(true)"> 43 <div v-if="open_safe_route" class="item" @click="handleSafeRoute(true)">
44 - <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF@2x.png" size="1.25rem" 44 + <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF01.png" size="1.25rem"
45 style="vertical-align: middle;" /> 45 style="vertical-align: middle;" />
46 </div> 46 </div>
47 <div v-else class="item" @click="handleSafeRoute(false)"> 47 <div v-else class="item" @click="handleSafeRoute(false)">
48 - <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF@2x.png" size="1.25rem" 48 + <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF02.png" size="1.25rem"
49 style="vertical-align: middle;" /> 49 style="vertical-align: middle;" />
50 </div> 50 </div>
51 </div> 51 </div>
...@@ -189,12 +189,14 @@ export default { ...@@ -189,12 +189,14 @@ export default {
189 current_lng: '', 189 current_lng: '',
190 current_lat: '', 190 current_lat: '',
191 current_route: '', 191 current_route: '',
192 + current_safe_route: '',
192 show_popup: false, 193 show_popup: false,
193 dialog_show: false, 194 dialog_show: false,
194 dialog_text: '', 195 dialog_text: '',
195 walk_route: '', 196 walk_route: '',
196 isActive: 0, 197 isActive: 0,
197 route_marker: [], 198 route_marker: [],
199 + route_safe_marker: [],
198 open_safe_route: true, 200 open_safe_route: true,
199 show_walk_route: true, 201 show_walk_route: true,
200 popup_title: '', 202 popup_title: '',
...@@ -490,13 +492,12 @@ export default { ...@@ -490,13 +492,12 @@ export default {
490 addSafeRoute() { // 新增路径 492 addSafeRoute() { // 新增路径
491 // 行动路线 493 // 行动路线
492 var path = [ 494 var path = [
493 - [120.586841, 31.314543], 495 + [120.587645, 31.314833],
494 - [120.586862, 31.314304], 496 + [120.587709, 31.314338],
495 - [120.587495, 31.314204], 497 + [120.588211, 31.314377],
496 - [120.587512, 31.313796],
497 ]; 498 ];
498 // 生成折线地图路径 499 // 生成折线地图路径
499 - this.current_route = new AMap.Polyline({ 500 + this.current_safe_route = new AMap.Polyline({
500 path, 501 path,
501 isOutline: true, 502 isOutline: true,
502 outlineColor: '#7F7F7F', 503 outlineColor: '#7F7F7F',
...@@ -512,7 +513,7 @@ export default { ...@@ -512,7 +513,7 @@ export default {
512 lineCap: 'round', 513 lineCap: 'round',
513 zIndex: 50 514 zIndex: 50
514 }) 515 })
515 - this.map.add([this.current_route]); 516 + this.map.add([this.current_safe_route]);
516 // 设置起始点标记 517 // 设置起始点标记
517 var marker1 = new AMap.Marker({ 518 var marker1 = new AMap.Marker({
518 icon: new AMap.Icon({ 519 icon: new AMap.Icon({
...@@ -530,7 +531,7 @@ export default { ...@@ -530,7 +531,7 @@ export default {
530 marker1.setLabel({ 531 marker1.setLabel({
531 direction: 'right', 532 direction: 'right',
532 offset: new AMap.Pixel(0, -10), //设置文本标注偏移量 533 offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
533 - content: "<div class='info'>点</div>", //设置文本标注内容 534 + content: "<div class='info'>点</div>", //设置文本标注内容
534 }); 535 });
535 var marker2 = new AMap.Marker({ 536 var marker2 = new AMap.Marker({
536 icon: new AMap.Icon({ 537 icon: new AMap.Icon({
...@@ -548,15 +549,15 @@ export default { ...@@ -548,15 +549,15 @@ export default {
548 marker2.setLabel({ 549 marker2.setLabel({
549 direction: 'right', 550 direction: 'right',
550 offset: new AMap.Pixel(0, -10), //设置文本标注偏移量 551 offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
551 - content: "<div class='info'>点</div>", //设置文本标注内容 552 + content: "<div class='info'>点</div>", //设置文本标注内容
552 }); 553 });
553 // 新增逃生路线标记 554 // 新增逃生路线标记
554 - this.route_marker = [marker1, marker2] 555 + this.route_safe_marker = [marker1, marker2]
555 - this.map.add(this.route_marker); 556 + this.map.add(this.route_safe_marker);
556 }, 557 },
557 removeSafeRoute() { // 移除地图路线 558 removeSafeRoute() { // 移除地图路线
558 - this.map.remove([this.current_route]); // 删除地图折线 559 + this.map.remove([this.current_safe_route]); // 删除地图折线
559 - this.map.remove(this.route_marker); // 删除起始点标记 560 + this.map.remove(this.route_safe_marker); // 删除起始点标记
560 }, 561 },
561 addNavRoute (path) { // 新增导航路径 562 addNavRoute (path) { // 新增导航路径
562 // 生成折线地图路径 563 // 生成折线地图路径
...@@ -580,7 +581,7 @@ export default { ...@@ -580,7 +581,7 @@ export default {
580 // 设置起始点标记 581 // 设置起始点标记
581 var marker1 = new AMap.Marker({ 582 var marker1 = new AMap.Marker({
582 icon: new AMap.Icon({ 583 icon: new AMap.Icon({
583 - image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8D-%E5%B0%8F1@2x.png', 584 + image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8D-%E5%B0%8Fz@2x.png',
584 size: new AMap.Size(40, 40), 585 size: new AMap.Size(40, 40),
585 // 图标所用图片大小 586 // 图标所用图片大小
586 imageSize: new AMap.Size(40, 40), 587 imageSize: new AMap.Size(40, 40),
...@@ -598,7 +599,7 @@ export default { ...@@ -598,7 +599,7 @@ export default {
598 }); 599 });
599 var marker2 = new AMap.Marker({ 600 var marker2 = new AMap.Marker({
600 icon: new AMap.Icon({ 601 icon: new AMap.Icon({
601 - image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8D-%E5%B0%8F1@2x.png', 602 + image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8D-%E5%B0%8Fz@2x.png',
602 size: new AMap.Size(40, 40), 603 size: new AMap.Size(40, 40),
603 // 图标所用图片大小 604 // 图标所用图片大小
604 imageSize: new AMap.Size(40, 40), 605 imageSize: new AMap.Size(40, 40),
......