component-shipinlv 1.0.3 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
package/dist/Buy/qr.js
CHANGED
package/dist/lib/getApiUrl.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
export declare const getMainPort: () => number;
|
1
2
|
declare const getApiUrl: (apiName?: string, apiEnv?: Global.Env | '') => string;
|
2
3
|
export declare const getApiEnv: (apiEnv?: Global.Env | '') => Global.Env;
|
3
4
|
export declare const getEnv: (env?: Global.Env | '') => Global.Env;
|
package/dist/lib/getApiUrl.js
CHANGED
@@ -7,6 +7,9 @@ var envData = function envData() {
|
|
7
7
|
var _window3;
|
8
8
|
return ((_window3 = window) === null || _window3 === void 0 || (_window3 = _window3.WebBaseConfig) === null || _window3 === void 0 ? void 0 : _window3.currentEnv) || currentEnv;
|
9
9
|
};
|
10
|
+
export var getMainPort = function getMainPort() {
|
11
|
+
return window.__ShipinlvMainPort || 61800;
|
12
|
+
};
|
10
13
|
var getApiUrl = function getApiUrl() {
|
11
14
|
var _domain;
|
12
15
|
var apiName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
@@ -15,10 +18,11 @@ var getApiUrl = function getApiUrl() {
|
|
15
18
|
if (/^https?:\/\//i.test(apiName)) {
|
16
19
|
return apiName;
|
17
20
|
}
|
21
|
+
var mainPort = getMainPort();
|
18
22
|
|
19
23
|
// 主客户端
|
20
24
|
if (/_main\//i.test(apiName)) {
|
21
|
-
return "http://127.0.0.1:
|
25
|
+
return "http://127.0.0.1:".concat(mainPort, "/").concat(apiName.replace(/^_main\//i, ''));
|
22
26
|
}
|
23
27
|
|
24
28
|
// 替换第一个 /
|
package/dist/lib/request.js
CHANGED
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
// 二次封装 hooks request ;
|
3
3
|
// 参数详见:https://github.com/umijs/umi-request/blob/master/README_zh-CN.md
|
4
4
|
import request from 'umi-request';
|
5
|
-
import getApiUrl, { getApiEnv } from "./getApiUrl";
|
5
|
+
import getApiUrl, { getApiEnv, getMainPort } from "./getApiUrl";
|
6
6
|
import goAuth from "./goAuth";
|
7
7
|
import Tool from "./Tool";
|
8
8
|
var requestApi = function requestApi() {
|
@@ -67,7 +67,7 @@ var requestApi = function requestApi() {
|
|
67
67
|
err = new Error();
|
68
68
|
}
|
69
69
|
console.log('request component shipinlv:', JSON.stringify(err), url);
|
70
|
-
if (!((_err = err) !== null && _err !== void 0 && _err.response) && url.indexOf(
|
70
|
+
if (!((_err = err) !== null && _err !== void 0 && _err.response) && url.indexOf("http://127.0.0.1:".concat(getMainPort())) === 0) {
|
71
71
|
err.name = "shipinlv-client-not-run";
|
72
72
|
err.message = "\u8BF7\u5148\u6253\u5F00\u7535\u8111\u4E0A\u5DF2\u5B89\u88C5\u7684\uFF1A\u3010\u89C6\u9891\u9A74\u5DE5\u5177\u7BB1\u3011\uFF0C\u518D\u64CD\u4F5C";
|
73
73
|
reject(err);
|
@@ -2,6 +2,7 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
4
|
import request from "../../lib/request";
|
5
|
+
import { getMainPort } from "../../lib/getApiUrl";
|
5
6
|
export function start(_x, _x2) {
|
6
7
|
return _start.apply(this, arguments);
|
7
8
|
}
|
@@ -33,7 +34,7 @@ function _runStatus() {
|
|
33
34
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
34
35
|
while (1) switch (_context2.prev = _context2.next) {
|
35
36
|
case 0:
|
36
|
-
return _context2.abrupt("return", request("http://127.0.0.1:".concat((body === null || body === void 0 ? void 0 : body.port) ||
|
37
|
+
return _context2.abrupt("return", request("http://127.0.0.1:".concat((body === null || body === void 0 ? void 0 : body.port) || getMainPort(), "/sub-client/runStatus"), _objectSpread({
|
37
38
|
method: 'GET',
|
38
39
|
params: _objectSpread({}, body)
|
39
40
|
}, options || {})));
|
package/dist/window.d.ts
CHANGED