作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

意见修改

... ... @@ -95,6 +95,7 @@ class RegisterController extends WeChatBaseController
//个人信息ajax提交
public function postInfo(){
$param=$this->request->param();
$param['birthday']=strtotime( $param['birthday']);
$param['status']=1;
$re=Db::name('users')->where('open_id',session('wechat_user')['id'])->update($param);
if ($re){
... ...
... ... @@ -6,46 +6,70 @@
<title>十方台公众号</title>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
<script src="__TMPL__/public/assets/js/fontsize.js"></script>
<script src="__TMPL__/public/assets/js/weui.js"></script>
<script src="__TMPL__/public/assets/js/myweui.js"></script>
<link href="__TMPL__/public/assets/css/weui.css" rel="stylesheet">
<link href="__TMPL__/public/assets/css/myweui.css" rel="stylesheet">
<link href="__TMPL__/public/assets/css/personal-info.css" rel="stylesheet">
</head>
<body>
<div class="content">
<div class="name-box">
<div class="input-box">
<text>姓名</text>
<input class="input" type="text" placeholder="请输入姓名" cursor="100" placeholder-class="placeholder-style"
id="user_name" value="" bindinput="inputName"/>
</div>
<div class="content">
<div class="name-box">
<div class="input-box">
<text>姓名</text>
<input class="input" type="text" placeholder="请输入姓名" cursor="100" placeholder-class="placeholder-style"
id="user_name" value="" bindinput="inputName"/>
</div>
<div class="age-box">
<div class="input-box">
<text>年龄</text>
<input class="input" type="number" placeholder="请输入年龄" cursor="100" placeholder-class="placeholder-style"
id="age" value="" bindinput="inputName"/>
</div>
</div>
<div class="age-box">
<div class="input-box">
<text>年龄</text>
<input class="input" type="number" placeholder="请输入年龄" cursor="100" placeholder-class="placeholder-style"
id="age" value="" bindinput="inputName"/>
</div>
<div class="sex-box">
<div class="input-box">
<text>性别</text>
<div class="man active" data-id="1"></div>
<div class="women" data-id="2"></div>
</div>
</div>
<div class="age-box">
<div class="input-box">
<text>生日</text>
<input type="text" id='showDatePicker'/>
</div>
<div class="family-box">
<div class="input-box">家庭住址(选填)</div>
<div class="address-input">
<input class="input" type="text" placeholder="请填写您的家庭住址(选填)" cursor="100" placeholder-class="placeholder-style"
value="" id="address" bindinput="inputName"/>
</div>
</div>
<div class="sex-box">
<div class="input-box">
<text>性别</text>
<div class="man active" data-id="1"></div>
<div class="women" data-id="2"></div>
</div>
</div>
<div class="family-box">
<div class="input-box">家庭住址(选填)</div>
<div class="address-input">
<input class="input" type="text" placeholder="请填写您的家庭住址(选填)" cursor="100"
placeholder-class="placeholder-style"
value="" id="address" bindinput="inputName"/>
</div>
<div class="footer" onclick="goNext()">
<div class="confirm-btn">
<text>确定</text>
</div>
</div>
<div class="footer" onclick="goNext()">
<div class="confirm-btn">
<text>确定</text>
</div>
</div>
</div>
</body>
<script>
$('#showDatePicker').on('click', function () {
weui.datePicker({
start: 1990,
end: new Date().getFullYear(),
onChange: function (result) {
// console.log(result);
},
onConfirm: function (result) {
$('#showDatePicker').val(result[0].label + '' + result[1].label + '' + result[2].label)
}
});
});
$(".man").click(function () {
$(".man").addClass('active');
$(".women").removeClass('active');
... ... @@ -54,39 +78,45 @@
$(".women").addClass('active');
$(".man").removeClass('active');
})
function goNext() {
var user_name=$('#user_name').val()
var age=$('#age').val()
var sex=$('.active').data("id")
var user_name = $('#user_name').val()
var age = $('#age').val()
var sex = $('.active').data("id")
// console.log(sex)
var address=$('#address').val()
if (user_name==""){
var address = $('#address').val()
if (user_name == "") {
alert('请输入姓名')
return false
}
if (age==""){
if (age == "") {
alert('请输入年龄')
return false
}
if ($('#showDatePicker').val()==""){
alert('请选择出生日期')
return false
}
$.ajax({
url: "{:url('user/register/postInfo')}",
type: "post",
data: {
user_name:user_name,
age:age,
sex:sex,
address:address,
},
success: function (data) {
if (data==1) {
alert('十方台温馨提示:\n注册成功')
window.location.href = "{:url('portal/index/index')}";
}else {
alert('十方台温馨提示:\n注册失败')
return false
}
}
})
url: "{:url('user/register/postInfo')}",
type: "post",
data: {
birthday:$('#showDatePicker').val(),
user_name: user_name,
age: age,
sex: sex,
address: address,
},
success: function (data) {
if (data == 1) {
alert('十方台温馨提示:\n注册成功')
window.location.href = "{:url('portal/index/index')}";
} else {
alert('十方台温馨提示:\n注册失败')
return false
}
}
})
}
</script>
</html>
\ No newline at end of file
... ...