login.wxml
<!--login wxml-->
<view class="login">
<!--头像-->
<view class="wxUserInfo">
<open-data type="userAvatarUrl"></open-data>
<open-data type="userNickName"></open-data>
</view>
<!--登陆-->
<view class="inputView">
<input name='input_user_name' class='input' type='number' placeholder='请输入账号' placeholder-style='color: #e0e0e0'/>
</view>
<view class="inputView" style="margin-top:5%">
<input name='input_user_password' class='input' type='number' placeholder='请输入密码' placeholder-style='color: #e0e0e0'/>
</view>
<button class='buttonForgetPassword' size='mini'>忘记密码</button>
<view class="buttonLoginView">
<button class='buttonLogin' bindtap='Login' >登\t陆</button>
</view>
<view class="buttonRegisterView">
<button class='buttonRegister' bindtap='Register'>注\t册</button>
</view>
</view>
login.wxss
/**login.wxss**/
.wxUserInfo {
display: flex;
flex-direction: column;
align-items: center;
}
.input{
padding-left: 10rpx;
height: 80rpx;
}
.inputView{
border: 1rpx solid #66c5ab; /*边界:大小1rpx, 为固体,为绿色*/
border-radius: 30rpx; /*边界角的弧度*/
margin-left: 5%;
margin-right: 5%;
margin-top: 15rpx;
}
.buttonForgetPassword{
color: #66c5ab;
width:30%;
margin-right: 5%;
margin-left: 65%;
margin-top: 5rpx;
background: none;
}
.buttonForgetPassword::after{
border: none; /*button去边框*/
}
.buttonLoginView{
border-radius: 30px;
width: 90%;
margin-left: 5%;
margin-right: 5%;
margin-top: 10rpx;
}
.buttonLogin{
background: #66c5ab;
color: white;
}
.buttonLogin::after{
border: none;
}
.buttonRegisterView{
border-radius: 30rpx;
width: 90%;
margin-left: 5%;
margin-right: 5%;
margin-top: 5rpx;
}
.buttonRegister{
background: none;
color: #66c5ab;
}
.buttonRegister::after{
border: none;
}
login.js
var
app = getApp()
Page({
//页面的初始数据
data: {
response:
""
,
},
//获取用户名和用户密码
inputUserName:
function
(e)
{
getApp().globalData.userName = e.detail.value.replace(/\s+/g,
''
);
//获取用户名并去空格
console.log(getApp().globalData.userName);
//控制台输出 用于调试
},
inputUserPwd:
function
(e)
{
getApp().globalData.userPassword = e.detail.value.replace(/\s+/g,