mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-12 20:36:48 +08:00
init
This commit is contained in:
@@ -85,23 +85,25 @@ export async function request(_url, params) {
|
|||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
'X-Token': localStorage.getItem('token'),
|
'token': getCookie('token'),
|
||||||
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||||
},
|
},
|
||||||
baseURL: import.meta.env.VITE_BASE_API,
|
baseURL: import.meta.env.VITE_BASE_API,
|
||||||
...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
||||||
}).then(resp => resp.data).then(response => {
|
}).then(resp => resp.data).then(response => {
|
||||||
if (response.code !== 200 && response.code !== 0) {
|
if (response.code !== 200 && response.code !== 0) {
|
||||||
console.log(1111111111)
|
if (response.code === 1000) {
|
||||||
console.log(response.code)
|
import.meta.env.DEV ? router.push({path: '/login'}) : window.open(import.meta.env.VITE_BASE_LOGIN_URL)
|
||||||
if (import.meta.env.DEV && response.code === 1000) {
|
}
|
||||||
router.push({path: '/login'})
|
// if (import.meta.env.DEV && response.code === 1000) {
|
||||||
} else {
|
// router.push({path: '/login'})
|
||||||
|
// } else {
|
||||||
|
// window.open()
|
||||||
// response.showMsg && notification.open({
|
// response.showMsg && notification.open({
|
||||||
// message: response.showMsg,
|
// message: response.showMsg,
|
||||||
// duration: 2,
|
// duration: 2,
|
||||||
// });
|
// });
|
||||||
}
|
// }
|
||||||
throw new Error('接口异常')
|
throw new Error('接口异常')
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user