This commit is contained in:
jiangrui 2024-09-20 16:59:24 +08:00
commit b48854611e
36 changed files with 69285 additions and 0 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}

1950
css/video-js.min.css vendored Normal file

File diff suppressed because one or more lines are too long

377
detail.html Normal file
View File

@ -0,0 +1,377 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="./css/video-js.min.css" />
<!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> -->
<!-- <script src="./js/hls.js@latest.js"></script> -->
<script src="./js/msg.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
body {
background: #fff;
/* padding: 0 15px; */
}
.videoBox {
width: 100%;
/* height: 300px; */
position: relative;
}
.content {
/* padding: 20px 40px; */
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.subTitle {
border-left: 4px solid #33907d;
padding-left: 10px;
color: #33907d;
font-weight: bold;
/* border-color: ; */
margin-bottom: 10px;
}
.tip {
font-size: 12px;
/* color: #d1d1d1; */
color: rgba(255, 255, 255, 0.3);
font-weight: 500;
padding-left: 10px;
}
.layer {
/* display: flex;
justify-content: space-between;
padding: 15px;
background: #fff;
border-radius: 8px;
border-left: 1px solid #33907d;
border-bottom: 1px solid #33907d;
margin-bottom: 10px;
box-shadow: 0px 1px 5px 0px; */
display: flex;
/* justify-content: center; */
justify-content: space-between;
box-sizing: border-box;
align-items: center;
padding: 20px;
width: 100%;
/* height: 130px; */
/* background: url("./img/layer.png") no-repeat; */
background: linear-gradient(
-58deg,
rgba(255, 255, 255, 0.14) 0%,
rgba(255, 255, 255, 0.09) 51%,
rgba(255, 255, 255, 0.15) 100%
);
border-radius: 19px;
background-size: 100%;
color: #fff;
position: relative;
/* margin: 15px; */
}
.layer_colume {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
background: linear-gradient(
-58deg,
rgba(255, 255, 255, 0.14) 0%,
rgba(255, 255, 255, 0.09) 51%,
rgba(255, 255, 255, 0.15) 100%
);
background-size: cover;
border-radius: 19px;
width: 100%;
/* padding: 30px; */
box-sizing: border-box;
color: #fff;
/* padding: 15px;
background: #fff;
border-radius: 8px;
border-left: 1px solid #33907d;
border-bottom: 1px solid #33907d;
margin-bottom: 10px;
box-shadow: 0px 1px 5px 0px; */
}
.status {
border-radius: 40px;
width: 40px;
height: 40px;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
box-sizing: content-box;
background: #c2f9e8;
color: #478f79;
font-size: 18px;
}
.isNormal {
font-size: 16px;
/* font-weight: bold; */
margin-bottom: 10px;
}
.join {
font-size: 12px;
color: #d1d1d1;
display: flex;
margin-bottom: 10px;
}
.icon_user {
background: url("./img/account.png") no-repeat;
width: 16px;
height: 16px;
display: inline-block;
padding-right: 5px;
}
.chosen {
display: flex;
}
.choseItem {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 50px;
}
.zhedang {
/* background: black; */
background: url("./img/mask.png");
width: 200px;
height: 100px;
position: absolute;
right: 0;
z-index: 1;
bottom: 4px;
}
body {
background: url("./img/detail_bg.jpg") no-repeat;
background-size: cover;
}
.text_dwxx {
background: url("./img/text_dwxx.png") no-repeat;
background-size: 100%;
width: 85px;
height: 27px;
}
.text_yldgc {
background: url("./img/text_yldgc.png") no-repeat;
background-size: 100%;
width: 108.5px;
height: 27px;
margin-top: 38px;
}
.icon_position1 {
background: url("./img/icon_position2.png") no-repeat;
background-size: 100%;
width: 30px;
height: 30px;
display: inline-block;
}
.name {
display: flex;
align-items: center;
}
.roll {
display: flex;
width: 100%;
padding: 0 15px;
box-sizing: border-box;
}
.rollItem {
/* background: url("./img/btn_roll_bg1.png") no-repeat; */
background: rgba(255, 255, 255, 0.18);
border-radius: 8px;
background-size: 100%;
justify-content: space-around;
align-items: center;
display: flex;
/* padding: 15px; */
margin-right: 34px;
margin-top: 12px;
margin-bottom: 27px;
padding: 10px 5px;
box-sizing: border-box;
width: 50%;
/* width: 176.5px;
height: 68.5px; */
}
.rollItem:last-child {
margin-right: 0;
}
.success {
background: url("./img/icon_sucess.png") no-repeat;
background-size: 100%;
width: 28.5px;
height: 27px;
display: inline-block;
margin-right: 8px;
}
.error {
background: url("./img/icon_wrong.png") no-repeat;
background-size: 100%;
width: 28.5px;
height: 27px;
display: inline-block;
margin-right: 8px;
}
.btn_status {
background: rgba(255, 255, 255, 0.18);
width: 98.5px;
height: 43px;
border-radius: 22px;
display: flex;
font-size: 20px;
font-weight: bold;
align-items: center;
justify-content: center;
}
.rollItemOption {
display: flex;
align-items: center;
padding-right: 12px;
}
.rollItemPercent {
border-left: 1px solid #fff;
padding-left: 12px;
}
.abs {
position: absolute;
bottom: -25px;
left: 0;
}
.refresh {
font-size: 12px;
}
.err {
color: #e21e1e;
}
/* */
.vjs-error .vjs-error-display {
width: 100%;
height: 100%;
background-color: rgba(29, 29, 61, 0.6);
background-image: url("../../../assets/img/icon_no_video.png");
background-repeat: no-repeat;
background-position: center center;
}
.vjs-error .vjs-error-display:before {
display: none;
}
.vjs-error .vjs-error-display:after {
color: #8483c5;
content: "取流失败";
font-family: PingFangSC, PingFangSC-Regular;
font-size: 20px;
left: 0;
margin-top: -0.5em;
position: absolute;
text-shadow: 0.05em 0.05em 0.1em #000;
text-align: center;
top: 75%;
vertical-align: middle;
width: 100%;
}
.vjs-modal-dialog-content {
display: none;
}
/* 自定义加载条的背景色和宽度 */
.video-js .vjs-loading-bar {
background: #f00; /* 红色加载条 */
height: 10px; /* 加载条高度 */
}
/* 自定义加载条的动画时长 */
.video-js .vjs-loading-bar .vjs-progress-control {
animation-duration: 5s; /* 动画时间 */
}
/* 如果需要隐藏加载中的图标或文字 */
.video-js .vjs-loading-bar .vjs-loading-bar {
position: relative; /* 如果需要覆盖定位 */
}
.video-js .vjs-loading-bar .vjs-loading-bar::after {
content: none; /* 隐藏加载文字 */
}
</style>
<script src="./js/jquery.min.js"></script>
<script src="./js/api.js"></script>
<script src="./js/video.min.js"></script>
<script>
var parameterValue;
$(function () {
parameterValue = getParameterByName("id");
console.log(parameterValue);
getInfo(parameterValue);
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}
// function initHls() {}
</script>
</head>
<body>
<!-- <div class="status"></div> -->
<div class="videoBox">
<video
webkit-playsinline="true"
playsinline="true"
x5-playsinline
preload="auto"
src=""
id="myVideo"
autoplay
style="width: 100% !important; height: 100% !important"
muted
></video>
<script>
var player = videojs("myVideo");
</script>
</div>
<div class="content">
<!-- <div class="text_dwxx"></div>
<div class="layer">
<div class="name">
<i class="icon_position1"></i> <span>达州区</span>
</div>
<span class="btn_status">正常</span>
<div class="tip abs">网络问题可能导致视频加载失败,请重新进</div>
</div>
<div class="text_yldgc"></div>
<div class="layer_colume">
<div style="margin-top: 22px">该点位是否正常通行?</div>
<div class="tip"><span>0</span>人已参与</div>
<div class="roll">
<div class="rollItem">
<div class="rollItemOption"><i class="success"></i></div>
<div class="rollItemPercent">50%</div>
</div>
<div class="rollItem">
<div class="rollItemOption"><i class="error"></i></div>
<div class="rollItemPercent">50%</div>
</div>
</div>
<div class="tip abs">共查数据每2小时更新一次</div>
</div> -->
</div>
</body>
</html>

BIN
img/account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

BIN
img/btn_list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/btn_map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/btn_roll_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
img/btn_roll_bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
img/detail_bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 KiB

BIN
img/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

BIN
img/icon_position.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

BIN
img/icon_position1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
img/icon_position2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
img/icon_sucess.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
img/icon_title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

BIN
img/icon_wrong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
img/item_bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
img/item_bg2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
img/layer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
img/layer1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
img/mask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/navTitle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
img/poi-marker-default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/success.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

BIN
img/text_dwxx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
img/text_yldgc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
img/videoListBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

249
index.html Normal file
View File

@ -0,0 +1,249 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="./js/jquery.min.js"></script>
<script src="./js/api.js"></script>
<script
type="text/javascript"
src="https://webapi.amap.com/maps?v=2.0&key=b2d0af3352717eab4ccab7e5ba0c2f54"
></script>
<script>
function mapMode() {
window.location.href = "map.html";
}
// console.log(AMap.GeometryUtil.distance([104.0575,30.5686], [107.461343,31.22154]))
AMap.plugin("AMap.Geolocation", function () {
var geolocation = new AMap.Geolocation({
enableHighAccuracy: true, //是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位默认5s
position: "RB", //定位按钮的停靠位置
offset: [10, 20], //定位按钮与设置的停靠位置的偏移量,默认:[10, 20]
zoomToAccuracy: false, //定位成功后是否自动调整地图视野到定位点
});
// map.addControl(geolocation);
geolocation.getCurrentPosition(function (status, result) {
console.log(status, result);
if (status == "complete") {
onComplete(result);
} else {
onError(result);
}
});
});
function onComplete(data) {
console.log(data);
localStorage.setItem("local", data.position);
// document.getElementById("status").innerHTML = "定位成功";
// var str = [];
// str.push("定位结果:" + data.position);
// current_position = data.position;
// str.push("定位类别:" + data.location_type);
// if (data.accuracy) {
// str.push("精度:" + data.accuracy + " 米");
// } //如为IP精确定位结果则没有精度信息
// str.push("是否经过偏移:" + (data.isConverted ? "是" : "否"));
// document.getElementById("result").innerHTML = str.join("<br>");
}
//解析定位错误信息
function onError(data) {
// document.getElementById("status").innerHTML = "定位失败";
// document.getElementById("result").innerHTML =
// "失败原因排查信息:" +
// data.message +
// "</br>浏览器返回信息:" +
// data.originMessage;
}
</script>
<style>
* {
margin: 0;
padding: 0;
}
body {
background: #f1f4f5;
}
.videoList {
display: flex;
flex-wrap: wrap;
flex-direction: row;
margin-top: 20px;
}
.bg1 {
background: url("./img/item_bg1.png") no-repeat;
}
.bg2 {
background: url("./img/item_bg2.png") no-repeat;
}
.videoItem {
width: 48%;
/* border: 1px solid #000; */
/* background: #fff; */
/* background: url("./img/item_bg.png") no-repeat; */
background-size: cover;
border-radius: 8px;
display: flex;
flex-direction: column;
box-sizing: border-box;
margin-right: 10px;
margin-bottom: 10px;
}
.videoItem1 {
width: 48%;
/* border: 1px solid #000; */
/* background: #fff; */
/* background: url("./img/item_bg1.png") no-repeat; */
background-color: rgba(0, 0, 0, 0.2);
background-size: cover;
border-radius: 8px;
display: flex;
flex-direction: column;
box-sizing: border-box;
margin-right: 10px;
margin-bottom: 10px;
}
img {
width: 100%;
height: 100px;
border-radius: 8px;
}
.videoItem:nth-child(2n) {
margin-right: 0;
}
.main {
padding-left: 15px;
padding-right: 15px;
}
video {
width: 100%;
height: 100%;
}
.navTitle {
/* text-align: center; */
/* padding: 24px 44px; */
padding: 5% 6%;
width: 100%;
height: 86px;
background: url("./img/navTitle.png") no-repeat;
background-size: 100%;
box-sizing: border-box;
display: flex;
/* align-items: center; */
justify-content: space-between;
}
.videoBox {
position: relative;
}
.name {
font-weight: bold;
font-size: 14px;
margin: 10px;
/* margin-bottom: 10px; */
/* padding-left: 10px; */
}
.status {
background: #55aa7f;
position: absolute;
right: 0;
top: 0;
padding: 5px 10px;
color: #fff;
font-size: 12px;
border-radius: 0px 4px 4px 4px;
}
.err{
background: #e21e1e;
}
.btn_map {
cursor: pointer;
/* background: #33907d;
border: 0;
color: #fff;
border-radius: 12px;
padding: 7px 15px; */
border: none;
outline: none;
background: url("./img/btn_list.png") no-repeat;
background-size: 100%;
width: 90px;
height: 28.5px;
/* width: 20%;
height: 100%; */
}
.positionDiv {
display: flex;
align-items: center;
margin-bottom: 10px;
font-size: 12px;
}
.icon_position {
background: url("./img/icon_position1.png") no-repeat;
background-size: cover;
display: inline-block;
width: 16px;
height: 16px;
margin-right: 5px;
margin-left: 8px;
}
select {
float: right;
/* height: 30px;
width: 128px; */
width: 90px;
height: 28.5px;
border-radius: 16px;
padding-left: 5px;
outline: none;
}
.videoListTitle {
background: url("./img/icon_title.png") no-repeat;
padding-left: 30px;
padding-top: 2px;
/* background-color: blue; */
/* padding: 10px; */
/* background-size: cover; */
/* color: #fff; */
}
</style>
<script>
$(function () {
getList();
});
</script>
</head>
<body>
<div class="navTitle">
<button type="button" class="btn_map" onclick="mapMode()">
<!-- 地图模式 -->
</button>
<select name="" id="groupType" onchange="handleGroupTypeChange()">
<option value="">全部</option>
<option value="1">城市道路积水</option>
<option value="2">河道水情观测</option>
</select>
</div>
<div class="main">
<!-- <div class="navTitle">
<div class="navBack"></div>
<div class="title">易涝点查询</div>
</div> -->
<!-- 1 城市道路积水, 2 河道水情观测 -->
<div class="videoBox">
<div class="videoList1">
<!-- <div class="videoListTitle">城市道路积水</div> -->
<div class="videoList"></div>
</div>
<div class="videoList2">
<!-- <div class="videoListTitle">河道水情观测</div> -->
<div class="videoList"></div>
</div>
</div>
</div>
</body>
</html>

244
js/api.js Normal file
View File

@ -0,0 +1,244 @@
var BASE = "https://ykdz.yundazhou.com/api";
var player;
var markers = [];
var groupType = undefined;
function getList(tag) {
$.ajax({
url: BASE + "/waterLoggingPoints/list",
type: "GET",
// data: JSON.stringify(param),
data: { groupType },
async: false,
dataType: "json",
contentType: "application/json; charset=UTF-8",
success: function (data) {
if (data.c === 200) {
// console.log(data);
$(".videoList").empty();
$(`.videoList1`).empty();
$(`.videoList2`).empty();
if (tag === 1) {
data.d.map((item) => {
//创建一个 Marker 实例:
const marker = new AMap.Marker({
icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
position: new AMap.LngLat(item.longitude, item.latitude), //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
anchor: "bottom-center",
title: item.name,
});
// 设置鼠标划过点标记显示的文字提示
marker.setTitle(item.name);
// 设置label标签
// label默认蓝框白底左上角显示样式className为amap-marker-label
marker.setLabel({
direction: "top",
offset: new AMap.Pixel(10, 0), //设置文本标注偏移量
content: "<div class='info'>" + item.name + "</div>", //设置文本标注内容
});
marker.on("click", () => {
location.href = `detail.html?id=${item.id}`;
});
map.add(marker);
markers.push(marker);
});
} else {
let data1 = data.d.filter((item) => item.groupType === 1);
let data2 = data.d.filter((item) => item.groupType === 2);
if (data1.length > 0) {
appendListDom(data1);
}
if (data2.length > 0) {
appendListDom(data2);
}
}
}
},
});
}
function appendListDom(data) {
// let title =
// '<div class"titleBg">' + data[0].groupType === 1
// ? "城市道路积水"
// : "河道水情观测" + "</div>";
// $(".videoList").append(title);
let type = data[0].groupType;
let title =
type === 1
? '<div class="videoListTitle">城市道路积水</div><div class="videoList"></div>'
: '<div class="videoListTitle">河道水情观测</div><div class="videoList"></div>';
$(`.videoList${type}`).prepend(title);
console.log(1);
data.map((item) => {
let local =
(localStorage.getItem("local") &&
localStorage.getItem("local").split(",")) ||
"0,0";
let dis = AMap.GeometryUtil.distance(local, [
item.longitude,
item.latitude,
]);
let bg = item.groupType === 1 ? "bg1" : "bg2";
let status = item.num2 > item.num1 ? "异常" : "正常";
let statusClass = status === "异常" ? "err" : "";
let str =
'<div class="videoItem ' +
bg +
'" onclick="handleDetail(\'' +
item.id +
"')\" id=" +
item.id +
">" +
'<div class="videoBox">' +
'<span class="status ' +
statusClass +
'">' +
status +
"</span>" +
'<img src="' +
item.image +
'" />' +
"</div>" +
"<div class='name'>" +
item.name +
"</div>" +
'<div class="positionDiv"><i class="icon_position"></i>' +
Math.round(dis / 1000) +
"km</div>" +
"</div>";
$(`.videoList${type}> .videoList`).append(str);
console.log(2);
});
}
function handleDetail(id) {
console.log(id);
window.location.href = `detail.html?id=${id}`;
}
function getInfo(id) {
$.ajax({
url: BASE + "/waterLoggingPoints/info",
type: "GET",
// data: JSON.stringify(param),
async: false,
dataType: "json",
data: { id },
contentType: "application/json; charset=UTF-8",
success: function (data) {
document.title = data.d.name;
if (data.d.mark === 1) {
$(".videoBox").append('<div class="zhedang"></div>');
}
$(".content").empty();
// let str = `<div class="subTitle">点位信息<span class="tip">网络问题可能导致视频加载失败,请重新进入</span></div>
// <div class="layer">
// <div class="name">${data.d.name}</div>
// <div class="status">正常</div>
// </div>
// <div class="subTitle">易涝点共查<span class="tip">共查数据每2小时更新一次</span></div>
// <div class="layer_colume">
// <div class="isNormal">该点位是否能正常通行?</div>
// <div class="join"><i class="icon_user"></i><span>${data.d.numAll}</span>已参与</div>
// <div class="chosen">
// <div class="choseItem">
// <img onclick="commit(1)" src="./img/success.png"/>
// <span>${data.d.numProportion1}</span>
// </div>
// <div class="choseItem">
// <img onclick="commit(0)" src="./img/error.png"/>
// <span>${data.d.numProportion2}</span>
// </div>
// </div>
// </div>`;
let status = data.d.num2 > data.d.num1 ? "异常" : "正常";
let statusClass = status === "异常" ? "err" : "";
let str = `<div class="text_dwxx"></div>
<div class="layer">
<div class="name">
<i class="icon_position1"></i> <span>${data.d.name}</span>
</div>
<span class="btn_status ${statusClass}">${status}</span>
<div class="tip abs">如果监控长时间未成功播放请刷新重试<button onclick="refresh()" class="refresh">点击刷新</button></div>
</div>
<div class="text_yldgc"></div>
<div class="layer_colume">
<div style="margin-top: 22px">该点位是否正常通行?</div>
<div class="tip"><span>${data.d.numAll}</span></div>
<div class="roll">
<div class="rollItem" onclick="commit(1)">
<div class="rollItemOption"><i class="success"></i> </div>
<div class="rollItemPercent">${data.d.numProportion1}</div>
</div>
<div class="rollItem" onclick="commit(0)">
<div class="rollItemOption"><i class="error"></i> </div>
<div class="rollItemPercent">${data.d.numProportion2}</div>
</div>
</div>
<div class="tip abs">共查数据每2小时更新一次</div>
</div>`;
$(".content").append(str);
if (data.c === 200) {
console.log(data);
player.src({
src: data.d.playUrl,
type: "application/x-mpegURL",
});
player.play();
// var hls;
// var video = document.getElementById("myVideo");
// $(".status").text(Hls.isSupported(),document.getElementById("myVideo"));
// var hls = new Hls();
// hls.loadSource(data.d.playUrl);
// hls.attachMedia(video);
// hls.on(Hls.Events.MANIFEST_PARSED, function () {
// video.play();
// });
// $(video).attr('src',data.d.playUrl)
// data.d.map((item, index) => {
// // if (index !== 1) {
// $("#source_video" + index).attr("src", item);
// videojs("video" + index);
// // }
// });
}
},
});
}
function refresh() {
location.reload();
}
function commit(tag) {
let payload = {
id: parameterValue,
isNormal: tag ? true : false,
};
$.ajax({
url: BASE + "/waterLoggingPoints/dataCommit",
type: "POST",
// data: JSON.stringify(param),
async: false,
dataType: "json",
data: JSON.stringify(payload),
contentType: "application/json; charset=UTF-8",
success: function (data) {
// alert("提交成功!");
msg.info("提交成功!");
getInfo(parameterValue);
},
});
}
function handleGroupTypeChange() {
console.log($("#groupType").val());
groupType = $("#groupType").val();
getList();
}

2
js/hls.js@latest.js Normal file

File diff suppressed because one or more lines are too long

4
js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

721
js/msg.js Normal file
View File

@ -0,0 +1,721 @@
/**
* 信息提醒不依赖任何乱七八糟框架及其他文件导入 msg.js msg.info('哈哈哈') 一句代码使用
* 作者管雷鸣
* 个人网站www.guanleiming.com
* 个人微信: xnx3com
* 公司潍坊雷鸣云网络科技有限公司
* 公司官网www.leimingyun.com
*/
var msg = {
/*
* 当前msg的版本
*/
version:1.11,
/*
* 错误的图
*/
errorIcon:'<svg style="width: 3rem; height:3rem; padding: 1.5rem; padding-bottom: 1.1rem; box-sizing: content-box;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6977"><path d="M696.832 326.656c-12.8-12.8-33.28-12.8-46.08 0L512 465.92 373.248 327.168c-12.8-12.8-33.28-12.8-46.08 0s-12.8 33.28 0 46.08L466.432 512l-139.264 139.264c-12.8 12.8-12.8 33.28 0 46.08s33.28 12.8 46.08 0L512 558.08l138.752 139.264c12.288 12.8 32.768 12.8 45.568 0.512l0.512-0.512c12.8-12.8 12.8-33.28 0-45.568L557.568 512l139.264-139.264c12.8-12.8 12.8-33.28 0-46.08 0 0.512 0 0 0 0zM512 51.2c-254.464 0-460.8 206.336-460.8 460.8s206.336 460.8 460.8 460.8 460.8-206.336 460.8-460.8-206.336-460.8-460.8-460.8z m280.064 740.864c-74.24 74.24-175.104 116.224-280.064 115.712-104.96 0-205.824-41.472-280.064-115.712S115.712 616.96 115.712 512s41.472-205.824 116.224-280.064C306.176 157.696 407.04 115.712 512 116.224c104.96 0 205.824 41.472 280.064 116.224 74.24 74.24 116.224 175.104 115.712 280.064 0.512 104.448-41.472 205.312-115.712 279.552z" fill="#ffffff" p-id="6978"></path></svg>',
/*
* 当前弹出窗口显示的id每次弹出窗口都会生成一个随机id
*/
currentWindowsId:0,
/*
* 弹出层的div id相关
*/
id:{
/*
* 弹出层 div id 的随机命名数组这里存的是精确到毫秒的时间戳 比如命名时会采用 wangmarket_loading + 此处id时间戳 的方式
*/
idArray : new Array(),
/*
* 从数组中增加一个值这个值增加到数组最后并将增加的值返回
*/
create:function(){
//创建一个随机id
var thisId = new Date().getTime()+'';
//将随机id加入弹窗id序列
msg.id.idArray[msg.id.idArray.length] = thisId;
return thisId;
},
/*
* 从数组中删除值并将删除的值返回
* id 要删除的value如果不传入那默认删除最后一个
*/
delete:function(id = ''){
var thisId = '';
if(id == ''){
//取出数组最后一个值
thisId = msg.id.idArray[msg.id.idArray.length-1];
//删除数组最后一个值
msg.id.idArray.pop();
}else{
thisId = id;
//删除指定的id
for(var i = 0; i<msg.id.idArray.length; i++){
if(msg.id.idArray[i] == id){
msg.id.idArray.splice(i,1); //删除这个元素
return id;
}
}
}
return thisId;
},
/*
* 这里就只是单纯存放 info\success\failure 这三个免得同时点了几个后不自动取消的bug
*/
tishiIdArray: new Array()
},
/**
* 成功的提醒
* @param text 提示文字
* @param func 关闭提示后要执行的方法
*/
success:function(text,func){
this.closeAllSimpleMsg();
var thisId = this.show(text, '<svg style="width: 3rem; height:3rem; padding: 1.5rem; padding-bottom: 1.1rem; box-sizing: content-box;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2351"><path d="M384 887.456L25.6 529.056 145.056 409.6 384 648.544 878.944 153.6 998.4 273.056z" p-id="2352" fill="#ffffff"></path></svg>');
msg.id.tishiIdArray[msg.id.tishiIdArray.length] = thisId;
this.delayClose(1800, func, thisId);
return thisId;
},
/**
* 获取元素距离body距离
* @param {*} element
* @returns
*/
getElementDistanceToTop: function (element) {
var rect = element.getBoundingClientRect();
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return rect.top + scrollTop;
},
/**
* 显示tips提示窗口
* @param options 参数(idtexttip宽度高度背景色字体色显示方向direction)
* @return 返回弹出层的id可以使用 msg.close(id) 来关闭指定的弹出层
*/
showTips:function(options){
// 获取元素
var dom = document.getElementById(options.id);
var rect=dom.getBoundingClientRect()
// console.log(rect)
// 获取元素距离上方的距离
var topDistance=this.getElementDistanceToTop(dom)
// 获取元素距离左侧的距离
, leftDistance =rect.x
// 获取元素宽度
,widthDom = dom.offsetWidth
// 获取元素高度
,heightDom = dom.offsetHeight
// 获取视口的高度和宽度
,windowHeight = window.innerHeight
,windowWidth = window.innerWidth
// 计算元素距离下方的距离
,bottomDistance = windowHeight - topDistance - dom.offsetHeight
// 计算元素距离右侧的距离
,rightDistance = windowWidth - leftDistance - widthDom;
// console.log("距离上方的距离:" + topDistance);
// console.log("距离下方的距离:" + bottomDistance);
// console.log("距离左侧的距离:" + leftDistance);
// console.log("距离右侧的距离:" + rightDistance);
// 提示框离内容的距离
const specd="20px"
// 默认背景色#10a6a8
// const bg_color="rgba(46, 196, 182, 0.75)";
,background="#10a6a8"
// 默认颜色
,color="#FFFFFF"
// 默认宽度
,width="200px"
// 默认高度
,height="auto"
//默认方向
,direction="right";
if(!options.background) options.background=background;
if(!options.color) options.color=color;
if(!options.width) options.width=width;
if(!options.height) options.height=height;
if(!options.direction) options.direction=direction;
// console.log(options)
if(options.direction!=="left" && options.direction!=="right"&&options.direction!=="top"&&options.direction!=="bottom") return console.log("请输入正确的tips方向")
//创建一个随机id
var thisId = msg.id.create();
/** 显示前,如果还有其他正在显示的,将其都关掉 **/
//this.close();
if(document.getElementsByTagName("body") != null && document.getElementsByTagName("body").length > 0 && dom instanceof Element){
var div=document.createElement("div");
div.id = 'wangmarket_popup_'+thisId;
div.style = `position:absolute;padding:10px;border-radius:2px;
${options.direction == "left" || options.direction == "right" ? `top: ${topDistance}px;`:""}
${options.direction == "left" ? `right: calc(${rightDistance}px + ${widthDom}px + ${parseInt(specd)/2}px);`:""}
${options.direction == "right" ? `left: calc(${leftDistance}px + ${widthDom}px + ${parseInt(specd) / 2}px);`:""}
${options.direction == "top" || options.direction == "bottom" ? `left:${leftDistance}px;`:""}
${options.direction == "top" ? `bottom: calc(${bottomDistance}px + ${heightDom}px + ${parseInt(specd) / 2}px);`:""}
${options.direction == "bottom" ? `top: calc(${topDistance}px + ${heightDom}px + ${parseInt(specd) / 2}px);`:""}
background:${options.background};
z-index: 2147483647;width: ${options.width};
box-shadow: 0px 3px 10px 0px rgba(143, 140, 140, 0.31);
height:${options.height};box-sizing:border-box`;
// 添加一个初始样式使创建的元素在初始时缩放为0
div.style.transform = "scale(0.8)";
// 添加过渡效果
div.style.transition = "transform 0.1s ease-in-out";
div.innerHTML = ''
+ `<div id="tip" style="font-size:12px;line-height:18px;text-align:left;color:${options.color};white-space: initial">`+
options.text
+'</div>';
div.classList.add('_custom_deng');
var pseudoElementStyle = `
content: " ";
position: absolute;
${options.direction=="left"||options.direction=="right"?"top: 13px;":""}
${options.direction=="top"||options.direction=="bottom"?"left: 10%;":""}
${options.direction}: 100%;
border: ${parseInt(specd)/4}px solid transparent;
border-${options.direction}: ${parseInt(specd)/2}px solid ${options.background};
`;
// console.log(this.flag)
var existingStyle = document.getElementById("_custom_deng_style");
if (!existingStyle) {
var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.id = "_custom_deng_style";
styleSheet.innerText = `._custom_deng::before { ${pseudoElementStyle} }`;
document.head.appendChild(styleSheet);
} else {
existingStyle.innerText = `._custom_deng::before { ${pseudoElementStyle} }`;
}
// 触发缩放动画效果
setTimeout(function () {
div.style.transform = "scale(1)"; // 缩放为1显示动画效果
}, 10);
document.body.appendChild(div);
}else{
alert('提示body中没有子元素无法显示 msg.js 的提示');
}
// 触发动画
return thisId;
},
/**
* 鼠标跟随提示
* @param options 弹出层的其他属性传入如
* <pre>
* {
* id:'元素属性id值' //要显示文字提示的元素属性id。 ****必传项****
* text:'提示的文字内容', //显示的内容支持html。 ****必传项****
* direction:'right', //弹出层要显示的方位。不传默认 right。传入如 left、right、top、bottom。
* height:'auto', //弹出层显示的高度。不传默认是 auto。 传入如 100px 、 10rem 等。不能使用%百分比。
* width:'200px', //弹出层显示的宽度。不传默认是 200px。传入如 100px 、 10rem 、 50% 等。
* background:'#10a6a8'//背景颜色。十六进制颜色编码。不传默认是 '#10a6a8'
* color:'#FFFFFF' //字体颜色。十六进制颜色编码。不传默认是 '#FFFFFF'
* }
* </pre>
* @return 返回弹出层的id可以使用 msg.close(id) 来关闭指定的弹出层
*/
tip:function(options){
if(!options||!options.id||!options.text) return console.log("msg.tip()方法中请传入基本的选项(包括id和显示文本)")
var dom=document.getElementById(options.id)
if(!dom) return
var thisId
//mouseover mouseout
//mouseenter mouseleave 防止内部子元素触发
dom.addEventListener("mouseenter",(event)=>{
event.stopPropagation()
this.closeAllSimpleMsg();
thisId = this.showTips(options);
msg.id.tishiIdArray[msg.id.tishiIdArray.length] = thisId;
})
dom.addEventListener("mouseleave",()=>{
this.close(thisId)
})
return thisId;
},
/**
* 失败错误的提醒
* @param text 提示文字
* @param func 关闭提示后要执行的方法
*/
failure:function(text, func){
this.closeAllSimpleMsg();
var thisId = this.show(text, this.errorIcon);
msg.id.tishiIdArray[msg.id.tishiIdArray.length] = thisId;
this.delayClose(1800, func, thisId);
return thisId;
},
/**
* 提示信息
* @param text 提示文字
* @param func 关闭提示后要执行的方法
*/
info:function(text, func){
this.closeAllSimpleMsg();
var thisId = this.show(text, '<svg style="width: 3rem; height:3rem; padding: 1.5rem; padding-bottom: 1.1rem; box-sizing: content-box;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7996"><path d="M509.979 959.316c-247.308 0-447.794-200.486-447.794-447.794S262.671 63.728 509.979 63.728s447.794 200.486 447.794 447.794-200.485 447.794-447.794 447.794z m0-814.171c-202.346 0-366.377 164.031-366.377 366.377s164.031 366.377 366.377 366.377c202.342 0 366.377-164.031 366.377-366.377S712.321 145.145 509.979 145.145z m-40.708 610.628c-40.709 0-40.709-40.708-40.709-40.708l40.709-203.543s0-40.709-40.709-40.709c0 0-40.709 0-40.709-40.709h122.126s40.709 0 40.709 40.709-40.709 162.834-40.709 203.543 40.709 40.709 40.709 40.709h40.709c-0.001 0-0.001 40.708-122.126 40.708z m81.417-407.085c-22.483 0-40.709-18.225-40.709-40.709s18.225-40.709 40.709-40.709 40.709 18.225 40.709 40.709-18.226 40.709-40.709 40.709z" p-id="7997" fill="#ffffff"></path></svg>');
msg.id.tishiIdArray[msg.id.tishiIdArray.length] = thisId;
this.delayClose(1800, func, thisId);
return thisId;
},
/**
* 关闭infosuccessfailure 这几个的所有提示消息
*/
closeAllSimpleMsg:function(){
for(var i = 0; i<msg.id.tishiIdArray.length; i++){
msg.close(msg.id.tishiIdArray[i]);
}
},
/**
* 弹出询问选择框确定取消
*/
confirm:function(text){
return confirm(text);
},
/**
* 加载中等待中的动画效果
* @param text 提示文字
*/
loading:function(text){
this.show(text, '<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiBmaWxsPSIjRjlGOUY5Ij4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjMiIHI9IjAiPgogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iciIgdmFsdWVzPSIwOzM7MDswIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgYmVnaW49IjAiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgogIDxjaXJjbGUgdHJhbnNmb3JtPSJyb3RhdGUoNDUgMTYgMTYpIiBjeD0iMTYiIGN5PSIzIiByPSIwIj4KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiIHZhbHVlcz0iMDszOzA7MCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGJlZ2luPSIwLjEyNXMiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgogIDxjaXJjbGUgdHJhbnNmb3JtPSJyb3RhdGUoOTAgMTYgMTYpIiBjeD0iMTYiIGN5PSIzIiByPSIwIj4KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiIHZhbHVlcz0iMDszOzA7MCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGJlZ2luPSIwLjI1cyIga2V5U3BsaW5lcz0iMC4yIDAuMiAwLjQgMC44OzAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjgiIGNhbGNNb2RlPSJzcGxpbmUiIC8+CiAgPC9jaXJjbGU+CiAgPGNpcmNsZSB0cmFuc2Zvcm09InJvdGF0ZSgxMzUgMTYgMTYpIiBjeD0iMTYiIGN5PSIzIiByPSIwIj4KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiIHZhbHVlcz0iMDszOzA7MCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGJlZ2luPSIwLjM3NXMiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgogIDxjaXJjbGUgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDE2IDE2KSIgY3g9IjE2IiBjeT0iMyIgcj0iMCI+CiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiB2YWx1ZXM9IjA7MzswOzAiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMC41cyIga2V5U3BsaW5lcz0iMC4yIDAuMiAwLjQgMC44OzAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjgiIGNhbGNNb2RlPSJzcGxpbmUiIC8+CiAgPC9jaXJjbGU+CiAgPGNpcmNsZSB0cmFuc2Zvcm09InJvdGF0ZSgyMjUgMTYgMTYpIiBjeD0iMTYiIGN5PSIzIiByPSIwIj4KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiIHZhbHVlcz0iMDszOzA7MCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGJlZ2luPSIwLjYyNXMiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgogIDxjaXJjbGUgdHJhbnNmb3JtPSJyb3RhdGUoMjcwIDE2IDE2KSIgY3g9IjE2IiBjeT0iMyIgcj0iMCI+CiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiB2YWx1ZXM9IjA7MzswOzAiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMC43NXMiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgogIDxjaXJjbGUgdHJhbnNmb3JtPSJyb3RhdGUoMzE1IDE2IDE2KSIgY3g9IjE2IiBjeT0iMyIgcj0iMCI+CiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiB2YWx1ZXM9IjA7MzswOzAiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMC44NzVzIiBrZXlTcGxpbmVzPSIwLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44OzAuMiAwLjIgMC40IDAuOCIgY2FsY01vZGU9InNwbGluZSIgLz4KICA8L2NpcmNsZT4KICA8Y2lyY2xlIHRyYW5zZm9ybT0icm90YXRlKDE4MCAxNiAxNikiIGN4PSIxNiIgY3k9IjMiIHI9IjAiPgogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iciIgdmFsdWVzPSIwOzM7MDswIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgYmVnaW49IjAuNXMiIGtleVNwbGluZXM9IjAuMiAwLjIgMC40IDAuODswLjIgMC4yIDAuNCAwLjg7MC4yIDAuMiAwLjQgMC44IiBjYWxjTW9kZT0ic3BsaW5lIiAvPgogIDwvY2lyY2xlPgo8L3N2Zz4K" style="width: 3rem; height:3rem; padding: 1.5rem; padding-bottom: 1.1rem; box-sizing: content-box;" />');
},
/**
* 关闭各种提示包括加载中成功失败提示信息等都可以用此强制关闭
* id 弹出层的id正常使用无需传入 这里传入的是 msg.id.idArray 中的某个值
*/
close:function(id = ''){
this.currentWindowsId = 0; //当前没有任何窗口
//取出数组的值
var thisId = msg.id.delete(id);
var loadingDiv = document.getElementById('wangmarket_popup_'+thisId);
if(loadingDiv != null){
var loadingDivParent = loadingDiv.parentNode;
if(loadingDivParent != null){
loadingDivParent.removeChild(loadingDiv);
}
}
//关闭pupups相关
//var popupsDiv = document.getElementById('wangmarket_popups')
//if(popupsDiv != null){
// var popupsDivParent = popupsDiv.parentNode;
// if(popupsDivParent != null){
// popupsDivParent.removeChild(popupsDiv);
// }
//}
},
/**
* 延迟几秒后关闭弹出提示
* @param time 延迟多长时间单位是毫秒
* @param func 关闭提示后要执行的方法
* @param id 弹出窗口的id
*/
delayClose: function(time, func, id=''){
var cid = parseInt(Math.random()*100000);
this.currentWindowsId = cid;
var that = this;
setTimeout(function(){
if(that.currentWindowsId == cid){
/* 能对应起来,才会关闭。避免关闭别的刚显示的窗口 */
msg.close(id);
}
if(func != null){
func();
}
},time);
},
/**
* 显示提示窗口私有方法
* text 提示文字
* img 显示的图片或者svg
* @return 返回弹出层的id可以使用 msg.close(id) 来关闭指定的弹出层
*/
show:function(text, img){
/** 是否是横向显示 **/
var wangmarket_loading_hengxiang = false;
if(text != null && text.length > 10){
wangmarket_loading_hengxiang = true;
}
//创建一个随机id
var thisId = msg.id.create();
/** 显示前,如果还有其他正在显示的,将其都关掉 **/
//this.close();
if(document.getElementsByTagName("body") != null && document.getElementsByTagName("body").length > 0){
var div=document.createElement("div");
div.id = 'wangmarket_popup_'+thisId;
div.style = 'position: fixed;z-index: 2147483647;margin: 0 auto;text-align: center;width: 100%;';
div.innerHTML = ''
+'<div id="loading" style="position: fixed;top: 30%;text-align: center;font-size: 1rem;color: #dedede;margin: 0px auto;left: 50%;margin-left: -'+(wangmarket_loading_hengxiang? '9':'3.5')+'rem;">'
+'<div style="width: 7rem;background-color: #2e2d3c;border-radius: 0.3rem; filter: alpha(Opacity=80); -moz-opacity: 0.8; opacity: 0.8; min-height: 4.8rem;'+(wangmarket_loading_hengxiang? 'width: 18rem;':'')+'">'
+'<div'+(wangmarket_loading_hengxiang? ' style="float:left;height: 20rem; margin-top: -0.6rem; position: fixed;"':'')+'>'+img+'</div>'
+'<div style="width: 100%;padding-bottom: 1.4rem; font-size: 1.1rem; padding-left: 0.3rem;padding-right: 0.3rem; box-sizing: border-box;line-height: 1.2rem;color: white;'+(wangmarket_loading_hengxiang? 'padding: 1rem; text-align: left; padding-right: 0.3rem; line-height: 1.5rem;margin-left: 4.8rem; padding-right: 5.5rem; padding-top: 0.7rem;':'')+'">'+text+'</div>'
+'</div>';
+'</div>';
document.getElementsByTagName("body")[0].appendChild(div);
}else{
alert('提示body中没有子元素无法显示 msg.js 的提示');
}
return thisId;
},
/**
* 弹出层弹出窗口
* @param attribute 弹出层的其他属性传入如
* <pre>
* {
* text:'弹窗的内容', //弹出窗显示的内容支持html
* url:'https://www.leimingyun.com/index.html' //设置弹出窗口要打开的网址如果url跟text同时设置那么优先采用url text设置将无效
* top:'30%', //弹出层距离顶部的距离不传默认是30%。 可以传入如 30%、 5rem、 10px 等
* left:'5%', //弹出层距离浏览器左侧的距离不传默认是5%
* height:'100px', //弹出层显示的高度。不传默认是 auto。 传入如 100px 、 10rem 等。不能使用%百分比。
* width:'90%', //弹出层显示的宽度。不传默认是 90%。传入如 100px 、 10rem 、 50% 等。
* bottom:'1rem', //弹出层距离底部的距离。不传默认是 auto 。 height 跟 bottom 如果这两个同时设置了那么height生效bottom是不生效的
* close:false //是否显示右上角的关闭按钮不传默认是true显示关闭按钮
* background:'#2e2d3c' //背景颜色。十六进制颜色编码。不传默认是 '#2e2d3c'
* opacity:92 //弹出层的透明度默认是92, 取值0~1000是不透明100是全部透明
* padding:'10px' //弹出层四周留的空隙默认是1rem。可传入如 10px 、 1rem 等
* }
* </pre>
* @return 返回弹出层的id可以使用 msg.close(id) 来关闭指定的弹出层
*/
popups:function(attribute){
var setLeftPosition = false; //是否设置了距离左侧距离
var setTopPosition = false; //是否设置了距离顶部距离
if(typeof(attribute) == 'undefined'){
attribute = {};
}else if(typeof(attribute) == 'string'){
//直接传入了 string 格式的提示文本
attribute = {text:attribute};
}
if(attribute == null){
attribute = {}
}
if(attribute.left != null){
setLeftPosition = true;
}
if(attribute.top != null || attribute.bottom != null){
setTopPosition = true;
}
if(attribute.url != null){
if(attribute.text != null){
//友好提醒
console.log('友好提醒:您已经设置了 attribute.url ,但是您又设置了 attribute.text ,根据优先级, 将采用 attribute.url ,而 attribute.text 设置无效。 ');
}
var suiji_load_id = 'msg_popups_loading_'+new Date().getTime();
attribute.text = '<iframe src="'+attribute.url+'" frameborder="0" style="width:100%;height:100%; display:none;" onload="document.getElementById(\''+suiji_load_id+'\').style.display=\'none\'; this.style.display=\'\';"></iframe><div id="'+suiji_load_id+'" style="width: 100%; height: 100%; text-align: center; padding-top: 30%; font-size: 1.4rem; box-sizing: border-box; overflow: hidden; ">加载中...</div>';
}
//如果text为空那么提示一下
if(attribute.text == null){
attribute.text = '您未设置text的值所以这里出现提醒文字。您可以这样用: <pre>msg.popups(\'我是提示文字\');</pre>';
}
//判断一下 height 跟 bottom 是否同时设置了因为如果这两个同时设置了bottom是不生效的
if(attribute.height != null && attribute.bottom != null){
console.log('msg.js -- function popups() : 友情提示:您同时设置了height、bottom两个属性此时height属性生效bottom属性将会不起作用');
}
//赋予默认属性
if(attribute.close == null){
attribute.close = true;
}
if(attribute.top == null){
attribute.top = 'auto';
}
if(attribute.bottom == null || attribute.bottom.length < 1){
attribute.bottom = 'auto';
}
if(attribute.background == null){
attribute.background = '#2e2d3c';
}
if(attribute.opacity == null){
attribute.opacity = 92;
}
if(attribute.height == null){
attribute.height = 'auto';
}
if(attribute.left == null){
attribute.left = '5%';
}
if(attribute.width == null){
attribute.width = '90%';
}
if(attribute.padding == null){
attribute.padding = '1rem';
}
//创建一个随机id
var thisId = msg.id.create();
var div=document.createElement("div");
//div.id = 'wangmarket_popups';
div.id = 'wangmarket_popup_'+thisId;
div.style = 'position: fixed; z-index: 2147483647; margin: 0px auto; text-align: center; width: 100%; ';
div.innerHTML = '<div style="position: fixed; top:'+attribute.top+'; bottom:'+attribute.bottom+'; text-align: center;font-size: 1rem;color: #dedede;margin: 0px auto;width: '+attribute.width+';left: '+attribute.left+'; height: '+attribute.height+'; overflow-y: initial; overflow-x: initial;">'+
'<div style="padding:0rem">'+
'<div style="width: 100%;background-color: '+attribute.background+';border-radius: 0.3rem;filter: alpha(Opacity='+attribute.opacity+');-moz-opacity: '+(attribute.opacity/100)+';opacity: '+(attribute.opacity/100)+';min-height: 4.8rem; height: 100%;">'+
'<div style=" width: 100%; font-size: 1rem; box-sizing: border-box; line-height: 1.3rem; color: white; text-align: left; padding: '+attribute.padding+'; overflow-y: auto; height: '+attribute.height+'; display: flex; border-radius: 0.4rem;">'+
attribute.text+
'</div>'+
(attribute.close? '<div class="msg_close" style="top: -0.8rem;position: absolute;right: -0.6rem;background-color: aliceblue;border-radius: 50%;height: 2rem;width: 2rem; z-index: 2147483647;" onclick="msg.close('+thisId+');"><svg style="width: 2rem; height:2rem; cursor: pointer;" t="1601801323865" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4482" width="48" height="48"><path d="M512.001 15.678C237.414 15.678 14.82 238.273 14.82 512.86S237.414 1010.04 512 1010.04s497.18-222.593 497.18-497.18S786.589 15.678 512.002 15.678z m213.211 645.937c17.798 17.803 17.798 46.657 0 64.456-17.798 17.797-46.658 17.797-64.456 0L512.001 577.315 363.241 726.07c-17.799 17.797-46.652 17.797-64.45 0-17.804-17.799-17.804-46.653 0-64.456L447.545 512.86 298.79 364.104c-17.803-17.798-17.803-46.657 0-64.455 17.799-17.798 46.652-17.798 64.45 0l148.761 148.755 148.755-148.755c17.798-17.798 46.658-17.798 64.456 0 17.798 17.798 17.798 46.657 0 64.455L576.456 512.86l148.756 148.755z m0 0" fill="'+attribute.background+'" p-id="4483"></path></svg></div>':'')+
'</div>'+
'</div>'+
'</div>';
//<div style="width: 100%;padding-bottom: 1rem;font-size: 1.1rem;padding-left: 0.3rem;padding-right: 2.0rem;box-sizing: border-box;line-height: 1.2rem;color: white;text-align: right;"> <button style=" border: aliceblue; padding: 0.4rem; padding-left: 1rem; padding-right: 1rem; font-size: 0.8rem; background-color: darkcyan; " onclick="close1();">确定</button> </div>
if(document.getElementsByTagName("body") != null && document.getElementsByTagName("body").length > 0){
document.getElementsByTagName("body")[0].appendChild(div);
/** 计算位置,剧中显示 **/
//弹窗位置控制元素
//var msgPositionDom = document.getElementById('wangmarket_popups').firstChild;
var msgPositionDom = document.getElementById('wangmarket_popup_'+thisId).firstChild;
if(!setLeftPosition){
//如果没有设置left那么设置宽度居中
try {
var htmlWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; //html可见区域宽度
var msgWidth = msgPositionDom.clientWidth||msgPositionDom.offsetWidth; //当前弹窗的宽度
msgPositionDom.style.left = ((htmlWidth - msgWidth)/2) + 'px';
} catch (e) {
console.log(e);
}
}
if(!setTopPosition){
//如果没有设置top、bottom那么设置高度居中
try {
var htmlHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; //html可见区域高度
var msgHeight = msgPositionDom.clientHeight||msgPositionDom.offsetHeight; //当前弹窗的高度
if(msgHeight > htmlHeight){
//如果弹窗高度比body还高那么直接就显示到顶部
msgPositionDom.style.top = '20px';
}else{
msgPositionDom.style.top = ((htmlHeight - msgHeight)/2) + 'px';
}
} catch (e) {
console.log(e);
}
}
}else{
alert('提示body中没有子元素无法显示 msg.js 的提示');
return;
}
return thisId;
},
/**
* 确认弹出提示
* @param attribute 弹出层的其他属性传入如
* <pre>
* {
* text:'弹窗的内容', //弹出窗显示的内容支持html
* width:'17rem', //弹出层显示的宽度。不传默认是 17rem。传入如 100px 、 17rem 、 50% 等。
* close:false //是否显示右上角的关闭按钮不传默认是false不显示关闭按钮
* background:'#2e2d3c' //背景颜色。十六进制颜色编码。不传默认是 '#2e2d3c'
* opacity:92, //弹出层的透明度默认是92, 取值0~1000是不透明100是全部透明
* padding:'10px', //弹出层四周留的空隙默认是1rem。可传入如 10px 、 1rem 等
* buttons:{
* '确定':function(){
* console.log('点击了确定');
* },
* '取消':function(){
* console.log('点击了取消');
* }
* },
* buttonStyle:'padding-left:0.6rem; padding-right:0.6rem; font-size: 0.9rem;' //弹出的confirm右下角的几个按钮的样式会直接加到 <button style="....这里" 不传入默认则是padding-left:0.6rem; padding-right:0.6rem; font-size: 0.9rem;
* }
* </pre>
* @param okFunc 如果上面attribute使用的是最简单使用方式attribute传入的是 text显示的内容那么这里就是点了确定按钮后执行的方法
*/
confirm:function(attribute, okFunc){
//这里存在一种最简单的弹出方式,直接传入提示内容跟点击确定后执行的方法,所以要在前面判断一下
if(typeof(attribute) == 'string'){
//attribute 是 confirm弹出的内容
attribute = {text:attribute}
attribute.buttons = {
'确定':okFunc,
'取消':function(){}
}
}
if(attribute.buttonStyle == null){
attribute.buttonStyle = 'padding-left:0.6rem; padding-right:0.6rem; font-size: 0.9rem;';
}
//如果text为空那么提示一下
if(attribute.text == null){
attribute.text = '您未设置text的值所以这里出现提醒文字。您可以这样用: <pre>msg.popups(\'我是提示文字\');</pre>';
}else{
if(attribute.buttons == null){
attribute.text = '您还未设置 buttons 属性';
}
//统计自定义了几个button
var i = 0;
for(let key in attribute.buttons){
i++;
}
//取出button来
var buttonsHtml = ''; //button显示的html
for(let key in attribute.buttons){
i--;
//新取一个函数名
var name = ''+key+'_'+new Date().getTime();
window.msg.confirm[name] = function(){ msg.close(); attribute.buttons[key](); };
buttonsHtml = buttonsHtml+'<button onclick="window.msg.confirm[\''+name+'\']();" style="'+attribute.buttonStyle+'">'+key+'</button>'+(i>0? '&nbsp;&nbsp;':'');
}
attribute.text = '<div style="line-height: 1.4rem; width:100%; padding-right: 0.2rem;">'+attribute.text+'<div style=" display: inherit; width: 100%; text-align: right;margin-top: 1rem;">'+buttonsHtml+'</div></div>';
}
//赋予默认属性
if(attribute.close == null){
attribute.close = false;
}
if(attribute.width == null){
attribute.width = '17rem';
}
return msg.popups(attribute);
},
//需要确认的弹出提示替代js原本的alert弹窗
alert:function(text){
return msg.confirm({
text:text,
buttons:{
确定:function(){}
}
});
},
/**
* 弹出 input 输入框
* options 设置包含
text: 提示的文字必填
okFunc 点击了确定按钮执行的方法,必填 这里传入 function(value){ //这里拿到的value 就是用户自己输入的 }
defaultValue 输入框中的默认值如果不传此参数那输入框中默认就是没有任何值
type: input 普通单行文本输入 textarea 多行文本输入不传默认是input
width: 弹出输入框的宽度传入如 20rem 200px 不穿默认是 20rem
height: 弹出输入框的高度传入如 20rem 200px不传默认是初始高度也就是input是1行textarea是两行
* okFunc [废弃]点击了确定按钮执行的方法,必填 这里传入 function(value){ //这里拿到的value 就是用户自己输入的 }
* defaultValue [废弃]输入框中的默认值非必填如果不传此参数那输入框中默认就是没有任何值
* isTextarea [废弃]是否是textarea输入框默认是false不是只是单纯的input输入框这个参数默认不用传入
*/
input:function(options, okFunc, defaultValue, isTextarea=false){
if(typeof(defaultValue) == 'undefined' || defaultValue == null){
defaultValue = '';
}
//v1.10之前的方式,进行兼容
if(typeof(options) == 'string'){
var textStr = options+'';
options = {
text:textStr
};
}
if(typeof(options.type) == 'undefined'){
if(isTextarea == true){
//textarea输入方式
options.type = 'textarea';
}else{
//input 文本输入方式
options.type = 'input';
}
}
if(typeof(options.defaultValue) == 'undefined'){
options.defaultValue = defaultValue;
}
if(typeof(options.okFunc) == 'undefined'){
options.okFunc = okFunc;
}
//输入判断
if(typeof(options.okFunc) == 'undefined' || options.okFunc == null){
msg.failure('请传入点击确定按钮要执行的方法');
return;
}
//设置初始属性
if(typeof(options.width) == 'undefined'){
options.width = '20rem';
}
if(typeof(options.height) == 'undefined'){
options.height = 'auto';
}
//默认是input
var inputHTML = '<input type="text" id="msg_input_id" style="width: 100%; line-height: 1.6rem; margin-right: 1rem; box-sizing: border-box; height:'+options.height+';" value="'+options.defaultValue+'" >';
if(options['type'] == 'textarea'){
//textarea输入框
inputHTML = '<textarea id="msg_input_id" style="width: 100%; line-height: 1.1rem; margin-right: 1rem; box-sizing: border-box; height:'+options.height+';">'+options.defaultValue+'</textarea>';
}
var enterButtonId = 'msg_input_enterButtonId_'+new Date().getTime(); //确认按钮的id
var text = ''+
'<div style="width: 100%; height:auto;">'+
'<div style=" padding-bottom: 0.8rem; font-size: 1.2rem; line-height: 1.7rem;">'+options.text+'</div>'+
'<div>'+inputHTML+'</div>'+
'<div style=" display: inherit; width: 100%; text-align: right;margin-top: 1rem;"><button id='+enterButtonId+' style="padding-left:0.8rem; padding-right:0.8rem; font-size: 1rem;">确定</button></div>'+
'</div>';
var thisId = msg.popups({
text:text,
width:options.width,
height:'auto'
});
var enter = document.getElementById(enterButtonId);
enter.onclick = function(){
var msg_input_value = document.getElementById('msg_input_id').value;
msg.close();
options.okFunc(msg_input_value);
}
return thisId;
},
/**
* 弹出 textarea 输入框
* text 提示文字,必填
* okFunc 点击了确定按钮执行的方法,必填 这里传入 function(value){ //这里拿到的value 就是用户自己输入的 }
* defaultValue 输入框中的默认值非必填如果不传此参数那输入框中默认就是没有任何值
*/
textarea:function(options, okFunc, defaultValue){
return msg.input(options, okFunc, defaultValue, true);
}
}

65224
js/video.js Normal file

File diff suppressed because one or more lines are too long

40
js/video.min.js vendored Normal file

File diff suppressed because one or more lines are too long

353
map.html Normal file
View File

@ -0,0 +1,353 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="initial-scale=1.0, user-scalable=no, width=device-width"
/>
<title>视频点位治理</title>
<!-- <link
rel="stylesheet"
href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"
/> -->
<!-- <link rel="stylesheet" href="./css/video-js.min.css" /> -->
<link
rel="stylesheet"
href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"
/>
<style>
* {
margin: 0;
padding: 0;
}
html,
body,
#container {
height: 100%;
width: 100%;
}
.amap-icon img {
width: 25px;
height: 34px;
}
.amap-marker-label {
border: 0;
background-color: transparent;
}
.info {
position: relative;
margin: 0;
top: 0;
right: 0;
min-width: 0;
}
#dialog {
display: none;
background: rgba(0, 0, 0, 0.8);
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
}
.content {
background: white;
margin: 0 auto;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
}
.left {
flex: 1;
}
.right {
display: flex;
padding-left: 10px;
padding-right: 10px;
flex-direction: column;
}
#mapDiv {
z-index: 0;
}
.btns {
display: flex;
justify-content: space-between;
}
.btn_close {
background: #909092;
cursor: pointer;
color: #fff;
width: 100px;
height: 30px;
outline: none;
border: 0;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
}
textarea {
height: 90%;
margin-top: 20px;
}
video {
width: 100%;
height: 100%;
}
.btn_dispatch {
background: #5485f1;
color: #fff;
width: 100%;
height: 40px;
font-size: 18px;
outline: none;
border: 0;
border-radius: 4px;
margin-top: 20px;
}
.navTitle {
/* text-align: center; */
/* padding: 24px 44px; */
padding: 5% 6%;
width: 100%;
height: 86px;
background: url("./img/navTitle.png") no-repeat;
background-size: 100%;
box-sizing: border-box;
display: flex;
/* align-items: center; */
justify-content: space-between;
}
.btn_map {
cursor: pointer;
/* background: #33907d;
border: 0;
color: #fff;
border-radius: 12px;
padding: 7px 15px; */
border: none;
outline: none;
background: url("./img/btn_map.png") no-repeat;
background-size: 100%;
width: 90px;
height: 28.5px;
/* width: 20%;
height: 100%; */
}
</style>
<script src="./js/jquery.min.js"></script>
<script src="./js/api.js"></script>
</head>
<body>
<!-- <img src="./img/jk.png" style="position: absolute; left:0;top:0;" alt=""> -->
<!-- <div
onclick="history.back()"
style="
text-align: left;
height: 60px;
display: flex;
align-items: center;
font-size: 20px;
"
>
< 列表模式
</div> -->
<!-- <div id="status"></div>
<div id="result"></div> -->
<div class="navTitle">
<button type="button" class="btn_map" onclick="listMode()">
<!-- 地图模式 -->
</button>
<!-- <select name="" id="groupType" onchange="handleGroupTypeChange()">
<option value="">全部</option>
<option value="1">城市道路积水</option>
<option value="2">河道水情观测</option>
</select> -->
</div>
<div id="container"></div>
<script
type="text/javascript"
src="https://webapi.amap.com/maps?v=2.0&key=b2d0af3352717eab4ccab7e5ba0c2f54"
></script>
<script type="text/javascript">
var current_position;
// 创建地图实例
var map = new AMap.Map("container", {
zoom: 11,
center: [107.535867, 31.228318],
resizeEnable: true,
});
// 中心点定位
// document.getElementById('adcode').innerHTML= '当前中心点:'+map.getCenter()
// AMap.plugin("AMap.Geolocation", function () {
// var geolocation = new AMap.Geolocation({
// enableHighAccuracy: true, //是否使用高精度定位,默认:true
// timeout: 10000, //超过10秒后停止定位默认5s
// position: "RB", //定位按钮的停靠位置
// offset: [10, 20], //定位按钮与设置的停靠位置的偏移量,默认:[10, 20]
// zoomToAccuracy: false, //定位成功后是否自动调整地图视野到定位点
// });
// map.addControl(geolocation);
// geolocation.getCurrentPosition(function (status, result) {
// console.log(status, result);
// if (status == "complete") {
// onComplete(result);
// } else {
// onError(result);
// }
// });
// });
//解析定位结果
// function onComplete(data) {
// console.log(data);
// localStorage.setItem('local',data.position)
// // document.getElementById("status").innerHTML = "定位成功";
// // var str = [];
// // str.push("定位结果:" + data.position);
// // current_position = data.position;
// // str.push("定位类别:" + data.location_type);
// // if (data.accuracy) {
// // str.push("精度:" + data.accuracy + " 米");
// // } //如为IP精确定位结果则没有精度信息
// // str.push("是否经过偏移:" + (data.isConverted ? "是" : "否"));
// // document.getElementById("result").innerHTML = str.join("<br>");
// }
// //解析定位错误信息
// function onError(data) {
// // document.getElementById("status").innerHTML = "定位失败";
// // document.getElementById("result").innerHTML =
// // "失败原因排查信息:" +
// // data.message +
// // "</br>浏览器返回信息:" +
// // data.originMessage;
// }
// var options = {};
// //判断手机是否支持该功能,并获取经纬度
// if (navigator.geolocation) {
// navigator.geolocation.getCurrentPosition(success, error, options);
// } else {
// alert("你的浏览器不支持定位功能");
// }
// //成功的回调
// function success(lo, la) {
// var la = position.coords.latitude;
// var lo = position.coords.longitude;
// alert("纬度" + la);
// alert("经度" + lo);
// //something.......
// }
// //失败的回调
// function error(errorCode) {
// alert("获取失败,原因:" + errorCode.message);
// }
// 确保地图已经加载完成
// console.log(223);
// AMap.service(["AMap.DistanceSearch"], function () {
// console.log(123);
// var distanceSearch = new AMap.DistanceSearch();
// // 计算距离的回调函数
// distanceSearch.on("complete", function (result) {
// if (result.info === "OK") {
// // result.results[0].distance 是两点之间的距离
// console.log(
// "距离是:" + result.results[0].distance.toFixed(2) + " 米"
// );
// }
// });
// // 计算两个坐标点之间的距离
// distanceSearch.search(
// [
// { keyword: "107.461343,31.22154" }, // 坐标1, 例如:北京天安门
// { keyword: current_position.lng + "," + current_position.lat }, // 坐标2, 例如:北京天安门附近的点
// ],
// AMap.DistanceSearch.DRIVING
// ); // 可以更换为 AMap.DistanceSearch.WALKING 或 AMap.DistanceSearch.TRANSIT
// });
var cluster;
var gridSize = 60;
var player;
var clickHandler = function (e) {
alert(
"您在[ " +
e.lnglat.getLng() +
"," +
e.lnglat.getLat() +
" ]的位置点击了地图!"
);
};
// 实例化点标记
function addMarker() {
if (!marker) {
marker = new AMap.Marker({
icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
position: [116.406315, 39.908775],
offset: new AMap.Pixel(-13, -30),
});
marker.setMap(map);
}
}
function updateIcon() {
marker.setIcon(
"//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png"
);
}
function updateContent() {
if (!marker) {
return;
}
// 自定义点标记内容
var markerContent = document.createElement("div");
// 点标记中的图标
var markerImg = document.createElement("img");
markerImg.className = "markerlnglat";
markerImg.src =
"//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png";
markerImg.setAttribute("width", "25px");
markerImg.setAttribute("height", "34px");
markerContent.appendChild(markerImg);
// 点标记中的文本
var markerSpan = document.createElement("span");
markerSpan.className = "marker";
markerSpan.innerHTML = "Hi我被更新啦";
markerContent.appendChild(markerSpan);
marker.setContent(markerContent); //更新点标记内容
marker.setPosition([116.391467, 39.927761]); //更新点标记位置
}
// 清除 marker
function clearMarker() {
if (marker) {
marker.setMap(null);
marker = null;
}
}
</script>
<script src="./js/api.js"></script>
<script>
$(function () {
getList(1);
});
function listMode(){
window.location.href = "index.html";
}
</script>
</body>
</html>

