peridata.html
14.2 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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<link rel="stylesheet" type="text/css" href="css/weui.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/tanchu.css" />
<script type="text/javascript">
// $(function () {
// $('#beginTime').date();
// $('#endTime').date({ theme: "datetime" });
// });
</script>
<title>个人中心</title>
<style>
.perbut{
position: fixed;
bottom: 0;
width:100%;
}
.perp .specp img{
width: 0.5rem;
}
.txt,#input_file{
width: 100%;
height: 100%;
opacity: 0;
position: absolute;
left: 0;
top: 0;
}
.specp{
position: relative;
}
</style>
</head>
<body style="background-color:#fff;">
<div class="perheader center">
<div class="left perback">
<a href="#" onClick="javascript:history.back(-1);">
<img src="images/care_03.jpg" />
</a>
</div>
<div class="headertext">个人资料</div>
</div>
<div class="perpart1">
<div id="datePlugin"></div>
<div class="perp" id="square">
<span>头像</span>
<a href="#">
<span class="right">
<img src="images/pergo_03.jpg" />
</span>
<span class="specp">
<form id="uploadimage">
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" onchange="imgPreview(this)">
</form>
<img src="images/cali_05.jpg" id="preview"/>
</span>
</a>
</div>
<div class="perp">
<span>姓名</span>
<span class="right">
<input type="text" placeholder="请输入姓名" id="p_name" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="infup">
<span style="color:#999797">性别 </span>
<span class="right sex">
<input type="radio" id="male" name="sex" />
<label for="male">男</label>
<input type="radio" id="female" name="sex" />
<label for="female">女</label>
</span>
</div>
<div class="perp">
<span>手机</span>
<span class="right phonesp" id="phonesp">18611022356
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>生日</span>
<span class="right">
<input id="beginTime" placeholder="1985-12-02" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>身份证号</span>
<span class="right">
<input type="text" placeholder="输入身份证号" maxlength="18" id="id_card" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>身高</span>
<span class="right">
<input type="text" class="select-value9" id="person_height" placeholder="174cm" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>体重</span>
<span class="right">
<input type="text" class="select-value4" id="weight" placeholder="79.0kg" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>婚姻状况</span>
<span class="right">
<input type="text" class="select-value12" id="marry" placeholder="已婚" />
<img src="images/pergo_03.jpg" />
<!--<a href="javascript:;" class="weui-btn weui-btn_default" id="showPicker">单列选择器</a>-->
</span>
</div>
<div class="perp culture_btn">
<span>文化程度</span>
<span class="right">
<input type="text" class="select-value13" id="culture_name" placeholder="研究生以上" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp medical_btn">
<span>职业</span>
<span class="right">
<input type="text" class="select-value14" id="job" placeholder="国家公务员" />
<img src="images/pergo_03.jpg" />
</span>
</div>
<div class="perp">
<span>医保类型</span>
<span class="right">
<input type="text" class="select-value15" id="medical_name" placeholder="城镇居民医保" />
<img src="images/pergo_03.jpg" />
</span>
</div>
</div>
<div>
<button type="button" class="perbut" />保存</div>
<div class="mPicker hide">
<div class="mPicker-mask hide"></div>
</div>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="js/common.js"/>
<script type="text/javascript" src="js/weui.js"/>
<script type="text/javascript" src="js/date.js"></script>
<script type="text/javascript" src="js/iscroll.js"></script>
<script src="js/base.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/per.js"></script>
<script type="text/javascript">
$(document).ready(function () {
getMedical()
getCulture()
//上传图片
// var obj = document.getElementById('#input_file')
// imgPreview(obj)
// 获取个人信息
getinfo()
})
// 获取个人信息
function getinfo(){
$.ajax({
type:"POST",
url: baseUrl+"user/index/getUserinfo",
dataType:"json",
data:{
DeviceType:"1",
token:"1",
rid:"0"
},
success:function (res) {
console.log(res)
var data = res.data;
$('#p_name').val('')
$('#p_name').val(data.name)
if (data.sex==1){
$('#male').attr('checked','true')
}else{
$('#female').attr('checked','true')
}
$('#phonesp').html(`${data.mobile}
<img src="images/pergo_03.jpg" />`)
$('#beginTime').val(data.birthday)
$('#id_card').val(data.idcard)
$('#person_height').val(data.height)
if (data.marry==1){
$('#marry').val(`已婚`)
}
$('#culture_name').val(data.culture_name)
$('#job').val(data.job)
$('#medical_name').val(data.medical_name)
}
})
}
function imgPreview(fileDom) {
//判断是否支持FileReader
if(window.FileReader) {
var reader = new FileReader();
} else {
alert("您的设备不支持图片预览功能,如需该功能请升级您的设备!");
}
//获取文件
var file = fileDom.files[0];
console.log(file)
var imageType = /^image\//;
//是否是图片
if(!imageType.test(file.type)) {
alert("请选择图片!");
return;
}
//读取完成
reader.onload = function(e) {
//获取图片dom
var img = document.getElementById("preview");
//图片路径设置为读取的图片
img.src = e.target.result;
var formData = new FormData(document.getElementById('uploadimage'));
// var formData = $('#uploadimage').submit();
//
// formData.append('file',file ); //添加图片信息的参数
// formData.append('fileType','image' ); //添加图片信息的参数
$.ajax({
url: baseUrl+'user/index/upAvatar',
type: 'POST',
cache: false, //上传文件不需要缓存
data:formData,
headers:{
DeviceType:"1",
token:"1",
},
dataType: 'json',
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function(data) {
alert('上传成功')
},
error: function(data) {
// alert("上传失败");
}
})
};
reader.readAsDataURL(file);
}
function up_pic(img) {
// var formData = new FormData();
// var file=$('#input_file').files[0];
formData.append('file',file ); //添加图片信息的参数
formData.append('sizeid', 123); //添加其他参数
$.ajax({
url: baseUrl+'user/index/upAvatar',
type: 'POST',
cache: false, //上传文件不需要缓存
data:formData,
headers:{
DeviceType:"1",
token:"1",
},
dataType: 'json',
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function(data) {
alert('上传成功')
},
error: function(data) {
// alert("上传失败");
}
})
}
var level13;
var level14;
//获取文化程度接口
function getCulture(){
$.ajax({
type:"POST",
url: baseUrl+'user/index/getCulture',
dataType:"json",
data:{
DeviceType:"1",
token:"1",
},
success:function (res) {
level13 = []
console.log(res.data)
// var temp = [1,2,3]
for ( key in res.data){
level13.push({
"name": res.data[key].culture_name,
"value": res.data[key].id,
})
}
console.log(level13)
/**文化程度**/
var method3 = $('.select-value13').mPicker({
level: 1,
dataJson: level13,
Linkage: false,
rows: 6,
idDefault: true,
header: '<div class="mPicker-header">文化程度</div>',
confirm: function() {
//console.info($('.select-value3').data('id1'));
},
cancel: function() {
//console.info($('.select-value3').data('id1'));
}
})
},
})
}
//获取文化程度接口
function getMedical(){
$.ajax({
type:"POST",
url: baseUrl+'user/index/getMedical',
dataType:"json",
data:{
DeviceType:"1",
token:"1",
},
success:function (res) {
level14 = []
console.log(res.data)
// var temp = [1,2,3]
for ( key in res.data){
level14.push({
"name": res.data[key].medical_name,
"value": res.data[key].id,
})
}
console.log(level14)
/**文化程度**/
var method3 = $('.select-value14').mPicker({
level: 1,
dataJson: level14,
Linkage: false,
rows: 6,
idDefault: true,
header: '<div class="mPicker-header">文化程度</div>',
confirm: function() {
//console.info($('.select-value3').data('id1'));
},
cancel: function() {
//console.info($('.select-value3').data('id1'));
}
})
},
})
}
/**医保类型**/
var method3 = $('.select-value15').mPicker({
level: 1,
dataJson: level15,
Linkage: false,
rows: 6,
idDefault: true,
header: '<div class="mPicker-header">医保类型</div>',
confirm: function() {
//console.info($('.select-value3').data('id1'));
},
cancel: function() {
//console.info($('.select-value3').data('id1'));
}
})
</script>
</body>