添加了一些页面

This commit is contained in:
qianlile
2021-08-17 13:36:34 +08:00
parent 7c061bbb9b
commit a341927725
47 changed files with 2430 additions and 686 deletions

View File

@@ -23,32 +23,40 @@ Page({
//获取验证码图片和uuid
async getCaptchaImage(){
const res = await loginApi('/captchaImage',{ method:'GET' });
const res = await loginApi('/captchaImage',{ method:'get' });
const data = JSON.parse(res.result)
this.setData({
img:res.data.img,
uuid:res.data.uuid
img:data.img,
uuid:data.uuid
})
},
//登录
async submit(){
const res = await loginApi('/login',{
wx.showLoading({
title: '正在登录',
})
const res = await loginApi('/login',{
method:'POST',
data:{
body:{
code:this.data.value,
uuid:this.data.uuid,
password: this.data.password,
username: this.data.username
},
json:true
})
if (res.data.code !== 200) {
wx.hideLoading();
if (res.result.code !== 200) {
wx.showToast({
title: '登录失败',
title: res.result.msg,
icon:'error'
});
this.getCaptchaImage();
return;
}
wx.setStorageSync('token', res.data.token);
wx.setStorageSync('token', res.result.token);
wx.switchTab({
url: '/pages/index/index',
})