component-shipinlv 1.0.28 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ interface Props {
4
4
  clientUniqueKey: string;
5
5
  loginTypeList: Global.AuthClientLoginType[];
6
6
  domain?: string;
7
+ env?: Global.Env;
7
8
  onLoginSuccess: () => void;
8
9
  }
9
10
  declare const Auth: React.FC<Props>;
@@ -28,6 +28,7 @@ var Auth = function Auth(_ref) {
28
28
  var productType = _ref.productType,
29
29
  clientUniqueKey = _ref.clientUniqueKey,
30
30
  loginTypeList = _ref.loginTypeList,
31
+ env = _ref.env,
31
32
  _ref$domain = _ref.domain,
32
33
  domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
33
34
  _ref$onLoginSuccess = _ref.onLoginSuccess,
@@ -315,6 +316,7 @@ var Auth = function Auth(_ref) {
315
316
  }),
316
317
  disabled: !loginTypeList.includes('account-login'),
317
318
  children: /*#__PURE__*/_jsx(AuthLoginReg, {
319
+ env: env,
318
320
  productType: productType,
319
321
  clientUniqueKey: clientUniqueKey,
320
322
  accountRegDisabled: !loginTypeList.includes('account-reg'),
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ env?: Global.Env;
3
4
  productType: string;
4
5
  clientUniqueKey: string;
5
6
  activeKeyDefault?: 'login' | 'reg' | string;
@@ -8,7 +8,8 @@ import AuthLogin from "./login";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  var AuthLoginReg = function AuthLoginReg(_ref) {
11
- var productType = _ref.productType,
11
+ var env = _ref.env,
12
+ productType = _ref.productType,
12
13
  clientUniqueKey = _ref.clientUniqueKey,
13
14
  _ref$activeKeyDefault = _ref.activeKeyDefault,
14
15
  activeKeyDefault = _ref$activeKeyDefault === void 0 ? 'reg' : _ref$activeKeyDefault,
@@ -45,6 +46,7 @@ var AuthLoginReg = function AuthLoginReg(_ref) {
45
46
  children: [/*#__PURE__*/_jsx(Tabs.TabPane, {
46
47
  tab: "\u767B\u5F55",
47
48
  children: /*#__PURE__*/_jsx(AuthLogin, {
49
+ env: env,
48
50
  productType: productType,
49
51
  clientUniqueKey: clientUniqueKey,
50
52
  onSuccess: function onSuccess() {
@@ -54,6 +56,7 @@ var AuthLoginReg = function AuthLoginReg(_ref) {
54
56
  }, "login"), /*#__PURE__*/_jsx(Tabs.TabPane, {
55
57
  tab: "\u6CE8\u518C",
56
58
  children: /*#__PURE__*/_jsx(Reg, {
59
+ env: env,
57
60
  productType: productType,
58
61
  clientUniqueKey: clientUniqueKey,
59
62
  onSuccess: function onSuccess() {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ env?: Global.Env;
3
4
  productType: string;
4
5
  clientUniqueKey: string;
5
6
  onSuccess: () => void;
@@ -10,6 +10,7 @@ import { useRequest } from '@umijs/hooks';
10
10
 
11
11
  // import styles from "./reg.scss" ;
12
12
  import * as AuthController from "../service/api/AuthController";
13
+ import AuthUserOffline from "./user-offline";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  var formItemLayout = {
@@ -43,7 +44,8 @@ var tailFormItemLayout = {
43
44
  }
44
45
  };
45
46
  var AuthReg = function AuthReg(_ref) {
46
- var productType = _ref.productType,
47
+ var env = _ref.env,
48
+ productType = _ref.productType,
47
49
  clientUniqueKey = _ref.clientUniqueKey,
48
50
  _ref$onSuccess = _ref.onSuccess,
49
51
  onSuccess = _ref$onSuccess === void 0 ? function () {} : _ref$onSuccess;
@@ -55,17 +57,39 @@ var AuthReg = function AuthReg(_ref) {
55
57
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
56
58
  form = _Form$useForm2[0];
57
59
  var _useRequest = useRequest(function (data) {
60
+ var unbind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
58
61
  return AuthController.login(_objectSpread(_objectSpread({
59
62
  productType: productType,
60
63
  clientUniqueKey: clientUniqueKey,
61
64
  from: "web"
62
65
  }, data), {}, {
66
+ unbind: unbind,
63
67
  inviteUserId: Tool.getInviteUserId()
64
- }));
68
+ }), {
69
+ env: env
70
+ });
65
71
  }, {
66
72
  manual: true,
67
73
  onSuccess: function onSuccess(result) {
68
74
  loginSuccess(result);
75
+ },
76
+ onError: function onError(err) {
77
+ if (err.name === 'user-offline') {
78
+ var dialog = Tool.pageDialog({
79
+ title: '此账号已经在其他电脑登录',
80
+ content: /*#__PURE__*/_jsx(AuthUserOffline, {
81
+ message: err.message,
82
+ onConfirm: function onConfirm() {
83
+ run(form.getFieldsValue(), true);
84
+ dialog.destroy();
85
+ },
86
+ onCancel: function onCancel() {
87
+ dialog.destroy();
88
+ }
89
+ }),
90
+ width: 520
91
+ });
92
+ }
69
93
  }
70
94
  }),
71
95
  loading = _useRequest.loading,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ env?: Global.Env;
3
4
  productType: string;
4
5
  clientUniqueKey: string;
5
6
  onSuccess: () => void;
@@ -41,7 +41,8 @@ var tailFormItemLayout = {
41
41
  }
42
42
  };
43
43
  var Reg = function Reg(_ref) {
44
- var productType = _ref.productType,
44
+ var env = _ref.env,
45
+ productType = _ref.productType,
45
46
  clientUniqueKey = _ref.clientUniqueKey,
46
47
  _ref$onSuccess = _ref.onSuccess,
47
48
  onSuccess = _ref$onSuccess === void 0 ? function () {} : _ref$onSuccess;
@@ -54,7 +55,9 @@ var Reg = function Reg(_ref) {
54
55
  clientUniqueKey: clientUniqueKey
55
56
  }, data), {}, {
56
57
  inviteUserId: Tool.getInviteUserId()
57
- }));
58
+ }), {
59
+ env: env
60
+ });
58
61
  }, {
59
62
  manual: true,
60
63
  onSuccess: function onSuccess(result) {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ message: string;
4
+ onConfirm: () => void;
5
+ onCancel: () => void;
6
+ }
7
+ declare const AuthUserOffline: React.FC<Props>;
8
+ export default AuthUserOffline;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { Button, Form, Space } from 'antd';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ var AuthUserOffline = function AuthUserOffline(_ref) {
6
+ var message = _ref.message,
7
+ _ref$onConfirm = _ref.onConfirm,
8
+ onConfirm = _ref$onConfirm === void 0 ? function () {} : _ref$onConfirm,
9
+ _ref$onCancel = _ref.onCancel,
10
+ onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel;
11
+ return /*#__PURE__*/_jsx("section", {
12
+ className: "authClientLogin",
13
+ children: /*#__PURE__*/_jsxs(Form, {
14
+ children: [/*#__PURE__*/_jsx(Form.Item, {
15
+ children: message
16
+ }), /*#__PURE__*/_jsx(Form.Item, {
17
+ children: /*#__PURE__*/_jsxs(Space, {
18
+ children: [/*#__PURE__*/_jsx(Button, {
19
+ type: "primary",
20
+ onClick: function onClick() {
21
+ return onConfirm();
22
+ },
23
+ children: "\u7EE7\u7EED\u767B\u5F55"
24
+ }), /*#__PURE__*/_jsx(Button, {
25
+ type: "link",
26
+ danger: true,
27
+ ghost: true,
28
+ onClick: function onClick() {
29
+ return onCancel();
30
+ },
31
+ children: "\u53D6\u6D88"
32
+ })]
33
+ })
34
+ })]
35
+ })
36
+ });
37
+ };
38
+ export default AuthUserOffline;
@@ -4,7 +4,7 @@ export declare function login(body: {
4
4
  password: string;
5
5
  from: "web";
6
6
  inviteUserId: number;
7
- }): Promise<UserAuth.LoginSuccessData>;
7
+ }, options?: ServicesApi.RequestOptions): Promise<UserAuth.LoginSuccessData>;
8
8
  export declare function weMiniLoginQr(body: {
9
9
  loginId: string;
10
10
  loginType: 'client';
@@ -12,10 +12,10 @@ export declare function weMiniLoginQr(body: {
12
12
  inviteUserId: number;
13
13
  domain: string;
14
14
  env: Global.Env;
15
- }): Promise<UserAuth.WeQrResult>;
15
+ }, options?: ServicesApi.RequestOptions): Promise<UserAuth.WeQrResult>;
16
16
  export declare function reg(body: {
17
17
  productType: string;
18
18
  accountName: string;
19
19
  password: string;
20
20
  inviteUserId: number;
21
- }): Promise<UserAuth.LoginSuccessData>;
21
+ }, options?: ServicesApi.RequestOptions): Promise<UserAuth.LoginSuccessData>;
@@ -2,24 +2,24 @@ 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
- export function login(_x) {
5
+ export function login(_x, _x2) {
6
6
  return _login.apply(this, arguments);
7
7
  }
8
8
  function _login() {
9
- _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body) {
9
+ _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body, options) {
10
10
  return _regeneratorRuntime().wrap(function _callee$(_context) {
11
11
  while (1) switch (_context.prev = _context.next) {
12
12
  case 0:
13
13
  // 兼容
14
14
  // @ts-ignore
15
15
  body.account = body.accountName;
16
- return _context.abrupt("return", request("auth/loginAccount", {
16
+ return _context.abrupt("return", request("auth/loginAccount", _objectSpread({
17
17
  method: 'POST',
18
18
  headers: {
19
19
  'Content-Type': 'application/json'
20
20
  },
21
21
  data: _objectSpread({}, body)
22
- }));
22
+ }, options || {})));
23
23
  case 2:
24
24
  case "end":
25
25
  return _context.stop();
@@ -28,23 +28,22 @@ function _login() {
28
28
  }));
29
29
  return _login.apply(this, arguments);
30
30
  }
31
- export function weMiniLoginQr(_x2) {
31
+ export function weMiniLoginQr(_x3, _x4) {
32
32
  return _weMiniLoginQr.apply(this, arguments);
33
33
  }
34
34
  function _weMiniLoginQr() {
35
- _weMiniLoginQr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
35
+ _weMiniLoginQr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
36
36
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
37
37
  while (1) switch (_context2.prev = _context2.next) {
38
38
  case 0:
39
- return _context2.abrupt("return", request('auth/wechatLoginQr',
40
- //`client/auth/weMiniLoginQr`,
41
- {
39
+ return _context2.abrupt("return", request('auth/wechatLoginQr', //`client/auth/weMiniLoginQr`,
40
+ _objectSpread({
42
41
  method: 'POST',
43
42
  headers: {
44
43
  'Content-Type': 'application/json'
45
44
  },
46
45
  data: _objectSpread({}, body)
47
- }));
46
+ }, options || {})));
48
47
  case 1:
49
48
  case "end":
50
49
  return _context2.stop();
@@ -53,21 +52,21 @@ function _weMiniLoginQr() {
53
52
  }));
54
53
  return _weMiniLoginQr.apply(this, arguments);
55
54
  }
56
- export function reg(_x3) {
55
+ export function reg(_x5, _x6) {
57
56
  return _reg.apply(this, arguments);
58
57
  }
59
58
  function _reg() {
60
- _reg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(body) {
59
+ _reg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(body, options) {
61
60
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
62
61
  while (1) switch (_context3.prev = _context3.next) {
63
62
  case 0:
64
- return _context3.abrupt("return", request("auth/reg", {
63
+ return _context3.abrupt("return", request("auth/reg", _objectSpread({
65
64
  method: 'POST',
66
65
  headers: {
67
66
  'Content-Type': 'application/json'
68
67
  },
69
68
  data: _objectSpread({}, body)
70
- }));
69
+ }, options || {})));
71
70
  case 1:
72
71
  case "end":
73
72
  return _context3.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",