component-shipinlv 1.0.29 → 1.0.30

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.
@@ -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 = {
@@ -56,11 +57,13 @@ var AuthReg = function AuthReg(_ref) {
56
57
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
57
58
  form = _Form$useForm2[0];
58
59
  var _useRequest = useRequest(function (data) {
60
+ var unbind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
59
61
  return AuthController.login(_objectSpread(_objectSpread({
60
62
  productType: productType,
61
63
  clientUniqueKey: clientUniqueKey,
62
64
  from: "web"
63
65
  }, data), {}, {
66
+ unbind: unbind,
64
67
  inviteUserId: Tool.getInviteUserId()
65
68
  }), {
66
69
  env: env
@@ -69,6 +72,24 @@ var AuthReg = function AuthReg(_ref) {
69
72
  manual: true,
70
73
  onSuccess: function onSuccess(result) {
71
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
+ }
72
93
  }
73
94
  }),
74
95
  loading = _useRequest.loading,
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",