Skip to content

Commit 6c11161

Browse files
committed
修改alert的样式
1 parent cbceebc commit 6c11161

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1120
-142
lines changed

examples/classic/OGC_GeoJSON.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<script type="text/javascript" exclude="iclient-classic" include="OSMBuildings-SuperMap"
1111
src="../../dist/include-classic.js"></script>
1212
<script type="text/javascript">
13-
var map, layer, osm, vLayer,
13+
var map, layer,vLayer,
1414
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
1515
url = host + "/iserver/services/map-world/rest/maps/World";
1616
//初始化地图

examples/classic/OGC_kml.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
<style type="text/css">
66
.editPane {
77
position: absolute;
8-
right: 10px;
8+
right: 50px;
99
top: 10px;
1010
text-align: center;
1111
background: #FFF;
1212
z-index: 1000;
13-
width: 200px;
1413
display: inline-block;
1514

1615
}

examples/classic/OGC_queryByWFS.html

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<style type="text/css">
77
.editPane {
88
position: absolute;
9-
right: 10px;
9+
right: 50px;
1010
top: 10px;
1111
text-align: center;
1212
background: #FFF;
@@ -32,7 +32,7 @@ <h5 class='panel-title text-center'>WFS 查询</h5>
3232
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
3333
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
3434
<script type="text/javascript">
35-
var map, layer, vectorLayer, vectorLayer, vector_style, vector_style_select, myFilter, drawings = null, draw = null,
35+
var map, layer, vectorLayer, vectorLayer, vector_style, vector_style_select, myFilter, drawings = null, draw = null,alertDiv,
3636
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
3737
url = host + "/iserver/services/map-world/rest/maps/World",
3838
url2 = host + "/iserver/services/data-world/wfs100";
@@ -46,7 +46,7 @@ <h5 class='panel-title text-center'>WFS 查询</h5>
4646
enableKinetic: true
4747
}
4848
})]
49-
});
49+
},notice());
5050

5151
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
5252
transparent: true,
@@ -153,6 +153,36 @@ <h5 class='panel-title text-center'>WFS 查询</h5>
153153
vectorLayer.refresh({force: true});
154154
vectorLayer.filter = myFilter;
155155
draw.deactivate();
156+
clearAlert();
157+
}
158+
159+
function notice() {
160+
showAlert("点击右侧按钮,绘制多边形");
161+
}
162+
163+
//弹出提示框
164+
function showAlert(msg, className) {
165+
if (className === null || typeof (className) === 'undefined') {
166+
className = "alert-success";
167+
}
168+
className = className.toString();
169+
if (alertDiv) {
170+
$(alertDiv).remove();
171+
}
172+
if (!$('#msg_container')[0]) {
173+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
174+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:300px;display: none;opacity: 0.9;text-align: center;'>" +
175+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
176+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
177+
$('body').append(alertDiv)
178+
}
179+
$('#msg_container').addClass(className);
180+
$('#msg_container').slideDown(300);
181+
$('#msg').html(msg);
182+
}
183+
//clear alert
184+
function clearAlert() {
185+
$('#msg_container').hide();
156186
}
157187
</script>
158188
</body>

examples/classic/controler_areaMeasure.html

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h5 class='panel-title text-center'>面积量算</h5>
3232
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
3333
<script type="text/javascript">
3434
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
35-
var map, layer, drawPolygon, polygonLayer;
35+
var map, layer, drawPolygon, polygonLayer,alertDiv;
3636
style = {
3737
strokeColor: "#304DBE",
3838
strokeWidth: 2,
@@ -73,6 +73,7 @@ <h5 class='panel-title text-center'>面积量算</h5>
7373
}
7474

7575
function areaMeasure(){
76+
clearAlert();
7677
clearFeatures();
7778
drawPolygon.activate();
7879
}
@@ -99,13 +100,37 @@ <h5 class='panel-title text-center'>面积量算</h5>
99100
function measureCompleted(measureEventArgs) {
100101
var area = measureEventArgs.result.area,
101102
unit = measureEventArgs.result.unit;
102-
alert("量算结果:"+ area + "平方米");
103+
showAlert("量算结果:"+ area + "平方米");
103104
}
104105
//移除图层要素
105106
function clearFeatures(){
106107
polygonLayer.removeAllFeatures();
107108
}
108-
</script>
109109

