diff --git a/src/api/request.js b/src/api/request.js index f6ab42e..757baf5 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,8 +1,6 @@ import router from "@/router"; import {reactive, ref, toRefs, watch} from "vue"; import axios from 'axios'; -import {getCookie} from "@/api/utils"; -import {BASE} from "@/api/api"; export function usePage(_url, param) { @@ -23,7 +21,7 @@ export function usePage(_url, param) { function fetchData() { state.loading = true request(_url, state.params).then(r => { - state.params.pageNo === 1 ? (state.data = (r.data.records || r.data.rows)) : (state.data = [...state.data, ...(r.data.records || r.data.rows)]) + state.params.pageNo === 1 ? (state.data = (r.data.records||r.data.rows)) : (state.data = [...state.data, ...(r.data.records||r.data.rows)]) state.size = r.data.size state.total = r.data.total state.current = r.data.current @@ -89,7 +87,7 @@ export async function request(_url, params) { 'X-Token': localStorage.getItem('token'), ...method !== 'get' ? {'Content-Type': 'application/json'} : {} }, - baseURL: BASE, + baseURL: '/manageApi-release', ...method !== 'get' ? {data: JSON.stringify(body)} : {} }).then(resp => resp.data).then(response => { if (response.code !== 200 && response.code !== 0) { @@ -111,39 +109,4 @@ export async function request(_url, params) { console.log(e) // router.push({path: '/login'}) }) -} - -export async function boeRequest(_url, params) { - const s = _url.split(' ') - let url = s[0] - const method = s[1]?.toLowerCase() || 'get' - if (method === 'get') { - let paramsArray = []; - //拼接参数 - if (params) { - Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key])) - if (url.search(/\?/) === -1) { - url += '?' + paramsArray.join('&') - } else { - url += '&' + paramsArray.join('&') - } - } - } - const body = method !== 'get' ? params || {} : {} - return axios({ - url, - method, - headers: { - token: getCookie('token'), - ...method !== 'get' ? {'Content-Type': 'application/json'} : {} - }, - baseURL: '', - ...method !== 'get' ? {data: JSON.stringify(body)} : {} - }).then(resp => resp.data).then(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/router/index.js b/src/router/index.js index 3176265..16056b8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -20,7 +20,7 @@ const routes = [ ] const router = createRouter({ - history: createWebHistory("/fe-student"), + history: createWebHistory("/fe-student-release"), routes })