@tushi11/elpis 1.0.32 → 1.0.34
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/app/pages/common/curl.js
CHANGED
|
@@ -64,9 +64,30 @@ const curl = ({
|
|
|
64
64
|
pageConfigs?.requestSetting?.proxyOption[mergedRequestOptions?.proxyIndex || 0];
|
|
65
65
|
if (tokenName && tokenKey) {
|
|
66
66
|
const data = window.localStorage.getItem(tokenKey);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
if (data) {
|
|
68
|
+
const { value: token } = JSON.parse(data);
|
|
69
|
+
headers[tokenName] = token;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// try {
|
|
73
|
+
// const data = window.localStorage.getItem(tokenKey);
|
|
74
|
+
// // 检查 data 是否存在且不为空
|
|
75
|
+
// if (!data) {
|
|
76
|
+
// // 可选:如果需要提示 token 不存在,可添加 feedback.msgWarning('未找到登录信息');
|
|
77
|
+
// return; // 或跳过设置 token
|
|
78
|
+
// }
|
|
79
|
+
// // 解析 JSON 并容错
|
|
80
|
+
// const parsedData = JSON.parse(data);
|
|
81
|
+
// // 检查解析后的数据是否为对象且存在 value 属性
|
|
82
|
+
// if (parsedData && typeof parsedData === 'object' && 'value' in parsedData) {
|
|
83
|
+
// headers[tokenName] = parsedData.value;
|
|
84
|
+
// } else {
|
|
85
|
+
// feedback.msgWarning('登录信息格式错误');
|
|
86
|
+
// }
|
|
87
|
+
// } catch (error) {
|
|
88
|
+
// // 捕获 JSON 解析错误或其他异常
|
|
89
|
+
// feedback.msgError(`处理登录信息失败: ${error.message}`);
|
|
90
|
+
// }
|
|
70
91
|
}
|
|
71
92
|
|
|
72
93
|
// 处理请求头
|
|
@@ -160,6 +160,10 @@ const axiosHooks = {
|
|
|
160
160
|
feedback.closeLoading();
|
|
161
161
|
|
|
162
162
|
if (!error.isCancel) {
|
|
163
|
+
if (error.message.includes('code 401')) {
|
|
164
|
+
console.log(error.message);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
163
167
|
// 排除主动取消请求的错误(避免误提示)
|
|
164
168
|
error.message && feedback.msgError(error.message);
|
|
165
169
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tushi11/elpis",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"@babel/core": "^7.24.0",
|
|
18
18
|
"@babel/plugin-transform-runtime": "^7.1.0",
|
|
19
19
|
"@babel/preset-env": "^7.4.5",
|
|
20
|
+
"@babel/runtime": "^7.28.4",
|
|
20
21
|
"@element-plus/icons-vue": "^2.3.1",
|
|
21
22
|
"@iconify-json/ep": "^1.2.3",
|
|
22
23
|
"@iconify-json/mdi": "^1.2.3",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"koa": "2.7.0",
|
|
49
50
|
"koa-bodyparser": "^4.2.1",
|
|
50
51
|
"koa-nunjucks-2": "^3.0.2",
|
|
52
|
+
"koa-proxy": "^1.0.0-alpha.3",
|
|
51
53
|
"koa-router": "^7.4.0",
|
|
52
54
|
"koa-static": "^5.0.0",
|
|
53
55
|
"koa-useragent": "2.0.0",
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
"postcss": "^8.4.41",
|
|
69
71
|
"postcss-loader": "^8.1.1",
|
|
70
72
|
"postcss-pxtorem": "^6.1.0",
|
|
71
|
-
"koa-proxy": "^1.0.0-alpha.3",
|
|
72
73
|
"sass": "^1.77.8",
|
|
73
74
|
"sass-loader": "^16.0.5",
|
|
74
75
|
"style-loader": "^0.14.1",
|