110+
//弹出提示框
111+
function showAlert(msg, className) {
112+
if (className === null || typeof (className) === 'undefined') {
113+
className = "alert-success";
114+
}
115+
className = className.toString();
116+
if (alertDiv) {
117+
$(alertDiv).remove();
118+
}
119+
if (!$('#msg_container')[0]) {
120+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
121+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:300px;display: none;opacity: 0.9;text-align: center;'>" +
122+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
123+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
124+
$('body').append(alertDiv)
125+
}
126+
$('#msg_container').addClass(className);
127+
$('#msg_container').slideDown(300);
128+
$('#msg').html(msg);
129+
}
130+
//clear alert
131+
function clearAlert() {
132+
$('#msg_container').hide();
133+
}
134+
</script>
110135
</body>
111136
</html>

examples/classic/controler_distanceMeasure.html

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h5 class='panel-title text-center'>距离量算</h5>
3131
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
3232
<script type="text/javascript">
3333
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
34-
var map, local, layer, drawLine, lineLayer,
34+
var map,layer, drawLine, lineLayer,alertDiv,
3535
style = {
3636
strokeColor: "#304DBE",
3737
strokeWidth: 2,
@@ -79,6 +79,7 @@ <h5 class='panel-title text-center'>距离量算</h5>
7979
map.setCenter(new SuperMap.LonLat(0, 0), 1.5);
8080
}
8181
function distanceMeasure() {
82+
clearAlert();
8283
clearFeatures();
8384
drawLine.activate();
8485
}
@@ -104,13 +105,38 @@ <h5 class='panel-title text-center'>距离量算</h5>
104105
function measureCompleted(measureEventArgs) {
105106
var distance = measureEventArgs.result.distance;
106107
var unit = measureEventArgs.result.unit;
107-
alert("量算结果:" + distance + "米");
108+
showAlert("量算结果:" + distance + "米");
108109
}
109110

110111
//移除图层要素
111112
function clearFeatures() {
112113
lineLayer.removeAllFeatures();
113114
}
115+
//弹出提示框
116+
function showAlert(msg, className) {
117+
if (className === null || typeof (className) === 'undefined') {
118+
className = "alert-success";
119+
}
120+
className = className.toString();
121+
if (alertDiv) {
122+
$(alertDiv).remove();
123+
}
124+
if (!$('#msg_container')[0]) {
125+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
126+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:300px;display: none;opacity: 0.9;text-align: center;'>" +
127+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
128+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
129+
$('body').append(alertDiv)
130+
}
131+
$('#msg_container').addClass(className);
132+
$('#msg_container').slideDown(300);
133+
$('#msg').html(msg);
134+
}
135+
//clear alert
136+
function clearAlert() {
137+
$('#msg_container').hide();
138+
}
139+
114140
</script>
115141
</body>
116142
</html>

examples/classic/controler_featureSnap.html

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h5 class='panel-title text-center'>要素编辑</h5>
3434
<script type="text/javascript">
3535
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
3636
var map, layer, vector, modifyFeature, snapState = true, dataAdded = false,
37-
switchSnap,
37+
switchSnap,alertDiv,
3838
snap01,
3939
url = host + "/iserver/services/map-world/rest/maps/World";
4040
//新建矢量图层
@@ -100,6 +100,7 @@ <h5 class='panel-title text-center'>要素编辑</h5>
100100
//移除图层要素
101101
function clearFeatures() {
102102
deactiveAll();
103+
clearAlert();
103104
dataAdded = false;
104105
vector.removeAllFeatures();
105106
}
@@ -139,10 +140,35 @@ <h5 class='panel-title text-center'>要素编辑</h5>
139140

140141
dataAdded = true;
141142
} else {
142-
alert("数据已加载。");
143+
showAlert("数据已加载。");
143144
}
144145
edit_feature();
145146
}
147+
//弹出提示框
148+
function showAlert(msg, className) {
149+
if (className === null || typeof (className) === 'undefined') {
150+
className = "alert-success";
151+
}
152+
className = className.toString();
153+
if (alertDiv) {
154+
$(alertDiv).remove();
155+
}
156+
if (!$('#msg_container')[0]) {
157+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
158+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:260px;display: none;opacity: 0.9;'>" +
159+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
160+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
161+
$('body').append(alertDiv)
162+
}
163+
$('#msg_container').addClass(className);
164+
$('#msg_container').slideDown(300);
165+
$('#msg').html(msg);
166+
}
167+
//clear alert
168+
function clearAlert() {
169+
$('#msg_container').hide();
170+
}
171+
146172
</script>
147173
</body>
148174
</html>

