描述:登录页面修改

This commit is contained in:
SelfRidicule 2024-02-22 15:15:08 +08:00
parent 946d891fc6
commit 0f7b1982c6
4 changed files with 47 additions and 395 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
.idea
node_modules/
miniprogram/miniprogram_npm

View File

@ -4,245 +4,14 @@ Page({
* 页面的初始数据
*/
data: {
type: 'log',
getCodeTime: 40, //发送短信的间隔时间
verifyCodeTime: '获取验证码',
passwordfocus: false,
mobilefocus: false,
codefocus: false,
typeName: 'password',
passFlag: 1
},
onShow() {
// wx.hideHomeButton()
},
tapType: function (e) {
var type = e.currentTarget.dataset.type;
this.setData({
type
})
},
foget: function () {
wx.navigateTo({
url: '/pages/my/retrievePassword/retrievePassword',
})
},
navlogs () {
wx.navigateTo({
url: '/pages/logs/logs',
})
},
codelog: function () {
this.setData({
codelog: 1
})
},
getphone: function (e) {
this.setData({
mobile: e.detail.value
})
},
passWordInput: function (e) {
var type = e.currentTarget.dataset.type
if (this.data.typeName = 'text') {
this.setData({
typeName: 'password'
})
} else if (this.data.typeName = 'password') {
this.setData({
typeName: 'text'
})
}
},
showPass() { // 显示密码而非*号
console.log(this.data.storePass)
if (this.data.passFlag == 1) { // 第一次点击
this.setData({
passFlag: 2,
typeName: 'text'
});
} else { // 第二次点击
this.setData({
passFlag: 1,
typeName: 'password'
});
}
},
bSubmit: function (e) {
var that = this,
mobile = e.detail.value.mobile,
password = e.detail.value.password
if (!mobile) {
wx.showToast({
title: '请先填写手机号',
duration: 3000,
icon: 'none'
});
that.setData({
mobilefocus: true
})
return false;
}
if (!password) {
that.setData({
passwordfocus: true
});
return false
}
app.AjaxRequest('POST', {
'content-type': 'application/json'
}, '/auth/login', {
username: mobile,
password: password
}, function (res) {
wx.showToast({
title: res.message,
duration: 3000,
icon: 'none'
});
if (res.code == 0) {
wx.cloud.init()
wx.cloud.callFunction({
name: "pay",
success(res) {
wx.setStorageSync('OPENID', res.result.OPENID)
}
})
wx.setStorageSync('parkId', res.parkId)
wx.setStorageSync('token', res.token)
wx.setStorageSync('userId', res.userId)
wx.reLaunch({
url: '/pages/index/index',
})
}
})
},
bindGetUserInfo(e) {
var userInfo = e.detail.userInfo
wx.cloud.init()
wx.cloud.callFunction({
// 云函数名称
name: 'pay',
}).then(res => {
console.log(e.detail.userInfo)
app.AjaxRequest('POST', {
'content-type': 'application/json'
}, '/wx/login', {
avatar: userInfo.avatarUrl,
username: userInfo.nickName,
gender: userInfo.gender === 1 ? '0' : '1',
openid: res.result.OPENID
}, function (res) {
if (res.code == 0) {
wx.setStorageSync('userId', res.userId)
wx.setStorageSync('token', res.token)
wx.reLaunch({
url: '/pages/index/index',
})
}
})
})
},
/**
* 执行发送验证码
*/
verifyCodeEvent: function (e) {
var that = this;
//验证手机号
if (that.data.buttonDisable == true) return false;
var mobile = that.data.mobile;
var regMobile = /^[1]([3-9])[0-9]{9}$/;
if (!regMobile.test(mobile)) {
wx.showToast({
title: '手机号错误',
duration: 3000,
icon: 'none'
});
that.setData({
mobilefocus: true
});
return false;
}
that.Countdown()
//验证手机号 END
wx.showLoading();
wx.request({
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'GET',
url: app.DOMAIN_NAME + '/sms/send',
data: {
username: mobile,
type: 'MEMBER_REGISTER'
},
success: res => {
var mes = res.data.message,
code = mes.slice(21, 25)
that.setData({
code
})
wx.hideLoading()
that.Countdown();
}
})
},
/**
* 发送短信倒计时,防止恶意刷短信
*/
Countdown: function () {
var that = this;
that.setData({
buttonDisable: true
});
var getCodeTime = wx.getStorageSync('getCodeTime');
var intervalId = setInterval(function () {
getCodeTime--;
wx.setStorageSync('getCodeTime', getCodeTime);
that.setData({
verifyCodeTime: '重新获取' + '(' + getCodeTime + 's' + ')'
});
//倒计时完成
if (getCodeTime == 0) {
wx.setStorageSync('getCodeTime', that.data.getCodeTime);
clearInterval(intervalId);
that.setData({
verifyCodeTime: '获取验证码',
buttonDisable: false
})
}
}, 1000);
IMG_NAME: app.IMG_NAME,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
var that = this;
//限制发送验证码的时间,防止恶意刷短信
var getCodeTime = wx.getStorageSync('getCodeTime');
if (getCodeTime <= that.data.getCodeTime - 1 && getCodeTime > 0) {
that.Countdown(that);
} else {
wx.setStorageSync('getCodeTime', that.data.getCodeTime)
that.setData({
buttonDisable: false
})
}
},
/**

View File

@ -1,24 +1,10 @@
<view class='page'>
<!-- <view>
<image mode="widthFix" style="width:30%" src="/images/login.webp"></image>
</view> -->
<view class="login-header">
<view class="login-title">请登录</view>
<view class="login-info">Please Login Your Account</view>
</view>
<view class='container' style="background: url('{{IMG_NAME + '/profile/opt/static/login/bg.png'}}') no-repeat;">
<image class="titleImg" src="{{IMG_NAME + '/profile/opt/static/login/bg.png'}}" mode="aspectFill"></image>
<view class="bottomView">
<image class="loginBtnImg" src="{{IMG_NAME + '/profile/opt/static/login/loginBtn.png'}}" mode="aspectFill"></image>
<button class="loginBtn" open-type="getUserInfo" bindgetuserinfo="authorLogin"></button>
</view>
<view class="logBox">
<form bindsubmit='bSubmit' bindreset="formReset">
<!--
<view class="{{RemberPass}}" style="width:30%;text-align:left;margin-left:80rpx;float:left;font-size:13px;margin-bottom: 20%;">
<switch type="checkbox" checked="{{switchChecked}}" bindswitcheck="switchChecked" bindchange="bindswitchchange" style="transform:scale(0.8)"/>记住密码
</view>
-->
<button open-type="getUserInfo" bindgetuserinfo="authorLogin" style="text-align: center;margin-bottom: 10%;background: white;">
<image bindtap="wxlog" src="/images/icon/new.png" mode="widthFix" style="width:84rpx;height:84rpx;"></image>
<view style="font-size: 14px;">微信登陆</view>
</button>
</form>
</view>
</view>

View File

@ -1,150 +1,45 @@
.page{
width:100%;
height: 100%;
/*padding: 50rpx 50rpx; */
box-sizing: border-box;
color: black;
font-size: 60rpx;
}
.floR{
font-size: 14pt;
/* font-weight: 600; */
}page {
width: 100%;
height: 100%;
background: #fff;
font-size: 32rpx;
.container{
width: 100vw;
height: 100vh;
background-position: center top;
}
.container {
padding: 0 60rpx;
.titleImg{
border: 1px solid red;
display: block;
margin: 100rpx auto;
width: 649rpx;
height: 256rpx;
}
.wechatapp {
padding: 80rpx 0 48rpx;
border-bottom: 1rpx solid #e3e3e3;
margin-bottom: 72rpx;
text-align: center;
.bottomView{
border: 1px solid red;
position: absolute;
left: 50%;
bottom: 120rpx;
margin-left: -310rpx;
width: 620rpx;
height: 150rpx;
}
.wechatapp .header {
width: 190rpx;
height: 190rpx;
border: 2px solid #fff;
margin: 0rpx auto 0;
border-radius: 50%;
overflow: hidden;
box-shadow: 1px 0px 5px rgba(50, 50, 50, 0.3);
.loginBtnImg{
background: gray;
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
left: 0;
top: 0;
}
.auth-title {
color: #585858;
font-size: 40rpx;
margin-bottom: 40rpx;
text-align: center;
.loginBtn{
background:blue;
width: 100%;
height: 100%;
position: absolute;
z-index: 2;
left: 0;
top: 0;
opacity: 0;
}
.auth-subtitle {
color: #888;
margin-bottom: 88rpx;
text-align: center;
}
.login-btn {
border: none;
background: #04be01;
color: #fff;
font-size: 11pt;
border-radius: 999rpx;
}
.login-btn::after {
display: none;
}
.login-btn.button-hover {
box-shadow: inset 0 5rpx 30rpx rgba(0, 0, 0, 0.15);
}
.bshaw {
padding: 10rpx 40rpx;
}
input {
width: 88%;
margin-top: 4rpx;
text-align: left;
padding-right: 30rpx;
box-sizing: border-box;
float: right;
color: #696969;
}
.inputbox {
font-size: 30rpx;
margin: 0 auto;
margin-bottom: 8%;
display: flex;
padding: 3% 0;
width: 90%;
border-radius: 50rpx;
background-color: #F7F7F7;
}
.topBox{
position: absolute;
width: 84%;
top: 250rpx;
left: 8%;
}
.logBox{
margin-top: 10%;
}
.code {
text-align: center;
width: 240rpx;
border-radius: 0 45rpx 45rpx 0;
font-size: 24rpx;
color: #3147FA;
z-index: 999;
padding-top: 10rpx;
}
.nexts{
width: 390rpx;
height: 100%;
color: #fff;
padding: 20rpx 0;
border-radius: 30rpx;
text-align: center;
display: inline-block;
margin: 0 auto;
}
.login-header{
height: 200rpx;
padding: 40rpx 30rpx;
display: flex;
flex-direction: column;
background-color: #73ccd8;
color: white;
}
.login-title{
font-size: 52rpx;
font-weight: 700;
padding: 20rpx;
}
.login-info{
font-size: 28rpx;
padding: 20rpx;
}
.pailie{
display: flex;
flex-direction: column;
}