component-shipinlv 0.0.12 → 0.0.13

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.
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
3
  import styled from 'styled-components';
4
4
  export default {
5
- AuthQrLogin: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .qr{\n display: block;\n margin: 12px auto 0;\n width: 230px;\n height: 230px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n &.qrAlipay{\n border: 3px solid #1677ff;\n }\n .reTry{\n font-size: 80px;\n background-color: rgba( 255, 255, 255, 0.95 );\n text-align: center;\n line-height: 210px;\n height: 100%;\n a{\n display: block;\n }\n }\n }\n .alt{\n padding: 10px 0 0;\n color: #999;\n text-align: center;\n }\n .altWeb{\n padding: 16px 0 0;\n max-width: 300px;\n margin: 0 auto;\n .titles{\n text-align: center;\n font-weight: bold;\n }\n ul{\n margin: 0 10px;\n }\n\n }\n .percent{\n width: 100%;\n position: absolute;\n overflow: hidden;\n left: 0;\n bottom: 0;\n .warp{\n height: 4px;\n background-color: #1677ff;\n transition: all 1.6s ease-in-out;\n -webkit-transition: all 1.6s ease-in-out;\n }\n }\n "]))),
5
+ AuthQrLogin: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .weQrUrl{\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n }\n .qr{\n display: block;\n margin: 12px auto 0;\n width: 230px;\n height: 230px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n &.qrAlipay{\n border: 3px solid #1677ff;\n }\n .reTry{\n font-size: 80px;\n background-color: rgba( 255, 255, 255, 0.95 );\n text-align: center;\n line-height: 210px;\n height: 100%;\n a{\n display: block;\n }\n }\n }\n .alt{\n padding: 10px 0 0;\n color: #999;\n text-align: center;\n }\n .altWeb{\n padding: 16px 0 0;\n max-width: 300px;\n margin: 0 auto;\n .titles{\n text-align: center;\n font-weight: bold;\n }\n ul{\n margin: 0 10px;\n }\n\n }\n .percent{\n width: 100%;\n position: absolute;\n overflow: hidden;\n left: 0;\n bottom: 0;\n .warp{\n height: 4px;\n background-color: #1677ff;\n transition: all 1.6s ease-in-out;\n -webkit-transition: all 1.6s ease-in-out;\n }\n }\n "]))),
6
6
  LoginForm: styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 auto;\n padding: 0 0 5px 0 ;\n background-color: rgba(255, 255, 255, 0.75 );\n border-radius: 6px;\n "]))),
7
7
  WebTitle: styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-weight: normal;\n font-size: 22px;\n text-align: center;\n padding: 0;\n margin: 6px 0 0 0;\n line-height: 1em;\n span{\n display: inline-block;\n padding-left: 5px;\n font-weight: lighter;\n font-size: 16px;\n }\n "]))),
8
8
  WeQrUrlBox: styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: 240px !important;\n "])))
@@ -14,12 +14,13 @@ import Platform from "../../lib/platform";
14
14
  import QrWs from "./ws";
15
15
  import { getApiEnv } from "../../lib/getApiUrl";
16
16
  import styles from "./index.css";
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { Fragment as _Fragment } from "react/jsx-runtime";
19
- import { jsxs as _jsxs } from "react/jsx-runtime";
20
17
  var reTryMaxCount = 120;
21
18
  var reTryTimeLoop = 1000; // ms
22
19
  var FromWhere = 'web';
20
+ import QRCode from 'qrcode.react';
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { Fragment as _Fragment } from "react/jsx-runtime";
23
+ import { jsxs as _jsxs } from "react/jsx-runtime";
23
24
  var LoginQr = function LoginQr(_ref) {
24
25
  var defaultLoginType = _ref.defaultLoginType,
25
26
  wechatDisabled = _ref.wechatDisabled,
@@ -144,7 +145,7 @@ var LoginQr = function LoginQr(_ref) {
144
145
  }, {
145
146
  manual: defaultLoginType !== 'wechat',
146
147
  onSuccess: function onSuccess(result) {
147
- setWeQrUrl(Tool.makeQrUrl(result.url, '#0bc160'));
148
+ setWeQrUrl(result.url);
148
149
  onRunCheck();
149
150
  }
150
151
  }),
@@ -252,18 +253,25 @@ var LoginQr = function LoginQr(_ref) {
252
253
  return onRetryWeQr();
253
254
  },
254
255
  children: /*#__PURE__*/_jsxs(styles.WeQrUrlBox, {
255
- children: [/*#__PURE__*/_jsx("div", {
256
+ children: [/*#__PURE__*/_jsxs("div", {
256
257
  style: {
257
- backgroundImage: "url('".concat(weQrUrl, "')")
258
+ // backgroundImage: `url('${ weQrUrl }')`,
258
259
  },
259
260
  className: "qr wechat ".concat(isNextTry ? '' : 'noTry'),
260
- children: !isNextTry && /*#__PURE__*/_jsx("div", {
261
+ children: [!isNextTry && /*#__PURE__*/_jsx("div", {
261
262
  className: "reTry",
262
263
  onClick: onRetryWeQr,
263
264
  children: /*#__PURE__*/_jsx("a", {
264
265
  children: /*#__PURE__*/_jsx(RedoOutlined, {})
265
266
  })
266
- })
267
+ }), /*#__PURE__*/_jsx("div", {
268
+ className: "weQrUrl",
269
+ children: /*#__PURE__*/_jsx(QRCode, {
270
+ value: weQrUrl,
271
+ fgColor: "#0bc160",
272
+ size: 230
273
+ })
274
+ })]
267
275
  }), Platform.isH5 ? /*#__PURE__*/_jsxs("div", {
268
276
  className: "altWeb",
269
277
  children: [/*#__PURE__*/_jsx("div", {
package/dist/Buy/index.js CHANGED
@@ -49,6 +49,7 @@ var Buy = function Buy(_ref) {
49
49
  };
50
50
  }();
51
51
  var onOpenVipQr = function onOpenVipQr() {
52
+ var _ref3;
52
53
  var userId = Tool.getLocalUserInfo().id;
53
54
  if (Platform.isWechat || Platform.isH5) {
54
55
  Tool.h5Pay({
@@ -73,7 +74,7 @@ var Buy = function Buy(_ref) {
73
74
  Tool.toast('^_^,谢谢购买,祝您发财');
74
75
  }
75
76
  }),
76
- width: Math.min(520, window.innerWidth * 0.95)
77
+ width: Math.min(520, ((_ref3 = global || window) === null || _ref3 === void 0 ? void 0 : _ref3.innerWidth) * 0.95)
77
78
  });
78
79
  // 广播,点击了 购买;
79
80
  Tool.event.run('vip-buy-click');
package/dist/Buy/qr.js CHANGED
@@ -5,6 +5,7 @@ import { CloseOutlined, PauseOutlined, WechatOutlined } from '@ant-design/icons'
5
5
  import { useRequest } from '@umijs/hooks';
6
6
  import * as TradeController from "../service/api/TradeController";
7
7
  import * as VipController from "../service/api/VipController";
8
+ import QRCode from 'qrcode.react';
8
9
  import Tool from "../lib/Tool";
9
10
  import PageContentWarp from "../UI/PageContentWarp";
10
11
  import styles from "./qr.css";
@@ -79,7 +80,8 @@ var VipQr = function VipQr(_ref) {
79
80
  } else {}
80
81
  } else {}
81
82
  setOrderPayInfo(result);
82
- setPayQrImageUrl(Tool.makeQrUrl(result.codeUrl || result.mWebUrl, '#0bc160'));
83
+ // setPayQrImageUrl( Tool.makeQrUrl( result.codeUrl || result.mWebUrl, '#0bc160') );
84
+ setPayQrImageUrl(result.codeUrl || result.mWebUrl);
83
85
  // 五秒后自动弹出;
84
86
  setTimeout(function () {
85
87
  setPayResult(true);
@@ -143,9 +145,9 @@ var VipQr = function VipQr(_ref) {
143
145
  })]
144
146
  }), /*#__PURE__*/_jsx("div", {
145
147
  className: "qrImage",
146
- children: payQrImageUrl && /*#__PURE__*/_jsx("img", {
147
- src: payQrImageUrl,
148
- alt: ""
148
+ children: payQrImageUrl && /*#__PURE__*/_jsx(QRCode, {
149
+ value: payQrImageUrl,
150
+ fgColor: "#0bc160"
149
151
  })
150
152
  }), Platform.isH5 ? /*#__PURE__*/_jsxs("div", {
151
153
  className: "altInH5",
@@ -6,6 +6,7 @@ import styles from "./DialogDrawer.css";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  // 抽屉
8
8
  var DialogDrawer = function DialogDrawer(props) {
9
+ var _window;
9
10
  var state = Tool.extend({
10
11
  id: '',
11
12
  title: '提示',
@@ -20,7 +21,7 @@ var DialogDrawer = function DialogDrawer(props) {
20
21
  }, props);
21
22
 
22
23
  // 宽度
23
- state.width = Math.min(state.width, window.innerWidth);
24
+ state.width = Math.min(state.width, (_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth);
24
25
 
25
26
  // 管理 显示隐藏
26
27
  var _useState = useState(true),
@@ -153,6 +153,7 @@ declare const Tool: {
153
153
  top: number;
154
154
  };
155
155
  makeQrUrl(url: string, foreground?: string, size?: number): any;
156
+ makeQr(url: string, fgColor?: string, size?: number): import("react/jsx-runtime").JSX.Element;
156
157
  onLogin(): void;
157
158
  getObjectURL(file: File): string;
158
159
  onDownFile(url: string): void;
package/dist/lib/Tool.js CHANGED
@@ -2,10 +2,12 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ var _window8;
5
6
  // @ts-nocheck
6
7
 
7
8
  import { Modal, message, Tooltip } from 'antd';
8
- var JrQrcode = require('jr-qrcode');
9
+ // const JrQrcode = require('jr-qrcode');
10
+ import QRCode from 'qrcode.react';
9
11
 
10
12
  // import { history } from 'umi';
11
13
 
@@ -20,13 +22,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
22
  var packageJson = require("../../package.json");
21
23
  var store = {
22
24
  key: function key() {
23
- var WebBaseConfig = window.WebBaseConfig || {};
25
+ var _window;
26
+ var WebBaseConfig = ((_window = window) === null || _window === void 0 ? void 0 : _window.WebBaseConfig) || {};
24
27
  return "__".concat(WebBaseConfig.webKind, "-").concat(WebBaseConfig.productName, "__");
25
28
  },
26
29
  get: function get(name) {
27
30
  var getData;
28
31
  try {
29
- getData = window.localStorage.getItem(this.key() + name);
32
+ var _window2;
33
+ getData = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.localStorage.getItem(this.key() + name);
30
34
  if (getData) {
31
35
  getData = JSON.parse(getData);
32
36
  }
@@ -47,7 +51,8 @@ var store = {
47
51
  value: value
48
52
  };
49
53
  try {
50
- window.localStorage.setItem(this.key() + name, JSON.stringify(saveData));
54
+ var _window3;
55
+ (_window3 = window) === null || _window3 === void 0 || _window3.localStorage.setItem(this.key() + name, JSON.stringify(saveData));
51
56
  } catch (e) {
52
57
  console.error('LocalStorage set Error:', e);
53
58
  }
@@ -319,16 +324,18 @@ var Tool = _objectSpread(_objectSpread({
319
324
  },
320
325
  //参数:变量名,url为空则表从当前页面的url中取
321
326
  getQuery: function getQuery(name) {
327
+ var _window4, _document;
322
328
  var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
323
- var u = arguments[1] || window.location.search.replace('?', '') || document.location.hash.replace('#', ''),
329
+ var u = arguments[1] || ((_window4 = window) === null || _window4 === void 0 || (_window4 = _window4.location) === null || _window4 === void 0 ? void 0 : _window4.search.replace('?', '')) || ((_document = document) === null || _document === void 0 || (_document = _document.location) === null || _document === void 0 ? void 0 : _document.hash.replace('#', '')),
324
330
  reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'),
325
331
  r = u.substr(u.indexOf('?') + 1).match(reg);
326
332
  return r != null ? decodeURIComponent(r[2]) : '';
327
333
  },
328
334
  getQueryAll: function getQueryAll() {
335
+ var _window5, _document2;
329
336
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
330
337
  var theRequest = {};
331
- var str = url || window.location.search.replace('?', '') || document.location.hash.replace('#', '');
338
+ var str = url || ((_window5 = window) === null || _window5 === void 0 || (_window5 = _window5.location) === null || _window5 === void 0 ? void 0 : _window5.search.replace('?', '')) || ((_document2 = document) === null || _document2 === void 0 || (_document2 = _document2.location) === null || _document2 === void 0 ? void 0 : _document2.hash.replace('#', ''));
332
339
  if (url.indexOf('?') !== -1) {
333
340
  str = url.substr(url.indexOf('?') + 1);
334
341
  }
@@ -1032,11 +1039,21 @@ var Tool = _objectSpread(_objectSpread({
1032
1039
  foreground: foreground // 二维码颜色(默认黑色)
1033
1040
  });
1034
1041
  },
1042
+ makeQr: function makeQr(url) {
1043
+ var fgColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#1677ff';
1044
+ var size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 600;
1045
+ return /*#__PURE__*/_jsx(QRCode, {
1046
+ value: url,
1047
+ fgColor: fgColor,
1048
+ size: size
1049
+ });
1050
+ },
1035
1051
  onLogin: function onLogin() {
1036
1052
  return PostMessage('login');
1037
1053
  },
1038
1054
  getObjectURL: function getObjectURL(file) {
1039
- var url = window.URL || window.webkitURL;
1055
+ var _window6, _window7;
1056
+ var url = ((_window6 = window) === null || _window6 === void 0 ? void 0 : _window6.URL) || ((_window7 = window) === null || _window7 === void 0 ? void 0 : _window7.webkitURL);
1040
1057
  return url.createObjectURL(file);
1041
1058
  },
1042
1059
  // file
@@ -1081,10 +1098,12 @@ var Tool = _objectSpread(_objectSpread({
1081
1098
  (top || window).document.location.href = 'https://pay.shanren.wang/pay/we-h5?data=' + encodeURIComponent(data);
1082
1099
  }
1083
1100
  });
1084
- if (!window._GData) {
1101
+ if (window && !((_window8 = window) !== null && _window8 !== void 0 && _window8._GData)) {
1085
1102
  window._GData = {};
1086
1103
  }
1087
- Tool.GData = window._GData;
1088
- window._Tool = Tool;
1104
+ if (window) {
1105
+ Tool.GData = window._GData;
1106
+ window._Tool = Tool;
1107
+ }
1089
1108
  Tool.onWindowError();
1090
1109
  export default Tool;
@@ -1,11 +1,11 @@
1
1
  import ApiUrlsInfo, { currentEnv } from "../config/apiUrls";
2
2
  var ApiUrls = function ApiUrls() {
3
- var _window$WebBaseConfig, _window$WebBaseConfig2;
4
- return ((_window$WebBaseConfig = window.WebBaseConfig) === null || _window$WebBaseConfig === void 0 || (_window$WebBaseConfig = _window$WebBaseConfig[(_window$WebBaseConfig2 = window.WebBaseConfig) === null || _window$WebBaseConfig2 === void 0 ? void 0 : _window$WebBaseConfig2.webKind]) === null || _window$WebBaseConfig === void 0 ? void 0 : _window$WebBaseConfig.apiUrls) || ApiUrlsInfo;
3
+ var _window$WebBaseConfig, _window;
4
+ return ((_window$WebBaseConfig = window.WebBaseConfig) === null || _window$WebBaseConfig === void 0 || (_window$WebBaseConfig = _window$WebBaseConfig[(_window = window) === null || _window === void 0 || (_window = _window.WebBaseConfig) === null || _window === void 0 ? void 0 : _window.webKind]) === null || _window$WebBaseConfig === void 0 ? void 0 : _window$WebBaseConfig.apiUrls) || ApiUrlsInfo;
5
5
  };
6
6
  var envData = function envData() {
7
- var _window$WebBaseConfig3;
8
- return ((_window$WebBaseConfig3 = window.WebBaseConfig) === null || _window$WebBaseConfig3 === void 0 ? void 0 : _window$WebBaseConfig3.currentEnv) || currentEnv;
7
+ var _window2;
8
+ return ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.WebBaseConfig) === null || _window2 === void 0 ? void 0 : _window2.currentEnv) || currentEnv;
9
9
  };
10
10
  var getApiUrl = function getApiUrl() {
11
11
  var _ref, _domain;
@@ -1,6 +1,9 @@
1
1
  import * as JsErrorController from "../service/api/JsErrorController";
2
2
  var packageJson = require("../../package.json");
3
3
  var JsError = function JsError() {
4
+ if (!window) {
5
+ return;
6
+ }
4
7
  if (window.__onBindWindowError) {
5
8
  console.log('onWindowError Binded 2!');
6
9
  return false;
@@ -1,4 +1,5 @@
1
- var ua = window.navigator.userAgent.toLowerCase();
1
+ var _window;
2
+ var ua = (_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent.toLowerCase();
2
3
 
3
4
  // android平台
4
5
  var isAndroid = function () {
@@ -16,8 +17,8 @@ var isWechat = function () {
16
17
  }();
17
18
 
18
19
  // 微信小程序
19
- var isWxmp = function () {
20
- return /miniProgram/i.test(ua) || window.__wxjs_environment === 'miniprogram';
20
+ var isWxmp = function (_window2) {
21
+ return /miniProgram/i.test(ua) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.__wxjs_environment) === 'miniprogram';
21
22
  }();
22
23
 
23
24
  // 钉钉环境
@@ -72,7 +72,7 @@ var requestApi = function requestApi() {
72
72
  });
73
73
  };
74
74
  var onError = function onError(pageUrl) {
75
- var _window$__recordError;
75
+ var _window;
76
76
  var apiUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
77
77
  var title = arguments.length > 2 ? arguments[2] : undefined;
78
78
  var content = arguments.length > 3 ? arguments[3] : undefined;
@@ -80,7 +80,7 @@ var onError = function onError(pageUrl) {
80
80
  if (silent) {
81
81
  return;
82
82
  }
83
- (_window$__recordError = window.__recordError) === null || _window$__recordError === void 0 || _window$__recordError.create([{
83
+ (_window = window) === null || _window === void 0 || (_window = _window.__recordError) === null || _window === void 0 || _window.create([{
84
84
  title: title,
85
85
  siteUserId: Tool.getLocalUserInfo().id,
86
86
  errorLevel: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -72,6 +72,7 @@
72
72
  "@umijs/hooks": "^1.9.3",
73
73
  "jr-qrcode": "^1.1.4",
74
74
  "moment": "^2.29.4",
75
+ "qrcode.react": "^3.1.0",
75
76
  "styled-components": "^6.1.8",
76
77
  "umi-request": "^1.4.0",
77
78
  "yarn": "^1.22.19"