examples/classic/controler_geolocate.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h5 class='panel-title text-center'>Geolocate</h5>
3232
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
3333
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
3434
<script type="text/javascript">
35-
var map, layer, positionLayer,geolocate,
35+
var map, layer, positionLayer,geolocate,alertDiv,
3636
host = window.isLocal ? window.server : "http://117.122.248.69:8090";
3737
url = host + "/iserver/services/map-china400/rest/maps/China";
3838
map = new SuperMap.Map("map", {
@@ -93,8 +93,29 @@ <h5 class='panel-title text-center'>Geolocate</h5>
9393
map.setCenter(lonLat);
9494
}
9595
function getGeolocationFailed(event) {
96-
alert("您当前使用的浏览器不支持地图定位服务");
96+
showAlert("您当前使用的浏览器不支持地图定位服务",'alert-danger');
9797
}
98+
//弹出提示框
99+
function showAlert(msg, className) {
100+
if (className === null || typeof (className) === 'undefined') {
101+
className = "alert-success";
102+
}
103+
className = className.toString();
104+
if (alertDiv) {
105+
$(alertDiv).remove();
106+
}
107+
if (!$('#msg_container')[0]) {
108+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
109+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:260px;display: none;opacity: 0.9;'>" +
110+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
111+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
112+
$('body').append(alertDiv)
113+
}
114+
$('#msg_container').addClass(className);
115+
$('#msg_container').slideDown(300);
116+
$('#msg').html(msg);
117+
}
118+
98119
</script>
99120
</body>
100121
</html>

examples/classic/controler_navigation.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
</head>
77
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
88
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
9+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
910
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
1011
<script type="text/javascript">
1112
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
12-
var map, layerWorld;
13+
var map, layerWorld,alertDiv;
1314
var url = host + "/iserver/services/map-world/rest/maps/World";
1415

1516
map = new SuperMap.Map("map", {
@@ -30,7 +31,7 @@
3031
})], allOverlays: true
3132
},notice());
3233
function notice() {
33-
alert("按住alt键同时拖动鼠标左键进行缩放");
34+
showAlert("按住alt键同时拖动鼠标左键进行缩放");
3435
}
3536
layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
3637
transparent: true,
@@ -42,6 +43,26 @@
4243
map.addLayer(layerWorld);
4344
map.setCenter(new SuperMap.LonLat(0, 0), 2);
4445
}
46+
//弹出提示框
47+
function showAlert(msg, className) {
48+
if (className === null || typeof (className) === 'undefined') {
49+
className = "alert-success";
50+
}
51+
className = className.toString();
52+
if (alertDiv) {
53+
$(alertDiv).remove();
54+
}
55+
if (!$('#msg_container')[0]) {
56+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
57+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:260px;display: none;opacity: 0.9;'>" +
58+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
59+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
60+
$('body').append(alertDiv)
61+
}
62+
$('#msg_container').addClass(className);
63+
$('#msg_container').slideDown(300);
64+
$('#msg').html(msg);
65+
}
4566
</script>
4667
</body>
4768
</html>

examples/classic/controler_zoomBox.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
</head>
77
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
88
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
9+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
910
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
1011
<script type="text/javascript">
1112
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
12-
var map, layerWorld;
13+
var map, layerWorld, alertDiv;
1314
var url = host + "/iserver/services/map-world/rest/maps/World";
1415
map = new SuperMap.Map("map", {
1516
controls: [
1617
new SuperMap.Control.Navigation()]
17-
},notice());
18+
}, notice());
1819
function notice() {
19-
alert("按住shift键同时拖动鼠标左键进行缩放");
20+
showAlert("按住shift键同时拖动鼠标左键进行缩放");
2021
}
2122
//初始化拉框缩放控件类
2223
zoombox = new SuperMap.Control.ZoomBox({
@@ -39,6 +40,26 @@
3940
map.setCenter(new SuperMap.LonLat(0, 0), 1);
4041
}
4142

43+
//弹出提示框
44+
function showAlert(msg, className) {
45+
if (className === null || typeof (className) === 'undefined') {
46+
className = "alert-success";
47+
}
48+
className = className.toString();
49+
if (alertDiv) {
50+
$(alertDiv).remove();
51+
}
52+
if (!$('#msg_container')[0]) {
53+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
54+
"style='z-index:999999;position: absolute;top: 20px;left: 40%;width:260px;display: none;opacity: 0.9;'>" +
55+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button>" +
56+
"<strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
57+
$('body').append(alertDiv)
58+
}
59+
$('#msg_container').addClass(className);
60+
$('#msg_container').slideDown(300);
61+
$('#msg').html(msg);
62+
}
4263
</script>
4364
</body>
4465
</html>
-6.71 KB
Loading

0 commit comments

Comments
 (0)