<view class=“inputView” style=“border-bottom:1rpx solid #D7D7D7”>
<view class=“labcss”>
<image class=“userImage” src="/images/loginUser.png"></image>
<label class=“loginLab”>账号</label>
</view>
<view class=“inpcss”>
<input class=“inputText” placeholder=“请输入手机号” bindinput=“phoneInput” placeholder-class=“plhcss”/>
</view>
</view>
<!–密码–>
<view class=“inputView”>
<view class=“labcss”>
<image class=“pwdImage” src="/images/loginPwd.png"></image>
<label class=“loginLab”>密码</label>
</view>
<view class=“inpcss”>
<input class=“inputText” password=“true” placeholder=“请输入密码” bindinput=“passwordInput” placeholder-class=“plhcss”/>
</view>
</view>
<!–按钮–>
<view class=“loginBtnView”>
<button class=“loginBtn” disabled="{{disabled}}" hover-class=“BtnHover” bindtap=“login”>登 录</button>
</view>
Page({
data: {
phone: ‘’,
password: ‘’,
disabled: true,
},
// 获取输入账号
phoneInput: function (e) {
this.setData({
phone: e.detail.value
})
},
// 获取输入密码
passwordInput: function (e) {
this.setData({
password: e.detail.value
})
},
// 登录
login: function () {
if (this.data.phone.length == 0 || this.data.password.length == 0) {
wx.showToast({
title: ‘用户名和密码不能为空’,
icon: ‘’,
duration: 1500
})
} else {
// 这里修改成跳转的页面
wx.showToast({
title: ‘登录成功’,
icon: ‘success’,
duration: 2000
})
}
}
})
求代码