登录接口

This commit is contained in:
lnn19986213 2022-04-25 10:13:50 +08:00
parent 6435bf1e44
commit a5886b3429
3 changed files with 740 additions and 741 deletions

View File

@ -1,13 +1,6 @@
<template>
<view style="">
<u--form :model="userInfo" ref="loginForm">
<view class="content_main">
<view class="copyright_iocn">
<image style="width: 80rpx; height: 60rpx;" src="../../static/icon10.png" mode=""></image>
@ -23,7 +16,7 @@
<u--input type="password" placeholder="请输入密码" border="bottom" clearable v-model="userInfo.pasw">
</u--input>
</u-form-item>
<u-button text="登录" size="large" throttleTime=1000 color="#99241B" style="margin-top: 84rpx;">
<u-button text="登录" size="large" throttleTime=1000 color="#99241B" style="margin-top: 84rpx;" @click="login()">
</u-button>
<view class="other_op">
<text @click="goRegist">注册账号</text>
@ -53,7 +46,7 @@
return uni.$u.test.mobile(value);
},
message: '请输入格式正确的手机号',
trigger: ['change', 'blur'],
trigger: ['blur'],
}],
'pasw': [{
required: true,
@ -73,10 +66,27 @@
uni.navigateTo({
url: '/pages/Login/RemeberPW'
})
}
},
login(){
let data = {
phone: this.userInfo.number,
pwd: this.userInfo.pasw
}
this.http.request('/auth/loginByPwd', {phone: this.userInfo.number,pwd: this.userInfo.pasw}, "POST").then(res => {
if (res.code == 200) {
uni.navigateTo({
url: '/pages/pageHome/pageHome'
})
}
}).catch(e => {
uni.showToast({
title:e.data.message,
icon:"none",
});
})
}
},
onReady() {
this.$refs.loginForm.setRules(this.rules);
},
}

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
export default {
config: {
// baseUrl: "http://192.168.0.57:8090/api", //王锡
// baseUrl: "http://192.168.0.57:8090/h5/api", //王锡
// baseUrl: "http://192.168.124.110:8088/api", //周源
baseUrl: "http://192.168.0.7:8090/api", //俞燕红
baseUrl: "http://192.168.0.11:8080//h5/api", //俞燕红
// baseUrl: "https://wlsq.ydool.com.cn/api", //线上
header: {
'Content-Type': 'application/json;charset=UTF-8',
@ -52,6 +52,7 @@ export default {
options.complete = (response) => {
// console.log(response, 'response----')
let statusCode = response.statusCode
console.log(statusCode)
response.config = _config
if (process.env.NODE_ENV === 'development') {
if (statusCode === 200) {
@ -74,6 +75,17 @@ export default {
resolve(response.data);
} else if (response.data.code == 401) { //登录过期
reject(response)
} else if (response.data.code == 402) { //信息未完善
uni.showToast({
title: '信息未完善',
icon: 'none',
});
setTimeout(() => {
uni.navigateTo({
url: '../SelectId/SelectId'
})
}, 1200)
} else {
uni.showToast({
title: response.data.msg,
@ -89,12 +101,12 @@ export default {
title: '登录过期',
icon: 'none',
});
setTimeout(()=>{
setTimeout(() => {
uni.navigateTo({
url: '../login/login'
url: '../Login/Login'
})
},1200)
}, 1200)
} else {
uni.getNetworkType({
success: (res) => {