swagger文档展示开发
This commit is contained in:
6
zyplayer-doc-ui/swagger-ui/src/api/custom.js
Normal file
6
zyplayer-doc-ui/swagger-ui/src/api/custom.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import apiClient from './request/custom.js'
|
||||
|
||||
export const customApi = {
|
||||
post: (url, data) => apiClient({url: url, method: 'post', data: data}),
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export { zyplayerApi } from './zyplayer.js';
|
||||
export { customApi } from './custom.js';
|
||||
|
||||
|
||||
|
||||
14
zyplayer-doc-ui/swagger-ui/src/api/request/custom.js
Normal file
14
zyplayer-doc-ui/swagger-ui/src/api/request/custom.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import Axios from 'axios'
|
||||
import interceptors from './interceptors'
|
||||
import {getCustomApiBaseUrl} from "./utils";
|
||||
|
||||
const apiClient = Axios.create({
|
||||
baseURL: getCustomApiBaseUrl(),
|
||||
timeout: 20000,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
withCredentials: true
|
||||
});
|
||||
interceptors(apiClient);
|
||||
|
||||
export default apiClient;
|
||||
|
||||
@@ -4,7 +4,7 @@ import {getZyplayerApiBaseUrl} from "./utils";
|
||||
|
||||
// 增加不需要验证结果的标记
|
||||
const noValidate = {
|
||||
"/zyplayer-doc-db/executor/execute": true,
|
||||
"./swagger-resources": true,
|
||||
"/zyplayer-doc-db/datasource/test": true,
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function (axios) {
|
||||
response => {
|
||||
if (!!response.message) {
|
||||
vue.$message.error('请求错误:' + response.message);
|
||||
}else {
|
||||
} else {
|
||||
if (!response.config.needValidateResult || response.data.errCode === 200) {
|
||||
return response.data;
|
||||
} else if (response.data.errCode === 400) {
|
||||
|
||||
@@ -11,3 +11,15 @@ export function getZyplayerApiBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取custom后端域名
|
||||
*/
|
||||
export function getCustomApiBaseUrl() {
|
||||
let env = import.meta.env.VITE_APP_ENV;
|
||||
let baseUrl = import.meta.env.VITE_APP_CUSTOM_URL_ONLINE;
|
||||
if ("dev" === env) {
|
||||
baseUrl = import.meta.env.VITE_APP_CUSTOM_URL_DEV;
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user