@jx3box/jx3box-common 8.6.8 → 8.7.0
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/data/jx3_zlp.json +14 -2
- package/js/https.js +79 -23
- package/js/https_v2.js +54 -25
- package/package.json +1 -1
package/data/jx3_zlp.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"std": ["太极秘录","丝路风语","雾海寻龙", "万灵当歌", "群侠万变", "横刀断浪", "江湖无限", "北天药宗", "白帝风云", "其它"],
|
|
3
|
-
"origin": ["苍雪龙城","血战天策", "安史之乱", "日月明尊", "剑湖神宫", "巴蜀风云", "五毒现世", "圣殿云起", "藏剑山庄", "物华天宝", "其它"],
|
|
3
|
+
"origin": ["烽火燎原","苍雪龙城","血战天策", "安史之乱", "日月明尊", "剑湖神宫", "巴蜀风云", "五毒现世", "圣殿云起", "藏剑山庄", "物华天宝", "其它"],
|
|
4
4
|
"wujie": ["太极秘录","丝路风语","雾海寻龙", "万灵当歌", "群侠万变", "横刀断浪", "江湖无限", "北天药宗", "白帝风云", "其它"],
|
|
5
|
-
"all": ["太极秘录","丝路风语","苍雪龙城","雾海寻龙", "血战天策", "万灵当歌", "群侠万变", "安史之乱", "日月明尊", "横刀断浪", "剑湖神宫", "巴蜀风云", "江湖无限", "五毒现世", "圣殿云起", "北天药宗", "白帝风云", "藏剑山庄", "物华天宝", "其它"],
|
|
5
|
+
"all": ["烽火燎原","太极秘录","丝路风语","苍雪龙城","雾海寻龙", "血战天策", "万灵当歌", "群侠万变", "安史之乱", "日月明尊", "横刀断浪", "剑湖神宫", "巴蜀风云", "江湖无限", "五毒现世", "圣殿云起", "北天药宗", "白帝风云", "藏剑山庄", "物华天宝", "其它"],
|
|
6
6
|
"std_map": [
|
|
7
7
|
{
|
|
8
8
|
"label": "太极秘录",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
48
|
"origin_map": [
|
|
49
|
+
{
|
|
50
|
+
"label": "烽火燎原",
|
|
51
|
+
"value": "fenghuoliaoyuan"
|
|
52
|
+
},
|
|
49
53
|
{
|
|
50
54
|
"label": "苍雪龙城",
|
|
51
55
|
"value": "cangxuelongcheng"
|
|
@@ -92,6 +96,10 @@
|
|
|
92
96
|
}
|
|
93
97
|
],
|
|
94
98
|
"wujie_map": [
|
|
99
|
+
{
|
|
100
|
+
"label": "太极秘录",
|
|
101
|
+
"value": "taijimilu"
|
|
102
|
+
},
|
|
95
103
|
{
|
|
96
104
|
"label": "丝路风语",
|
|
97
105
|
"value": "silufengyu"
|
|
@@ -130,6 +138,10 @@
|
|
|
130
138
|
}
|
|
131
139
|
],
|
|
132
140
|
"all_map": [
|
|
141
|
+
{
|
|
142
|
+
"label": "烽火燎原",
|
|
143
|
+
"value": "fenghuoliaoyuan"
|
|
144
|
+
},
|
|
133
145
|
{
|
|
134
146
|
"label": "太极秘录",
|
|
135
147
|
"value": "taijimilu"
|
package/js/https.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
axios,
|
|
3
|
+
installInterceptors,
|
|
4
|
+
installNextInterceptors,
|
|
5
|
+
installHelperInterceptors,
|
|
6
|
+
installCmsInterceptors,
|
|
7
|
+
} from "./axios";
|
|
2
8
|
import { SSE } from "./sse";
|
|
3
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
__server,
|
|
11
|
+
__cms,
|
|
12
|
+
__node,
|
|
13
|
+
__spider,
|
|
14
|
+
__next,
|
|
15
|
+
__pay,
|
|
16
|
+
__helperUrl,
|
|
17
|
+
__team,
|
|
18
|
+
__lua,
|
|
19
|
+
} from "../data/jx3box.json";
|
|
4
20
|
import { getTokenFromUrl } from "./utils";
|
|
5
21
|
|
|
6
22
|
const server_map = {
|
|
@@ -26,7 +42,10 @@ function $cms(options = {}, axiosConfig = {}) {
|
|
|
26
42
|
}
|
|
27
43
|
|
|
28
44
|
let token = getTokenFromUrl();
|
|
29
|
-
token = token
|
|
45
|
+
token = token
|
|
46
|
+
? token
|
|
47
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
48
|
+
localStorage.getItem("token");
|
|
30
49
|
let config = {
|
|
31
50
|
// 同时发送cookie和basic auth
|
|
32
51
|
withCredentials: true,
|
|
@@ -58,13 +77,17 @@ function $helper(options) {
|
|
|
58
77
|
// 同时发送cookie和basic auth
|
|
59
78
|
withCredentials: true,
|
|
60
79
|
auth: {
|
|
61
|
-
username:
|
|
80
|
+
username:
|
|
81
|
+
(localStorage && localStorage.getItem("__token")) ||
|
|
82
|
+
localStorage.getItem("token") ||
|
|
83
|
+
"",
|
|
62
84
|
password: "helper common request",
|
|
63
85
|
},
|
|
64
86
|
baseURL: domain,
|
|
65
87
|
headers: {
|
|
66
88
|
Accept: "application/prs.helper.v2+json",
|
|
67
|
-
"JX3-Client-Type":
|
|
89
|
+
"JX3-Client-Type":
|
|
90
|
+
(options && options.client_id) || jx3ClientType(),
|
|
68
91
|
},
|
|
69
92
|
};
|
|
70
93
|
|
|
@@ -100,7 +123,10 @@ function $next(options = {}, axiosConfig = {}) {
|
|
|
100
123
|
}
|
|
101
124
|
|
|
102
125
|
let token = getTokenFromUrl();
|
|
103
|
-
token = token
|
|
126
|
+
token = token
|
|
127
|
+
? token
|
|
128
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
129
|
+
localStorage.getItem("token");
|
|
104
130
|
let config = {
|
|
105
131
|
// 同时发送cookie和basic auth
|
|
106
132
|
withCredentials: true,
|
|
@@ -137,7 +163,10 @@ function $team(options = {}) {
|
|
|
137
163
|
} else {
|
|
138
164
|
requestDomain = process.env.VUE_APP_TEAM_API || __team;
|
|
139
165
|
}
|
|
140
|
-
let _options = (options &&
|
|
166
|
+
let _options = (options &&
|
|
167
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
168
|
+
domain: requestDomain,
|
|
169
|
+
};
|
|
141
170
|
return $next(_options);
|
|
142
171
|
}
|
|
143
172
|
|
|
@@ -151,7 +180,10 @@ function $pay(options = {}) {
|
|
|
151
180
|
requestDomain = process.env.VUE_APP_PAY_API || __pay;
|
|
152
181
|
}
|
|
153
182
|
|
|
154
|
-
let _options = (options &&
|
|
183
|
+
let _options = (options &&
|
|
184
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
185
|
+
domain: requestDomain,
|
|
186
|
+
};
|
|
155
187
|
return $next(_options);
|
|
156
188
|
}
|
|
157
189
|
|
|
@@ -164,15 +196,24 @@ function $lua(options = {}) {
|
|
|
164
196
|
} else {
|
|
165
197
|
requestDomain = process.env.VUE_APP_LUA_API || __lua;
|
|
166
198
|
}
|
|
167
|
-
let _options = (options &&
|
|
199
|
+
let _options = (options &&
|
|
200
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
201
|
+
domain: requestDomain,
|
|
202
|
+
};
|
|
168
203
|
return $next(_options);
|
|
169
204
|
}
|
|
170
205
|
|
|
171
206
|
// node
|
|
172
207
|
function $node(options) {
|
|
173
|
-
|
|
208
|
+
const domain = (options && options.domain);
|
|
209
|
+
|
|
210
|
+
const requestDomain = domain || process.env.VUE_APP_NODE_API || __node;
|
|
211
|
+
|
|
174
212
|
let token = getTokenFromUrl();
|
|
175
|
-
token = token
|
|
213
|
+
token = token
|
|
214
|
+
? token
|
|
215
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
216
|
+
localStorage.getItem("token");
|
|
176
217
|
let config = {
|
|
177
218
|
// 同时发送cookie和basic auth
|
|
178
219
|
withCredentials: true,
|
|
@@ -180,14 +221,9 @@ function $node(options) {
|
|
|
180
221
|
username: token || "",
|
|
181
222
|
password: "node common request",
|
|
182
223
|
},
|
|
183
|
-
baseURL:
|
|
224
|
+
baseURL: requestDomain,
|
|
184
225
|
};
|
|
185
226
|
|
|
186
|
-
// 是否需要开启本地代理作为测试
|
|
187
|
-
if (options && options.proxy) {
|
|
188
|
-
config.baseURL = process.env.NODE_ENV === "production" ? domain : `http://localhost:${options.port}`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
227
|
// 创建实例
|
|
192
228
|
const ins = axios.create(config);
|
|
193
229
|
|
|
@@ -199,7 +235,9 @@ function $node(options) {
|
|
|
199
235
|
|
|
200
236
|
import { tokenExpires } from "../data/conf.json";
|
|
201
237
|
function isLogin() {
|
|
202
|
-
let created_at = !localStorage.getItem("created_at")
|
|
238
|
+
let created_at = !localStorage.getItem("created_at")
|
|
239
|
+
? -Infinity
|
|
240
|
+
: localStorage.getItem("created_at");
|
|
203
241
|
let logged_in = localStorage.getItem("logged_in") == "true" ? true : false;
|
|
204
242
|
return logged_in && Date.now() - created_at < tokenExpires;
|
|
205
243
|
}
|
|
@@ -217,7 +255,8 @@ function $https(server, options) {
|
|
|
217
255
|
|
|
218
256
|
// 是否需要开启本地代理作为测试
|
|
219
257
|
if (options && options.proxy) {
|
|
220
|
-
config.baseURL =
|
|
258
|
+
config.baseURL =
|
|
259
|
+
process.env.NODE_ENV === "production" ? server_map[server] : "/";
|
|
221
260
|
} else {
|
|
222
261
|
config.baseURL = server_map[server];
|
|
223
262
|
}
|
|
@@ -243,7 +282,10 @@ function $_https(server, options) {
|
|
|
243
282
|
}
|
|
244
283
|
|
|
245
284
|
let token = getTokenFromUrl();
|
|
246
|
-
token = token
|
|
285
|
+
token = token
|
|
286
|
+
? token
|
|
287
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
288
|
+
localStorage.getItem("token");
|
|
247
289
|
|
|
248
290
|
let config = {
|
|
249
291
|
// 同时发送cookie和basic auth
|
|
@@ -252,7 +294,8 @@ function $_https(server, options) {
|
|
|
252
294
|
username: token || "",
|
|
253
295
|
password: "$_https common request",
|
|
254
296
|
},
|
|
255
|
-
baseURL:
|
|
297
|
+
baseURL:
|
|
298
|
+
process.env.NODE_ENV === "production" ? server_map[server] : "/",
|
|
256
299
|
headers: {},
|
|
257
300
|
};
|
|
258
301
|
|
|
@@ -263,7 +306,8 @@ function $_https(server, options) {
|
|
|
263
306
|
|
|
264
307
|
// 是否需要开启本地代理作为测试
|
|
265
308
|
if (!options || options.proxy || options.proxy === undefined) {
|
|
266
|
-
config.baseURL =
|
|
309
|
+
config.baseURL =
|
|
310
|
+
process.env.NODE_ENV === "production" ? server_map[server] : "/";
|
|
267
311
|
} else {
|
|
268
312
|
config.baseURL = server_map[server];
|
|
269
313
|
}
|
|
@@ -281,4 +325,16 @@ function $_https(server, options) {
|
|
|
281
325
|
return ins;
|
|
282
326
|
}
|
|
283
327
|
|
|
284
|
-
export {
|
|
328
|
+
export {
|
|
329
|
+
$https,
|
|
330
|
+
$_https,
|
|
331
|
+
$cms,
|
|
332
|
+
$helper,
|
|
333
|
+
$next,
|
|
334
|
+
$team,
|
|
335
|
+
$pay,
|
|
336
|
+
$node,
|
|
337
|
+
$lua,
|
|
338
|
+
axios,
|
|
339
|
+
SSE,
|
|
340
|
+
};
|
package/js/https_v2.js
CHANGED
|
@@ -20,8 +20,11 @@ function $cms(options = {}, axiosConfig = {}) {
|
|
|
20
20
|
requestDomain = process.env.VUE_APP_CMS_API || domains.__cms;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
let token = getTokenFromUrl()
|
|
24
|
-
token = token
|
|
23
|
+
let token = getTokenFromUrl();
|
|
24
|
+
token = token
|
|
25
|
+
? token
|
|
26
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
27
|
+
localStorage.getItem("token");
|
|
25
28
|
let config = {
|
|
26
29
|
// 同时发送cookie和basic auth
|
|
27
30
|
withCredentials: true,
|
|
@@ -54,13 +57,17 @@ function $helper(options) {
|
|
|
54
57
|
// 同时发送cookie和basic auth
|
|
55
58
|
withCredentials: true,
|
|
56
59
|
auth: {
|
|
57
|
-
username:
|
|
60
|
+
username:
|
|
61
|
+
(localStorage && localStorage.getItem("__token")) ||
|
|
62
|
+
localStorage.getItem("token") ||
|
|
63
|
+
"",
|
|
58
64
|
password: "helper common request",
|
|
59
65
|
},
|
|
60
66
|
baseURL: domain,
|
|
61
67
|
headers: {
|
|
62
68
|
Accept: "application/prs.helper.v2+json",
|
|
63
|
-
"JX3-Client-Type":
|
|
69
|
+
"JX3-Client-Type":
|
|
70
|
+
(options && options.client_id) || jx3ClientType(),
|
|
64
71
|
},
|
|
65
72
|
};
|
|
66
73
|
|
|
@@ -95,8 +102,11 @@ function $next(options = {}, axiosConfig = {}) {
|
|
|
95
102
|
requestDomain = process.env.VUE_APP_NEXT_API || domains.__next;
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
let token = getTokenFromUrl()
|
|
99
|
-
token = token
|
|
105
|
+
let token = getTokenFromUrl();
|
|
106
|
+
token = token
|
|
107
|
+
? token
|
|
108
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
109
|
+
localStorage.getItem("token");
|
|
100
110
|
let config = {
|
|
101
111
|
// 同时发送cookie和basic auth
|
|
102
112
|
withCredentials: true,
|
|
@@ -129,7 +139,8 @@ function $team(options = {}) {
|
|
|
129
139
|
requestDomain = process.env.VUE_APP_TEAM_API || domains.__team;
|
|
130
140
|
}
|
|
131
141
|
|
|
132
|
-
let _options = (options &&
|
|
142
|
+
let _options = (options &&
|
|
143
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
133
144
|
domain: requestDomain,
|
|
134
145
|
};
|
|
135
146
|
return $next(_options);
|
|
@@ -145,7 +156,8 @@ function $pay(options = {}) {
|
|
|
145
156
|
requestDomain = process.env.VUE_APP_PAY_API || domains.__pay;
|
|
146
157
|
}
|
|
147
158
|
|
|
148
|
-
let _options = (options &&
|
|
159
|
+
let _options = (options &&
|
|
160
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
149
161
|
domain: requestDomain,
|
|
150
162
|
};
|
|
151
163
|
return $next(_options);
|
|
@@ -160,7 +172,8 @@ function $lua(options = {}) {
|
|
|
160
172
|
} else {
|
|
161
173
|
requestDomain = process.env.VUE_APP_LUA_API || domains.__lua;
|
|
162
174
|
}
|
|
163
|
-
let _options = (options &&
|
|
175
|
+
let _options = (options &&
|
|
176
|
+
Object.assign(options, { domain: requestDomain })) || {
|
|
164
177
|
domain: requestDomain,
|
|
165
178
|
};
|
|
166
179
|
return $next(_options);
|
|
@@ -168,9 +181,16 @@ function $lua(options = {}) {
|
|
|
168
181
|
|
|
169
182
|
// node 通用请求接口
|
|
170
183
|
function $node(options) {
|
|
171
|
-
let domain =
|
|
172
|
-
|
|
173
|
-
|
|
184
|
+
let domain = options && options.domain;
|
|
185
|
+
|
|
186
|
+
const requestDomain =
|
|
187
|
+
domain || process.env.VUE_APP_NODE_API || domains.__node;
|
|
188
|
+
|
|
189
|
+
let token = getTokenFromUrl();
|
|
190
|
+
token = token
|
|
191
|
+
? token
|
|
192
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
193
|
+
localStorage.getItem("token");
|
|
174
194
|
let config = {
|
|
175
195
|
// 同时发送cookie和basic auth
|
|
176
196
|
withCredentials: true,
|
|
@@ -178,14 +198,9 @@ function $node(options) {
|
|
|
178
198
|
username: token || "",
|
|
179
199
|
password: "node common request",
|
|
180
200
|
},
|
|
181
|
-
baseURL:
|
|
201
|
+
baseURL: requestDomain,
|
|
182
202
|
};
|
|
183
203
|
|
|
184
|
-
// 是否需要开启本地代理作为测试
|
|
185
|
-
if (options && options.proxy) {
|
|
186
|
-
config.baseURL = process.env.NODE_ENV === "production" ? domain : `http://localhost:${options.port}`;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
204
|
// 创建实例
|
|
190
205
|
const ins = axios.create(config);
|
|
191
206
|
|
|
@@ -198,8 +213,11 @@ function $node(options) {
|
|
|
198
213
|
// 默认请求
|
|
199
214
|
function $http(options) {
|
|
200
215
|
let domain = typeof options == "string" ? options : options.domain;
|
|
201
|
-
let token = getTokenFromUrl()
|
|
202
|
-
token = token
|
|
216
|
+
let token = getTokenFromUrl();
|
|
217
|
+
token = token
|
|
218
|
+
? token
|
|
219
|
+
: (localStorage && localStorage.getItem("__token")) ||
|
|
220
|
+
localStorage.getItem("token");
|
|
203
221
|
let config = {
|
|
204
222
|
// 同时发送cookie和basic auth
|
|
205
223
|
withCredentials: true,
|
|
@@ -267,7 +285,8 @@ function installInterceptors(target, options) {
|
|
|
267
285
|
function (err) {
|
|
268
286
|
if (!options || !options.mute) {
|
|
269
287
|
if (err.response && err.response.data) {
|
|
270
|
-
err.response.data.msg &&
|
|
288
|
+
err.response.data.msg &&
|
|
289
|
+
loadPop(err.response.data.msg, popType);
|
|
271
290
|
} else {
|
|
272
291
|
loadDefaultRequestErrorPop(err);
|
|
273
292
|
}
|
|
@@ -289,7 +308,11 @@ function installStandardInterceptors(target, options) {
|
|
|
289
308
|
function (response) {
|
|
290
309
|
if (response.data.code) {
|
|
291
310
|
if (!options || !options.mute) {
|
|
292
|
-
response.data.msg &&
|
|
311
|
+
response.data.msg &&
|
|
312
|
+
loadPop(
|
|
313
|
+
`[${response.data.code}]${response.data.msg}`,
|
|
314
|
+
popType
|
|
315
|
+
);
|
|
293
316
|
}
|
|
294
317
|
return Promise.reject(response);
|
|
295
318
|
}
|
|
@@ -298,7 +321,11 @@ function installStandardInterceptors(target, options) {
|
|
|
298
321
|
function (err) {
|
|
299
322
|
if (!options || !options.mute) {
|
|
300
323
|
console.log(err.response);
|
|
301
|
-
if (
|
|
324
|
+
if (
|
|
325
|
+
err.response &&
|
|
326
|
+
err.response.data &&
|
|
327
|
+
err.response.data.msg
|
|
328
|
+
) {
|
|
302
329
|
loadPop(err.response.data.msg, popType);
|
|
303
330
|
} else {
|
|
304
331
|
loadDefaultRequestErrorPop(err);
|
|
@@ -323,7 +350,10 @@ function installHelperInterceptors(target, options) {
|
|
|
323
350
|
return response;
|
|
324
351
|
} else {
|
|
325
352
|
if (!options || !options.mute) {
|
|
326
|
-
loadPop(
|
|
353
|
+
loadPop(
|
|
354
|
+
`[${response.data.code}]${response.data.message}`,
|
|
355
|
+
popType
|
|
356
|
+
);
|
|
327
357
|
}
|
|
328
358
|
return Promise.reject(response);
|
|
329
359
|
}
|
|
@@ -337,5 +367,4 @@ function installHelperInterceptors(target, options) {
|
|
|
337
367
|
);
|
|
338
368
|
}
|
|
339
369
|
|
|
340
|
-
|
|
341
370
|
export { $cms, $next, $helper, $node, $team, $pay, $lua, $http, axios, SSE };
|