yuang-framework-ui-common 1.0.61 → 1.0.62

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.
@@ -10,6 +10,7 @@ import { alertMessageBox } from '../utils/messageBoxUtils';
10
10
 
11
11
  import { application } from '../config/applicationConfig';
12
12
  import { getSsoLoginUrl, clearSsoAccessToken, setSsoAccessToken } from '../utils/ssoUtils';
13
+ import { getIsDebug, setIsDebug } from '../utils/htmlUtils';
13
14
 
14
15
  import { clearGateway, initGateway } from '../config/gatewayConfig';
15
16
 
@@ -51,7 +52,9 @@ http.interceptors.response.use(async (res: any) => {
51
52
  showErrorMessage(messageMap.responseSturctError);
52
53
  return Promise.reject(new Error(messageMap.responseSturctError));
53
54
  }
54
- debugger
55
+ if(getIsDebug()) {
56
+ debugger
57
+ }
55
58
  if (res?.data?.statusCode !== 200) {
56
59
  // 登录过期处理
57
60
  if (res?.data?.statusCode === 401) {
@@ -1,4 +1,5 @@
1
1
 
2
+
2
3
  /**
3
4
  * 加载脚本
4
5
  * @param src
@@ -114,4 +115,22 @@ const getFileSize = (url: string) => {
114
115
  }
115
116
 
116
117
 
117
- export { loadScript, loadLink, loadIframe, getFileSize };
118
+ /**
119
+ * 设置是否调试
120
+ * @param value
121
+ */
122
+ const setIsDebug = (value: boolean) => {
123
+ localStorage.setItem('is-debug', value.toString());
124
+ }
125
+
126
+ /**
127
+ * 获取是否调试
128
+ */
129
+ const getIsDebug = () => {
130
+ let value = localStorage.getItem('is-debug');
131
+ if(value == 'true') {
132
+ return true;
133
+ }
134
+ return false;
135
+ }
136
+ export { loadScript, loadLink, loadIframe, getFileSize, setIsDebug, getIsDebug };
@@ -6,10 +6,20 @@
6
6
  * @returns {string|null}
7
7
  */
8
8
  const getParameter = (name: string, url?: string) : string => {
9
- url = url || window.location.search;
9
+ if (typeof(url) == 'undefined') {
10
+ // 格式:?name=chenghui
11
+ url = window.location.search;
12
+ } else {
13
+ if (url.indexOf('?') != -1) {
14
+ // 格式:?name=chenghui
15
+ url = url.substring(url.indexOf('?'));
16
+ }
17
+ }
10
18
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
11
19
  var r = url.substr(1).match(reg);
12
- if (r != null) return decodeURIComponent(r[2]);
20
+ if (r != null) {
21
+ return decodeURIComponent(r[2]);
22
+ }
13
23
  return '';
14
24
  }
15
25
 
@@ -19,8 +29,15 @@ const getParameter = (name: string, url?: string) : string => {
19
29
  * @returns {map|null}
20
30
  */
21
31
  const getParameterMap = (url?: string): Map<string, string> => {
22
- url = url || window.location.search;
23
-
32
+ if (typeof(url) == 'undefined') {
33
+ // 格式:?name=chenghui
34
+ url = window.location.search;
35
+ } else {
36
+ if (url.indexOf('?') != -1) {
37
+ // 格式:?name=chenghui
38
+ url = url.substring(url.indexOf('?'));
39
+ }
40
+ }
24
41
  let arrObj = url.split("?") as any;
25
42
  let params = Object.create(null);
26
43
  if (arrObj.length > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,7 +10,7 @@ import { ElMessage } from 'element-plus/es';
10
10
 
11
11
  const sendRequest = () => {
12
12
  // 测试
13
- http.get("/framework-api/standard/framework-captcha/getSliderCaptcha", { params: {} }).then((res) => {
13
+ http.get("/framework-api/core/framework-captcha/getSliderCaptcha", { params: {} }).then((res) => {
14
14
  ElMessage.success('发送成功');
15
15
  });
16
16
  }