Compare commits

..

No commits in common. "61e2f4d9adec47d1989649d953d0b9ce006c44b3" and "9aef1d6e52b53b59d9d6cbdb2e4332fa642962a2" have entirely different histories.

3 changed files with 11 additions and 40 deletions

View File

@ -14,8 +14,7 @@ Page({
*/
data: {
phoneNumber: '', // 手机号
password: '', // 密码
checked: false,
password: '' // 密码
},
handlePhoneInput(event) {
this.setData({ phoneNumber: event.detail.value });
@ -23,24 +22,7 @@ Page({
handlePasswordInput(event) {
this.setData({ password: event.detail.value });
},
togglePasswordVisibility() {
this.setData({ passwordVisible: !this.data.passwordVisible });
},
checkAccepted(e) {
console.log("开始设置值")
console.log(e.detail.value)
if(e.detail.value.length>0){
this.setData({
checked:true
})
}else{
this.setData({
checked:false
})
}
},
handleLogin() {
if (this.data.checked) {
wx.request({
url: requestUrl + '/user/login', // 你的接口地址
method: 'POST',
@ -70,13 +52,6 @@ Page({
console.log('登录失败', error);
}
});
} else {
// 如果协议未被接受,显示提示或者阻止登录
wx.showToast({
title: '请先同意用户使用协议',
icon: 'none',
});
}
},
/**
* 生命周期函数--监听页面加载

View File

@ -7,16 +7,14 @@
<!-- 手机号输入区 -->
<view class="phone">
<image src="/assets/images/icon/Phone.svg" class="phone-icon"></image>
<input bindinput="handlePhoneInput" placeholder="请输入手机号" />
<input bindinput ="handlePhoneInput" placeholder="请输入手机号" />
</view>
<!-- 密码输入区 -->
<view class="password">
<image src="/assets/images/icon/password.svg" class="password-icon"></image>
<!-- 根据passwordVisible动态设置input类型 -->
<input type="{{passwordVisible ? 'text' : 'password'}}" bindinput="handlePasswordInput" placeholder="请输入密码" />
<!-- 绑定点击事件到togglePasswordVisibility函数 -->
<image src="/assets/images/icon/eye.svg" class="eye-icon" bindtap="togglePasswordVisibility"></image>
<input type="password" bindinput="handlePasswordInput" placeholder="请输入密码" />
<image src="/assets/images/icon/eye.svg" class="eye-icon"></image>
</view>
<!-- 忘记密码链接 -->
@ -26,16 +24,14 @@
<!-- 登录按钮 -->
<view class="login-btn">
<!-- 绑定点击事件到handleLogin函数 -->
<button class="btn-dl" bindtap="handleLogin" type="primary">登录</button>
<button class="btn-dl" bind:tap="handleLogin" type="primary">登录</button>
</view>
<!-- 协议区 -->
<checkbox-group bindchange="checkAccepted" class="agreement-area">
<checkbox class="agreement-box" checked="{{checked}}"></checkbox>
<view class="agreement-text">小程序《用户使用协议》</view>
</checkbox-group>
<view class="agreement-area">
<checkbox class="agreement"></checkbox>
<view class="agreement-text">同意小程序的《使用协议》</view>
</view>
</view>
<!-- 登录提示框 -->

View File

@ -123,7 +123,7 @@
position: absolute;
}
/* 复选框 */
.login .login-card .agreement-area .agreement-box{
.login .login-card .agreement-area .agreement{
margin-left: 85rpx;
/* 修改复选框的大小 */
transform:scale(.6);