-
Notifications
You must be signed in to change notification settings - Fork 0
/
business-rental.html
370 lines (360 loc) · 10.8 KB
/
business-rental.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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>我要出租申请</title>
<link href="css/app.css" rel="stylesheet"/>
<link href="css/mui.listpicker.css" rel="stylesheet" />
<script src="js/mui.min.js"></script>
<style type="text/css">
.ui-page,html,body{
height:100%;
}
.vip-list li a{
color: #666;
padding:5px 25px 5px 15px;
display:block;
overflow:hidden;
}
.vip-list li a .f-l{
float:left;
}
.vip-list li .f-r{
float:right;
}
.vip-list li .f-r img{
float:left;
-webkit-border-radius:50%;
border-radius:50%;
}
.vip-list li.input-in{
line-height:30px;
background:#fff;
color:#666;
font-size:14px;
position:relative;
margin:10px 0 0 0;
}
.vip-list li a:after{
float:right;
font-size:12px;
color:#D9D8D8;
position:absolute;
right:8px;
top:5px;
}
.vip-list li a.exit{
text-align:center;
font-size:16px;
background:#FF5053;
color:#fff;
margin:0 10px
}
.vip-list li.certification{
padding:5px 15px;
background:none;
}
.mui-table-view-radio li{
padding:5px 15px;
}
.vip-list li.certification a,.from-btn{
padding:0 10px;
background:#fff;
display:block;
height:40px;
line-height:40px;
color:#fff;
font-size:16px;
border-radius:3px;
-webkit-border-radius:3px;
text-align:center;
background:#393767;
}
.from-btn{
margin:15px 10px;
}
.vip-list li .icon-radio-push:before{
display:none;
}
.vip-list li.mui-selected .icon-radio-push:before{
display:block;
position:absolute;
right:15px;
top:5px;
color:#393767;
}
.mui-views,.mui-view,.mui-pages,.mui-page,.mui-page-content {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: #efeff4;
}
.mui-pages {
top: 44px;
height: auto;
}
.content{
height: 100%;
}
.vip-list li.input-in:first-child{
margin:0
}
.mui-table-view-cell .mui-active{
background:#E7E7E8;
}
.vip-list li .input{
background:none;
width:100%;
border:none;
height:40px;
text-indent:15px;
}
.vip-list li.input-in{
padding:0 15px;
line-height: 40px;
}
.vip-list li.input-in .input{
text-align: right;
}
.c3{
color:#333;
}
.menuSlide{
top:44px;
}
.vip-list li.input-in .textarea{
width:100%;
border:none;
height:70px;
resize: none;
font-size:14px
}
.vip-list li.input-in .pic{
display:block;
color:#666;
font-size:14px;
text-align:right;
}
.pImg ul,.pImg{
content:"";display:table;clear:both;font-size:1px;line-height:0;height:0
}
.pImg ul li{
width:60px;
height:60px;
float:left;
text-align:center;
margin-left:10px;
margin-top:0;
margin-bottom:10px;
}
.pImg ul{
margin-left:-10px;
}
.pImg ul li img{
width:60px;
height:60px;
}
.pImg ul li{
position:relative;
}
.pImg ul li .icon-del{
position:absolute;
top:-6px;
right:-6px;
font-size:13px;
color:red;
height:16px;
vertical-align:top;
background:#fff;
border-radius:18px;
}
.pImg ul li .icon-del:after{
vertical-align:top;
position:relative;
top:8px
}
.icon-add:after{
font-size:14px;
position:relative;
top:-1px;
margin-left:3px;;
}
</style>
</head>
<body>
<div class="ui-page" id="ui-page">
<header class="ui-bar jy-bar" id="header">
<a href="javascript:;" class="icon-back icon" id="back"></a>
<div class="ui-title">出租申请</div>
<a href="javascript:;" class="icon-categorys icon" id="categorys"></a>
</header>
<section class="content">
<div class="vip-list">
<ul>
<li class="input-in"><span class="f-l">姓名</span><span class="f-r"><input type="text" class="input" id="uname" placeholder="输入姓名"/></span></li>
<li class="input-in"><span class="f-l">手机</span><span class="f-r"><input type="text" class="input" id="contacts" placeholder="输入手机"/></span></li>
<li class="input-in"><span class="f-l">邮箱</span><span class="f-r"><input type="text" class="input" id="email" placeholder="输入邮箱"/></span></li>
<li class="input-in"><span class="f-l">用途</span><span class="f-r"><input type="text" class="input" id="Application" placeholder="输入用途"/></span></li>
<li class="input-in"><span class="f-l">面积需求</span><span class="f-r"><input type="number" class="input" id="gname" placeholder="输入面积需求"/></span></li>
<li class="input-in"><span class="f-l">租金预算</span><span class="f-r"><input type="number" class="input" id="zname" placeholder="输入租金预算"/></span></li>
<li class="input-in"><textarea class="textarea" id="Position" placeholder="输入位置和描述"></textarea></li>
<li class="input-in">
<span class="f-l">图片</span>
<span class="f-r icon-add icon" id="updataPic">添加图片</span>
<div class="pImg" id="pimgList">
<ul>
</ul>
</div>
</li>
<li class="certification" style="margin-top:10px;"><a href="javascript:;" id="submitC" class="btn">提交</a></li>
</ul>
</div>
</section>
</div>
<script src="js/config.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">
(function($, doc) {
$.init({
statusBarBackground:'#393767'
});
//初始化单页的区域滚动
$('.mui-scroll-wrapper').scroll();
var submitC=doc.getElementById("submitC");
var uname=doc.getElementById("uname");
var contacts=doc.getElementById("contacts");
var email=doc.getElementById("email");
var gname=doc.getElementById("gname");
var zname=doc.getElementById("zname");
var Position=doc.getElementById("Position");
var Application=doc.getElementById("Application");
$.plusReady(function() {
plus.navigator.setStatusBarStyle('UIStatusBarStyleBlackTranslucent');
var stateDate = app.getStateDate(),dataArr={};
var currentWs=plus.webview.currentWebview();
if(app.has_login()){
uname.value=stateDate['user_name'];
contacts.value=stateDate['contacts'];
email.value=stateDate['emial'];
}
//拍照
function getImage() {
var cmr = plus.camera.getCamera();
cmr.captureImage( function (p) {
plus.io.resolveLocalFileSystemURL( p, function ( entry ) {
var localurl = entry.toLocalURL();
convertImgToBase64(localurl)
});
});
}
//相册选取
function galleryImgs(){
plus.navigator.setStatusBarStyle('UIStatusBarStyleDefault');
plus.gallery.pick( function(e){
plus.navigator.setStatusBarStyle('UIStatusBarStyleBlackTranslucent');
for(var i in e.files){
convertImgToBase64(e.files[i])
}
}, function ( e ) {
plus.navigator.setStatusBarStyle('UIStatusBarStyleBlackTranslucent');
},{filter:"image",multiple:true});
}
//图片转为base64;
var ImgResult=[],index=0;
function convertImgToBase64(path){
index=0;
var pimgList=doc.getElementById("pimgList");
var imgUl=pimgList.querySelector("ul");
var html='';
var li = doc.createElement('li');
var img = new Image();
// var w=window.screen.availWidth;
// var h=window.screen.availHeight;
plus.zip.compressImage({
src:path,
dst:path,
quality:20,
overwrite:true
},
function(imgObj) {
img.src = imgObj.target;
html+='<img src="'+imgObj.target+'" /><span class="icon icon-del"></span>';
li.setAttribute("data-index",index++);
li.innerHTML=html;
imgUl.appendChild(li);
img.onload = function () {
var that = this;
//生成canvas
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.height =imgObj.height;
canvas.width = imgObj.width;
ctx.drawImage(that, 0, 0,imgObj.width,imgObj.height);
var base64 = canvas.toDataURL('image/jpeg', 1);
var result=base64.split(",");
ImgResult.push(result[1]);
}
},function(error) {
plus.nativeUI.alert("Compress error!");
});
}
doc.getElementById("updataPic").addEventListener("tap",function(e) {
var a = [{
title: "拍照"
}, {
title: "相册选择"
}];
plus.nativeUI.actionSheet({
cancel: "取消",
buttons: a
}, function(b) {
switch (b.index) {
case 0:
break;
case 1:
getImage();
break;
case 2:
galleryImgs();
break;
default:
break
}
})
});
$("#pimgList").on("tap",'.icon-del',function(){
var parentNode=this.parentNode;
var index=parseInt(parentNode.getAttribute("data-index"));
ImgResult.splice(index,1);
document.getElementById("pimgList").querySelector('ul').removeChild(parentNode);
})
submitC.addEventListener("tap",function(){
dataArr.user_id=stateDate['id'];
dataArr.type="post";
dataArr.user_name=uname.value;
dataArr.contacts=contacts.value;
dataArr.email=email.value;
dataArr.area=gname.value;
dataArr.price=zname.value;
dataArr.position=Position.value;
dataArr.application=Application.value;
dataArr.img_list=ImgResult.join();
J.dataAjax(CONFING.Interface.addCzsq,dataArr,function(data){
if(data.type=='1'){
plus.nativeUI.alert(data.msg);
currentWs.reload(true);//重新加载当前窗口html
}else{
plus.nativeUI.toast(data.msg);
}
});
})
});
}(mui, document));
</script>
</body>
</html>