api修改

This commit is contained in:
dzl 2025-05-29 10:43:15 +08:00
parent 1c2e09ab2c
commit 514eecedee
5 changed files with 51 additions and 43 deletions

View File

@ -3,7 +3,9 @@ import {
HttpFileUpload HttpFileUpload
} from './request'; } from './request';
import config from './config'; import config from './config';
export const baseUrl = config.apiUrl; export const apiUrl = config.apiUrl;
let baseUrl = apiUrl
// baseUrl += "ebike/"
export const calluser = (url, parmas = {}) => { export const calluser = (url, parmas = {}) => {
return HttpRequest(baseUrl + "user/" + url, 'post', parmas); return HttpRequest(baseUrl + "user/" + url, 'post', parmas);
@ -36,7 +38,7 @@ export const callCoreApi = (url, parmas = {}, method = 'post') => {
export const callEcuCoreApi = (url, parmas = {}, method = 'post') => { export const callEcuCoreApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "maintenance/testCore/" + url, method, parmas); return HttpRequest(baseUrl + "maintenance/testCore/" + url, method, parmas);
} }
export const fileUpload = (file) => { export const fileUpload = (file) => {
return HttpFileUpload(baseUrl + "maintenance/ebikeBikeInfo/fileUpload", file); return HttpFileUpload(baseUrl + "maintenance/ebikeBikeInfo/fileUpload", file);
} }
@ -59,6 +61,6 @@ export const callMaintenanceApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "maintenance/" + url, method, parmas); return HttpRequest(baseUrl + "maintenance/" + url, method, parmas);
} }
export const fileUploadApi = (url,file) => { export const fileUploadApi = (url, file) => {
return HttpFileUpload(baseUrl + url, file); return HttpFileUpload(baseUrl + url, file);
} }

View File

