component-shipinlv 0.1.20 → 0.1.22

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.
@@ -1,24 +1,15 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  // h5 页面 登录公众号
4
- import * as WechatController from "../../service/api/WechatController";
5
- import Tool from "../../lib/Tool";
4
+
6
5
  var h5WePublicLogin = /*#__PURE__*/function () {
7
6
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8
- var domainUrl, redirectUrl, inviteUserId, loginResult;
9
7
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10
8
  while (1) switch (_context.prev = _context.next) {
11
9
  case 0:
12
10
  document.location.replace("https://auth.shanren.wang/auth/wechat/login?url=".concat(document.location.href));
13
11
  return _context.abrupt("return");
14
- case 7:
15
- loginResult = _context.sent;
16
- if (loginResult) {
17
- _context.next = 10;
18
- break;
19
- }
20
- return _context.abrupt("return");
21
- case 10:
12
+ case 2:
22
13
  case "end":
23
14
  return _context.stop();
24
15
  }
@@ -6,6 +6,7 @@ interface Props {
6
6
  accountHidden?: boolean;
7
7
  accountRegDisabled?: boolean;
8
8
  alipayDisabled?: boolean;
9
+ domain?: string;
9
10
  onLoginSuccess: () => void;
10
11
  }
11
12
  declare const LoginQr: React.FC<Props>;
@@ -18,7 +18,6 @@ var reTryMaxCount = 120;
18
18
  var reTryTimeLoop = 1000; // ms
19
19
  var FromWhere = 'web';
20
20
  import QRCode from 'qrcode.react';
21
- import isInClient from "../../lib/isInClient";
22
21
  import h5WePublicLogin from "./h5-we-public-login";
23
22
  import { jsx as _jsx } from "react/jsx-runtime";
24
23
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -30,6 +29,8 @@ var LoginQr = function LoginQr(_ref) {
30
29
  accountRegDisabled = _ref.accountRegDisabled,
31
30
  accountHidden = _ref.accountHidden,
32
31
  alipayDisabled = _ref.alipayDisabled,
32
+ _ref$domain = _ref.domain,
33
+ domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
33
34
  _ref$onLoginSuccess = _ref.onLoginSuccess,
34
35
  onLoginSuccess = _ref$onLoginSuccess === void 0 ? function () {} : _ref$onLoginSuccess;
35
36
  var _useState = useState(false),
@@ -142,10 +143,12 @@ var LoginQr = function LoginQr(_ref) {
142
143
  from: "web",
143
144
  // 没有推荐者,会根据域名判断 经销商
144
145
  inviteUserId: Tool.getInviteUserId(),
146
+ domain: domain || document.location.hostname,
145
147
  env: getApiEnv()
146
148
  });
147
149
  }, {
148
- manual: Platform.isWechat || !isInClient() || defaultLoginType !== 'wechat',
150
+ manual: true,
151
+ //,
149
152
  onSuccess: function onSuccess(result) {
150
153
  setWeQrUrl(result.url);
151
154
  onRunCheck();
@@ -233,9 +236,6 @@ var LoginQr = function LoginQr(_ref) {
233
236
  _context3.next = 9;
234
237
  return runWeLoginQr();
235
238
  case 9:
236
- _context3.next = 11;
237
- return runWeLoginQr();
238
- case 11:
239
239
  case "end":
240
240
  return _context3.stop();
241
241
  }
@@ -306,8 +306,7 @@ var LoginQr = function LoginQr(_ref) {
306
306
  })]
307
307
  })]
308
308
  }) : /*#__PURE__*/_jsx("div", {
309
- className: "alt",
310
- children: "\u8BF7\u7528\u5FAE\u4FE1\u626B\u7801\u767B\u5F55"
309
+ className: "alt"
311
310
  })]
312
311
  })
313
312
  })
@@ -1,5 +1,5 @@
1
1
  import PostMessage from "../lib/postMessage";
2
2
  var Login = function Login() {
3
- PostMessage('login');
3
+ PostMessage('need-login');
4
4
  };
5
5
  export default Login;
@@ -163,7 +163,7 @@ declare const Tool: {
163
163
  setTimeOffset(serverTime: number): void;
164
164
  getTime(): number;
165
165
  h5Pay(query: Pay.H5PayQuery): void;
166
- notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
166
+ notification(type: "info" | "error" | "success" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
167
167
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
168
168
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
169
169
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
package/dist/lib/Tool.js CHANGED
@@ -1053,7 +1053,7 @@ var Tool = _objectSpread(_objectSpread({
1053
1053
  });
1054
1054
  },
1055
1055
  onLogin: function onLogin() {
1056
- return PostMessage('login');
1056
+ return PostMessage('need-login');
1057
1057
  },
1058
1058
  getObjectURL: function getObjectURL(file) {
1059
1059
  var _window5, _window6;
@@ -2,7 +2,7 @@ import PostMessage from "./postMessage";
2
2
  export default function goAuth() {
3
3
  var authType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
4
4
  // Tool.go(`${ authType }/auth`);
5
- return PostMessage('login');
5
+ return PostMessage('need-login');
6
6
  // return;
7
7
  // if( window._openAuth_ ){
8
8
  // return Promise.reject( false );
@@ -1,3 +1,3 @@
1
- type PostMessage = 'login' | 'menu';
1
+ type PostMessage = 'need-login' | 'menu';
2
2
  declare const PostMessage: (type: PostMessage, data?: any) => void;
3
3
  export default PostMessage;
@@ -9,6 +9,7 @@ export declare function weMiniLoginQr(body: {
9
9
  loginType: 'client';
10
10
  from: string;
11
11
  inviteUserId: number;
12
+ domain: string;
12
13
  env: Global.Env;
13
14
  }): Promise<UserAuth.WeQrResult>;
14
15
  export declare function reg(body: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",