This commit is contained in:
parent
dcd6950354
commit
feb51a6001
|
|
@ -1,16 +1,16 @@
|
||||||
let aqEnnable = false // 参数加密开关
|
let aqEnnable = true;// 参数加密开关
|
||||||
const commonUrl = "http://10.40.92.33:18080/zhgd/";
|
const commonUrl = "http://127.0.0.1:18080/zhgd/";
|
||||||
/* 登录相关 */
|
/* 登录相关 */
|
||||||
const login_url = commonUrl + "auth/login"; // 登录url
|
const login_url = commonUrl + "auth/login"; // 登录url
|
||||||
const login_out = commonUrl + "auth/logout"; // 登出url
|
const login_out = commonUrl + "auth/logout"; // 登出url
|
||||||
const page_jump = commonUrl + "auth/pageJump"; // 登出url
|
const page_jump = commonUrl + "auth/pageJump"; // 登出url
|
||||||
const login_sg_page = "http://10.40.92.33:8100/sg_login.html" // 施工大屏登录页面
|
const login_sg_page = "http://127.0.0.1:63342/ah_jjzhgd_webscreen/sg_login.html" // 施工大屏登录页面
|
||||||
const login_sc_page = "http://10.40.92.33:8101/sc_login.html" // 省侧大屏登录页面
|
const login_sc_page = "http://10.40.92.33:8100/sc_login.html" // 省侧大屏登录页面
|
||||||
const login_sg_index = "http://10.40.92.33:8100/pages/home/navigation.html" // 施工大屏首页
|
const login_sg_index = "http://10.40.92.33:8101/pages/home/navigation.html" // 施工大屏首页
|
||||||
const login_sc_index = "http://10.40.92.33:8101/pages/web/index.html" // 省侧大屏首页
|
const login_sc_index = "http://10.40.92.33:8100/pages/web/index.html" // 省侧大屏首页
|
||||||
|
|
||||||
/* POST 请求 */
|
/* POST 请求 */
|
||||||
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType, isAes) {
|
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType,isAes) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
type: type,
|
type: type,
|
||||||
|
|
@ -33,8 +33,7 @@ function ajaxRequest2(url, type, token, successFn, errorFn) {
|
||||||
url: url,
|
url: url,
|
||||||
type: type,
|
type: type,
|
||||||
headers: {
|
headers: {
|
||||||
"authorization": token,
|
"authorization": token
|
||||||
"decrypt": 'decrypt'
|
|
||||||
},
|
},
|
||||||
success: successFn,
|
success: successFn,
|
||||||
error: errorFn
|
error: errorFn
|
||||||
|
|
@ -50,26 +49,7 @@ function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) {
|
||||||
"authorization": sessionStorage.getItem("zhgd_token"),
|
"authorization": sessionStorage.getItem("zhgd_token"),
|
||||||
"decrypt": isAes ? '' : 'decrypt'
|
"decrypt": isAes ? '' : 'decrypt'
|
||||||
},
|
},
|
||||||
async: async,
|
data: data,
|
||||||
beforeSend: beforeFn,
|
|
||||||
success: successFn,
|
|
||||||
error: errorFn
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* GET请求 */
|
|
||||||
function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, isAes) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: type,
|
|
||||||
headers: {
|
|
||||||
"authorization": sessionStorage.getItem("zhgd_token"),
|
|
||||||
"decrypt": isAes ? '' : 'decrypt'
|
|
||||||
},
|
|
||||||
xhrFields: {
|
|
||||||
responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob
|
|
||||||
},
|
|
||||||
async: async,
|
async: async,
|
||||||
beforeSend: beforeFn,
|
beforeSend: beforeFn,
|
||||||
success: successFn,
|
success: successFn,
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,6 @@ function wearGarList(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapInit(){
|
function mapInit(){
|
||||||
debugger
|
|
||||||
var lat,lon;
|
var lat,lon;
|
||||||
// if (navigator.geolocation) {
|
// if (navigator.geolocation) {
|
||||||
// navigator.geolocation.getCurrentPosition(function (position) {
|
// navigator.geolocation.getCurrentPosition(function (position) {
|
||||||
|
|
@ -191,28 +190,8 @@ function wearGarList(){
|
||||||
map.centerAndZoom(new BMapGL.Point(lon,lat), 11);
|
map.centerAndZoom(new BMapGL.Point(lon,lat), 11);
|
||||||
map.enableScrollWheelZoom(true);
|
map.enableScrollWheelZoom(true);
|
||||||
|
|
||||||
// 创建点标记
|
// 人员定位
|
||||||
let marker = new BMapGL.Marker(new BMapGL.Point(lon,lat));
|
personnelPositioning();
|
||||||
map.addOverlay(marker);
|
|
||||||
// 创建信息窗口
|
|
||||||
var opts = {
|
|
||||||
width: 200,
|
|
||||||
height: 100,
|
|
||||||
title: '人员信息'
|
|
||||||
};
|
|
||||||
var content = createInfoWindowContent();
|
|
||||||
var infoWindow = new BMapGL.InfoWindow(content, opts);
|
|
||||||
// 点标记添加点击事件
|
|
||||||
marker.addEventListener('click', function () {
|
|
||||||
map.openInfoWindow(infoWindow, new BMapGL.Point(lon,lat)); // 开启信息窗口
|
|
||||||
});
|
|
||||||
// 创建信息窗口内容
|
|
||||||
function createInfoWindowContent() {
|
|
||||||
return '<div>张三 男 xx岁</div>' +
|
|
||||||
'<div>17681010134</div>' +
|
|
||||||
'<div id="showTrack" onclick="test()"><a style="color: #1e9fff" href="#"">查看轨迹</a></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 绘制镂空面
|
// 绘制镂空面
|
||||||
RecreateFence();
|
RecreateFence();
|
||||||
|
|
@ -225,6 +204,92 @@ function wearGarList(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//人员定位
|
||||||
|
function personnelPositioning(){
|
||||||
|
const url = commonUrl + "screen/largeScreen/personnelControl/personnelCoordinatePoint";
|
||||||
|
const params = {
|
||||||
|
"roleCode": roleCode,
|
||||||
|
"orgId": orgId,
|
||||||
|
"userId": userId,
|
||||||
|
"bidCode": bidCode
|
||||||
|
}
|
||||||
|
let encryptStr = encryptCBC(JSON.stringify(params));
|
||||||
|
ajaxRequest(url, "POST", encryptStr, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
console.log(result);
|
||||||
|
if (result.code === 200) {
|
||||||
|
|
||||||
|
let data = result.data;
|
||||||
|
data.forEach(function(item) {
|
||||||
|
debugger
|
||||||
|
let arrName = item.modeName.split(',');
|
||||||
|
let arr = item.val.split(',')
|
||||||
|
for (let i = 0; i < arrName.length; i++) {
|
||||||
|
item[arrName[i]] = arr[i];
|
||||||
|
}
|
||||||
|
// 解析经纬度和绑定人
|
||||||
|
var latitude = parseFloat(item.维度); // 维度
|
||||||
|
var longitude = parseFloat(item.经度); // 经度
|
||||||
|
var bindUser = item.绑定人; // 绑定人
|
||||||
|
|
||||||
|
创建标记点
|
||||||
|
var point = new BMapGL.Point(longitude, latitude);
|
||||||
|
var marker = new BMapGL.Marker(point);
|
||||||
|
map.addOverlay(marker);
|
||||||
|
|
||||||
|
// 创建信息窗口
|
||||||
|
var opts = {
|
||||||
|
width: 200,
|
||||||
|
height: 100,
|
||||||
|
title: '人员信息'
|
||||||
|
};
|
||||||
|
var content = createInfoWindowContent(item.userName, bindUser, item.phone); // 使用解析后的数据创建信息窗口内容
|
||||||
|
var infoWindow = new BMapGL.InfoWindow(content, opts);
|
||||||
|
|
||||||
|
// 点标记添加点击事件
|
||||||
|
marker.addEventListener('click', function () {
|
||||||
|
map.openInfoWindow(infoWindow, point); // 开启信息窗口
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
// 创建信息窗口内容
|
||||||
|
function createInfoWindowContent(userName, bindUser, phone) {
|
||||||
|
return '<div>' + userName + ' ' + bindUser + '</div>' +
|
||||||
|
'<div>' + phone + '</div>' +
|
||||||
|
'<div id="showTrack" onclick="test(bindUser)"><a style="color: #1e9fff" href="#"">查看轨迹</a></div>';
|
||||||
|
}
|
||||||
|
// // 创建点标记
|
||||||
|
// let marker = new BMapGL.Marker(new BMapGL.Point(lon,lat));
|
||||||
|
// map.addOverlay(marker);
|
||||||
|
// // 创建信息窗口
|
||||||
|
// var opts = {
|
||||||
|
// width: 200,
|
||||||
|
// height: 100,
|
||||||
|
// title: '人员信息'
|
||||||
|
// };
|
||||||
|
// var content = createInfoWindowContent();
|
||||||
|
// var infoWindow = new BMapGL.InfoWindow(content, opts);
|
||||||
|
// // 点标记添加点击事件
|
||||||
|
// marker.addEventListener('click', function () {
|
||||||
|
// map.openInfoWindow(infoWindow, new BMapGL.Point(lon,lat)); // 开启信息窗口
|
||||||
|
// });
|
||||||
|
// // 创建信息窗口内容
|
||||||
|
// function createInfoWindowContent() {
|
||||||
|
// return '<div>张三 男 xx岁</div>' +
|
||||||
|
// '<div>17681010134</div>' +
|
||||||
|
// '<div id="showTrack" onclick="test()"><a style="color: #1e9fff" href="#"">查看轨迹</a></div>';
|
||||||
|
// }
|
||||||
|
|
||||||
|
} else if (result.code === 500) {
|
||||||
|
layer.msg(result.msg, { icon: 2 });
|
||||||
|
}else if(result.code === 401){
|
||||||
|
loginout(1)
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
// error(xhr)
|
||||||
|
} , "application/json",aqEnnable);
|
||||||
|
}
|
||||||
|
|
||||||
// 重新绘制围栏
|
// 重新绘制围栏
|
||||||
function RecreateFence(){
|
function RecreateFence(){
|
||||||
const url = commonUrl + "screen/largeScreen/personnelControl/getReplicaFence";
|
const url = commonUrl + "screen/largeScreen/personnelControl/getReplicaFence";
|
||||||
|
|
@ -282,7 +347,7 @@ function wearGarList(){
|
||||||
// error(xhr)
|
// error(xhr)
|
||||||
} , "application/json",aqEnnable);
|
} , "application/json",aqEnnable);
|
||||||
}
|
}
|
||||||
function test(){
|
function test(bindUser){
|
||||||
// 查看轨迹函数
|
// 查看轨迹函数
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
|
|
|
||||||
|
|
@ -197,10 +197,12 @@ function wearGarList(){
|
||||||
function mapInit(module){
|
function mapInit(module){
|
||||||
// 获取经纬度
|
// 获取经纬度
|
||||||
var lat,lon;
|
var lat,lon;
|
||||||
if (navigator.geolocation) {
|
// if (navigator.geolocation) {
|
||||||
navigator.geolocation.getCurrentPosition(function (position) {
|
// navigator.geolocation.getCurrentPosition(function (position) {
|
||||||
lat = position.coords.latitude;
|
// lat = position.coords.latitude;
|
||||||
lon = position.coords.longitude;
|
// lon = position.coords.longitude;
|
||||||
|
lat = '31.93566198931321';
|
||||||
|
lon = '117.16010067578883';
|
||||||
console.log(lon,lat)
|
console.log(lon,lat)
|
||||||
map= new BMap.Map("map");
|
map= new BMap.Map("map");
|
||||||
map.centerAndZoom(new BMap.Point(lon,lat), 15);
|
map.centerAndZoom(new BMap.Point(lon,lat), 15);
|
||||||
|
|
@ -217,10 +219,10 @@ function mapInit(module){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
console.log("浏览器不支持 Geolocation API");
|
// console.log("浏览器不支持 Geolocation API");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue