yuang-framework-ui-common 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config/httpConfig.ts
CHANGED
@@ -15,8 +15,8 @@ const messageMap = {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
const http = axios.create({
|
18
|
-
baseURL:
|
19
|
-
timeout:
|
18
|
+
baseURL: '/gateway-server',
|
19
|
+
timeout: 10000,
|
20
20
|
headers: {}
|
21
21
|
})
|
22
22
|
|
@@ -84,7 +84,7 @@ http.interceptors.response.use((res) => {
|
|
84
84
|
let errorMessage = '';
|
85
85
|
if (error?.response?.data) {
|
86
86
|
let { statusCode, message } = error?.response?.data;
|
87
|
-
if(statusCode !== 200) {
|
87
|
+
if (statusCode !== 200) {
|
88
88
|
errorMessage = message;
|
89
89
|
}
|
90
90
|
} else {
|
@@ -98,7 +98,7 @@ http.interceptors.response.use((res) => {
|
|
98
98
|
* 请求之前的配置
|
99
99
|
* @param config
|
100
100
|
*/
|
101
|
-
const beforeRequestConfig = (config) => {
|
101
|
+
const beforeRequestConfig = (config: any) => {
|
102
102
|
if (!config.url) {
|
103
103
|
return console.error('参数[url]不存在');
|
104
104
|
}
|
package/lib/config/initConfig.ts
CHANGED
@@ -12,7 +12,7 @@ import 'vant/lib/index.css';
|
|
12
12
|
import {http} from './httpConfig';
|
13
13
|
import moment from 'moment';
|
14
14
|
|
15
|
-
const initConfig = (app: any) => {
|
15
|
+
const initConfig = (app: any, config: any) => {
|
16
16
|
app.config.globalProperties.$http = http;
|
17
17
|
app.config.globalProperties.$moment = moment;
|
18
18
|
|
@@ -22,7 +22,10 @@ const initConfig = (app: any) => {
|
|
22
22
|
} else {
|
23
23
|
app.use(vant);
|
24
24
|
}
|
25
|
-
|
25
|
+
if(config?.apiBaseUrl) {
|
26
|
+
http.defaults.baseURL = config?.apiBaseUrl;
|
27
|
+
}
|
28
|
+
(window as any).$config = Object.freeze(config);
|
26
29
|
}
|
27
30
|
|
28
31
|
export {initConfig} ;
|
package/lib/utils/ssoUtils.ts
CHANGED
@@ -5,7 +5,12 @@ import {getLocalStorageItem, setLocalStorageItem, removeLocalStorageItem} from '
|
|
5
5
|
|
6
6
|
|
7
7
|
const getSsoLoginUrl = (redirectUrl = '') => {
|
8
|
-
let
|
8
|
+
let apiFullBaseUrl = (window as any).$config?.apiFullBaseUrl;
|
9
|
+
if(!apiFullBaseUrl) {
|
10
|
+
console.error('参数[apiFullBaseUrl]为空');
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
let ssoLoginUrl = `${apiFullBaseUrl}/sso-api/server/sso/login`;
|
9
14
|
if (!redirectUrl) {
|
10
15
|
ssoLoginUrl += `?redirectUrl=${encodeURIComponent(window.location.href)}`;
|
11
16
|
} else {
|
@@ -15,7 +20,12 @@ const getSsoLoginUrl = (redirectUrl = '') => {
|
|
15
20
|
}
|
16
21
|
|
17
22
|
const getSsoLogoutUrl = (redirectUrl = '') => {
|
18
|
-
let
|
23
|
+
let apiFullBaseUrl = (window as any).$config?.apiFullBaseUrl;
|
24
|
+
if(!apiFullBaseUrl) {
|
25
|
+
console.error('参数[apiFullBaseUrl]为空');
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
let ssoLogoutUrl = `${apiFullBaseUrl}/sso-api/server/sso/logout`;
|
19
29
|
if (!redirectUrl) {
|
20
30
|
ssoLogoutUrl += `?redirectUrl=${encodeURIComponent(window.location.href)}`;
|
21
31
|
} else if (redirectUrl) {
|