Commit 3cae8679 by zhangquan

吸顶效果

1 parent fdb1bb4f
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import WxValidate from '~/utils/WxValidate'
import { import {
selectAccountLogin, selectAccountLogin,
setLoginInfo setLoginInfo
...@@ -18,7 +19,8 @@ Page({ ...@@ -18,7 +19,8 @@ Page({
phone:'', phone:'',
code:'' code:''
}, },
authorized: false authorized: false,
phoneReady: false
}, },
navbarReady(e) { navbarReady(e) {
let { let {
...@@ -33,6 +35,7 @@ Page({ ...@@ -33,6 +35,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.validate = new WxValidate()
}, },
onReady() { onReady() {
this.init() this.init()
...@@ -154,8 +157,11 @@ Page({ ...@@ -154,8 +157,11 @@ Page({
this.setData({ this.setData({
[`formData.${name}`] : value [`formData.${name}`] : value
}) })
let a = this.validate.methods.tel(formData.phone) if(this.validate.methods.tel(this.data.formData.phone)){
console.log(a) this.setData({
phoneReady: true
})
}
}, },
/**获取验证码 */ /**获取验证码 */
getSmsCode() { getSmsCode() {
...@@ -165,7 +171,7 @@ Page({ ...@@ -165,7 +171,7 @@ Page({
count count
} = this.data, } = this.data,
countDown = 60 countDown = 60
if (count) return if (count || !this.data.phoneReady) return
// this.setData({ // this.setData({
// smsLoading: true // smsLoading: true
// }) // })
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<view class="login-btn code"> <view class="login-btn code">
<input maxlength="4" adjust-position="{{false}}" placeholder-class="placeholder" placeholder="请输入验证码" <input maxlength="4" adjust-position="{{false}}" placeholder-class="placeholder" placeholder="请输入验证码"
bindinput="input" value="{{formData.code}}" data-name="code"/> bindinput="input" value="{{formData.code}}" data-name="code"/>
<button disabled="{{phoneReady}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button> <button disabled="{{!phoneReady}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view> </view>
<view class="login-btn wx-btn" bindtap="handleLogin">登录</view> <view class="login-btn wx-btn" bindtap="handleLogin">登录</view>
<view class="other">或 <text bindtap="switchLoginMethod" data-type="0">微信登录</text></view> <view class="other">或 <text bindtap="switchLoginMethod" data-type="0">微信登录</text></view>
......
...@@ -6,6 +6,7 @@ Component({ ...@@ -6,6 +6,7 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
headerHeight: Number
}, },
/** /**
......
...@@ -146,7 +146,6 @@ ...@@ -146,7 +146,6 @@
} }
.project-img{ .project-img{
height: 500rpx;
white-space: nowrap; white-space: nowrap;
.img-item{ .img-item{
height: 300rpx; height: 300rpx;
......
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
</view> </view>
</view> </view>
<view class="project-wrap"> <view class="project-wrap">
<view style="position: sticky;top: {{headerHeight}}px ;z-index: 1;">
<tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab> <tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
</view>
<scroll-view class="project-img" scroll-into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-y="{{true}}"> <scroll-view class="project-img" scroll-into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item"> <view id="to-{{index}}" class="img-item">
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
</navigation-bar> </navigation-bar>
<view style="padding-top: {{headerHeight}}px;"> <view style="padding-top: {{headerHeight}}px;">
<product></product> <product headerHeight="{{headerHeight}}"></product>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!