-
Notifications
You must be signed in to change notification settings - Fork 1
/
lay_index.html
264 lines (260 loc) · 10 KB
/
lay_index.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>房价估计</title>
<script type="text/javascript" src="layui/layui.all.js"></script>
<!--<script type="text/javascript" src="js/vendor/jquery-2.2.4.min.js"></script>-->
<link rel="stylesheet" type="text/css" href="./layui/css/layui.css">
</head>
<body style="background-image: url(bg.jpg)">
<div class="layui-col-md8 layui-col-md-offset2">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
<legend style="color: #dddddd; font-size:45px">房价估计</legend>
</fieldset>
<form class="layui-form" action="">
<div class="content">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card layui-form-item" style="opacity: 0.8;">
<div class="layui-card-header" style="text-shadow:2px 2px 3px #333333;color: #ffffff;background-color:#008888;font-size: 30px;">请填写房屋信息</div>
<div class="layui-card-body" style="padding: 15px;">
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">城市</label>
<div class="layui-input-inline">
<select name="city" lay-verify="">
<option value="北京市">北京市</option>
<option value="武汉市">武汉市</option>
<option value="上海市">上海市</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">区(县)</label>
<div class="layui-input-inline">
<select name="district" lay-verify="">
<option value="昌平区">昌平区</option>
<option value="朝阳区">朝阳区</option>
<option value="大兴区">大兴区</option>
<option value="东城区">东城区</option>
<option value="房山区">房山区</option>
<option value="丰台区">丰台区</option>
<option value="海淀区">海淀区</option>
<option value="怀柔区">怀柔区</option>
<option value="门头沟区">门头沟区</option>
<option value="密云区">密云区</option>
<option value="平谷区">平谷区</option>
<option value="石景山区">石景山区</option>
<option value="顺义区">顺义区</option>
<option value="通州区">通州区</option>
<option value="西城区">西城区</option>
<option value="延庆区">延庆区</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">小区</label>
<div class="layui-input-inline">
<input type="text" name="community" required lay-verify="required" placeholder="输入小区" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">面积</label>
<div class="layui-input-inline">
<input type="text" name="square" required lay-verify="required" placeholder="输入面积(平方米)" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">建筑年代</label>
<div class="layui-input-inline">
<select name="ctime" lay-verify="">
<option value="1975">70年代</option>
<option value="1985">80年代</option>
<option value="1995">90年代</option>
<option value="2005">00年代</option>
<option value="2015">10年代</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">装修情况</label>
<div class="layui-input-inline">
<select name="rcondition" lay-verify="">
<option value="1">其他</option>
<option value="2">毛坯房</option>
<option value="3">粗装修</option>
<option value="4">精装修</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">建筑结构</label>
<div class="layui-input-inline">
<select name="struc" lay-verify="">
<option value="1">未知</option>
<option value="2">混合</option>
<option value="3">砖木</option>
<option value="4">砖及混凝土</option>
<option value="5">铁</option>
<option value="6">铁及复合材料</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">户型</label>
<div class="layui-input-inline">
<select name="btype" lay-verify="">
<option value="1">塔楼</option>
<option value="2">平房</option>
<option value="4">板房</option>
<option value="3">混合结构</option>
</select>
</div>
<div class="layui-input-inline">
<select name="living" lay-verify="">
<option value="1">1室</option>
<option value="2">2室</option>
<option value="3">3室</option>
<option value="4">4室</option>
</select>
</div>
<div class="layui-input-inline">
<select name="drawing" lay-verify="">
<option value="1">1厅</option>
<option value="2">2厅</option>
<option value="3">3厅</option>
<option value="4">4厅</option>
</select>
</div>
<div class="layui-input-inline">
<select name="kitchen" lay-verify="">
<option value="0">0厨房</option>
<option value="1">1厨房</option>
<option value="2">2厨房</option>
<option value="3">3厨房</option>
</select>
</div>
<div class="layui-input-inline">
<select name="bath" lay-verify="">
<option value="0">0卫</option>
<option value="1">1卫</option>
<option value="2">2卫</option>
<option value="3">3卫</option>
</select>
</div>
</div>
<!--朝向选项name置空从而不传值-->
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">朝向</label>
<div class="layui-input-inline">
<select name="">
<option value="010">东</option>
<option value="021">南</option>
<option value="0571">西</option>
<option value="0572">北</option>
</select>
</div>
</div>
<!--楼层这块在js里算出一个比率来确定高低-->
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">楼层</label>
<div class="layui-input-inline">
<input type="number" min="1" name="floor" required lay-verify="required" placeholder="输入楼层" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">总楼层</label>
<div class="layui-input-inline">
<input type="number" min="1" name="total_floor" required lay-verify="required" placeholder="输入总楼层"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-pane">
<label class="layui-form-label">房源特色</label>
<div class="layui-input-inline">
<input value="1" type="checkbox" name="five" title="满五">
</div>
<div class="layui-input-inline">
<input value="1" type="checkbox" name="elevator" title="有电梯">
</div>
<div class="layui-input-inline">
<input value="1" type="checkbox" name="subway" title="地铁房">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript">
//Demo
function parseParams(data) {
try {
var tempArr = [];
for (var i in data) {
var key = encodeURIComponent(i);
var value = encodeURIComponent(data[i]);
tempArr.push(key + '=' + value);
}
var urlParamsStr = tempArr.join('&');
return urlParamsStr;
} catch (err) {
return '';
}
}
layui.use(['jquery', 'layer', 'element'], function () {
$ = layui.jquery;
var form = layui.form;
form.render('select');
form.render('checkbox');
//监听提交
form.on('submit(formDemo)', function (data) {
data = data.field;
var floor = data.floor,
total_floor = data.total_floor,
rank = floor / total_floor;
//alert(rank);
//location.href="result.html";
if (floor == 1)
data.floor = 3;
else if (floor == total_floor)
data.floor = 4;
else if (rank > 0.7)
data.floor = 0;
else if (rank < 0.3)
data.floor = 2;
else
data.floor = 1;
delete data.total_floor;
var square = data.square;
data = parseParams(data);
layer.msg("正在估价,请稍候");
$.ajax({
url: "http://10.134.139.149:8124/?" + data,
method: 'get',
success: function (res) {
var averagePrice = res / square;
averagePrice = averagePrice.toFixed(2);
window.open("result.html?" + data + "&totalPrice=" + res +
"&averagePrice=" + averagePrice);
},
error: function () {
layer.msg("错误");
}
})
return false;
});
});
</script>
</body>
</html>