作者 刘朕

合并分支 '1iuzhen' 到 'master'

登录选择年龄修改



查看合并请求 !21
... ... @@ -121,8 +121,16 @@ class LoginController extends HomeBaseController
$where = [
'delete_time' => 0
];
$list = [];
$babyList = $baby_model->where($where)->select();
$this->assign('babyList',$babyList);
foreach ($babyList as $kg=>$vg) {
$info = [
'label' => $vg['age'],
'value' => $vg['id']
];
$list[] = $info;
}
$this->assign('babyList',json_encode($list));
return $this->fetch(':choose');
} else {
return redirect($this->request->root() . '/');
... ...
... ... @@ -10,6 +10,12 @@
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<title>选择年龄</title>
<style type="text/css">
.container {
height: 100%;
}
.input_num {
position: relative;
}
.input_num p {
font-size: 0.3rem;
margin-left: 0.4rem;
... ... @@ -49,11 +55,13 @@
</div>
<div class="input_num">
<p>宝宝年龄</p>
<select name="baby_age" class="input_text">
<volist name="babyList" id="vo">
<option value="{$vo.id}">{$vo.age}</option>
</volist>
</select>
<input type="text" name="baby_age" id="age" value="" class="input_text" placeholder="请选择宝宝年龄" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
<!--<select name="baby_age" class="input_text">-->
<!--<volist name="babyList" id="vo">-->
<!--<option value="{$vo.id}">{$vo.age}</option>-->
<!--</volist>-->
<!--</select>-->
<!--<input type="text" name="" id="age" value="" class="input_text" placeholder="7~35月龄" />-->
<!--<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />-->
</div>
... ... @@ -87,9 +95,29 @@
// id: 'datePicker'
// });
// })
var age_id = '';
$('#age').click(function() {
var babyList = JSON.parse(`{$babyList}`);
weui.picker(babyList, {
onChange: function(result) {
console.log(result);
},
onConfirm: function(result) {
$('#age').val(result[0].label);
age_id = result[0].value;
console.log(result);
},
id: 'multiPickerBtn'
});
});
$('.btn').click(function(){
if($('#age').val() == '') {
_error('请选择宝宝年龄');
return false;
}
var data = {
id: $('select[name=baby_age]').val()
id: age_id
};
$.ajax({
url: "{:url('user/Login/chooseSubmit')}",
... ... @@ -107,6 +135,7 @@
});
// 弹窗提示
var popup_switch = true;
function _error(test) {
if(popup_switch) {
popup_switch = false;
... ...