mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 12:56:45 +08:00
-- 添加学员
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {reactive, ref, toRefs, watch} from "vue";
|
||||
import axios from 'axios';
|
||||
import {getCookie} from "@/api/method";
|
||||
import JSONBigInt from 'json-bigint';
|
||||
|
||||
|
||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||
export function useBoeApiPage(_url, params = {}, config = {
|
||||
init: true,
|
||||
result: res => res.result,
|
||||
@@ -23,6 +23,8 @@ export function useBoeApiPage(_url, params = {}, config = {
|
||||
console.log('params', params)
|
||||
state.loading = true
|
||||
return request(_url, params).then(r => {
|
||||
console.log(2222222222222)
|
||||
console.log(r)
|
||||
state.data = config.result(r)
|
||||
state.totalPage = config.totalPage(r)
|
||||
state.total = config.total(r)
|
||||
@@ -136,34 +138,35 @@ export async function request(_url, params) {
|
||||
}
|
||||
}
|
||||
const body = method !== 'get' ? params || {} : {}
|
||||
console.log('token', getCookie('token'))
|
||||
return axios({
|
||||
url,
|
||||
return fetch(url,{
|
||||
method,
|
||||
headers: {
|
||||
headers:{
|
||||
token: getCookie('token'),
|
||||
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||
},
|
||||
baseURL: '',
|
||||
...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
||||
}).then(resp => resp.data).then(response => {
|
||||
console.log(response)
|
||||
// if (response.status !== 200 && response.code !== 0) {
|
||||
// if (response.code === 3 || response.code === 4 || response.code === 100) {
|
||||
// router.push({path: '/login'})
|
||||
// return
|
||||
// } else {
|
||||
// response.showMsg && notification.open({
|
||||
// message: response.showMsg,
|
||||
// duration: 2,
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
return response
|
||||
}).catch(e => {
|
||||
console.log(2222)
|
||||
console.log(e)
|
||||
// router.push({path: '/login'})
|
||||
...method !== 'get' ? {body: JSON.stringify(body)} : {}
|
||||
}).then(res=>{
|
||||
return res.text()
|
||||
}).then(res=>{
|
||||
return JSONBigIntStr.parse(res)
|
||||
})
|
||||
// return axios({
|
||||
// url,
|
||||
// method,
|
||||
// headers: {
|
||||
// token: getCookie('token'),
|
||||
// ...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||
// },
|
||||
// baseURL: '',
|
||||
// ...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
||||
// }).then(resp => {
|
||||
// return resp.data
|
||||
// }).then(response => {
|
||||
// console.log(response)
|
||||
// return response
|
||||
// }).catch(e => {
|
||||
// console.log(2222)
|
||||
// console.log(e)
|
||||
// // router.push({path: '/login'})
|
||||
// })
|
||||
}
|
||||
Reference in New Issue
Block a user