♻️ Refactoring code. 重构前端 api url 保持原有微服务请求前缀方式

This commit is contained in:
lbw 2023-03-09 18:41:36 +08:00
parent d8603d88fd
commit 5472d7593d
48 changed files with 301 additions and 266 deletions

3
.env
View File

@ -1,3 +1,6 @@
# 是否是微服务架构(重要)
VITE_IS_MICRO= false
# 前端加密密钥
VITE_PWD_ENC_KEY='pigxpigxpigxpigx'

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export const pageList = (params?: Object) => {
return request({
url: '/admin/appmenu/tree',
url: '/app/appmenu/tree',
method: 'get',
params,
});
@ -10,14 +10,14 @@ export const pageList = (params?: Object) => {
export const info = (id: String) => {
return request({
url: `/admin/appmenu/${id}`,
url: `/app/appmenu/${id}`,
method: 'get',
});
};
export const save = (data: Object) => {
return request({
url: '/admin/appmenu',
url: '/app/appmenu',
method: 'post',
data: data,
});
@ -25,7 +25,7 @@ export const save = (data: Object) => {
export const update = (data: Object) => {
return request({
url: '/admin/appmenu',
url: '/app/appmenu',
method: 'put',
data: data,
});
@ -33,7 +33,7 @@ export const update = (data: Object) => {
export const addObj = (data: Object) => {
return request({
url: '/admin/appmenu',
url: '/app/appmenu',
method: 'post',
data: data,
});
@ -41,7 +41,7 @@ export const addObj = (data: Object) => {
export function delObj(ids?: object) {
return request({
url: '/admin/appmenu',
url: '/app/appmenu',
method: 'delete',
data: ids,
});
@ -49,14 +49,14 @@ export function delObj(ids?: object) {
export function getDetails(obj: Object) {
return request({
url: '/admin/appmenu/details/' + obj,
url: '/app/appmenu/details/' + obj,
method: 'get',
});
}
export function getDetailsByName(obj: Object) {
return request({
url: '/admin/appmenu/detailsByName/' + obj,
url: '/app/appmenu/detailsByName/' + obj,
method: 'get',
});
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) {
return request({
url: '/admin/approle/page',
url: '/app/approle/page',
method: 'get',
params: query,
});
@ -10,14 +10,14 @@ export function fetchList(query: any) {
export function list() {
return request({
url: '/admin/approle/list',
url: '/app/approle/list',
method: 'get',
});
}
export function addObj(obj: any) {
return request({
url: '/admin/approle',
url: '/app/approle',
method: 'post',
data: obj,
});
@ -25,14 +25,14 @@ export function addObj(obj: any) {
export function getObj(id: string) {
return request({
url: '/admin/approle/' + id,
url: '/app/approle/' + id,
method: 'get',
});
}
export function delObj(ids?: object) {
return request({
url: '/admin/approle',
url: '/app/approle',
method: 'delete',
data: ids,
});
@ -40,7 +40,7 @@ export function delObj(ids?: object) {
export function putObj(obj: any) {
return request({
url: '/admin/approle',
url: '/app/approle',
method: 'put',
data: obj,
});
@ -48,14 +48,14 @@ export function putObj(obj: any) {
export function fetchRoleTree(roleId: string) {
return request({
url: '/admin/appmenu/tree/' + roleId,
url: '/app/appmenu/tree/' + roleId,
method: 'get',
});
}
export function permissionUpd(roleId: string, menuIds: string) {
return request({
url: '/admin/approle/menu',
url: '/app/approle/menu',
method: 'put',
data: {
roleId: roleId,
@ -66,14 +66,14 @@ export function permissionUpd(roleId: string, menuIds: string) {
export function getDetails(obj: Object) {
return request({
url: '/admin/approle/details/' + obj,
url: '/app/approle/details/' + obj,
method: 'get',
});
}
export function getDetailsByCode(obj: Object) {
return request({
url: '/admin/approle/detailsByCode/' + obj,
url: '/app/approle/detailsByCode/' + obj,
method: 'get',
});
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) {
return request({
url: '/admin/approlemenu/page',
url: '/app/approlemenu/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query: any) {
export function addObj(obj: any) {
return request({
url: '/admin/approlemenu',
url: '/app/approlemenu',
method: 'post',
data: obj,
});
@ -18,21 +18,21 @@ export function addObj(obj: any) {
export function getObj(id: string) {
return request({
url: '/admin/approlemenu/' + id,
url: '/app/approlemenu/' + id,
method: 'get',
});
}
export function delObj(id: string) {
return request({
url: '/admin/approlemenu/' + id,
url: '/app/approlemenu/' + id,
method: 'delete',
});
}
export function putObj(obj: string) {
return request({
url: '/admin/approlemenu',
url: '/app/approlemenu',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/appsocial/page',
url: '/app/appsocial/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/appsocial',
url: '/app/appsocial',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/appsocial/' + id,
url: '/app/appsocial/' + id,
method: 'get',
});
}
export function delObj(ids?: object) {
return request({
url: '/admin/appsocial/',
url: '/app/appsocial/',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObj(ids?: object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/appsocial',
url: '/app/appsocial',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) {
return request({
url: '/admin/appuser/page',
url: '/app/appuser/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query: any) {
export function addObj(obj: any) {
return request({
url: '/admin/appuser',
url: '/app/appuser',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj: any) {
export function getObj(id: string) {
return request({
url: '/admin/appuser/' + id,
url: '/app/appuser/' + id,
method: 'get',
});
}
export function delObj(ids?: object) {
return request({
url: '/admin/appuser/',
url: '/app/appuser/',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObj(ids?: object) {
export function putObj(obj: any) {
return request({
url: '/admin/appuser',
url: '/app/appuser',
method: 'put',
data: obj,
});
@ -41,14 +41,14 @@ export function putObj(obj: any) {
export function getDetails(obj: Object) {
return request({
url: '/admin/appuser/details/' + obj,
url: '/app/appuser/details/' + obj,
method: 'get',
});
}
export function getDetailsByPhone(obj: Object) {
return request({
url: '/admin/appuser/detailsByPhone/' + obj,
url: '/app/appuser/detailsByPhone/' + obj,
method: 'get',
});
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) {
return request({
url: '/admin/appuserrole/page',
url: '/app/appuserrole/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query: any) {
export function addObj(obj: any) {
return request({
url: '/admin/appuserrole',
url: '/app/appuserrole',
method: 'post',
data: obj,
});
@ -18,21 +18,21 @@ export function addObj(obj: any) {
export function getObj(id: string) {
return request({
url: '/admin/appuserrole/' + id,
url: '/app/appuserrole/' + id,
method: 'get',
});
}
export function delObj(id: string) {
return request({
url: '/admin/appuserrole/' + id,
url: '/app/appuserrole/' + id,
method: 'delete',
});
}
export function putObj(obj: any) {
return request({
url: '/admin/appuserrole',
url: '/app/appuserrole',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) {
return request({
url: '/admin/sys-job-log/page',
url: '/daemon/sys-job-log/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query: any) {
export function delObjs(ids: object) {
return request({
url: '/admin/sys-job-log',
url: '/daemon/sys-job-log',
method: 'delete',
data: ids,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/sys-job/page',
url: '/daemon/sys-job/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/sys-job',
url: '/daemon/sys-job',
method: 'post',
data: obj,
});
@ -18,21 +18,21 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/sys-job/' + id,
url: '/daemon/sys-job/' + id,
method: 'get',
});
}
export function delObj(id?: string) {
return request({
url: '/admin/sys-job/' + id,
url: '/daemon/sys-job/' + id,
method: 'delete',
});
}
export function putObj(obj?: Object) {
return request({
url: '/admin/sys-job',
url: '/daemon/sys-job',
method: 'put',
data: obj,
});
@ -40,21 +40,21 @@ export function putObj(obj?: Object) {
export function startJobRa(jobId: string) {
return request({
url: '/admin/sys-job/start-job/' + jobId,
url: '/daemon/sys-job/start-job/' + jobId,
method: 'post',
});
}
export function runJobRa(jobId: string) {
return request({
url: '/admin/sys-job/run-job/' + jobId,
url: '/daemon/sys-job/run-job/' + jobId,
method: 'post',
});
}
export function shutDownJobRa(jobId: string) {
return request({
url: '/admin/sys-job/shutdown-job/' + jobId,
url: '/daemon/sys-job/shutdown-job/' + jobId,
method: 'post',
});
}

View File

@ -11,7 +11,7 @@ export const login = (data: any) => {
const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_PASSWORD_CLIENT);
Session.set('basicAuth', basicAuth);
return request({
url: '/admin/oauth2/token',
url: '/auth/oauth2/token',
method: 'post',
params: data,
headers: {
@ -29,7 +29,7 @@ export const loginByMobile = (mobile: any, code: any) => {
Session.set('basicAuth', basicAuth);
return request({
url: '/admin/oauth2/token',
url: '/auth/oauth2/token',
headers: {
isToken: false,
'TENANT-ID': '1',
@ -47,7 +47,7 @@ export const loginBySocial = (state: string, code: string) => {
Session.set('basicAuth', basicAuth);
return request({
url: '/admin/oauth2/token',
url: '/auth/oauth2/token',
headers: {
isToken: false,
'TENANT-ID': '1',
@ -60,7 +60,7 @@ export const loginBySocial = (state: string, code: string) => {
export const sendMobileCode = (mobile: any) => {
return request({
url: '/admin/mobile/' + mobile,
url: '/auth/mobile/' + mobile,
method: 'get',
});
};
@ -72,7 +72,7 @@ export const refreshTokenApi = (refresh_token: string) => {
const basicAuth = Session.get('basicAuth');
return request({
url: '/admin/oauth2/token',
url: '/auth/oauth2/token',
headers: {
isToken: false,
'TENANT-ID': '1',
@ -90,7 +90,7 @@ export const refreshTokenApi = (refresh_token: string) => {
export const checkToken = (refreshTime: number, refreshLock: boolean) => {
const basicAuth = Session.get('basicAuth');
request({
url: '/admin/token/check_token',
url: '/auth/token/check_token',
headers: {
isToken: false,
Authorization: basicAuth,
@ -131,7 +131,7 @@ export const checkToken = (refreshTime: number, refreshLock: boolean) => {
*/
export const getUserInfo = () => {
return request({
url: '/admin/user/info',
url: '/auth/user/info',
method: 'get',
});
};

View File

@ -19,7 +19,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/wx-account-fans/page',
url: '/mp/wx-account-fans/page',
method: 'get',
params: query,
});
@ -27,7 +27,7 @@ export function fetchList(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-account-fans',
url: '/mp/wx-account-fans',
method: 'post',
data: obj,
});
@ -35,28 +35,28 @@ export function addObj(obj) {
export function sync(appId) {
return request({
url: '/admin/wx-account-fans/sync/' + appId,
url: '/mp/wx-account-fans/sync/' + appId,
method: 'post',
});
}
export function getObj(id) {
return request({
url: '/admin/wx-account-fans/' + id,
url: '/mp/wx-account-fans/' + id,
method: 'get',
});
}
export function delObjs(id) {
return request({
url: '/admin/wx-account-fans/' + id,
url: '/mp/wx-account-fans/' + id,
method: 'delete',
});
}
export function putObj(obj) {
return request({
url: '/admin/wx-account-fans',
url: '/mp/wx-account-fans',
method: 'put',
data: obj,
});
@ -64,7 +64,7 @@ export function putObj(obj) {
export function black(obj, appid) {
return request({
url: '/admin/wx-account-fans/black/' + appid,
url: '/mp/wx-account-fans/black/' + appid,
method: 'post',
data: obj,
});
@ -72,7 +72,7 @@ export function black(obj, appid) {
export function unblack(obj, appid) {
return request({
url: '/admin/wx-account-fans/unblack/' + appid,
url: '/mp/wx-account-fans/unblack/' + appid,
method: 'post',
data: obj,
});

View File

@ -19,7 +19,7 @@ import request from '/@/utils/request';
export function getPage(query) {
return request({
url: '/admin/wx-account-tag/page',
url: '/mp/wx-account-tag/page',
method: 'get',
params: query,
});
@ -27,7 +27,7 @@ export function getPage(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-account-tag',
url: '/mp/wx-account-tag',
method: 'post',
data: obj,
});
@ -35,7 +35,7 @@ export function addObj(obj) {
export function delObjs(obj) {
return request({
url: '/admin/wx-account-tag',
url: '/mp/wx-account-tag',
method: 'delete',
data: obj,
});
@ -43,7 +43,7 @@ export function delObjs(obj) {
export function putObj(obj) {
return request({
url: '/admin/wx-account-tag',
url: '/mp/wx-account-tag',
method: 'put',
data: obj,
});
@ -51,14 +51,14 @@ export function putObj(obj) {
export function sync(appId) {
return request({
url: '/admin/wx-account-tag/sync/' + appId,
url: '/mp/wx-account-tag/sync/' + appId,
method: 'post',
});
}
export function list(appId) {
return request({
url: '/admin/wx-account-tag/list/',
url: '/mp/wx-account-tag/list/',
method: 'get',
params: { wxAccountAppid: appId },
});

View File

@ -19,7 +19,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/wx-account/page',
url: '/mp/wx-account/page',
method: 'get',
params: query,
});
@ -27,7 +27,7 @@ export function fetchList(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-account',
url: '/mp/wx-account',
method: 'post',
data: obj,
});
@ -35,35 +35,35 @@ export function addObj(obj) {
export function getObj(id) {
return request({
url: '/admin/wx-account/' + id,
url: '/mp/wx-account/' + id,
method: 'get',
});
}
export function generateQr(appid) {
return request({
url: '/admin/wx-account/qr/' + appid,
url: '/mp/wx-account/qr/' + appid,
method: 'post',
});
}
export function clearQuota(appid) {
return request({
url: '/admin/wx-account/clear-quota/' + appid,
url: '/mp/wx-account/clear-quota/' + appid,
method: 'post',
});
}
export function delObjs(id) {
return request({
url: '/admin/wx-account/' + id,
url: '/mp/wx-account/' + id,
method: 'delete',
});
}
export function putObj(obj) {
return request({
url: '/admin/wx-account',
url: '/mp/wx-account',
method: 'put',
data: obj,
});
@ -71,14 +71,14 @@ export function putObj(obj) {
export function fetchAccountList() {
return request({
url: '/admin/wx-account/list',
url: '/mp/wx-account/list',
method: 'get',
});
}
export function fetchStatistics(q) {
return request({
url: '/admin/wx-account/statistics',
url: '/mp/wx-account/statistics',
method: 'get',
params: q,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function getPage(query) {
return request({
url: '/admin/wx-auto-reply/page',
url: '/mp/wx-auto-reply/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function getPage(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-auto-reply',
url: '/mp/wx-auto-reply',
method: 'post',
data: obj,
});
@ -18,21 +18,21 @@ export function addObj(obj) {
export function getObj(id) {
return request({
url: '/admin/wx-auto-reply/' + id,
url: '/mp/wx-auto-reply/' + id,
method: 'get',
});
}
export function delObj(id) {
return request({
url: '/admin/wx-auto-reply/' + id,
url: '/mp/wx-auto-reply/' + id,
method: 'delete',
});
}
export function putObj(obj) {
return request({
url: '/admin/wx-auto-reply',
url: '/mp/wx-auto-reply',
method: 'put',
data: obj,
});

View File

@ -19,7 +19,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/wx-fans-msg/page',
url: '/mp/wx-fans-msg/page',
method: 'get',
params: query,
});
@ -27,7 +27,7 @@ export function fetchList(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-fans-msg',
url: '/mp/wx-fans-msg',
method: 'post',
data: obj,
});
@ -35,21 +35,21 @@ export function addObj(obj) {
export function getObj(id) {
return request({
url: '/admin/wxfansmsg/' + id,
url: '/mp/wxfansmsg/' + id,
method: 'get',
});
}
export function delObjs(id) {
return request({
url: '/admin/wxfansmsg/' + id,
url: '/mp/wxfansmsg/' + id,
method: 'delete',
});
}
export function putObj(obj) {
return request({
url: '/admin/wxfansmsg',
url: '/mp/wxfansmsg',
method: 'put',
data: obj,
});
@ -57,7 +57,7 @@ export function putObj(obj) {
export function fetchResList(query) {
return request({
url: '/admin/wx-fans-msg/page',
url: '/mp/wx-fans-msg/page',
method: 'get',
params: query,
});
@ -65,7 +65,7 @@ export function fetchResList(query) {
export function addResObj(obj) {
return request({
url: '/admin/wx-fans-msg',
url: '/mp/wx-fans-msg',
method: 'post',
data: obj,
});
@ -73,7 +73,7 @@ export function addResObj(obj) {
export function delResObj(id) {
return request({
url: '/admin/wx-fans-msg/' + id,
url: '/mp/wx-fans-msg/' + id,
method: 'delete',
});
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function getPage(query) {
return request({
url: '/admin/wx-material/page',
url: '/mp/wx-material/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function getPage(query) {
export function addObj(obj) {
return request({
url: '/admin/wx-material/materialNews',
url: '/mp/wx-material/materialNews',
method: 'post',
data: obj,
});
@ -18,7 +18,7 @@ export function addObj(obj) {
export function materialNewsUpdate(obj) {
return request({
url: '/admin/wx-material/materialNews',
url: '/mp/wx-material/materialNews',
method: 'put',
data: obj,
});
@ -26,14 +26,14 @@ export function materialNewsUpdate(obj) {
export function getObj(id) {
return request({
url: '/admin/wx-material/' + id,
url: '/mp/wx-material/' + id,
method: 'get',
});
}
export function delObj(query) {
return request({
url: '/admin/wx-material',
url: '/mp/wx-material',
method: 'delete',
params: query,
});
@ -41,7 +41,7 @@ export function delObj(query) {
export function putObj(obj) {
return request({
url: '/admin/wx-material',
url: '/mp/wx-material',
method: 'put',
data: obj,
});
@ -49,7 +49,7 @@ export function putObj(obj) {
export function getMaterialOther(query) {
return request({
url: '/admin/wx-material/materialOther',
url: '/mp/wx-material/materialOther',
method: 'get',
params: query,
responseType: 'blob',
@ -58,7 +58,7 @@ export function getMaterialOther(query) {
export function getMaterialVideo(query) {
return request({
url: '/admin/wx-material/materialVideo',
url: '/mp/wx-material/materialVideo',
method: 'get',
params: query,
});
@ -66,7 +66,7 @@ export function getMaterialVideo(query) {
export function getTempMaterialOther(query) {
return request({
url: '/admin/wx-material/tempMaterialOther',
url: '/mp/wx-material/tempMaterialOther',
method: 'get',
params: query,
responseType: 'blob',

View File

@ -19,14 +19,14 @@ import request from '/@/utils/request';
export function getObj(id) {
return request({
url: '/admin/wx-menu/' + id,
url: '/mp/wx-menu/' + id,
method: 'get',
});
}
export function saveObj(appId, data) {
return request({
url: '/admin/wx-menu/' + appId,
url: '/mp/wx-menu/' + appId,
method: 'post',
data: data,
});
@ -34,7 +34,7 @@ export function saveObj(appId, data) {
export function publishObj(id) {
return request({
url: '/admin/wx-menu/' + id,
url: '/mp/wx-menu/' + id,
method: 'put',
});
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/leave-bill/page',
url: '/act/leave-bill/page',
method: 'get',
params: query
})
@ -10,7 +10,7 @@ export function fetchList(query) {
export function addObj(obj) {
return request({
url: '/admin/leave-bill',
url: '/act/leave-bill',
method: 'post',
data: obj
})
@ -18,21 +18,21 @@ export function addObj(obj) {
export function getObj(id) {
return request({
url: '/admin/leave-bill/' + id,
url: '/act/leave-bill/' + id,
method: 'get'
})
}
export function submit(id) {
return request({
url: '/admin/leave-bill/submit/' + id,
url: '/act/leave-bill/submit/' + id,
method: 'get'
})
}
export function delObj(ids?: Object) {
return request({
url: '/admin/leave-bill',
url: '/act/leave-bill',
method: 'delete',
data: ids
})
@ -40,7 +40,7 @@ export function delObj(ids?: Object) {
export function putObj(obj) {
return request({
url: '/admin/leave-bill/',
url: '/act/leave-bill/',
method: 'put',
data: obj
})

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/model',
url: '/act/model',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query) {
export function delObj(ids: Object) {
return request({
url: '/admin/model',
url: '/act/model',
method: 'delete',
data: ids,
});
@ -18,14 +18,14 @@ export function delObj(ids: Object) {
export function deploy(id) {
return request({
url: '/admin/model/deploy/' + id,
url: '/act/model/deploy/' + id,
method: 'post',
});
}
export function addObj(obj?: Object) {
return request({
url: '/admin/model/insert',
url: '/act/model/insert',
method: 'post',
data: obj,
});
@ -33,14 +33,14 @@ export function addObj(obj?: Object) {
export function getObj(id) {
return request({
url: '/admin/log/' + id,
url: '/act/log/' + id,
method: 'get',
});
}
export function putObj(obj) {
return request({
url: '/admin/log/',
url: '/act/log/',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/process',
url: '/act/process',
method: 'get',
params: query
})
@ -10,7 +10,7 @@ export function fetchList(query) {
export function delObj(ids?: Object) {
return request({
url: '/admin/process',
url: '/act/process',
method: 'delete',
data: ids
})
@ -18,7 +18,7 @@ export function delObj(ids?: Object) {
export function status(id, type) {
return request({
url: '/admin/process/status/' + id + '/' + type,
url: '/act/process/status/' + id + '/' + type,
method: 'put'
})
}

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query) {
return request({
url: '/admin/task/todo',
url: '/act/task/todo',
method: 'get',
params: query,
});
@ -10,21 +10,21 @@ export function fetchList(query) {
export function fetchDetail(id) {
return request({
url: '/admin/task/' + id,
url: '/act/task/' + id,
method: 'get',
});
}
export function fetchComment(id) {
return request({
url: '/admin/task/comment/' + id,
url: '/act/task/comment/' + id,
method: 'get',
});
}
export function doTask(obj) {
return request({
url: '/admin/task',
url: '/act/task',
method: 'post',
data: obj,
});
@ -32,7 +32,7 @@ export function doTask(obj) {
export function delObj(ids?:Object) {
return request({
url: '/admin/task',
url: '/act/task',
method: 'delete',
data: ids
})

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function useBuyApi(amount?: any) {
return request({
url: '/admin/goods/merge/buy',
url: '/pay/goods/merge/buy',
method: 'get',
params: { amount: amount },
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/channel/page',
url: '/pay/channel/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/channel',
url: '/pay/channel',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/channel/' + id,
url: '/pay/channel/' + id,
method: 'get',
});
}
export function delObjs(ids?: Object) {
return request({
url: '/admin/channel',
url: '/pay/channel',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObjs(ids?: Object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/channel',
url: '/pay/channel',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/goods/page',
url: '/pay/goods/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/goods',
url: '/pay/goods',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/goods/' + id,
url: '/pay/goods/' + id,
method: 'get',
});
}
export function delObjs(ids?: Object) {
return request({
url: '/admin/goods',
url: '/pay/goods',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObjs(ids?: Object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/goods',
url: '/pay/goods',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/notify/page',
url: '/pay/notify/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/notify',
url: '/pay/notify',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/notify/' + id,
url: '/pay/notify/' + id,
method: 'get',
});
}
export function delObjs(ids?: Object) {
return request({
url: '/admin/notify',
url: '/pay/notify',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObjs(ids?: Object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/notify',
url: '/pay/notify',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/refund/page',
url: '/pay/refund/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function useRefundApi(obj?: Object) {
return request({
url: '/admin/refund',
url: '/pay/refund',
method: 'post',
data: obj,
});
@ -25,7 +25,7 @@ export function getObj(id?: string) {
export function delObjs(ids?: Object) {
return request({
url: '/admin/refund',
url: '/pay/refund',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObjs(ids?: Object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/refund',
url: '/pay/refund',
method: 'put',
data: obj,
});

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) {
return request({
url: '/admin/trade/page',
url: '/pay/trade/page',
method: 'get',
params: query,
});
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) {
return request({
url: '/admin/trade',
url: '/pay/trade',
method: 'post',
data: obj,
});
@ -18,14 +18,14 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) {
return request({
url: '/admin/trade/' + id,
url: '/pay/trade/' + id,
method: 'get',
});
}
export function delObjs(ids?: Object) {
return request({
url: '/admin/trade',
url: '/pay/trade',
method: 'delete',
data: ids,
});
@ -33,7 +33,7 @@ export function delObjs(ids?: Object) {
export function putObj(obj?: Object) {
return request({
url: '/admin/trade',
url: '/pay/trade',
method: 'put',
data: obj,
});

View File

@ -1,134 +1,135 @@
<!-- excel 导入组件 -->
<template>
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
<el-upload
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:headers="headers"
:action="url"
:disabled="state.upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileError"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ $t('excel.operationNotice') }}
<em>{{ $t('excel.clickUpload') }}</em>
</div>
<template #tip>
<div class="el-upload__tip text-center">
<span>{{ $t('excel.fileFormat') }}</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="downExcelTemp" v-if="tempUrl"
>{{ $t('excel.downloadTemplate') }}
</el-link>
</div>
</template>
</el-upload>
<template #footer>
<el-button type="primary" @click="submitFileForm">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="state.upload.open = false">{{ $t('common.cancelButtonText') }}</el-button>
</template>
</el-dialog>
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
<el-upload
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:headers="headers"
:action="other.adaptationUrl(url)"
:disabled="state.upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileError"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ $t('excel.operationNotice') }}
<em>{{ $t('excel.clickUpload') }}</em>
</div>
<template #tip>
<div class="el-upload__tip text-center">
<span>{{ $t('excel.fileFormat') }}</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="downExcelTemp" v-if="tempUrl"
>{{ $t('excel.downloadTemplate') }}
</el-link>
</div>
</template>
</el-upload>
<template #footer>
<el-button type="primary" @click="submitFileForm">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="state.upload.open = false">{{ $t('common.cancelButtonText') }}</el-button>
</template>
</el-dialog>
<!--校验失败错误数据-->
<el-dialog :title="$t('common.validationFailureData')" v-model="state.errorVisible">
<el-table :data="state.errorData">
<el-table-column property="lineNum" :label="$t('common.lineNumbers')" width="100"></el-table-column>
<el-table-column property="errors" :label="$t('common.misDescription')" show-overflow-tooltip>
<template v-slot="scope">
<el-tag type="danger" v-for="error in scope.row.errors" :key="error">{{ error }} </el-tag>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!--校验失败错误数据-->
<el-dialog :title="$t('common.validationFailureData')" v-model="state.errorVisible">
<el-table :data="state.errorData">
<el-table-column property="lineNum" :label="$t('common.lineNumbers')" width="100"></el-table-column>
<el-table-column property="errors" :label="$t('common.misDescription')" show-overflow-tooltip>
<template v-slot="scope">
<el-tag type="danger" v-for="error in scope.row.errors" :key="error">{{ error }}</el-tag>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script setup lang="ts" name="upload-excel">
import { useMessage } from '/@/hooks/message';
import {useMessage} from '/@/hooks/message';
import other from '/@/utils/other';
import { Session } from '/@/utils/storage';
import {Session} from '/@/utils/storage';
const emit = defineEmits(['sizeChange', 'refreshDataList']);
const prop = defineProps({
url: {
type: String,
},
title: {
type: String,
},
tempUrl: {
type: String,
},
url: {
type: String,
},
title: {
type: String,
},
tempUrl: {
type: String,
},
});
const uploadRef = ref();
const state = reactive({
errorVisible: false,
errorData: [],
dialog: {
title: '',
isShowDialog: false,
},
upload: {
open: false,
isUploading: false,
},
errorVisible: false,
errorData: [],
dialog: {
title: '',
isShowDialog: false,
},
upload: {
open: false,
isUploading: false,
},
});
const downExcelTemp = () => {
other.downBlobFile(prop.tempUrl, {}, 'temp.xlsx');
other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, 'temp.xlsx');
};
const handleFileUploadProgress = () => {
state.upload.isUploading = true;
state.upload.isUploading = true;
};
const handleFileError = () => {
useMessage().error('上传失败,数据格式不合法!');
state.upload.open = false;
useMessage().error('上传失败,数据格式不合法!');
state.upload.open = false;
};
const handleFileSuccess = (response: any) => {
state.upload.isUploading = false;
state.upload.open = false;
uploadRef.value.clearFiles();
state.upload.isUploading = false;
state.upload.open = false;
uploadRef.value.clearFiles();
//
if (response.code === 1) {
useMessage().error('导入失败,以下数据不合法');
state.errorVisible = true;
state.errorData = response.data;
uploadRef.value.clearFiles();
//
emit('refreshDataList');
} else {
useMessage().success(response.msg ? response.msg : '导入成功');
//
emit('refreshDataList');
}
//
if (response.code === 1) {
useMessage().error('导入失败,以下数据不合法');
state.errorVisible = true;
state.errorData = response.data;
uploadRef.value.clearFiles();
//
emit('refreshDataList');
} else {
useMessage().success(response.msg ? response.msg : '导入成功');
//
emit('refreshDataList');
}
};
const submitFileForm = () => {
uploadRef.value.submit();
uploadRef.value.submit();
};
const show = () => {
state.upload.isUploading = false;
state.upload.open = true;
state.upload.isUploading = false;
state.upload.open = true;
};
const headers = computed(() => {
return {
Authorization: 'Bearer ' + Session.getToken(),
'TENANT-ID': Session.getTenant(),
};
return {
Authorization: 'Bearer ' + Session.getToken(),
'TENANT-ID': Session.getTenant(),
};
});
//
defineExpose({
show,
show,
});
</script>

View File

@ -5,7 +5,7 @@
<el-upload
ref="fileUpload"
class="avatar-uploader"
:action="props.uploadFileUrl"
:action="other.adaptationUrl(props.uploadFileUrl)"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
@ -26,6 +26,7 @@
import { useMessage } from '/@/hooks/message';
import { Session } from '/@/utils/storage';
import { watch } from 'vue';
import other from "/@/utils/other";
const imageUrl = ref('');
const fileUpload = ref();

View File

@ -4,7 +4,7 @@
<el-upload
ref="fileUpload"
v-if="props.type === 'default'"
:action="props.uploadFileUrl"
:action="other.adaptationUrl(props.uploadFileUrl)"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:headers="headers"
@ -39,7 +39,7 @@
<el-upload
ref="fileUpload"
v-if="props.type === 'simple'"
:action="props.uploadFileUrl"
:action="other.adaptationUrl(props.uploadFileUrl)"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:headers="headers"
@ -60,6 +60,7 @@
<script setup lang="ts" name="upload-file">
import { useMessage } from '/@/hooks/message';
import { Local, Session } from '/@/utils/storage';
import other from "/@/utils/other";
const props = defineProps({
modelValue: [String, Array],
//

View File

@ -12,6 +12,7 @@ import request from '/@/utils/request';
import { useMessage } from '/@/hooks/message';
// @ts-ignore
import * as CryptoJS from 'crypto-js';
import { validateNull } from './validate';
// 引入组件
const SvgIcon = defineAsyncComponent(() => import('/@/components/svgIcon/index.vue'));
@ -335,6 +336,9 @@ const other = {
getQueryString: (url: string, paraName: string) => {
return getQueryString(url, paraName);
},
adaptationUrl: (url?: string) => {
return adaptationUrl(url);
},
};
export function getQueryString(url: string, paraName: string) {
@ -401,5 +405,27 @@ export function toUnderline(str: string) {
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
}
/**
*
* 1. /act/oa/task ,, /admin/oa/task
* 2. /gen/xxx ,
*
* @param originUrl
*/
const adaptationUrl = (originUrl?: string) => {
// 微服务架构 不做路径转换,为空不做路径转换
const isMicro = import.meta.env.VITE_IS_MICRO;
if (validateNull(isMicro) || isMicro === true) {
return originUrl;
}
// 如果是代码生成服务,不做路径转换
if (originUrl?.startsWith('/gen')) {
return originUrl;
}
// 转为 /admin 路由前缀的请求
return `/admin/${originUrl?.split('/').splice(2).join('/')}`;
};
// 统一批量导出
export default other;

View File

@ -1,7 +1,8 @@
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
import { Session, Local } from '/@/utils/storage';
import { useMessageBox } from '/@/hooks/message';
import qs from 'qs';
import { useMessageBox } from '../hooks/message';
import other from './other';
// 配置新建一个 axios 实例
const service: AxiosInstance = axios.create({
@ -17,7 +18,7 @@ const service: AxiosInstance = axios.create({
// 添加请求拦截器
service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
(config: AxiosRequestConfig) => {
// get查询参数序列化
if (config.method === 'get') {
// @ts-ignore
@ -37,6 +38,8 @@ service.interceptors.request.use(
config.headers!['TENANT-ID'] = Local.get('tenantId');
}
//自动适配单体、微服务架构不同的URL
config.url = other.adaptationUrl(config.url);
return config;
},
(error) => {

View File

@ -125,7 +125,7 @@ const handleSelectionChange = (objs: any) => {
// excel
const exportExcel = () => {
downBlobFile('/admin/approle/export', state.queryForm, 'approle.xlsx');
downBlobFile('/app/approle/export', state.queryForm, 'approle.xlsx');
};
//

View File

@ -145,7 +145,7 @@
// excel
const exportExcel = () => {
downBlobFile('/admin/appsocial/export', state.queryForm, 'appsocial.xlsx');
downBlobFile('/app/appsocial/export', state.queryForm, 'appsocial.xlsx');
};
//

View File

@ -146,7 +146,7 @@ const handleSelectionChange = (objs: any) => {
// excel
const exportExcel = () => {
downBlobFile('/admin/appuser/export', state.queryForm, 'users.xlsx');
downBlobFile('/app/appuser/export', state.queryForm, 'users.xlsx');
};
//

View File

@ -187,7 +187,7 @@
// excel
const exportExcel = () => {
downBlobFile('/admin/sys-job/export', state.queryForm, 'job.xlsx');
downBlobFile('/daemon/sys-job/export', state.queryForm, 'job.xlsx');
};
const handleJobLog = (row: any) => {

View File

@ -131,7 +131,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/schedule/export', state.queryForm, 'schedule.xlsx');
downBlobFile('/daemon/schedule/export', state.queryForm, 'schedule.xlsx');
};
//

View File

@ -172,7 +172,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/fans/export', state.queryForm, 'fans.xlsx');
downBlobFile('/mp/fans/export', state.queryForm, 'fans.xlsx');
};
//

View File

@ -148,7 +148,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/wxAccountTag/export', state.queryForm, 'wxAccountTag.xlsx');
downBlobFile('/mp/wxAccountTag/export', state.queryForm, 'wxAccountTag.xlsx');
};
//

View File

@ -134,7 +134,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/account/export', state.queryForm, 'account.xlsx');
downBlobFile('/mp/account/export', state.queryForm, 'account.xlsx');
};
//

View File

@ -180,7 +180,7 @@ onMounted(() => {
// excel
const exportExcel = () => {
downBlobFile('/admin/wxFansMsg/export', state.queryForm, 'wxFansMsg.xlsx');
downBlobFile('/act/wxFansMsg/export', state.queryForm, 'wxFansMsg.xlsx');
};
//

View File

@ -129,7 +129,7 @@
// excel
const exportExcel = () => {
downBlobFile('/admin/leave-bill/export', state.queryForm, 'leave.xlsx')
downBlobFile('/act/leave-bill/export', state.queryForm, 'leave.xlsx')
}
//
@ -166,4 +166,4 @@
})
})
}
</script>
</script>

View File

@ -107,7 +107,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/task/export', state.queryForm, 'task.xlsx');
downBlobFile('/act/task/export', state.queryForm, 'task.xlsx');
};
//

View File

@ -130,7 +130,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/channel/export', state.queryForm, 'channel.xlsx');
downBlobFile('/pay/channel/export', state.queryForm, 'channel.xlsx');
};
//

View File

@ -131,7 +131,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/goods/export', state.queryForm, 'order.xlsx');
downBlobFile('/pay/goods/export', state.queryForm, 'order.xlsx');
};
//

View File

@ -102,7 +102,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/notify/export', state.queryForm, 'record.xlsx');
downBlobFile('/pay/notify/export', state.queryForm, 'record.xlsx');
};
//

View File

@ -108,7 +108,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/refund/export', state.queryForm, 'refund.xlsx');
downBlobFile('/pay/refund/export', state.queryForm, 'refund.xlsx');
};
//

View File

@ -153,7 +153,7 @@ const resetQuery = () => {
// excel
const exportExcel = () => {
downBlobFile('/admin/trade/export', state.queryForm, 'trade.xlsx');
downBlobFile('/pay/trade/export', state.queryForm, 'trade.xlsx');
};
//