yuang-framework-ui-common 1.0.25 → 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.
@@ -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} ;
@@ -5,7 +5,12 @@ import {getLocalStorageItem, setLocalStorageItem, removeLocalStorageItem} from '
5
5
 
6
6
 
7
7
  const getSsoLoginUrl = (redirectUrl = '') => {
8
- let ssoLoginUrl = ((window as any).$config?.apiFullBaseUrl ?? '') + '/sso-api/server/sso/login';
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 ssoLogoutUrl = ((window as any).$config?.apiFullBaseUrl ?? '') + '/sso-api/server/sso/logout';
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {