Authored by 张孝茹

软键盘档输入框

@@ -78,7 +78,7 @@ @@ -78,7 +78,7 @@
78 <div class="title">身高</div> 78 <div class="title">身高</div>
79 <div class="main"> 79 <div class="main">
80 <label>cm</label> 80 <label>cm</label>
81 - <input class="inp inp-2 height modify" type="number" value="{{height}}" /> 81 + <input class="inp inp-2 height modify bottom-out" type="number" value="{{height}}" />
82 </div> 82 </div>
83 <div class="arr"> 83 <div class="arr">
84 <span class="iconfont">&#xe604;</span> 84 <span class="iconfont">&#xe604;</span>
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 <div class="title">体重</div> 88 <div class="title">体重</div>
89 <div class="main"> 89 <div class="main">
90 <label>kg</label> 90 <label>kg</label>
91 - <input class="inp inp-2 weight modify" type="number" value="{{weight}}" /> 91 + <input class="inp inp-2 weight modify bottom-out" type="number" value="{{weight}}" />
92 </div> 92 </div>
93 <div class="arr"> 93 <div class="arr">
94 <span class="iconfont">&#xe604;</span> 94 <span class="iconfont">&#xe604;</span>
@@ -29,6 +29,7 @@ class UserInfo extends Page { @@ -29,6 +29,7 @@ class UserInfo extends Page {
29 $cityText: $('.city-text'), 29 $cityText: $('.city-text'),
30 $userPic: $('.user-pic'), 30 $userPic: $('.user-pic'),
31 $noDate: $('.inp.modify[type!=date]'), 31 $noDate: $('.inp.modify[type!=date]'),
  32 + $bottomOut: $('.bottom-out')
32 }; 33 };
33 34
34 this.view = { 35 this.view = {
@@ -82,6 +83,9 @@ class UserInfo extends Page { @@ -82,6 +83,9 @@ class UserInfo extends Page {
82 this.selector.$chosenCity.on('DOMNodeInserted', this.modifyInp.bind(this)); 83 this.selector.$chosenCity.on('DOMNodeInserted', this.modifyInp.bind(this));
83 this.selector.$userPic.on('click', this.userPic.bind(this)); 84 this.selector.$userPic.on('click', this.userPic.bind(this));
84 this.selector.$modifyInp.on('click', this.closeCitySwiper.bind(this)); 85 this.selector.$modifyInp.on('click', this.closeCitySwiper.bind(this));
  86 + this.selector.$bottomOut.on('focus', this.keepOut.bind(this));
  87 + this.selector.$bottomOut.on('blur', this.restore.bind(this));
  88 +
85 if (yoho.isApp) { 89 if (yoho.isApp) {
86 this.selector.$modifyInp.on('change', this.modifyInp.bind(this)); 90 this.selector.$modifyInp.on('change', this.modifyInp.bind(this));
87 } else { 91 } else {
@@ -98,6 +102,25 @@ class UserInfo extends Page { @@ -98,6 +102,25 @@ class UserInfo extends Page {
98 } 102 }
99 } 103 }
100 104
  105 + keepOut(e) {
  106 + let $this = $(e.currentTarget);
  107 +
  108 + $('body').css({
  109 + height: $(window).height() + $this.offset().top * 2 / 3
  110 + });
  111 +
  112 + $(document).scrollTop($this.offset().top * 2 / 3);
  113 + }
  114 +
  115 + restore() {
  116 +
  117 + $('body').css({
  118 + height: $(window).height()
  119 + });
  120 +
  121 + $(document).scrollTop(0);
  122 + }
  123 +
101 userPic() { 124 userPic() {
102 if (yoho.isApp) { 125 if (yoho.isApp) {
103 yoho.ready(() => { 126 yoho.ready(() => {