|
|
@@ -10,7 +10,7 @@ import Dialog from '@mui/material/Dialog';
|
|
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
|
import DialogContent from '@mui/material/DialogContent';
|
|
|
import DialogActions from '@mui/material/DialogActions';
|
|
|
-import httpRequest from '../http/http'
|
|
|
+import axios from 'axios';
|
|
|
import qs from 'qs';
|
|
|
import SignInModel from '../components/signInModel';
|
|
|
import SignInModelOne from '../components/signModel1';
|
|
|
@@ -71,23 +71,21 @@ function SignUp(props) {
|
|
|
googleId: '',
|
|
|
identity: 1,
|
|
|
}
|
|
|
- httpRequest(`${config.api}api/user`, {
|
|
|
- method: 'POST',
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/json'
|
|
|
- },
|
|
|
- body: JSON.stringify(params)
|
|
|
- }).then(res => {
|
|
|
- console.log(res)
|
|
|
+ axios.defaults.withCredentials = true;
|
|
|
+ axios.post(`${config.api}api/user`, qs.stringify(params)).then(res => {
|
|
|
clearInterval(progressTimer)
|
|
|
- if (res[0].length > 0) {
|
|
|
+ if (res.data.length > 0) {
|
|
|
setProgressValue(100)
|
|
|
- showAlert(props.lang.signInSuccess)
|
|
|
+ showAlert(props.lang.loginSuccess)
|
|
|
+ setAlertShow(true)
|
|
|
setTimeout(() => {
|
|
|
setLoading(false)
|
|
|
setProgressValue(0)
|
|
|
- }, 10)
|
|
|
+ setAlertShow(false)
|
|
|
+ }, 1000)
|
|
|
} else {
|
|
|
+ setLoading(false)
|
|
|
+ setProgressValue(0)
|
|
|
showAlert(res)
|
|
|
setAlertShow(true)
|
|
|
setTimeout(() => {
|
|
|
@@ -95,11 +93,12 @@ function SignUp(props) {
|
|
|
}, 1500);
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
+ setProgressValue(0)
|
|
|
clearInterval(progressTimer)
|
|
|
- showAlert(props.lang.signInFail)
|
|
|
+ setLoading(false)
|
|
|
+ showAlert(props.lang.loginError)
|
|
|
console.log(err)
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
|
|
|
const schoolChange = (e) => {
|
|
|
@@ -117,17 +116,11 @@ function SignUp(props) {
|
|
|
|
|
|
const getSchool = e => {
|
|
|
// 获取学校信息
|
|
|
- httpRequest(`${config.edu}admin/selectorganize`, {
|
|
|
- method: 'POST',
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
- },
|
|
|
- body: qs.stringify({ mode: e })
|
|
|
- }).then(res => {
|
|
|
+ axios.post(`${config.edu}admin/selectorganize`, qs.stringify({ mode: e })).then(res => {
|
|
|
console.log(res)
|
|
|
- if (res[0].length > 0) {
|
|
|
- setSchoolNum(res[0][0].mail)
|
|
|
- setSchoolName(res[0][0].name)
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ setSchoolNum(res.data[0][0].mail)
|
|
|
+ setSchoolName(res.data[0][0].name)
|
|
|
setSchoolShow(true)
|
|
|
} else {
|
|
|
setSchoolName(props.lang.notSchool)
|