解决了已知问题
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
import {url} from '../../request'
|
||||
Page({
|
||||
data: {
|
||||
show: true,
|
||||
morenshow: false,
|
||||
currentTab: 'code',
|
||||
},
|
||||
// 初始加载
|
||||
onShow(){
|
||||
this.setData({
|
||||
show: false,
|
||||
@ -11,6 +13,7 @@ Page({
|
||||
currentTab: 'password'
|
||||
})
|
||||
},
|
||||
// 账号密码登录
|
||||
showchange() {
|
||||
this.setData({
|
||||
show: true,
|
||||
@ -18,12 +21,39 @@ Page({
|
||||
currentTab: 'code'
|
||||
})
|
||||
},
|
||||
// 注册界面
|
||||
gozucepage(){
|
||||
wx.navigateTo({
|
||||
url: '/pages/zucepage/zucepage',
|
||||
})
|
||||
},
|
||||
|
||||
yanzhengphone(e){
|
||||
this.setData({
|
||||
yanzhengphone: e.detail.value
|
||||
})
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
yanzhengcode(e){
|
||||
this.setData({
|
||||
yanzhengcode: e.detail.value
|
||||
})
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
// 账号登录账号
|
||||
bindKeyInput(e){
|
||||
this.setData({
|
||||
inputValue: e.detail.value
|
||||
})
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
// 账号登录密码
|
||||
bindKeyInputpassword(e){
|
||||
this.setData({
|
||||
inputValuepassword: e.detail.value
|
||||
})
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
// 验证码登录
|
||||
showchangeback() {
|
||||
this.setData({
|
||||
show: false,
|
||||
@ -31,10 +61,251 @@ Page({
|
||||
currentTab: 'password'
|
||||
})
|
||||
},
|
||||
// 忘记密码
|
||||
wangji() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/wangjimima/wangjimima',
|
||||
})
|
||||
},
|
||||
// 账号密码登录提交
|
||||
submit(){
|
||||
const that = this
|
||||
const phone = this.data.inputValue;
|
||||
const password = this.data.inputValuepassword;
|
||||
// 手机号验证(6~11位数字)
|
||||
if (!/^\d{6,11}$/.test(phone)) {
|
||||
wx.showToast({
|
||||
title: '请输入6到11位的账号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 密码验证(6~10位字符)
|
||||
if (!/^.{6,10}$/.test(password)) {
|
||||
wx.showToast({
|
||||
title: '请输入6到10位的密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 勾选校验
|
||||
if (this.data.isAgree!=true) {
|
||||
wx.showToast({
|
||||
title: '请先勾选协议',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log("sakldhasjdhja");
|
||||
wx.request({
|
||||
url: url + '/userInfo/mini/pwd/login',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phoneNumber: this.data.inputValue,
|
||||
userPassword: this.data.inputValuepassword
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success(res) {
|
||||
console.log('登录成功', res);
|
||||
if(res.data.code==1){
|
||||
wx.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
wx.setStorage({
|
||||
key: "logmessage",
|
||||
data: {
|
||||
Authorization:res.data.data
|
||||
},
|
||||
success() {
|
||||
console.log("信息存储成功");
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
that.setmessage();
|
||||
wx.switchTab({
|
||||
url: '/pages/jiedan/jiedan',
|
||||
});
|
||||
}, 2000);
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error('请求失败', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 勾选
|
||||
onAgreeChange(e) {
|
||||
this.setData({
|
||||
isAgree: true
|
||||
});
|
||||
console.log("gaibianler",this.data.isAgree);
|
||||
},
|
||||
// 获取验证码
|
||||
getcode(){
|
||||
const phone = this.data.yanzhengphone;
|
||||
if (!/^\d{11}$/.test(phone)) {
|
||||
wx.showToast({
|
||||
title: '请输入11位的手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.request({
|
||||
url: url + '/userInfo/code',
|
||||
method: 'POST',
|
||||
data: {
|
||||
templateString: this.data.yanzhengphone
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success(res) {
|
||||
console.log('发送成功', res);
|
||||
if(res.data.code==1){
|
||||
wx.showToast({
|
||||
title: '发送成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error('请求失败', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 验证码登录提交
|
||||
submityanzhengma(){
|
||||
const _this = this;
|
||||
const code = this.data.yanzhengcode
|
||||
if (!/^\d{6}$/.test(code)) {
|
||||
wx.showToast({
|
||||
title: '请输入6位的有效验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.data.isAgree!=true) {
|
||||
wx.showToast({
|
||||
title: '请先勾选协议',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log("sakldhasjdhja");
|
||||
wx.request({
|
||||
url: url + '/userInfo/mini/vcd/login',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phoneNumber: this.data.yanzhengphone,
|
||||
verificationCode: this.data.yanzhengcode
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success(res) {
|
||||
console.log('登录成功', res);
|
||||
if(res.data.code==1){
|
||||
wx.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
wx.setStorage({
|
||||
key: "logmessage",
|
||||
data: {
|
||||
Authorization:res.data.data
|
||||
},
|
||||
success() {
|
||||
console.log("信息存储成功");
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
_this.setmessage();
|
||||
wx.switchTab({
|
||||
url: '/pages/jiedan/jiedan',
|
||||
});
|
||||
}, 2000);
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error('请求失败', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
setmessage() {
|
||||
const that = this;
|
||||
wx.getStorage({
|
||||
key: "logmessage",
|
||||
success(res) {
|
||||
console.log(res.data, 'sajlkdlasjdkl');
|
||||
const userinfo = res.data;
|
||||
wx.request({
|
||||
url: url + '/userInfo/get/jwt',
|
||||
method: 'GET',
|
||||
data: {},
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': userinfo.Authorization
|
||||
},
|
||||
success(res) {
|
||||
console.log('查询成功', res);
|
||||
if (res.data.code==1) {
|
||||
wx.setStorage({
|
||||
key: "usermessage",
|
||||
data: {
|
||||
nickName:res.data.data.nickName,
|
||||
phoneNumber:res.data.data.phoneNumber,
|
||||
userRole:res.data.data.userRole,
|
||||
invitationCode:res.data.data.invitationCode,
|
||||
userAvatar:res.data.data.userAvatar
|
||||
},
|
||||
success() {
|
||||
console.log("信息存储成功");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error('请求失败', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
fail(err) {
|
||||
console.error("获取 logmessage 失败", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user