weather copy 2.html
5.49 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="../js/jquery-3.4.1.min.js"></script>
<script src="../js/JavaScript.js"></script>
<script src="../js/popupJS.js"></script>
<link rel="stylesheet" href="../css/popupHtml.css">
<!-- import Vue before Element -->
<script src="../js/vue.min.js"></script>
<!-- import JavaScript -->
<!-- <script src="https://unpkg.com/element-ui/lib/index.js"></script> -->
<script src="../js/element.js"></script>
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
<link rel="stylesheet" href="../js/element.css">
<style>
#weather {
width: 100%;
height: 100%;
/* background: url(../img/bg.png) no-repeat center center; */
/* background-color: aliceblue; */
background-size: 100% 100%;
/* display:flex; */
flex-direction: column;
}
.title {
display: block;
height: 30px;
line-height: 30px;
text-align: center;
color: #00EEF6;
font-size: 14px;
font-weight: inherit;
}
.iconfont {
display: inline-block;
font-size: 30px;
padding: 10px 12px;
width: 24px;
height: 24px;
text-align: center;
cursor: default;
}
</style>
</head>
<body marginwidth="0" marginheight="0">
<div id="weather">
<h1 class="title" onmousedown="MouseDown(event)" onmouseup="MouseUp(event)" onmouseout="MouseUp(event)">
天气<i class=" icon-guanbi" onclick="Close()">X</i>
</h1>
<div class="main">
<div class="row">
<el-checkbox v-model="fog.is">雾</el-checkbox>
<el-slider v-model="fog.snowfall" :min="20" @change="fall(fog.snowfall, 'fog')"></el-slider>
</div>
<div class="row">
<el-checkbox v-model="rain.is">雨</el-checkbox>
<el-slider v-model="rain.rainfall" :min="20" @change="fall(rain.rainfall, 'rain')"></el-slider>
</div>
<div class="row">
<el-checkbox v-model="snow.is">雪</el-checkbox>
<el-slider v-model="snow.snowfall" :min="20" @change="fall(snow.snowfall, 'snow')"></el-slider>
</div>
</div>
</div>
</body>
<script>
new Vue({
el: '#weather',
data: function () {
return {
rain: {
rainfall: 20,
is: false,
func: "Command.Execute",
args: [2206, 1],
fallarg: 2206
},
snow: {
snowfall: 20,
is: false,
func: "Command.Execute",
args: [2207, 1],
fallarg: 2200
},
fog: {
snowfall: 80,
is: false,
func: "Command.Execute",
args: [2208, 1],
fallarg: 2204
},
target: {},
}
},
watch: {
"rain.is"(val) {
this.target = {
rain: Object.assign(this.rain, { args: [2206, val ? 1 : 0] })
};
this.eventSky("rain");
},
"snow.is"(val) {
this.target = {
snow: Object.assign(this.snow, { args: [2207, val ? 1 : 0] })
};
this.eventSky("snow");
},
"fog.is"(val) {
this.target = {
fog: Object.assign(this.fog, { args: [2208, val ? 1 : 0] })
};
this.eventSky("fog");
}
},
methods: {
// currency(a, b) {
// maps.sgWorld.Command.Execute(a, b);
// },
eventSky(key) {
let func = this.target[key].func.split("."),
args = this.target[key].args,
a = args[0],
b = args[1];
let sgWorld = this.CreateSGObj();
args.length > 1
? sgWorld[func[0]][func[1]](a, b)
: sgWorld[func[0]][func[1]](a);
this.target[key].callback && this[this.target[key].callback]();
},
fall(v, k) {
this.target = {
[k]: Object.assign(this[k], { args: [this[k].fallarg, v] })
};
this.eventSky(k);
},
CreateSGObj() {
try {
var obj = document.getElementById("SGWorld");
if (obj === null) {
obj = document.createElement('object');
obj.setAttribute("name", "SGWorld");
obj.setAttribute("id", "SGWorld");
obj.style.height = "1px";
obj.style.width = "1px";
//定义TerraExplorer对象
obj.setAttribute("classid", "CLSID:3A4F919C-65A8-11D5-85C1-0001023952C1");
document.body.appendChild(obj);
}
return obj;
}
catch (e) { alert("CreateSGWorld " + e); }
}
}
})
</script>
</html>