// /commonLogin/login // http://home.xianci.info:19090/ // var BASE = "http://home.xianci.info:19090"; var BASE = "https://ykdz.yundazhou.com:8000/api"; var isDebug = false; var token = ""; var markers = []; var info = undefined; function debugLogin() { let params = { type: "1", code }; // alert(code); $.ajax({ url: BASE + "/commonLogin/login", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), async: false, dataType: "json", contentType: "application/json; charset=UTF-8", success: function (data) { // alert(JSON.stringify(data)); if (data.c === 200) { token = data.d; sessionStorage.setItem("token", data.d); // $(".dwdh").text(data.d); getInfo(); } }, }); } function login() { let params = { type: "1", code }; $.ajax({ url: BASE + "/commonLogin/login", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), async: false, dataType: "json", contentType: "application/json; charset=UTF-8", success: function (data) { // alert(JSON.stringify(data)); if (data.c === 200) { token = data.d; sessionStorage.setItem("token", data.d); // $(".dwdh").text(data.d); getInfo(); } }, }); } function getInfo() { $.ajax({ url: BASE + "/staff/info", type: "GET", // data: JSON.stringify(param), // data: JSON.stringify(params), async: false, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { // alert(JSON.stringify(data)); console.log(data.d); // info = data.d; sessionStorage.setItem("info", JSON.stringify(data.d)); } }, }); } function getBanner() { let params = { type: "1", isBanner: true }; $.ajax({ url: BASE + "/newsAnnouncement/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { console.log(data); data.d.records.map((item) => { let str = `
`; // let date = moment(item.publishDate).format("YYYY-MM-DD HH:mm:ss"); // console.log(date); // let str = `
//
//
${item.title}
//
${item.content}
//
// ${item.staffName}${date} //
//
// //
`; $(".swiper-wrapper").append(str); var mySwiper = new Swiper(".swiper-container", { direction: "horizontal", loop: true, autoplay: 5000, // 如果需要分页器 pagination: ".swiper-pagination", // 如果需要前进后退按钮 // nextButton: ".swiper-button-next", // prevButton: ".swiper-button-prev", // 如果需要滚动条 // scrollbar: ".swiper-scrollbar", }); }); } }, }); } function ggList() { let params = { type: "2" }; $.ajax({ url: BASE + "/newsAnnouncement/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { console.log(data); //
${item.content}
data.d.records.map((item) => { let str = `
${item.title}
${item.staffName}${item.publishDate}
`; $(".newslist").append(str); }); } }, }); } function newsList() { let params = { type: "1", ...zzggListQuery }; $.ajax({ url: BASE + "/newsAnnouncement/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { getInfo(); console.log(data); //
${item.content}
data.d.records.map((item) => { zzggTotal = data.d.pages; let date = moment(item.publishDate * 1000).format( "YYYY-MM-DD HH:mm:ss" ); console.log(date); let str = `
${item.title}
${item.staffName}${date}
`; $(".zcggList").append(str); }); } }, }); } function ggList() { let params = { type: "2" }; $.ajax({ url: BASE + "/newsAnnouncement/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { console.log(data); gsggTotal = data.d.pages; data.d.records.map((item) => { let date = moment(item.publishDate * 1000).format( "YYYY-MM-DD HH:mm:ss" ); let str = `
${item.title}
${item.staffName}${date}
`; //
${item.content}
$(".gsggList").append(str); }); } }, }); } function markList() { // /civilAirDefenseEngineering/getList let params = { current: 1, size: 99999 }; $.ajax({ url: BASE + "/civilAirDefenseEngineering/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { var cluster; var gridSize = 60; var points = []; data.d.records.map((item) => { let obj = { ...item, lnglat: [item.lng, item.lat], }; points.push(obj); // console.log(points); }); // console.log(points); var count = points.length; // console.log(count); var _renderClusterMarker = function (context) { var factor = Math.pow(context.count / count, 1 / 18); var div = document.createElement("div"); var Hue = 180 - factor * 180; var bgColor = "hsla(" + Hue + ",100%,40%,0.7)"; var fontColor = "hsla(" + Hue + ",100%,90%,1)"; var borderColor = "hsla(" + Hue + ",100%,40%,1)"; var shadowColor = "hsla(" + Hue + ",100%,90%,1)"; div.style.backgroundColor = bgColor; var size = Math.round( 30 + Math.pow(context.count / count, 1 / 5) * 20 ); div.style.width = div.style.height = size + "px"; div.style.border = "solid 1px " + borderColor; div.style.borderRadius = size / 2 + "px"; div.style.boxShadow = "0 0 5px " + shadowColor; div.innerHTML = context.count; div.style.lineHeight = size + "px"; div.style.color = fontColor; div.style.fontSize = "14px"; div.style.textAlign = "center"; context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); context.marker.setContent(div); }; var _renderMarker = function (context) { console.log(context.data[0].type); var offset = new AMap.Pixel(-9, -9); //非聚合点样式 let data = context.data[0]; let pic = context.data[0].type.includes("疏散点") ? "./img/marker_ssd.png" : "./img/marker_nld.png"; let content = '
'; console.log(content); context.marker.setLabel({ direction: "bottom", offset: new AMap.Pixel(0, 0), //设置文本标注偏移量 }); context.marker.on("click", () => { $(".current").empty(); console.log(context.data[0]); let dis = AMap.GeometryUtil.distance(local, [ context.data[0].lng, context.data[0].lat, ]); let str = `
${context.data[0].name}
${context.data[0].type}可疏散人数:${ context.data[0].number ? context.data[0].number + "人" : "无" }
${context.data[0].address}
${Math.round(dis / 1000)}km
`; $(".current").append(str); // getUrl(context.data[0].cameraIndexCode); // window.payload.id = context.data[0].id; // // window.content = context.data[0].marking // $("#markingName").val(context.data[0].markingName); // $("#content").val(context.data[0].marking); // $("#date").text(context.data[0].markingDate); }); //此处 需要用 ()=>{} 否则无法触发点击数据 // context.marker.on("mouseover", () => { // var info = []; // info.push( // "
" // ); // info.push("
"); // info.push("
"); // info.push( // "
视频点位名称:
" + // data.name + // "

" // ); // info.push( // "
标注者:
" + // (data.markingName === null ? "" : data.markingName) + // "

" // ); // info.push( // "
标注内容:
" + // (data.marking === null ? "" : data.marking) + // "

" // ); // info.push( // "
标注时间:
" + // (data.marking === null ? "" : data.markingDate) + // "

" // ); // info.push("
"); // this.infoWindow = new AMap.InfoWindow({ // offset: new AMap.Pixel(0, -15), //弹窗与图标的偏移 // content: info.join(""), //使用默认信息窗体框样式,显示信息内容 // }); // // 阻止地图滚轮事件传播到地图 // this.infoWindow.on("mousewheel", (event) => { // event.stopPropagation(); // 阻止事件传播到地图 // }); // // 监听弹窗内部的滚轮事件 // this.infoWindow // .getContentDom() // .addEventListener("mousewheel", (event) => { // event.stopPropagation(); // 阻止事件传播到地图 // // 处理弹窗内容的滚动 // // 你可以根据需要自定义滚动行为,例如使用滚动条等 // }); // this.infoWindow.open(this.map, context.marker.getPosition()); // }); context.marker.setContent(content); context.marker.setOffset(offset); }; // console.log(map) addCluster(2); function addCluster(tag) { if (cluster) { cluster.setMap(null); } if (tag == 2) { console.log("addCluster", map, _renderClusterMarker); //完全自定义 map.plugin(["AMap.MarkerClusterer"], function () { cluster = new AMap.MarkerClusterer(map, points, { gridSize: gridSize, // 设置网格像素大小 renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式 renderMarker: _renderMarker, // 自定义非聚合点样式 }); }); } else if (tag == 1) { //自定义图标 var sts = [ { url: "//a.amap.com/jsapi_demos/static/images/blue.png", size: new AMap.Size(32, 32), offset: new AMap.Pixel(-16, -16), }, { url: "//a.amap.com/jsapi_demos/static/images/green.png", size: new AMap.Size(32, 32), offset: new AMap.Pixel(-16, -16), }, { url: "//a.amap.com/jsapi_demos/static/images/orange.png", size: new AMap.Size(36, 36), offset: new AMap.Pixel(-18, -18), }, { url: "//a.amap.com/jsapi_demos/static/images/red.png", size: new AMap.Size(48, 48), offset: new AMap.Pixel(-24, -24), }, { url: "//a.amap.com/jsapi_demos/static/images/darkRed.png", size: new AMap.Size(48, 48), offset: new AMap.Pixel(-24, -24), }, ]; cluster = new AMap.MarkerCluster(map, points, { styles: sts, gridSize: gridSize, }); } else { console.log("默认"); //默认样式 map.plugin(["AMap.MarkerClusterer"], function () { cluster = new AMap.MarkerClusterer(map, points, { gridSize: gridSize, // 设置网格像素大小 }); }); } } // let local = // (sessionStorage.getItem("local") && // sessionStorage.getItem("local").split(",")) || // // "107.487141,31.219671"; // "0,0"; let local = sessionStorage.getItem("local") ? sessionStorage.getItem("local").split(",") : "107.487141,31.219671"; let tmpData = data.d.records.map((item) => ({ ...item, ...{ dis: AMap.GeometryUtil.distance(local, [item.lng, item.lat]) }, })); console.log(tmpData); // alert(local); tmpData.sort(function (a, b) { return a.dis - b.dis; }); tmpData.map((item) => { // const marker = new AMap.Marker({ // icon: // item.type === "疏散点" // ? "./img/marker_ssd.png" // : "./img/marker_nld.png", // position: new AMap.LngLat(item.lng, item.lat), //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] // anchor: "bottom-center", // title: item.name, // }); // // 设置鼠标划过点标记显示的文字提示 // marker.setTitle(item.name); // map.add(marker); // markers.push(marker); // // dom append let dis = AMap.GeometryUtil.distance(local, [item.lng, item.lat]); let str = `
${item.name}
${item.type}可疏散人数:${ item.number ? item.number + "人" : "无" }
${item.address}
${Math.round(dis / 1000)}km
`; $(".markList").append(str); }); } }, }); } function toLocation(lon, lat) { var target = new AMap.LngLat(lon, lat); map.setZoom(12); //map.setCenter(target); setTimeout(() => { map.setCenter(target); }, 50); } function goGuide(lng, lat, name) { console.log(lng, lat); let dom = document.createElement("a"); dom.href = `https://uri.amap.com/marker?position=${lng},${lat}&name=${name}`; dom.click(); // 高德地图 } function eventList() { let params = { current: 1, size: 10000, self: true, }; $.ajax({ url: BASE + "/eventRecord/getList", type: "POST", // data: JSON.stringify(param), data: JSON.stringify(params), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { console.log(data); qkczTotal = data.d.pages; data.d.records.map((item) => { let date = moment(item.createDate * 1000).format( "YYYY-MM-DD HH:mm:ss" ); let maps = { 1: "发现国动设施附近施工", 2: "发现国动设施处倾倒建渣或垃圾", 3: "发现在国动设施正被破坏", 4: "发现在国动设施已被破坏", }; let title = item.type; let pic = item.imageUrls.split(",")[0]; let type2Map = { 1: "基层矛盾", 2: "线上预约", 3: "应急救援", 4: "巡查上报", }; //
${item.content}
let str = `
${title}
${type2Map[item.type2]}${date}
`; $(".qkczList").append(str); }); } }, }); } function handleEventInfo(id) { window.location.href = "qkczDetail.html?id=" + id; } function toggleToolBar() { console.log($(".menus_qksb").attr("class")); if ($(".menus_qksb").attr("class") === "menus_qksb toggled") { // $(".toolBarBox").show(); $(".menus_qksb").removeClass("toggled"); $(".toolBarBox").hide(); $(".toolBar").css("background", "none"); } else { $(".menus_qksb").addClass("toggled"); $(".toolBarBox").show(); $(".toolBar").css("background", "#fff"); } } function handleEventUpload(type) { console.log(type); // window.location.href = "eventUpload.html?type2=" + type; switch (type) { case 1: window.location.href = "jcmd.html"; break; case 2: window.location.href = "xsyy.html"; break; case 3: window.location.href = "yjjy.html"; break; case 4: window.location.href = "xcsb.html"; break; default: break; } } function toast(text, time) { let toast = document.getElementById("toast"); let toast_box = document.getElementsByClassName("toast_box")[0]; toast.innerHTML = text; toast_box.style.animation = "show 1.5s"; toast_box.style.display = "inline-block"; setTimeout(function () { toast_box.style.animation = "hide 1.5s"; setTimeout(function () { toast_box.style.display = "none"; }, 1400); }, time); } //调用 function correct() { toast("is ok!", 5000); } function warning() { toast("没有更多了", 3000); } function error() { toast("没有权限", 3000); } function newsDetail(id) { location.href = "newsDetail.html?id=" + id; } function getNewsInfo(id) { $.ajax({ url: BASE + "/newsAnnouncement/getInfo", type: "POST", // data: JSON.stringify(param), data: JSON.stringify({ id }), // async: true, dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { // console.log(data); // data.d.records.map((item) => { let str = data.d.content; $(".title").text(data.d.title); $(".author").text(data.d.staffName); $(".date").text( moment(data.d.publishDate * 1000).format("YYYY-MM-DD HH:mm:ss") ); $(".content").append(str); // }); } else { alert(data.m); } }, }); } function init() { // 监听滚动事件 window.onscroll = function () { // 获取滚动容器的高度 var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; // 获取容器可视区域的高度 var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // 获取当前滚动的位置 var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; console.log(); // 判断是否到达底部 if (scrollHeight - (scrollTop + clientHeight) < 1) { // 到达底部,执行相应操作 let pageMap = ["index.html", "gsgg.html", "qkcz.html"]; let currentPage = location.href.split("/").pop(); if (pageMap.includes(currentPage)) { switch (currentPage) { case "index.html": if (zzggTotal > zzggListQuery.current) { zzggListQuery.current = zzggListQuery.current + 1; newsList(); } else { // alert("没有更多"); warning(); } break; case "qkcz.html": if (qkczTotal > qkczListQuery.current) { qkczListQuery.current = qkczListQuery.current + 1; newsList(); } else { // alert("没有更多"); warning(); } break; // case "jjyb.html": // if (jjybTotal > jjybListQuery.current) { // jjybListQuery.current = jjybListQuery.current + 1; // markList(); // } else { // // alert("没有更多"); // warning(); // } // break; case "gsgg.html": if (gsggTotal > gsggListQuery.current) { gsggListQuery.current = gsggListQuery.current + 1; ggList(); } else { // alert("没有更多"); warning(); } break; default: break; } } // console.log("已经到达底部"); // if (zzggTotal > zzggListQuery.current) { // zzggListQuery.current = zzggListQuery.current + 1; // newsList(); // } else { // alert("没有更多"); // } } }; } function getEventInfo(id) { // let data = { // d: { // content: "xxxxxx", // imageUrls: // "http://ykdz.yundazhou.com:8000/file/2e87ca9f-b710-469f-949a-0691adc22ba3.png,http://ykdz.yundazhou.com:8000/file/5be01df6-a34a-4f1f-b377-193c76032963.圆角矩形13拷贝2@3x.png", // staffName: "张三", // type: "1", // uploadTime: "1727163829", // dealTime: "1727163829", // dealStatus: "1", // }, // }; // $(".content").text(data.d.content); // $("#staffName").text(data.d.staffName); // let imgs = data.d.imageUrls.split(","); // imgs.map((item) => { // let str = ``; // $(".imgList").append(str); // }); // $("#uploadTime").text( // moment(data.d.uploadTime * 1000).format("YYYY-MM-DD HH:mm") // ); // $("#dealTime").text( // moment(data.d.dealTime * 1000).format("YYYY-MM-DD HH:mm") // ); // // 1 发现国动设施附近施工,2 发现国动设施处倾倒建渣或垃圾,3 发现在国动设施正被破坏,4 发现在国动设施已被破坏 // let typeMap = { // 1: "发现国动设施附近施工", // 2: "发现国动设施处倾倒建渣或垃圾", // 3: "发现在国动设施正被破坏", // 4: "发现在国动设施已被破坏", // }; // let type = typeMap[data.d.type]; // $("#type").text(type); // // 1 处理中,2 已处理 // $("#status").text(data.d.dealStatus === "1" ? "处理中" : "已处理"); $.ajax({ url: BASE + "/eventRecord/getInfo", type: "POST", data: JSON.stringify({ id }), dataType: "json", contentType: "application/json; charset=UTF-8", headers: { Authorization: sessionStorage.token }, success: function (data) { if (data.c === 200) { $(".content").text(data.d.content); let imgs = data.d.imageUrls.split(","); imgs.map((item) => { let str = ``; $(".imgList").append(str); }); // $("#uploadTime").text( // moment(data.d.uploadTime * 1000).format("YYYY-MM-DD HH:mm") // ); // if (data.d.dealTime) { // $("#dealTime").text( // moment(data.d.dealTime * 1000).format("YYYY-MM-DD HH:mm") // ); // } $("#dept").text(data.d.dept); // 1 发现国动设施附近施工,2 发现国动设施处倾倒建渣或垃圾,3 发现在国动设施正被破坏,4 发现在国动设施已被破坏 // let typeMap = { // 1: "发现国动设施附近施工", // 2: "发现国动设施处倾倒建渣或垃圾", // 3: "发现在国动设施正被破坏", // 4: "发现在国动设施已被破坏", // }; let type2Map = { 1: "基层矛盾", 2: "线上预约", 3: "应急救援", 4: "巡查上报", }; // let type = typeMap[data.d.type]; $("#type").text(data.d.type); $("#type2").text(type2Map[data.d.type2]); // 1 处理中,2 已处理 $("#status").text(data.d.dealStatus === "1" ? "处理中" : "已处理"); // $(".newsAuthor").text(type2Map[data.d.type2]); // console.log(data); // data.d.records.map((item) => { // let str = data.d.content; // $(".title").text(data.d.title); // $(".author").text(data.d.staffName); // $(".date").text(moment(data.d.publishDate * 1000).format( // "YYYY-MM-DD HH:mm:ss" // )) // $(".content").append(str); // }); switch (data.d.type2) { case "1": $(".jcmd").css("display", "flex"); $(".jcmd #staffName").text(data.d.staffName); $(".jcmd #staffPhone").text(data.d.staffPhone); break; case "2": $(".xsyy").css("display", "flex"); $(".xsyy #staffName").text(data.d.staffName); $(".xsyy #staffPhone").text(data.d.staffPhone); break; case "3": $(".yjjy").css("display", "flex"); $(".yjjy #staffName").text(data.d.staffName); $(".yjjy #staffPhone").text(data.d.staffPhone); let date = moment(data.d.uploadTime * 1000).format( "YYYY-MM-DD HH:mm:ss" ); $(".yjjy #uploadTime").text(date); $(".yjjy #address").text(data.d.address); break; case "4": $(".xcsb").css("display", "flex"); $(".xcsb #staffName").text(data.d.staffName); $(".xcsb #type").text(data.d.type); $(".xcsb #uploadTime").text(data.d.uploadTime&& moment(data.d.uploadTime * 1000).format("YYYY-MM-DD HH:mm") ); $(".xcsb #dealTime").text( data.d.dealTime && moment(data.d.dealTime * 1000).format("YYYY-MM-DD HH:mm") ); break; default: break; } // let formMap = { // 1: `
//
上报人
//
//
//
//
上报时间
//
//
//
//
处置时间
//
//
//
//
分类
//
//
//
//
事件类型
//
//
//
//
部门
//
//
`, // 2:`` // }; } else { alert(data.m); } }, }); } function handlePreview(src) { console.log(src); // $('.previewLayer').css('background',`url:(${src})`); // $('.previewImg').css('background', `url(${src})no-repeat`); $(".previewImg").attr("src", src); $(".previewLayer").css("display", "flex"); } function handleClosePreview() { $(".previewLayer").css("display", "none"); } function fullScreen() { $(".icon_fullScreen").hide(); $(".icon_fullScreen_exit").show(); $("#container").addClass("mapFullScreen"); } function exitFullScreen() { $(".icon_fullScreen_exit").hide(); $(".icon_fullScreen").show(); $("#container").removeClass("mapFullScreen"); } // function scrollPageInit() { // const list = document.getElementById("zcggList"), // loader = document.getElementById("loader"), // nothing = document.getElementById("nothing"), // LIST_LIMIT_CNT = 15, // LOADING_TIME = 500; // let hasMore = true, // loadLock = false; // const observer = new IntersectionObserver( // ([entry]) => { // if (entry.isIntersecting) { // pullUp(); // } // }, // { // root: null, // rootMargin: "0px", // threshold: 0, // } // ); // observer.observe(loader); // function pullUp() { // if (!hasMore) { // return; // } // if (loadLock) { // return; // } // loadData(); // } // function loadData() { // const len = list.children.length; // loadLock = true; // setTimeout(() => { // if (len >= LIST_LIMIT_CNT) { // loader.className = "hidden"; // nothing.className = ""; // hasMore = false; // return; // } // for (let i = len; i < len + 5; i++) { // const item = document.createElement("div"); // item.className = "item"; // item.textContent = i; // list.appendChild(item); // } // loadLock = false; // }, LOADING_TIME); // } // } // 开始监听 // observer.observe(element) // const loader = document.getElementById('loader') // const observer = new IntersectionObserver(([entry]) => { // if (entry.isIntersecting) { // pullUp() // } // }, { // root: null, // rootMargin: '0px', // threshold: 0 // }) // observer.observe(loader)