作者 wendy0406

王玉琪

... ... @@ -5704,21 +5704,6 @@ var level12 = [{
"name": '已婚',
"value": '2',
},
{
"name": '丧偶',
"value": '3',
},
{
"name": '离异',
"value": '4',
},
{
"name": '其他',
"value": '5',
}];
var level25 = [{
... ...
... ... @@ -74,16 +74,17 @@
<div class="infup">
<span style="color:#999797">性别 </span>
<span class="right sex">
<input type="radio" id="male" name="sex" />
<input type="radio" id="male" value="男" name="sex" />
<label for="male"></label>
<input type="radio" id="female" name="sex" />
<input type="radio" id="female" value="女" name="sex" />
<label for="female"></label>
</span>
</div>
<div class="perp">
<span>手机</span>
<span class="right phonesp" id="phonesp">18611022356
<span class="right">
<input id="phonesp" value="" placeholder="18611022356"/>
<img src="images/pergo_03.jpg" />
</span>
</div>
... ... @@ -158,28 +159,23 @@
<div class="mPicker hide">
<div class="mPicker-mask hide"></div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<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/common.js"s></script>
<script type="text/javascript" src="js/weui.js"></script>
<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 () {
$('#beginTime').date();
$('#endTime').date({ theme: "datetime" });
});
// 获取个人信息
function getinfo(){
$.ajax({
... ... @@ -200,7 +196,7 @@
$('#p_name').val(data.name)
if (data.sex==1){
$('#male').attr('checked','true')
}else{
}else if(data.sex==2){
$('#female').attr('checked','true')
}
$('#phonesp').html(`${data.mobile}
... ... @@ -241,72 +237,27 @@
//图片路径设置为读取的图片
img.src = e.target.result;
var formData = new FormData(document.getElementById('uploadimage'));
// var formData = $('#uploadimage').submit();
//
// formData.append('file',file ); //添加图片信息的参数
// formData.append('fileType','image' ); //添加图片信息的参数
//图片上传
var imgurl = document.getElementById("input_file").value;
var formData = new FormData();
formData.append("file", $("#input_file")[0].files[0]);
$.ajax({
type:"POST",
url: baseUrl+'user/index/upAvatar',
dataType: 'json', //返回值类型 一般设置为json
headers:{
"XX-Device-Type":"1",
"XX-Token":"1",
},
success: function(data) {
alert(data.code + " " + data.msg);
if(data.code == 200) {
$("#headPic").attr("src", "/market/images/image.png");
//将图片换成默认的+图片
type: 'post',
data: formData,
processData: false,
contentType: false,
success: function (res) {
avatar = res.data.url;
}
}
});
//建立一個可存取到該file的url
function getObjectURL(file) {
var url = null;
if(window.createObjectURL != undefined) { // basic
url = window.createObjectURL(file);
} else if(window.URL != undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file);
} else if(window.webkitURL != undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file);
}
return url;
}
};
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:{
// "XX-Device-Type":"1",
// "XX-Token":"1",
// },
// dataType: 'json',
// processData: false, // 告诉jQuery不要去处理发送的数据
// contentType: false, // 告诉jQuery不要去设置Content-Type请求头
// success: function(data) {
// alert('上传成功')
// },
// error: function(data) {
// // alert("上传失败");
// }
// })
// }
var level13;
var level14;
//获取文化程度接口
... ... @@ -407,13 +358,66 @@
})
// 点击保存接口
var avatar,p_name,name,sex,birthday,idcard,weight,marry,culture,job,medical;
$('.perbut').click(function () {
var mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
p_name = $('#p_name').val()
var val=$('input:radio[name="sex"]:checked').val();
if (val=='男'){
sex = '1';
} else if (val=='女'){
sex = '2';
}
if (!mobile.test($('#phonesp').val())) {
let loading = weui.loading('请填写正确手机号码')
setTimeout(function () {
loading.hide();
}, 1500);
}else {
phonesp = $('#phonesp').val()
}
beginTime = $('#beginTime').val()
id_card = $('#id_card').val()
person_height = $('#person_height').val()
weight = $('#weight').val()
culture_name = $('#culture_name').val()
job = $('#job').val()
medical_name = $('#medical_name').val()
if($('#marry').val()=='已婚'){
marry='1'
}else if ($('#marry').val()=='未婚'){
marry='0'
}
setPersonal()
})
// 保存
function setPersonal() {
$.ajax({
type:"POST",
url: baseUrl+'user/index/setPersonal',
dataType:"json",
headers:{
"XX-Device-Type":"1",
"XX-Token":"1",
},
data:{
rid: 1,
avatar: avatar,
name: p_name,
sex: sex,
mobile: phonesp,
birthday: beginTime,
idcard: id_card,
height: person_height,
weight: weight,
marry: marry,
culture: culture_name,
job: job,
medical: medical_name,
},
success:function (res) {
console.log(res)
}
})
}
</script>
... ...