Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
5
app.js
5
app.js
@ -1,7 +1,6 @@
|
|||||||
const { checkLogin } = require('./utils/logcheck');
|
const { checkLogin } = require('./utils/logcheck');
|
||||||
App({
|
App({
|
||||||
onLaunch() {
|
|
||||||
// checkLogin();
|
|
||||||
},
|
|
||||||
|
|
||||||
|
onLaunch: function () {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -89,6 +89,29 @@ Page({
|
|||||||
agree: e.detail.value.length > 0
|
agree: e.detail.value.length > 0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
validatePassword(password) {
|
||||||
|
// 校验密码长度
|
||||||
|
if (password.length < 6 || password.length > 10) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '密码长度应在6到10个字符之间',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否包含字母、数字和下划线
|
||||||
|
const regex = /^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z0-9]+$/;
|
||||||
|
if (!regex.test(password)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '密码必须包含字母和数字,且不包含特殊字符',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// 注册按钮点击
|
// 注册按钮点击
|
||||||
async onRegister() {
|
async onRegister() {
|
||||||
@ -102,12 +125,13 @@ Page({
|
|||||||
})) {
|
})) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const { nickname, phone, captcha, inviteCode, password } = this.data;
|
||||||
|
if (!this.validatePassword(password)) return ;
|
||||||
// 2. 再单独校验协议勾选
|
// 2. 再单独校验协议勾选
|
||||||
if (!this.data.agree) {
|
if (!this.data.agree) {
|
||||||
wx.showToast({ title: '请先同意用户协议', icon: 'none' });
|
wx.showToast({ title: '请先同意用户协议', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { nickname, phone, captcha, inviteCode, password } = this.data;
|
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
mask: true
|
||||||
|
@ -20,6 +20,31 @@ function checkLogin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkLogin2() {
|
||||||
|
try {
|
||||||
|
const user = wx.getStorageSync('usermessage');
|
||||||
|
if (!user || (typeof user === 'object' && Object.keys(user).length === 0)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '您未登录请先登录',
|
||||||
|
icon:'error',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/logain/logain',
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/logain/logain',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
checkLogin
|
checkLogin, checkLogin2
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user