From b89a0526a12788807560d37fd147988dc4ec4567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 9 Jan 2020 17:13:52 +0800 Subject: [PATCH] refine --- mock/index.js | 2 +- src/api/article.js | 10 +++++----- src/api/remote-search.js | 4 ++-- src/api/role.js | 10 +++++----- src/api/user.js | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mock/index.js b/mock/index.js index 217ee3d5388..cedb357b44b 100644 --- a/mock/index.js +++ b/mock/index.js @@ -57,7 +57,7 @@ export function mockXHR() { // for mock server const responseFake = (url, type, respond) => { return { - url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`), + url: new RegExp(`${process.env.VUE_APP_BASE_API}/vue-element-admin${url}`), type: type || 'get', response(req, res) { console.log('request invoke:' + req.path) diff --git a/src/api/article.js b/src/api/article.js index f54b8af6551..407bda163fe 100644 --- a/src/api/article.js +++ b/src/api/article.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function fetchList(query) { return request({ - url: '/article/list', + url: '/vue-element-admin/article/list', method: 'get', params: query }) @@ -10,7 +10,7 @@ export function fetchList(query) { export function fetchArticle(id) { return request({ - url: '/article/detail', + url: '/vue-element-admin/article/detail', method: 'get', params: { id } }) @@ -18,7 +18,7 @@ export function fetchArticle(id) { export function fetchPv(pv) { return request({ - url: '/article/pv', + url: '/vue-element-admin/article/pv', method: 'get', params: { pv } }) @@ -26,7 +26,7 @@ export function fetchPv(pv) { export function createArticle(data) { return request({ - url: '/article/create', + url: '/vue-element-admin/article/create', method: 'post', data }) @@ -34,7 +34,7 @@ export function createArticle(data) { export function updateArticle(data) { return request({ - url: '/article/update', + url: '/vue-element-admin/article/update', method: 'post', data }) diff --git a/src/api/remote-search.js b/src/api/remote-search.js index c7e1911776c..02e42b46e56 100644 --- a/src/api/remote-search.js +++ b/src/api/remote-search.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function searchUser(name) { return request({ - url: '/search/user', + url: '/vue-element-admin/search/user', method: 'get', params: { name } }) @@ -10,7 +10,7 @@ export function searchUser(name) { export function transactionList(query) { return request({ - url: '/transaction/list', + url: '/vue-element-admin/transaction/list', method: 'get', params: query }) diff --git a/src/api/role.js b/src/api/role.js index f6a983f1706..959bbd213f6 100644 --- a/src/api/role.js +++ b/src/api/role.js @@ -2,21 +2,21 @@ import request from '@/utils/request' export function getRoutes() { return request({ - url: '/routes', + url: '/vue-element-admin/routes', method: 'get' }) } export function getRoles() { return request({ - url: '/roles', + url: '/vue-element-admin/roles', method: 'get' }) } export function addRole(data) { return request({ - url: '/role', + url: '/vue-element-admin/role', method: 'post', data }) @@ -24,7 +24,7 @@ export function addRole(data) { export function updateRole(id, data) { return request({ - url: `/role/${id}`, + url: `/vue-element-admin/role/${id}`, method: 'put', data }) @@ -32,7 +32,7 @@ export function updateRole(id, data) { export function deleteRole(id) { return request({ - url: `/role/${id}`, + url: `/vue-element-admin/role/${id}`, method: 'delete' }) } diff --git a/src/api/user.js b/src/api/user.js index de69f70733b..b8b8741caff 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function login(data) { return request({ - url: '/user/login', + url: '/vue-element-admin/user/login', method: 'post', data }) @@ -10,7 +10,7 @@ export function login(data) { export function getInfo(token) { return request({ - url: '/user/info', + url: '/vue-element-admin/user/info', method: 'get', params: { token } }) @@ -18,7 +18,7 @@ export function getInfo(token) { export function logout() { return request({ - url: '/user/logout', + url: '/vue-element-admin/user/logout', method: 'post' }) }