day31-33 :nth-child和:nth-of-type的区别

区别不大。
以为p为子元素为例。
p:nth-child(n) p的父元素的第n个子元素
p:nth-of-type p的父元素的第n个p元素

<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Туристический маршрут Владивостока: 3 дня и 2 ночи</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } body { background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c); color: #333; padding: 20px; min-height: 100vh; } .container { max-width: 1200px; margin: 0 auto; background: rgba(255, 255, 255, 0.95); border-radius: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); overflow: hidden; padding: 25px; } header { text-align: center; padding: 25px 0; background: linear-gradient(90deg, #1a2a6c, #b21f1f); color: white; border-radius: 10px; margin-bottom: 30px; } h1 { font-size: 2.5rem; margin-bottom: 10px; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); } .subtitle { font-size: 1.2rem; opacity: 0.9; } .info-section { display: flex; justify-content: space-around; flex-wrap: wrap; margin-bottom: 30px; padding: 15px; background: #f0f8ff; border-radius: 10px; border-left: 5px solid #1a2a6c; } .info-box { text-align: center; padding: 15px; min-width: 200px; } .info-box h3 { color: #1a2a6c; margin-bottom: 10px; font-size: 1.3rem; } .info-box p { font-size: 1.1rem; color: #b21f1f; font-weight: bold; } .schedule-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); } .schedule-table th { background: linear-gradient(90deg, #1a2a6c, #b21f1f); color: white; padding: 15px; text-align: left; font-size: 1.1rem; } .schedule-table td { padding: 12px 15px; border-bottom: 1px solid #ddd; } .schedule-table tr:nth-child(even) { background-color: #f9f9f9; } .schedule-table tr:hover { background-color: #f0f8ff; } .day-header { background: #e3f2fd; font-weight: bold; color: #1a2a6c; font-size: 1.2rem; } .time-cell { font-weight: bold; color: #b21f1f; width: 15%; } .action-cell { width: 30%; } .description-cell { width: 55%; } .download-section { text-align: center; padding: 25px; background: #f0f8ff; border-radius: 10px; margin-top: 20px; } .download-btn { background: linear-gradient(90deg, #1a2a6c, #b21f1f); color: white; border: none; padding: 15px 40px; font-size: 1.2rem; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); } .download-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); } .download-btn:active { transform: translateY(1px); } .map-container { margin-top: 30px; border-radius: 10px; overflow: hidden; height: 300px; background: #e9ecef; display: flex; align-items: center; justify-content: center; position: relative; } .map-placeholder { text-align: center; color: #6c757d; padding: 20px; } .map-placeholder h3 { margin-bottom: 15px; color: #1a2a6c; } .map-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(26, 42, 108, 0.8); color: white; padding: 10px; text-align: center; } footer { text-align: center; margin-top: 30px; padding: 20px; color: white; font-size: 0.9rem; opacity: 0.8; } @media (max-width: 768px) { .schedule-table { font-size: 0.9rem; } .schedule-table th, .schedule-table td { padding: 8px 10px; } .info-section { flex-direction: column; } h1 { font-size: 2rem; } } </style> </head> <body> <div class="container"> <header> <h1>Владивосток: 3 дня / 2 ночи</h1> <p class="subtitle">Идеальный маршрут по жемчужине Дальнего Востока России</p> </header> <div class="info-section"> <div class="info-box"> <h3>Продолжительность</h3> <p>3 дня / 2 ночи</p> </div> <div class="info-box"> <h3>Рекомендуемый отель</h3> <p>Отель "Азимут" ★★★★</p> </div> <div class="info-box"> <h3>Лучшее время для посещения</h3> <p>Май - Октябрь</p> </div> <div class="info-box"> <h3
06-10
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>超大杯数据可视化平台</title> <link rel="icon" href="image/logo.png" type="image/png"> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { position: relative; width: 100vw; height: 100vh; overflow: hidden; background-color: #000; display: flex; justify-content: center; align-items: center; } .main-container { position: relative; width: 90vw; max-width: 1920px; aspect-ratio: 16/9; background-image: url('image/bg.png'); background-size: cover; background-position: center; } /* 新增统一布局容器 */ .layout-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .corner-text { position: absolute; top: 3%; left: 3.5%; background-color: rgba(0, 0, 0, 0.5); color: white; padding: 0.6% 1.2%; border-radius: 4px; font-family: Arial, sans-serif; font-size: 1.2vw; } /* 右上角日期框样式 - 右移 */ .top-right-box { position: absolute; top: 5%; right: 1.5%; display: flex; align-items: center; background-color: rgba(0, 0, 0, 0.5); border: 1px solid rgba(57, 86, 176, 0.9); border-radius: 4px; padding: 0.6% 1%; width: 12vw; height: 2vw; min-width: 100px; min-height: 24px; } /* 下拉框容器样式 - 右移 */ .top-right-box1 { position: absolute; top: 34%; right: 0.1%; display: flex; align-items: center; background-color: rgba(0, 0, 0, 0.5); border: 1px solid rgba(57, 86, 176, 0.9); border-radius: 4px; padding: 0.2% 0.5%; width: 10vw; height: 2vw; } .top-right-box .date-text { font-size: 0.8vw; color: #ffffff; margin-right: 5px; } .top-right-box .right-icon { width: 1vw; min-width: 15px; aspect-ratio: 1/1; background-image: url('image/image.png'); background-size: contain; background-repeat: no-repeat; margin-left: 50px; } /* 标题框 - 背景图可自由设置大小 */ .title-box { position: absolute; top: 6.5%; right: 1.5%; width: 49vw; height: 75px; min-width: 200px; min-height: 75px; background-image: url('image/bg_tit.png'); background-size: 100% 35%; background-repeat: no-repeat; background-position: center; overflow: hidden; display: flex; align-items: center; justify-content: flex-start; padding: 0 10px; } .title-text { font-size: 1vw; color: #fff; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .title-text1 { font-size: 1vw; color: #fff; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .data-modules { position: absolute; top: 9%; left: 3.5%; display: flex; gap: 1%; width: 45%; } .data-module { position: relative; flex: 1; aspect-ratio: 1/1.5; background-image: url('image/bg_data.png'); background-size: contain; background-repeat: no-repeat; background-position: center; display: flex; flex-direction: column; align-items: center; justify-content: center; } .module-icon { position: absolute; top: 12%; width: 80%; aspect-ratio: 1/1; background-size: contain; background-repeat: no-repeat; background-position: center; } .module-1 .module-icon { background-image: url('image/icon1.png'); } .module-2 .module-icon { background-image: url('image/icon2.png'); } .module-3 .module-icon { background-image: url('image/icon3.png'); } .module-4 .module-icon { background-image: url('image/icon4.png'); } .module-number { margin-top: 85%; font-size: 1.2vw; font-weight: bold; color: rgb(17, 167, 227); text-align: center; } .module-text { margin-top: 6%; font-size: 0.85vw; color: rgba(255, 255, 255, 0.9); text-align: center; } /* 表格样式 - 参考图风格 */ .table-container { position: absolute; top: 15%; left: 49.5%; width: 49%; height: 50%; overflow: auto; scrollbar-color: rgba(57, 86, 176, 0.9) transparent; } .data-table { width: 100%; border-collapse: collapse; color: #fff; font-size: 0.9vw; background-color: rgba(30, 163, 213, 0.4); } .data-table thead { background-color:rgba(30, 163, 213, 0.4); } .data-table th, .data-table td { padding: 0.8% 1.5%; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.1); } .data-table tbody tr:nth-child(odd) { background-color: #0b1f3d; } .data-table tbody tr:nth-child(even) { background-color: #08182e; } .data-table .up { color: #28a745; font-weight: bold; } .data-table .down { color: #dc3545; font-weight: bold; } /* 下拉框样式 */ .branch-select { background-color: transparent; color: #fff; border: none; outline: none; width: 100%; height: 100%; font-size: 10px; color: #ffffff; appearance: none; -webkit-appearance: none; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" fill="%238899b2" viewBox="0 0 100 100"><polygon points="0,0 100,0 50,50"/></svg>'); background-repeat: no-repeat; background-position: right 6px center; background-size: 8px auto; padding-right: 16px; } .branch-select option { background-color: #0b1f3d; border-bottom: 1px solid rgba(57, 86, 176, 0.5); } /* 月|年样式 */ .time-period-container { display: flex; align-items: center; /* 垂直居中对齐 */ margin-right: 40px; } .month-text { font-family: 'Arial', sans-serif; font-size: 14px; color: #44aeff; margin-left: 200px; /* 调整左边距 */ padding: 4px 8px; /* 统一垂直内边距 */ position: relative; line-height: 1; /* 统一行高 */ } .year-text { font-family: 'Arial', sans-serif; font-size: 14px; color: #8899b2; padding: 4px 8px; /* 统一垂直内边距 */ line-height: 1; /* 统一行高 */ } .tab-line { position: absolute; bottom: 25px; /* 调整下划线位置,确保在文本下方 */ left: 388px; width: 10%; height: 4px; /* 调整图片显示高度 */ background-image: url('image/tab_line.png'); /* 确保图片路径正确 */ background-size: contain; background-repeat: no-repeat; } /* 响应式调整 */ @media (max-aspect-ratio: 16/9) { .main-container { width: 100vw; } } </style> </head> <body> <div class="main-container"> <div class="layout-container"> <div class="corner-text" id="timeDisplay">2025年6月19日 15:42:24</div> <div class="top-right-box"> <div class="date-text" id="dateDisplay">2025-06-19</div> <div class="right-icon"></div> </div> <div class="title-box"> <span class="title-text">成本改善的重点科目完成情况列表</span> <!-- 月|年调整至同一高度,月下方放置图片 --> <div class="time-period-container"> <span class="month-text">月</span> <div class="tab-line"></div> <span class="year-text">|</span> <span class="year-text">年</span> </div> <div class="top-right-box1"> <select class="branch-select" id="branchSelect"> <option value="">选择分公司</option> <option value="branch1">北京分公司</option> <option value="branch2">上海分公司</option> <option value="branch3">广州分公司</option> <option value="branch4">深圳分公司</option> </select> </div> </div> <div class="data-modules"> <div class="data-module module-1"> <div class="module-icon"></div> <div class="module-number">132,576.42</div> <div class="module-text">预算目标(万元)</div> </div> <div class="data-module module-2"> <div class="module-icon"></div> <div class="module-number">112,576.42</div> <div class="module-text">预算完成(万元)</div> </div> <div class="data-module module-3"> <div class="module-icon"></div> <div class="module-number">98,576.42</div> <div class="module-text">成本完成(万元)</div> </div> <div class="data-module module-4"> <div class="module-icon"></div> <div class="module-number">14,000.00</div> <div class="module-text">成本缺口(万元)</div> </div> </div> <!-- 新增表格模块 --> <div class="table-container"> <table class="data-table"> <thead> <tr> <th>指标</th> <th>本月</th> <th>本月同比</th> <th>本月环比</th> <th>本月预算</th> </tr> </thead> <tbody> <tr> <td>分出保费</td> <td>2,013.23 <span class="up">↑</span></td> <td>34.45% <span class="down">↓</span></td> <td>-3.25% <span class="down">↓</span></td> <td>0.08万元</td> </tr> <tr> <td>XXXXX费用</td> <td>2,013.23</td> <td>34.45% <span class="up">↑</span></td> <td>-3.25%</td> <td>0.08万元</td> </tr> <tr> <td>XXXXX费用</td> <td>2,013.23 <span class="down">↓</span></td> <td>34.45%</td> <td>-3.25%</td> <td>0.08万元</td> </tr> <tr> <td>XXXXX费用</td> <td>2,013.23</td> <td>34.45%</td> <td>-3.25% <span class="down">↓</span></td> <td>0.08万元</td> </tr> <tr> <td>XXXXX费用</td> <td>2,013.23</td> <td>34.45%</td> <td>-3.25% <span class="up">↑</span></td> <td>0.08万元</td> </tr> </tbody> </table> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded', function () { // 数字滚动效果 const numberElements = document.querySelectorAll('.module-number'); numberElements.forEach(el => { const originalText = el.textContent; el.textContent = "0.00"; setTimeout(() => { let counter = 0; const endValue = parseFloat(originalText.replace(/,/g, '')); const duration = 2000; const interval = 20; const steps = duration / interval; const increment = endValue / steps; const timer = setInterval(() => { counter += increment; if (counter >= endValue) { counter = endValue; clearInterval(timer); } el.textContent = counter.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ","); }, interval); }, 500); }); // 时间更新功能 function updateTime() { const now = new Date(); const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0'); const seconds = String(now.getSeconds()).padStart(2, '0'); const chineseDate = `${year}年${month}月${day}日`; const timeStr = `${hours}:${minutes}:${seconds}`; const isoDate = `${year}-${month}-${day}`; document.getElementById('timeDisplay').textContent = `${chineseDate} ${timeStr}`; document.getElementById('dateDisplay').textContent = isoDate; } updateTime(); setInterval(updateTime, 1000); const branchSelect = document.getElementById('branchSelect'); branchSelect.addEventListener('change', function() { console.log('选中的分公司:', this.value); }); }); </script> </body> </html>修改该代码,使各部件相对位置大小不变
06-23
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>智慧工匠-水利监测平台</title> <style> * { box-sizing: border-box; font-family: 'Microsoft YaHei', sans-serif; } body { background-color: #f0f8ff; margin: 0; padding: 20px; } .dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; max-width: 1200px; margin: 0 auto; } .card { background: white; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); padding: 20px; transition: transform 0.3s; } .card:hover { transform: translateY(-5px); } .card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e0e0e0; padding-bottom: 10px; margin-bottom: 15px; } .data-value { font-size: 2.5rem; font-weight: bold; color: #1e88e5; text-align: center; margin: 15px 0; } .data-label { text-align: center; color: #757575; } .time-display { text-align: right; color: #546e7a; font-size: 0.9rem; } .update-frequency { font-size: 0.8rem; color: #78909c; text-align: center; margin-top: 5px; } h1 { color: #0d47a1; text-align: center; margin-bottom: 30px; } .system-time { text-align: center; margin-bottom: 20px; font-size: 1.2rem; color: #37474f; } </style> </head> <body> <h1>智慧工匠-水利监测平台</h1> <div class="system-time" id="systemTime">系统时间:--:--:--</div> <div class="dashboard"> <!-- 水位监测 --> <div class="card"> <div class="card-header"> <h2>水位监测</h2> <div class="time-display" id="waterTime">--:--:--</div> </div> <div class="data-value" id="waterLevel">-- m</div> <div class="data-label">当前水位</div> <div class="update-frequency">24小时更新一次</div> </div> <!-- 流量监测 --> <div class="card"> <div class="card-header"> <h2>流量监测</h2> <div class="time-display" id="flowTime">--:--:--</div> </div> <div class="data-value" id="flowRate">-- m³/s</div> <div class="data-label">实时流量</div> <div class="update-frequency">每秒更新</div> </div> <!-- 水质监测 --> <div class="card"> <div class="card-header"> <h2>水质监测</h2> <div class="time-display" id="qualityTime">--:--:--</div> </div> <div class="data-value" id="waterQuality">-- 级</div> <div class="data-label">水质等级</div> <div class="update-frequency">24小时更新一次</div> </div> <!-- 降雨量监测 --> <div class="card"> <div class="card-header"> <h2>降雨量监测</h2> <div class="time-display" id="rainTime">--:--:--</div> </div> <div class="data-value" id="rainfall">-- mm</div> <div class="data-label">24小时累计</div> <div class="update-frequency">24小时更新一次</div> </div> </div> <script> // 获取北京时间 function getBeijingTime() { const now = new Date(); // 获取UTC时间(北京时间) return new Date(now.getTime() + (8 * 60 * 60 * 1000)); } // 格式化时间显示 function formatTime(date) { return date.toLocaleTimeString('zh-CN'); } // 更新系统时间显示(每秒更新) function updateSystemTime() { const beijingTime = getBeijingTime(); document.getElementById('systemTime').textContent = `系统时间:${formatTime(beijingTime)}`; } // 更新流量监测数据(每秒更新) function updateFlowData() { const beijingTime = getBeijingTime(); document.getElementById('flowRate').textContent = (120 + Math.random() * 20).toFixed(0) + ' m³/s'; document.getElementById('flowTime').textContent = formatTime(beijingTime); } // 更新水位监测数据(24小时更新一次) function updateWaterLevel() { const beijingTime = getBeijingTime(); document.getElementById('waterLevel').textContent = (15.2 + Math.random() * 0.3).toFixed(1) + ' m'; document.getElementById('rainTime').textContent = formatTime(beijingTime); } // 初始加载所有数据 function initializeData() { updateSystemTime(); updateWaterLevel(); updateFlowData(); updateWaterQuality(); updateRainfall(); } // 设置定时器 function setupTimers() { // 系统时间每秒更新 setInterval(updateSystemTime, 1000); // 流量数据每秒更新 setInterval(updateFlowData, 1000); // 水位、水质、降雨量数据每24小时更新一次(24*60*60*1000毫秒) setInterval(updateWaterLevel, 24 * 60 * 60 * 1000); setInterval(updateWaterQuality, 24 * 60 * 60 * 1000); setInterval(updateRainfall, 24 * 60 * 60 * 1000); } // 页面加载完成后初始化 window.onload = function() { initializeData(); setupTimers(); }; </script> </body> </html> 将顶部时间更改为北京时间,并且时间随北京时间变化而改变,卡片中的时间删除,流量每秒改变一次,水流质量,降雨量累计,水位监测每24变化一次,再将代码进行优化,使其可以更好的在Visual Studio Code运行
最新发布
11-30
<template> <div> <baidu-map id="allmap" :center="center" :zoom="zoom" @ready="handler" style="height:9.45rem;width: 100%;" @click="getClickInfo" :scroll-wheel-zoom='true'> <div class="drawing-panel" style="z-index: 99;"> <button class = "btn" @click='play(1)' size="small">播放</button> <button class = "btn" @click='play(2)' size="small">暂停</button> <button class = "btn" @click='play(3)' size="small">停止</button> </div> </baidu-map> </div> </template> <script> export default { name: 'BtAddrBaiDu', data () { return { startTime: null, endTime: null, center: {lng: 114.085947, lat: 22.547}, zoom: 15, point:"", gpsArr:[ { lng:114.000069, lat:22.500069 }, ], speed:500, lushu:{}, batteryId:"电池编号:"+this.$parent.$children[0].hwid, myMap: {} } }, mounted(){ this.handler() }, methods: { filterByTime(){ this.handler() }, handler({BMap, map}){ this.$nextTick(()=>{ this.$http({ url: this.$http.adornUrl('/mqtt/mtgpslocationinfo/queryGpsLocationInfos'), method: 'get', params: this.$http.adornParams({ 'startTime': this.startTime, 'endTime': this.endTime, 'thingid': this.$parent.$children[0].hwid }) }).then(({data}) => { map.enableScrollWheelZoom(new BMap.Point(114.085947, 22.547), 15); map.centerAndZoom(); var arrPois = []; if (data && data.code === 0) { const socitem = data.data if (socitem && socitem.length > 0) { let clng = socitem[socitem.length-1].longitude; let clat = socitem[socitem.length-1].latitude; this.center = {lng: clng, lat: clat}; var myIcon = new BMap.Icon( require("../../../assets/img/markers.png"), new BMap.Size(23, 25), { offset: new BMap.Size(10, 25), imageOffset: new BMap.Size(0, 0 - 11 * 25) }); for (let i = 0; i < socitem.length; i++) { var p0 = socitem[i].longitude; var p1 = socitem[i].latitude; var point = new BMap.Point(p0, p1); arrPois.push(point); var distance = this.getDistance(clat,clng, p1,p0); var content = "<table style='color: #FFF;'>"; content = content + "<tr><td> 电池编号:"+socitem[i].thingId+"</td></tr>"; content = content + "<tr><td> 经纬度:"+socitem[i].longitudedirectionValue+socitem[i].longitude+","+socitem[i].latitudedirectionValue+socitem[i].latitude+"</td></tr>"; content = content + "<tr><td> 与最新点距离:"+distance.toFixed(2)+"m</td></tr>"; content = content + "<tr><td> 时间:"+socitem[i].uploadTime+"</td></tr>"; content += "</table>"; var marker = this.createMarker( point, content, socitem[i].thingId, i, myIcon ); map.addOverlay(marker) var circle = new BMap.Circle(point, 6, { strokeColor: 'Red', strokeWeight: 8, strokeOpacity: 2, Color: 'Blue', fillColor: '#f03' }) map.addOverlay(circle) } } else { console.log('没有数据的显示') this.soctitle = '暂无数据显示' } } else { console.log('没有数据的显示') this.noneTitle = '没有数据~' } var sy = new BMap.Symbol(BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW, { scale: 0.3, strokeColor:'#fff', strokeWeight: 1 }); var icons = new BMap.IconSequence(sy, '100%', '5%',false); var polyLine = new BMap.Polyline(arrPois, { strokeWeight: 2, strokeOpacity: 0.5, strokeColor:"#303133", enableEditing: false, enableClicking: false, icons:[icons] }); map.addOverlay(polyLine); BMapLib.LuShu.prototype._move = function(initPos, targetPos, effect) { var pointsArr = [initPos, targetPos]; var me = this, currentCount = 0, timer = 10, step = this._opts.speed / (1000 / timer), init_pos = this._projection.lngLatToPoint(initPos), target_pos = this._projection.lngLatToPoint(targetPos), count = Math.round(me._getDistance(init_pos, target_pos) / step); this._map.addOverlay( new BMap.Polyline(pointsArr, { strokeColor: "#111", strokeWeight: 3, strokeOpacity: 0.5 }) ); if (count < 1) { me._moveNext(++me.i); return; } me._intervalFlag = setInterval(function() { if (currentCount >= count) { clearInterval(me._intervalFlag); if (me.i > me._path.length) { return; } me._moveNext(++me.i); } else { currentCount++; var x = effect(init_pos.x, target_pos.x, currentCount, count), y = effect(init_pos.y, target_pos.y, currentCount, count), pos = me._projection.pointToLngLat(new BMap.Pixel(x, y)); if (currentCount == 1) { var proPos = null; if (me.i - 1 >= 0) { proPos = me._path[me.i - 1]; } if (me._opts.enableRotation == true) { me.setRotation(proPos, initPos, targetPos); } if (me._opts.autoView) { if (!me._map.getBounds().containsPoint(pos)) { me._map.setCenter(pos); } } } me._marker.setPosition(pos); me._setInfoWin(pos); } }, timer); }; map.addControl(new BMap.OverviewMapControl({isOpen:true,anchor:BMAP_ANCHOR_BOTTOM_RIGHT})); map.addControl(new BMap.NavigationControl()); map.addControl(new BMap.ScaleControl({anchor:BMAP_ANCHOR_TOP_LEFT})); map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_SATELLITE_MAP],anchor: BMAP_ANCHOR_TOP_RIGHT})); this.initLushu(map, arrPois, this.batteryId); }) }) }, getDistance(lat1,lng1,lat2,lng2) { let EARTH_RADIUS = 6378.137; let radLat1 = this.rad(lat1); let radLat2 = this.rad(lat2); let a = radLat1 - radLat2; let b = this.rad(lng1) - this.rad(lng2); let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); s = s * EARTH_RADIUS; s = Math.round(s * 10000) / 10000; s = s*1000; return s; }, rad(d){ return d * Math.PI / 180.0; }, initLushu(map, arrPois, batteryId) { this.lushu = new BMapLib.LuShu(map, arrPois, { defaultContent: batteryId, autoView: true, icon: new BMap.Icon( require("../../../assets/img/mybike2.png"), new BMap.Size(52, 26), { anchor: new BMap.Size(27, 13) } ), speed: this.speed, enableRotation: true, landmarkPois: [ { lng:114.52785300795644, lat:38.14758574827796, html: "加油站", pauseTime: 2 } ] }); }, play(val) { if (this.arrIndex >= this.gpsArr.length - 3) { this.arrIndex = 0; } switch (val) { case 1: this.lushu.start(); break; case 2: this.lushu.pause(); break; case 3: this.lushu.stop(); this.arrIndex = 0; this.percentage = 0; break; } }, createMarker(point, iw, paramNumber,i,myIcon) { var markerx = new BMap.Marker(point); var label = new BMap.Label(i+1, { offset:new BMap.Size(-3,-5)}); label.setStyle({ background:'url()', color:'#fff', border:'none', fontSize:'12px', textAlign:'center', width:'25px', height:'25px', lineHeight:'25px' }); markerx.setLabel(label) markerx.setZIndex(9999) var opts = { width: 300, height: 180, title: '<h4>坐标信息'+'</h4>', enableMessage: true, message: "" } markerx.addEventListener("mouseover", function(e) { this.openInfoWindow(new BMap.InfoWindow(iw,opts)); }); markerx.addEventListener("mouseout", function(e) { this.closeInfoWindow(new BMap.InfoWindow(iw)); }); var that = this; markerx.addEventListener("click", function(e) { }); return markerx; } }} </script> <style > .title { color: darkgreen; text-align: center; height: 0.125rem; } .nodate { color: dimgrey; text-align: center; } .reminder { font-size: 0.15rem; color: darkcyan; margin-left: 1.25rem; } .btn { width: 1.125rem; height: 0.375rem; float: left; background-color: #fff; color: rgba(27, 142, 236, 1); font-size: 0.175rem; border:0.0125rem solid rgba(27, 142, 236, 1); border-radius: 0.0625rem; margin: 0 0.0625rem; text-align: center; line-height: 0.375rem; } .btn:hover { background-color: rgba(27, 142, 236, 0.8); color: #fff; } .drawing-panel { z-index: 999; position: fixed; bottom: 1.3rem; margin-left: 0.3rem; padding: 0.12rem 0.12rem; border-radius: .05rem; background-color: #fff; box-shadow: 0 0.025rem 0.075rem 0 rgba(27, 142, 236, 0.5); } .BMap_bubble_title { color: white; font-size: 0.1625rem; font-weight: bold; text-align: left; padding-left: 0.0625rem; padding-top: 0.0625rem; border-bottom: 0.0125rem solid gray; background-color: #409EFF; } .BMap_bubble_content { background-color: rgba(40, 40, 40, 0.8); padding-left: 0.0625rem; padding-top: 0.0625rem; padding-bottom: 0.125rem; border-bottom-left-radius: 0.1rem; border-bottom-right-radius: 0.1rem; } .BMap_pop div:nth-child(9) { top: 0.4375rem !important; border-radius: 0.0625rem; } .BMap_pop div:nth-child(5) { display: none; } .BMap_pop img { display: none; } .BMap_top { display: none; } .BMap_bottom { display: none; } .BMap_center { display: none; } .BMap_pop div:nth-child(1) div { display: none; } .BMap_pop div:nth-child(3) { display: none; } .BMap_pop div:nth-child(7) { display: none; } .time-picker { margin-bottom: 0.2rem; } .time-picker input { width: 150px; padding: 0.05rem; margin-right: 0.2rem; font-size: 0.15rem; } </style> 添加时间筛选组件时间范围,不要input
08-22
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值