@ -1,8 +1,10 @@
import httpInstance from '@/utils/request.js' import httpInstance from '@/utils/request.js'
let baseUrl = ""
baseUrl += "/ebike"
const callOperate = (url, parmas = {}, method = "post") => { const callOperate = (url, parmas = {}, method = "post") => {
return httpInstance({ return httpInstance({
baseURL: '/operate', baseURL: baseUrl + '/operate',
url: url, url: url,
method: method, method: method,
data: parmas data: parmas
@ -11,7 +13,7 @@ const callOperate = (url, parmas = {}, method = "post") => {
const callUser = (url, parmas = {}, method = "post") => { const callUser = (url, parmas = {}, method = "post") => {
return httpInstance({ return httpInstance({
baseURL: '/user', baseURL: baseUrl + '/user',
url: url, url: url,
method: method, method: method,
data: parmas data: parmas
@ -20,7 +22,7 @@ const callUser = (url, parmas = {}, method = "post") => {
const callOrder = (url, parmas = {}, method = "post") => { const callOrder = (url, parmas = {}, method = "post") => {
return httpInstance({ return httpInstance({
baseURL: '/order', baseURL: baseUrl + '/order',
url: url, url: url,
method: method, method: method,
data: parmas data: parmas
@ -29,7 +31,7 @@ const callOrder = (url, parmas = {}, method = "post") => {
const callPayment = (url, parmas = {}, method = "post") => { const callPayment = (url, parmas = {}, method = "post") => {
return httpInstance({ return httpInstance({
baseURL: '/payment', baseURL: baseUrl + '/payment',
url: url, url: url,
method: method, method: method,
data: parmas data: parmas

View File

@ -1,45 +1,47 @@
import httpInstance from '@/utils/request.js' import httpInstance from '@/utils/request.js'
let baseUrl = ""
baseUrl += "/ebike"
//登录 //登录
const getLoginAPI = (username, password) => { const getLoginAPI = (username, password) => {
return httpInstance({ return httpInstance({
baseURL: '/user', baseURL: baseUrl + '/user',
url: '/auth/loginByPwd', url: '/auth/loginByPwd',
method: 'POST', method: 'POST',
data: { data: {
username, username,
password password
} }
}) })
} }
const getUserZone = () => { const getUserZone = () => {
return httpInstance({ return httpInstance({
baseURL: '/operate', baseURL: baseUrl + '/operate',
url: '/ebikeRegion/getZone', url: '/ebikeRegion/getZone',
method: 'GET', method: 'GET',
data: {} data: {}
}) })
} }
const getUserOperation = () => { const getUserOperation = () => {
return httpInstance({ return httpInstance({
baseURL: '/operate', baseURL: baseUrl + '/operate',
url: '/ebikeRegion/getOperation', url: '/ebikeRegion/getOperation',
method: 'GET', method: 'GET',
data: {} data: {}
}) })
} }
//退出登录 //退出登录
const getLogoutAPI = () => { const getLogoutAPI = () => {
return httpInstance({ return httpInstance({
baseURL: '/user', baseURL: baseUrl + '/user',
url: '/auth/logout', url: '/auth/logout',
method: 'POST', method: 'POST',
data: {} data: {}
}) })
} }
export { getLoginAPI, getUserZone, getUserOperation, getLogoutAPI } export { getLoginAPI, getUserZone, getUserOperation, getLogoutAPI }

View File

@ -5,9 +5,9 @@ import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'; import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
let targetUrl = 'http://127.0.0.1:10010/' let targetUrl = 'http://192.168.2.151:10010/'
//targetUrl = 'https://attiya.fun/ebike/' //targetUrl = 'https://attiya.fun/ebike/'
// targetUrl = 'https://www.cdzhuojing.cn/' targetUrl = 'https://www.cdzhuojing.cn/'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
@ -30,7 +30,7 @@ export default defineConfig({
}, },
server: { server: {
proxy: { proxy: {
'^/operate/*': { '^/ebike/operate/*': {
changeOrigin: true, changeOrigin: true,
target: targetUrl, target: targetUrl,
rewrite: (path) => { rewrite: (path) => {
@ -44,7 +44,7 @@ export default defineConfig({
// res.setHeader('x-res-proxyUrl',proxyUrl) // res.setHeader('x-res-proxyUrl',proxyUrl)
// } // }
}, },
'^/maintenance/*': { '^/ebike/maintenance/*': {
changeOrigin: true, changeOrigin: true,
target: targetUrl, target: targetUrl,
rewrite: (path) => { rewrite: (path) => {
@ -58,7 +58,7 @@ export default defineConfig({
// res.setHeader('x-res-proxyUrl',proxyUrl) // res.setHeader('x-res-proxyUrl',proxyUrl)
// } // }
}, },
'^/user/*': { '^/ebike/user/*': {
changeOrigin: true, changeOrigin: true,
target: targetUrl, target: targetUrl,
rewrite: (path) => { rewrite: (path) => {
@ -72,7 +72,7 @@ export default defineConfig({
// res.setHeader('x-res-proxyUrl',proxyUrl) // res.setHeader('x-res-proxyUrl',proxyUrl)
// } // }
}, },
'^/order/*': { '^/ebike/order/*': {
changeOrigin: true, changeOrigin: true,
target: targetUrl, target: targetUrl,
rewrite: (path) => { rewrite: (path) => {
@ -86,7 +86,7 @@ export default defineConfig({
// res.setHeader('x-res-proxyUrl',proxyUrl) // res.setHeader('x-res-proxyUrl',proxyUrl)
// } // }
}, },
'^/payment/*': { '^/ebike/payment/*': {
changeOrigin: true, changeOrigin: true,
target: targetUrl, target: targetUrl,
rewrite: (path) => { rewrite: (path) => {

View File

@ -3,7 +3,9 @@ import {
HttpFileUpload HttpFileUpload
} from './request'; } from './request';
import config from './config'; import config from './config';
export const baseUrl = config.apiUrl; export const apiUrl = config.apiUrl;
let baseUrl = apiUrl
baseUrl += "ebike/"
export const callCoreApi = (url, parmas = {}, method = 'post') => { export const callCoreApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "maintenance/core/" + url, method, parmas); return HttpRequest(baseUrl + "maintenance/core/" + url, method, parmas);
@ -34,4 +36,4 @@ export const fileUploadUser = (file) => {
export const fileUploadUserPicture = (file) => { export const fileUploadUserPicture = (file) => {
return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUploadUserPicture", file); return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUploadUserPicture", file);
} }