-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleTest.html
151 lines (129 loc) · 4.91 KB
/
ConsoleTest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>模块与包</title>
<link rel="stylesheet" href="http://localhost/arcgis_js_api/library/3.14/3.14/dijit/themes/claro/claro.css">
<script>
var dojoConfig = {
// baseUrl: "js/",
packages: [{
name: "app",
location: "/test"
}]
};
</script>
<!-- <script type="text/javascript" data-dojo-config="async: true" src="http://localhost/arcgis_js_api/library/3.14/3.14/init.js"></script> -->
</head>
<body class="tundra">
<script src="http://localhost/arcgis_js_api/library/3.14/3.14/init.js" data-dojo-config="isDebug: 1, async: 1, parseOnLoad: 1"></script>
<p>
这是一用于基于控制台开发测试的文件。
<div data-dojo-type="dijit/TitlePane" id="test1" title="hello">
<div data-dojo-type="app/js/Test">测试</div>
</div>
</p>
<button id="mybutton" >点击啊</button>
<script>
require([ "dojo/store/Memory","dijit/registry", "dojo/parser","app/js/Test", "dojo/ready"], function (Memory,registry,parser,Test,ready) {
ready(300,function() {
// parser.parse();
// var filterText = registry.byId("test");
var test = new Test();
console.log("t1");
// parser.parse();
// var t= registry.byId("fruit");
// t.set("store",stateStore);
// t.set("searchAtt","name");
// t.startup();
});
// alert("hello");
// var sub=new Substation();
// /sub.startup();
// test.startup();
/* var shape = new Shape();
shape.setColor(0x0000FF);
console.log("形状的颜色为:" + shape.color);
*/
});
</script>
<script>
require(["dojo/aspect","dojo/on","dojo/dom", "dojo/store/Memory","dijit/registry", "dojo/parser"],function(aspect,on,dom,Memory,registry,parser){
parser.parse();
var clicked=false;
console.log("here");
var myButton=dom.byId("mybutton");
var myTitlePane=registry.byId("test1");
on(myButton, "click", function(e) {
var t=registry.byId("fruit");
var myTitlePane=registry.byId("test1");
var subStationList = new Memory();
aspect.after(myTitlePane, "toggle", function() {
if( clicked!=true){
subStationList.setData(initialize());
t.set("store",subStationList);
t.set("searchAtt","LABEL");
t.set("value","");
// initialize();
clicked=true;
}
else
// initialize();
clicked=true;
});
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
// var dArray=new Array();
// dArray.push({name:"1", id:"1"});
// dArray.push({name:"2", id:"2"});
// stateStore.setData(dArray);
// t.set("store",stateStore);
// t.set("searchAtt","name");
// t.set("value","");
});
});
</script>
<script>
function testE(){
alert("test");
}
</script>
<script>
function initialize()
{
require(["esri/request","esri/config"], function (esriRequest,esriConfig) {
var layerUrl = "http://10.50.51.67:6080/arcgis/rest/services/hrb/hrbPipe_2015/MapServer/8/query?where=1%3D1&outFields=OBJECTID%2CREFCOD%2CLABEL&returnGeometry=false&returnIdsOnly=false&orderByFields=REFCOD&returnZ=false&returnM=false&f=json";
esriConfig.defaults.io.corsEnabledServers.push("10.50.51.67");
esriConfig.defaults.io.corsDetection = false;
var layersRequest = esriRequest({
url: layerUrl,
content: {f: "json"},
handleAs: "json",
callbackParamName: "callback"
});
layersRequest.then(
function (response) {
console.log("Success: ", response.features[0].attributes.LABEL);
return response.features;
}, function (error) {
console.log("Error: ", error.message);
});
})
}
</script>
</body>
</html>