Commit 1a49efd9 by 白杨

添加网点接口

1 parent 7791ea74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>分享</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
<style>
body{
background: #EEF2F6;
margin: 0px;
}
.div-main{
width: 100%;
height: 100%;
}
.div-logo{
text-align: center;
margin-top: 45%;
}
.div-share{
margin: 15px;
margin-top: 25px;
}
.div-person{
padding: 15px;
background: #19AC9E;
color: #FFFFFF;
border-radius: 5px 5px 0px 0px;
overflow: hidden;
}
.div-password{
background: #FFFFFF;
padding: 15px;
border-radius: 0px 0px 5px 5px;
overflow: hidden;
}
input{
background: #F1F1F1;
border: none;
width: 60%;
height: 30px;
float: left;
}
button{
background: #19AC9E;
color: #FFFFFF;
font-size: 15px;
border: none;
border-radius: 2px;
padding-left: 35px;
padding-right: 35px;
padding-top: 6px;
padding-bottom: 6px;
float: right;
}
.img-photo{
width: 33px;
height: 33px;
border-radius: 33px;
}
</style>
</head>
<body>
<div class="div-main">
<!--logo-->
<div class="div-logo">
<img src="src/image/logo.png">
</div>
<!--分享验证-->
<div class="div-share">
<div class="div-person">
<!--<img class="img-photo" src="http://b.hiphotos.baidu.com/image/pic/item/b999a9014c086e069cd7964b00087bf40ad1cbb7.jpg" >-->
<!--<label style="margin-left: 15px;">Sure</label>-->
<label >打开加密地图</label>
</div>
<div class="div-password">
<label>请输入手机号:</label>
<div style="margin-top: 10px;">
<input type="text">
<button id="btn_test">提取</button>
</div>
</div>
</div>
<div style="width: 100%;text-align: center;">
<img src="src/image/image1.png" style="margin-top: 5rem">
</div>
</div>
</body>
<script type="text/javascript" src="dist/jquery/jquery-3.2.1.min.js"></script>
<script src="src/js/index.js"></script>
<script type="text/javascript">
$(function(){
index.init();
});
</script>
</html>
\ No newline at end of file
var index = {
init: function () {
$('#btn_test').click(function () {
index.mainReturn();
});
},
mainReturn: function () {
//跳转主界面
window.location.href="main.html";
}
}
\ No newline at end of file
...@@ -57,24 +57,51 @@ var main = { ...@@ -57,24 +57,51 @@ var main = {
main.updateLocation("location_confirm"); main.updateLocation("location_confirm");
}); });
$('#btn_update').click(function () { $('#btn_update').click(function () {
main.getUpdate(); main.updateReturn();
}); });
//获取网点 //获取网点
// this.getInfo(); this.validate();
this.getInfoSuccess(11); // this.getInfoSuccess(11);
}, },
getInfo:function () { validate:function () {
var method = "/v1/point/search"; var method = "/v1/point/search";
var parameter = { var parameter = {
custom_id:{"fieldName":"","fieldValue":""} custom_id:"{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}"
};
saas.saasHttpRequest(method,parameter,this.validateSuccess,this.validateError);
},
validateSuccess:function (data) {
if (data.code == "S001"){
var result = data.result;
if (result.length > 0){
var pointName = result[0].pointName;
var id = result[0].id;
main.getInfo(id);
}
}
},
validateError:function (error) {
},
getInfo:function (id) {
var method = "/v1/point/getPointById";
var parameter = {
pointId:id,
needExtCols:true
}; };
saas.saasHttpRequest(method,parameter,this.getInfoSuccess,this.getInfoError); saas.saasHttpRequest(method,parameter,this.getInfoSuccess,this.getInfoError);
}, },
getInfoSuccess:function (data) { getInfoSuccess:function (data) {
var lonlat = {x:120.42995, y:36.131393}; // var lonlat = {x:120.42995, y:36.131393};
var po = latLonToMeters(lonlat); // var po = latLonToMeters(lonlat);
this.addMarker(po.x, po.y,1, "src/image/icon.png"); // main.addMarker(po.x, po.y,1, "src/image/icon.png");
this.map.setCenter(new SuperMap.LonLat(po.x, po.y), 5); // main.map.setCenter(new SuperMap.LonLat(po.x, po.y), 5);
if (data.code == "S001"){
var result = data.result;
main.addMarker(result.x, result.y,result.id, "src/image/icon.png");
main.map.setCenter(new SuperMap.LonLat(result.x, result.y), 5);
}
}, },
getInfoError:function (error) { getInfoError:function (error) {
...@@ -101,8 +128,8 @@ var main = { ...@@ -101,8 +128,8 @@ var main = {
//注销控件 //注销控件
// main.dragFeature.deactivate(); // main.dragFeature.deactivate();
main.drawPoint.deactivate(); main.drawPoint.deactivate();
var point = this.pointFeature.geometry.getCentroid(); // var point = this.pointFeature.geometry.getCentroid();
console.log(point.x+","+point.y); // console.log(point.x+","+point.y);
} }
}, },
addMarker: function (pointX,pointY,code,iconPath) { addMarker: function (pointX,pointY,code,iconPath) {
...@@ -121,19 +148,32 @@ var main = { ...@@ -121,19 +148,32 @@ var main = {
graphicWidth:21, graphicWidth:21,
graphicHeight:30 graphicHeight:30
}; };
this.currentPoint = new SuperMap.Feature.Vector(geometry,{pointId:code},style); this.currentPoint = new SuperMap.Feature.Vector(geometry,{id:code},style);
this.vectorLayer.addFeatures(this.currentPoint); this.vectorLayer.addFeatures(this.currentPoint);
}, },
getUpdate:function () { updateReturn:function () {
//跳转修改信息界面 //跳转修改信息界面
window.location.href=""; window.location.href="dataPage.html";
}, },
drawCompleted:function (eventArgs) { drawCompleted:function (eventArgs) {
main.pastPoint = main.currentPoint; main.pastPoint = main.currentPoint;
main.currentPoint = eventArgs.feature; main.currentPoint = eventArgs.feature;
main.vectorLayer.removeAllFeatures(); main.vectorLayer.removeAllFeatures();
main.vectorLayer.addFeatures(main.currentPoint); main.vectorLayer.addFeatures(main.currentPoint);
var geometry = eventArgs.feature.geometry; var geometry = eventArgs.feature.geometry.getCentroid();
main.updatePoint(geometry.x,geometry.y);
},
updatePoint: function (x,y) {
var method = "/point/updatePoint";
var parameter = {
custom_id:"{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}",
infos:"{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}",
x:x,
y:y,
coord_type:"gcj02mc"
};
saas.customHttpRequest(method,parameter,this.getInfoSuccess,this.getInfoError);
} }
} }
var saas = { var saas = {
url: "http://saasapi.dituhui.com", // url: "http://saasapi.dituhui.com",
ak:"", url: "http://114.55.43.0:16907",
customUrl:"http://localhost:8080",
// ak:"ee824a89bb2b4c7cb74399bf9d5165bc",
ak:"30bdc45ee00940cda7917d134fdb1523",
saasHttpRequest: function (method, parameter, successComplate, errorComplate) { saasHttpRequest: function (method, parameter, successComplate, errorComplate) {
if(parameter){ if(parameter){
parameter.ak = saas.ak; parameter.ak = saas.ak;
...@@ -17,5 +20,22 @@ var saas = { ...@@ -17,5 +20,22 @@ var saas = {
error: errorComplate, error: errorComplate,
}; };
$.ajax(config); $.ajax(config);
},
customHttpRequest: function (method, parameter, successComplate, errorComplate) {
if(parameter){
parameter.ak = saas.ak;
}else{
parameter = {ak:saas.ak};
}
var config = {
url:saas.customUrl + method,
data:parameter,
dataType:"json",
type: "POST",
timeout: 90000,
success: successComplate,
error: errorComplate,
};
$.ajax(config);
} }
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!