| | |
| | | ebookCount: 0, |
| | | paperBookCount: 0, |
| | | bookList: [], |
| | | isIos: wx.getSystemInfoSync().platform === 'ios', |
| | | keyboardHeight: 0 |
| | | }, |
| | | |
| | | /** |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 监听页面软键盘弹起手动推动页面 |
| | | bindkeyboardheightchange(e) { |
| | | // 只对ios 处理 |
| | | if (!this.data.isIos === 'ios') { |
| | | return |
| | | } |
| | | |
| | | // 键盘高度 |
| | | const height = e.detail.height; |
| | | const className = e.target.dataset.class; |
| | | if (height === 0) { |
| | | this.scrollToInput(0); |
| | | return; |
| | | } |
| | | try { |
| | | this.createSelectorQuery() |
| | | .select(`.${className}`) |
| | | .boundingClientRect((res) => { |
| | | // 可使用窗口高度 |
| | | const windowHeight = wx.getSystemInfoSync().windowHeight; |
| | | // 除去键盘的剩余高度 |
| | | let restHeight = windowHeight - height; |
| | | // 元素左下角坐标 |
| | | let bottom = res.bottom; |
| | | // 只有当元素被软键盘覆盖的时候才上推页面 |
| | | if (bottom <= restHeight) return; |
| | | // 现阶段需要滚动的大小 |
| | | let scrollTop = bottom - restHeight; |
| | | this.scrollToInput(height, scrollTop); |
| | | }) |
| | | .exec(); |
| | | } catch (error) {} |
| | | }, |
| | | |
| | | // 获取页面滚动条位置 |
| | | getScrollOffset() { |
| | | return new Promise((resolve) => { |
| | | try { |
| | | wx.createSelectorQuery() |
| | | .selectViewport() |
| | | .scrollOffset((res) => { |
| | | resolve(res.scrollTop); |
| | | }) |
| | | .exec(); |
| | | } catch (error) { |
| | | resolve(0); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 监听页面软键盘弹起手动推动页面 |
| | | scrollToInput(keyboardHeight, scrollTop) { |
| | | this.setData({ |
| | | keyboardHeight, |
| | | }); |
| | | if (scrollTop) { |
| | | try { |
| | | this.getScrollOffset().then((lastScrollTop) => { |
| | | wx.pageScrollTo({ |
| | | // 如果已经存在滚动,在此基础上继续滚 |
| | | scrollTop: lastScrollTop ? lastScrollTop + scrollTop : scrollTop, |
| | | duration: 300, |
| | | }); |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | }, |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | |
| | | <view class="container"> |
| | | <view class="container" style="height:calc(100% + {{keyboardHeight ? (keyboardHeight + 'px'):'100%'}});padding-bottom:calc(180rpx + {{keyboardHeight ? 120 + 'px':0}}) "> |
| | | <t-tabs t-class="t-tabs" defaultValue="{{active}}" split="{{false}}" bind:change="tabClick" show-bottom-line="false"> |
| | | <t-tab-panel label="纸质样书" value="0" /> |
| | | <t-tab-panel label="电子样书" value="1" /> |
| | |
| | | <view class="item"> |
| | | <text class="label">姓名:</text> |
| | | <view class="item-content"> |
| | | <t-input placeholder="请输入真实姓名" borderless value="{{contactInfo.fullName}}" bindchange="onFullNameInput" /> |
| | | <t-input placeholder="请输入真实姓名" borderless value="{{contactInfo.fullName}}" bindchange="onFullNameInput" adjust-position="{{isIos?false:true}}" bindkeyboardheightchange="bindkeyboardheightchange" data-class="form-input-1" /> |
| | | </view> |
| | | </view> |
| | | <view class="item"> |
| | | <text class="label">联系电话:</text> |
| | | <view class="item-content"> |
| | | <t-input placeholder="输入联系电话" borderless value="{{contactInfo.phone}}" type="number" tips="{{phoneError ? '手机号输入不正确' : ''}}" bindchange="onPhoneInput" /> |
| | | <t-input placeholder="输入联系电话" borderless value="{{contactInfo.phone}}" type="number" tips="{{phoneError ? '手机号输入不正确' : ''}}" bindchange="onPhoneInput" adjust-position="{{isIos?false:true}}" bindkeyboardheightchange="bindkeyboardheightchange" data-class="form-input-2" /> |
| | | </view> |
| | | </view> |
| | | <view class="item"> |
| | | <text class="label">详细地址:</text> |
| | | <view class="item-content"> |
| | | <t-input placeholder="请输入详细地址" borderless value="{{contactInfo.detailedAddress}}" bindchange="onAddressInput" /> |
| | | <t-input placeholder="请输入详细地址" borderless value="{{contactInfo.detailedAddress}}" bindchange="onAddressInput" adjust-position="{{isIos?false:true}}" bindkeyboardheightchange="bindkeyboardheightchange" data-class="form-input-3" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | reasonTxt: "", |
| | | reasonTxtShow: false, |
| | | skeletonLoding: true, |
| | | isIos: wx.getSystemInfoSync().platform === 'ios', |
| | | keyboardHeight: 0 |
| | | }, |
| | | |
| | | /** |
| | |
| | | this.getUserRole() |
| | | } |
| | | }, |
| | | // 监听页面软键盘弹起手动推动页面 |
| | | bindkeyboardheightchange(e) { |
| | | // 只对ios 处理 |
| | | if (!this.data.isIos === 'ios') { |
| | | return |
| | | } |
| | | |
| | | // 键盘高度 |
| | | const height = e.detail.height; |
| | | const className = e.target.dataset.class; |
| | | if (height === 0) { |
| | | this.scrollToInput(0); |
| | | return; |
| | | } |
| | | try { |
| | | this.createSelectorQuery() |
| | | .select(`.${className}`) |
| | | .boundingClientRect((res) => { |
| | | // 可使用窗口高度 |
| | | const windowHeight = wx.getSystemInfoSync().windowHeight; |
| | | // 除去键盘的剩余高度 |
| | | let restHeight = windowHeight - height; |
| | | // 元素左下角坐标 |
| | | let bottom = res.bottom; |
| | | // 只有当元素被软键盘覆盖的时候才上推页面 |
| | | if (bottom <= restHeight) return; |
| | | // 现阶段需要滚动的大小 |
| | | let scrollTop = bottom - restHeight; |
| | | this.scrollToInput(height, scrollTop); |
| | | }) |
| | | .exec(); |
| | | } catch (error) {} |
| | | }, |
| | | |
| | | // 获取页面滚动条位置 |
| | | getScrollOffset() { |
| | | return new Promise((resolve) => { |
| | | try { |
| | | wx.createSelectorQuery() |
| | | .selectViewport() |
| | | .scrollOffset((res) => { |
| | | resolve(res.scrollTop); |
| | | }) |
| | | .exec(); |
| | | } catch (error) { |
| | | resolve(0); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 监听页面软键盘弹起手动推动页面 |
| | | scrollToInput(keyboardHeight, scrollTop) { |
| | | this.setData({ |
| | | keyboardHeight, |
| | | }); |
| | | if (scrollTop) { |
| | | try { |
| | | this.getScrollOffset().then((lastScrollTop) => { |
| | | wx.pageScrollTo({ |
| | | // 如果已经存在滚动,在此基础上继续滚 |
| | | scrollTop: lastScrollTop ? lastScrollTop + scrollTop : scrollTop, |
| | | duration: 300, |
| | | }); |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | }, |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | |
| | | <view class="container"> |
| | | <view class="container" style="height:calc(100% + {{keyboardHeight ? (keyboardHeight + 'px'):'100%'}});padding-bottom:calc(180rpx + {{keyboardHeight ? 120 + 'px':0}}) "> |
| | | <scroll-view class="scroll content" scroll-y> |
| | | <view class="tips" wx:if="{{!skeletonLoding}}"> 仅限学校本课程任课教师申请;请上传有效在职教师工作证将有助于审核。 </view> |
| | | <view class="page-body" wx:if="{{!skeletonLoding}}"> |
| | | <view class="baseInfoBox"> |
| | | <view class=" baseInfoBox"> |
| | | <view class="from-item"> |
| | | <view class="label"> <text class="empty"></text>当前状态: </view> |
| | | <view class="stateBox"> |
| | |
| | | <view class="from-item"> |
| | | <view class="label"> <text class="icon">*</text>邮箱: </view> |
| | | <view class="item-content"> |
| | | <t-input placeholder="输入邮箱" borderless value="{{teacherInfo.email}}" tips="{{emailError ? '邮箱输入不正确' : ''}}" bindchange="onEmailInput" disabled="{{!editState}}" /> |
| | | <t-input placeholder="输入邮箱" borderless value="{{teacherInfo.email}}" tips="{{emailError ? '邮箱输入不正确' : ''}}" bindchange="onEmailInput" disabled="{{!editState}}" adjust-position="{{isIos?false:true}}" bindkeyboardheightchange="bindkeyboardheightchange" data-class="form-input-7" /> |
| | | </view> |
| | | </view> |
| | | <view class="from-item"> |
| | | <view class="label"> <text class="empty"></text>详细地址: </view> |
| | | <view class="item-content"> |
| | | <t-input placeholder="请输入详细地址" borderless value="{{teacherInfo.detailedAddress}}" bindchange="onAddressInput" disabled="{{!editState}}" /> |
| | | <t-input placeholder="请输入详细地址" borderless value="{{teacherInfo.detailedAddress}}" bindchange="onAddressInput" disabled="{{!editState}}" adjust-position="{{isIos?false:true}}" bindkeyboardheightchange="bindkeyboardheightchange" data-class="form-input-8" /> |
| | | </view> |
| | | </view> |
| | | </view> |