diff --git a/package.json b/package.json index f694a453..91c565dd 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "element-resize-detector": "^1.2.4", "html2canvas": "^1.4.1", "jquery": "^3.6.1", + "json-bigint": "^1.0.0", "mitt": "^3.0.0", "moment": "^2.29.4", "qrcode.vue": "^3.3.3", diff --git a/src/api/request.js b/src/api/request.js index cc035bf9..63628a19 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -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'}) + // }) } \ No newline at end of file diff --git a/src/components/student/TableStudent.vue b/src/components/student/TableStudent.vue index 9e5e6572..8e32e182 100644 --- a/src/components/student/TableStudent.vue +++ b/src/components/student/TableStudent.vue @@ -62,7 +62,7 @@