udxcms 1.0.14 → 1.0.16
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/dist/api/common.js +54 -88
- package/dist/api/h5/axios.js +15 -20
- package/dist/api/h5/common.js +21 -37
- package/dist/api/index.js +20 -62
- package/dist/config/const.js +5 -8
- package/dist/config/index.js +1 -3
- package/dist/filter/dateyear.js +1 -4
- package/dist/filter/numberFormat.js +1 -4
- package/dist/index.js +37 -60
- package/dist/libs/localStorageConstant.js +18 -21
- package/dist/mixins/themeMixin-votex.js +1 -3
- package/dist/mixins/themeMixin.js +1 -3
- package/dist/router/Home.js +32 -70
- package/dist/router/index.js +1 -8
- package/dist/store/CmsStore.js +3 -5
- package/dist/store/CmsStoreH5.js +4 -6
- package/dist/store/index.js +2 -10
- package/dist/utils/EventBus.js +1 -4
- package/dist/utils/Session.js +1 -4
- package/dist/utils/Storage.js +2 -38
- package/dist/utils/apiEvent.js +2 -7
- package/dist/utils/axiosRetry.js +9 -14
- package/dist/utils/connect.js +21 -29
- package/dist/utils/http.js +17 -24
- package/dist/utils/index.js +97 -166
- package/dist/utils/isMobile.js +1 -4
- package/dist/utils/parse.js +3 -7
- package/dist/utils/pdf.js +3 -7
- package/package.json +1 -1
package/dist/utils/Session.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* @Author: Sneed
|
|
5
3
|
* @Date: 2020-10-28 17:23:58
|
|
@@ -8,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
6
|
* @Description:
|
|
9
7
|
*/
|
|
10
8
|
let Base64 = require("js-base64").Base64;
|
|
11
|
-
class Storage {
|
|
9
|
+
export default class Storage {
|
|
12
10
|
static set(key, value) {
|
|
13
11
|
sessionStorage.setItem(key, Base64.encode(JSON.stringify(value)));
|
|
14
12
|
}
|
|
@@ -32,4 +30,3 @@ class Storage {
|
|
|
32
30
|
sessionStorage.clear();
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
exports.default = Storage;
|
package/dist/utils/Storage.js
CHANGED
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
1
|
/*
|
|
37
2
|
* @Author: Sneed
|
|
38
3
|
* @Date: 2020-10-28 17:23:58
|
|
@@ -40,9 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
5
|
* @LastEditors: Lewis
|
|
41
6
|
* @Description:
|
|
42
7
|
*/
|
|
43
|
-
|
|
8
|
+
import * as localStorageConstant from "../libs/localStorageConstant";
|
|
44
9
|
let Base64 = require('js-base64').Base64;
|
|
45
|
-
class Storage {
|
|
10
|
+
export default class Storage {
|
|
46
11
|
static set(key, value) {
|
|
47
12
|
let newKey = this.getKey(key);
|
|
48
13
|
localStorage.setItem(newKey, Base64.encode(JSON.stringify(value)));
|
|
@@ -71,4 +36,3 @@ class Storage {
|
|
|
71
36
|
return localStorageConstant[key];
|
|
72
37
|
}
|
|
73
38
|
}
|
|
74
|
-
exports.default = Storage;
|
package/dist/utils/apiEvent.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const EventBus_1 = __importDefault(require("./EventBus"));
|
|
7
|
-
exports.default = new EventBus_1.default();
|
|
1
|
+
import EventBus from "./EventBus";
|
|
2
|
+
export default new EventBus();
|
package/dist/utils/axiosRetry.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,8 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.retryFun = exports.getBaseUrl = exports.retryDelay = exports.retryCount = void 0;
|
|
13
10
|
/*
|
|
14
11
|
* @Author: lewis lewis@everylink.ai
|
|
15
12
|
* @Date: 2023-12-19 10:49:53
|
|
@@ -18,17 +15,16 @@ exports.retryFun = exports.getBaseUrl = exports.retryDelay = exports.retryCount
|
|
|
18
15
|
* @FilePath: /localTools/Users/apple/web-front/web-front/src/common_modules/cms-submodule/utils/axiosRetry.js
|
|
19
16
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
20
17
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export const retryCount = 1; // 重试次数,现在默认重试一次,后期可以调整
|
|
19
|
+
export const retryDelay = 100; // 重试延迟时间
|
|
23
20
|
let site_common_api_url = '';
|
|
24
|
-
const getBaseUrl = (retry) => {
|
|
21
|
+
export const getBaseUrl = (retry) => {
|
|
25
22
|
site_common_api_url = site_common_api_url ? site_common_api_url : (site_config && site_config.site_common_api_url) || "";
|
|
26
23
|
const baseUrlList = site_common_api_url.split(',');
|
|
27
24
|
const index = retry >= baseUrlList.length ? baseUrlList.length - 1 : retry;
|
|
28
25
|
return baseUrlList[index];
|
|
29
26
|
};
|
|
30
|
-
|
|
31
|
-
const retryFun = (instance, error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
export const retryFun = (instance, error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
28
|
var _a;
|
|
33
29
|
if ((error === null || error === void 0 ? void 0 : error.code) === 'ECONNABORTED' || ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes("timeout"))) {
|
|
34
30
|
var config = error.config;
|
|
@@ -62,10 +58,9 @@ const retryFun = (instance, error) => __awaiter(void 0, void 0, void 0, function
|
|
|
62
58
|
return Promise.reject(error);
|
|
63
59
|
}
|
|
64
60
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
retryFun: exports.retryFun
|
|
61
|
+
export default {
|
|
62
|
+
retryCount,
|
|
63
|
+
retryDelay,
|
|
64
|
+
getBaseUrl,
|
|
65
|
+
retryFun
|
|
71
66
|
};
|
package/dist/utils/connect.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* @Descripttion:
|
|
4
3
|
* @version:
|
|
@@ -7,16 +6,11 @@
|
|
|
7
6
|
* @LastEditors: lewis lewis@everylink.ai
|
|
8
7
|
* @LastEditTime: 2025-09-24 10:59:39
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.connnectSingle = exports.ConnectSocketTool = exports.connectCloseReason = void 0;
|
|
15
|
-
const sockjs_client_1 = __importDefault(require("sockjs-client"));
|
|
16
|
-
const webstomp_client_1 = __importDefault(require("webstomp-client"));
|
|
9
|
+
import SockJs from 'sockjs-client';
|
|
10
|
+
import Stomp from 'webstomp-client';
|
|
17
11
|
// import Store from "@/store/index";
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
import { getEventCenter } from "../index";
|
|
13
|
+
import { getTradeDefaultChainId, getMarketApi } from './index';
|
|
20
14
|
var dealMarktUrl = function (url) {
|
|
21
15
|
return url + "/market-ws/";
|
|
22
16
|
};
|
|
@@ -43,29 +37,29 @@ let dealSubscribId = {
|
|
|
43
37
|
}
|
|
44
38
|
};
|
|
45
39
|
let count = 0;
|
|
46
|
-
|
|
40
|
+
export const connectCloseReason = [
|
|
47
41
|
'All transports failed',
|
|
48
42
|
'Cannot connect to server',
|
|
49
43
|
'Sending error: Error: http status 404',
|
|
50
44
|
'Server lost session'
|
|
51
45
|
];
|
|
52
|
-
class ConnectSocketTool {
|
|
46
|
+
export class ConnectSocketTool {
|
|
53
47
|
constructor(chainId, type) {
|
|
54
48
|
this.getStompClient = (webSocketUrl, options) => {
|
|
55
|
-
const socket = new
|
|
56
|
-
return
|
|
49
|
+
const socket = new SockJs(webSocketUrl);
|
|
50
|
+
return Stomp.over(socket, options);
|
|
57
51
|
};
|
|
58
52
|
if (connectTemp.chainId && connectTemp.chainId != chainId || type) {
|
|
59
|
-
this.chainId = chainId ||
|
|
53
|
+
this.chainId = chainId || getTradeDefaultChainId();
|
|
60
54
|
this.close();
|
|
61
55
|
// this.connect()
|
|
62
56
|
}
|
|
63
57
|
else if (!connectTemp.stompClient && connectTemp.conncetedStr == '') {
|
|
64
|
-
this.chainId = chainId ||
|
|
58
|
+
this.chainId = chainId || getTradeDefaultChainId();
|
|
65
59
|
// this.connect()
|
|
66
60
|
}
|
|
67
61
|
else {
|
|
68
|
-
this.chainId = chainId ||
|
|
62
|
+
this.chainId = chainId || getTradeDefaultChainId();
|
|
69
63
|
}
|
|
70
64
|
}
|
|
71
65
|
connect(errorCallBack) {
|
|
@@ -73,7 +67,7 @@ class ConnectSocketTool {
|
|
|
73
67
|
console.log('connect...', new Date());
|
|
74
68
|
console.log("connectType:", connectType);
|
|
75
69
|
console.log("connectTemp:", connectTemp);
|
|
76
|
-
const { store } =
|
|
70
|
+
const { store } = getEventCenter();
|
|
77
71
|
if (connectTemp.stompClient && this.chainId && this.chainId == connectTemp.chainId) {
|
|
78
72
|
resolve(connectTemp.stompClient);
|
|
79
73
|
return;
|
|
@@ -84,12 +78,12 @@ class ConnectSocketTool {
|
|
|
84
78
|
}
|
|
85
79
|
connectTemp.conncetedStr = 'connecting';
|
|
86
80
|
let apiType = connectType === "market_ws" ? "ws" : "api";
|
|
87
|
-
let base_url = site_config &&
|
|
81
|
+
let base_url = site_config && getMarketApi(this.chainId, connectType, apiType) || '';
|
|
88
82
|
if (store.state.trade.tradeMode == 'perpetual') {
|
|
89
|
-
base_url =
|
|
83
|
+
base_url = getMarketApi(this.chainId, 'perpetual', apiType);
|
|
90
84
|
// 永续暂时不支持聚合
|
|
91
85
|
if (!base_url) {
|
|
92
|
-
base_url =
|
|
86
|
+
base_url = getMarketApi(store.state.chainId, 'perpetual', apiType);
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
// console.log("this.chainId", this.chainId);
|
|
@@ -112,7 +106,7 @@ class ConnectSocketTool {
|
|
|
112
106
|
// }
|
|
113
107
|
// ws_url = "https://ws.powx.io/market-ws/";
|
|
114
108
|
console.log("ws_url:", ws_url);
|
|
115
|
-
var options = { debug: false, protocols:
|
|
109
|
+
var options = { debug: false, protocols: Stomp.VERSIONS.supportedProtocols(), heartbeat: { outgoing: 20000, incoming: 10000 } };
|
|
116
110
|
let stompClient = this.getStompClient(ws_url, options);
|
|
117
111
|
console.log("stompClient:", stompClient);
|
|
118
112
|
try {
|
|
@@ -256,9 +250,8 @@ class ConnectSocketTool {
|
|
|
256
250
|
}
|
|
257
251
|
}
|
|
258
252
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
let sock = new sockjs_client_1.default(url, '', {});
|
|
253
|
+
export const connnectSingle = function (url) {
|
|
254
|
+
let sock = new SockJs(url, '', {});
|
|
262
255
|
// let stompClient = Stomp.over(socket)
|
|
263
256
|
// stompClient.connect({
|
|
264
257
|
// Authorization: ''
|
|
@@ -285,9 +278,8 @@ const connnectSingle = function (url) {
|
|
|
285
278
|
console.log('close');
|
|
286
279
|
};
|
|
287
280
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
connnectSingle: exports.connnectSingle,
|
|
281
|
+
export default {
|
|
282
|
+
connnectSingle,
|
|
291
283
|
ConnectSocketTool,
|
|
292
|
-
connectCloseReason
|
|
284
|
+
connectCloseReason,
|
|
293
285
|
};
|
package/dist/utils/http.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,25 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.fetchDemo = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
import axios from "axios";
|
|
17
11
|
// import config from "./config";
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
import Storage from "./Storage";
|
|
13
|
+
import { getTimeZone } from "./index";
|
|
20
14
|
// import router from "@/router/index";
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
import { getEventCenter } from "../index";
|
|
16
|
+
import { retryCount, retryDelay, retryFun, getBaseUrl } from "./axiosRetry";
|
|
23
17
|
// 示例说明
|
|
24
|
-
const fetchDemo = (data) => {
|
|
18
|
+
export const fetchDemo = (data) => {
|
|
25
19
|
/**
|
|
26
20
|
* @param {Boolean} isActionRequest [暂时无场景使用] 是否操作请求。如果是操作流程中的请求,设置该值为 true 。操作流程中的请求错误和普通数据获取请求的处理方式不一致。
|
|
27
21
|
* @param {Boolean} skipErrorHandle 是否跳过统一的错误处理句柄。如果业务中有需要自己处理的错误,设置该值为 true 。
|
|
28
22
|
*/
|
|
29
|
-
return
|
|
23
|
+
return axios.request({
|
|
30
24
|
url: `test`,
|
|
31
25
|
method: "get",
|
|
32
26
|
params: data,
|
|
@@ -34,21 +28,20 @@ const fetchDemo = (data) => {
|
|
|
34
28
|
skipErrorHandle: true,
|
|
35
29
|
});
|
|
36
30
|
};
|
|
37
|
-
|
|
38
|
-
const instance = axios_1.default.create({
|
|
31
|
+
const instance = axios.create({
|
|
39
32
|
timeout: 60 * 1000,
|
|
40
|
-
retry:
|
|
41
|
-
retryDelay:
|
|
33
|
+
retry: retryCount,
|
|
34
|
+
retryDelay: retryDelay,
|
|
42
35
|
});
|
|
43
36
|
instance.interceptors.request.use((config) => {
|
|
44
|
-
const { store } =
|
|
45
|
-
config.baseURL =
|
|
46
|
-
config.headers["x-auth-token"] =
|
|
37
|
+
const { store } = getEventCenter();
|
|
38
|
+
config.baseURL = getBaseUrl(0);
|
|
39
|
+
config.headers["x-auth-token"] = Storage.get("TOKEN");
|
|
47
40
|
config.headers["client_id"] = "WEB";
|
|
48
41
|
config.headers["language"] = localStorage.getItem("language");
|
|
49
42
|
config.headers["timezone"] =
|
|
50
43
|
(store.state.user.userInfo && store.state.user.userInfo.timezone) ||
|
|
51
|
-
|
|
44
|
+
getTimeZone() ||
|
|
52
45
|
"";
|
|
53
46
|
config.headers["country"] =
|
|
54
47
|
(store.state.user.userInfo && store.state.user.userInfo.country) ||
|
|
@@ -59,7 +52,7 @@ instance.interceptors.request.use((config) => {
|
|
|
59
52
|
});
|
|
60
53
|
instance.interceptors.response.use((response) => {
|
|
61
54
|
const { status, data } = response;
|
|
62
|
-
const { router, store } =
|
|
55
|
+
const { router, store } = getEventCenter();
|
|
63
56
|
let code = response.data && response.data.code;
|
|
64
57
|
if (response.data && response.data.message) {
|
|
65
58
|
response.data.codeMessage = response.data.message;
|
|
@@ -106,7 +99,7 @@ instance.interceptors.response.use((response) => {
|
|
|
106
99
|
return Promise.reject(data);
|
|
107
100
|
}
|
|
108
101
|
}, (error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
-
const res = yield
|
|
102
|
+
const res = yield retryFun(instance, error);
|
|
110
103
|
return res;
|
|
111
104
|
}));
|
|
112
|
-
|
|
105
|
+
export default instance;
|