118
map1.html Normal file
View File

@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script
src="http://api.tianditu.gov.cn/api?v=4.0&tk=9b4d8b15bdf9c3cec8d6f2945afc9c18"
type="text/javascript"
></script>
<script
src="http://api.tianditu.gov.cn/staticimage? center=116.40,39.93&width=500&height=500&zoom=12&layers=vec_c,cva_c &markers=116.34867,39.94593|116.42626,39.94731|116.4551,39.90267 |116.43381,39.86766|116.34249,39.87178|116.32807,39.90748&tk=9b4d8b15bdf9c3cec8d6f2945afc9c18"
type="text/javascript"
></script>
<script>
var map;
var zoom = 12,
marker;
// function addMapClick() {
// removeMapClick();
// map.addEventListener("click", MapClick);
// }
// function removeMapClick() {
// map.removeEventListener("click", MapClick);
// }
// function MapClick(e) {
// alert(e.lnglat.getLng() + "," + e.lnglat.getLat());
// }
function addMarkerClick() {
//移除标注的点击事件,防止多次注册
removeMarkerClick();
//注册标注的点击事件
marker.addEventListener("click", MarkerClick);
}
function removeMarkerClick() {
//移除标注的点击事件
marker.removeEventListener("click", MarkerClick);
}
function MarkerClick(e) {
alert(e.lnglat.getLng() + "," + e.lnglat.getLat());
window.location.href = "detail.html";
}
function onLoad() {
// map = new T.Map("mapDiv");
// map.centerAndZoom(new T.LngLat(116.40769, 39.89945), zoom);
// //创建标注对象
// marker = new T.Marker(new T.LngLat(116.411794, 39.9068));
// //向地图上添加标注
// map.addOverLay(marker);
// addMarkerClick();
map = new T.Map("mapDiv", {
attributionControl: false,
inertia: false,
});
map.centerAndZoom(new T.LngLat(116.40969, 37.43997405227057), zoom);
var arrayObj = new Array();
for (var i = 0; i < 500; i++) {
marker = new T.Marker(
new T.LngLat(Math.random() * 40 + 85, Math.random() * 30 + 21),
{ title: i }
);
arrayObj.push(marker);
addMarkerClick();
}
var markers = new T.MarkerClusterer(map, { markers: arrayObj });
// var latlng = new T.LngLat(116.411794, 39.9068);
// var label = new T.Label({
// text: "天地图:<a href='https://www.tianditu.gov.cn' target='_blank'>https://www.tianditu.gov.cn </a>",
// position: latlng,
// offset: new T.Point(-100, -50),
// });
// //创建地图文本对象
// map.addOverLay(label);
}
// function onLoad() {
// map = new T.Map('mapDiv', {
// attributionControl: false,
// inertia: false
// });
// map.centerAndZoom(new T.LngLat(116.40969, 37.43997405227057), zoom);
// var arrayObj = new Array();
// for (var i = 0; i < 500; i++) {
// var marker = new T.Marker(new T.LngLat(Math.random() * 40 + 85, Math.random() * 30 + 21), {title: i});
// arrayObj.push(marker);
// }
// var markers = new T.MarkerClusterer(map, {markers: arrayObj});
// }
</script>
<style>
* {
margin: 0;
padding: 0;
}
.navTitle {
display: flex;
}
</style>
</head>
<body onLoad="onLoad()">
<div class="navTitle">
<div class="navBack"><button onclick="history.back()">返回</button></div>
<div class="title">地图版</div>
</div>
<div
id="mapDiv"
style="position: absolute; top: 60px; width: 100%; height: 100%"
></div>
</body>
</html>