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
@@ -111,7 +111,7 @@ var VipQr = function VipQr(_ref) {
111
111
  // 五秒后自动弹出;
112
112
  setTimeout(function () {
113
113
  setPayResult(true);
114
- }, 20e3);
114
+ }, 3e3);
115
115
  } else {
116
116
  Tool.toast('支付类型有问题');
117
117
  }
@@ -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;
@@ -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:61800/".concat(apiName.replace(/^_main\//i, ''));
25
+ return "http://127.0.0.1:".concat(mainPort, "/").concat(apiName.replace(/^_main\//i, ''));
22
26
  }
23
27
 
24
28
  // 替换第一个 /
@@ -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('http://127.0.0.1:61800') === 0) {
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) || 61800, "/sub-client/runStatus"), _objectSpread({
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
@@ -5,5 +5,6 @@ declare interface Window{
5
5
  __onBindWindowError: boolean;
6
6
  __wxjs_environment: string;
7
7
  __recordError: any;
8
+ __ShipinlvMainPort: number;
8
9
  }
9
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",