component-shipinlv 1.0.29 → 1.0.31

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,41 @@
1
+ import React from 'react';
2
+ import { Button, Form, Space, Divider } 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(Divider, {}), /*#__PURE__*/_jsx("div", {
17
+ style: {
18
+ textAlign: "right"
19
+ },
20
+ children: /*#__PURE__*/_jsxs(Space, {
21
+ children: [/*#__PURE__*/_jsx(Button, {
22
+ type: "link",
23
+ danger: true,
24
+ ghost: true,
25
+ onClick: function onClick() {
26
+ return onCancel();
27
+ },
28
+ children: "\u53D6\u6D88"
29
+ }), /*#__PURE__*/_jsx(Button, {
30
+ type: "primary",
31
+ onClick: function onClick() {
32
+ return onConfirm();
33
+ },
34
+ children: "\u7EE7\u7EED\u767B\u5F55"
35
+ })]
36
+ })
37
+ })]
38
+ })
39
+ });
40
+ };
41
+ export default AuthUserOffline;
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
2
2
  var _templateObject, _templateObject2, _templateObject3;
3
3
  import styled from 'styled-components';
4
4
  export default {
5
- videoPublishCreateTask: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 12px 0 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n .groupIcon{\n color: blue;\n }\n .rateSelect{\n width: 120px;\n }\n .normalVideo{\n color: blue;\n }\n .shoppingCart{\n color: #F60;\n }\n .selectFile{\n padding: 12px 0 0;\n }\n .submits{\n text-align: right;\n padding: 0 0 36px 0;\n }\n "]))),
5
+ videoPublishCreateTask: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 12px 0 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n .groupIcon{\n color: blue;\n }\n .rateSelect{\n width: 120px;\n }\n .normalVideo{\n color: blue;\n }\n .shoppingCart{\n color: #F60;\n }\n .selectFile{\n padding: 12px 0 0;\n }\n .submits{\n text-align: right;\n padding: 0 0 36px 0;\n }\n .accountListWarp{\n display: flex;\n flex-direction: row;\n .accountList{\n flex: 2;\n margin-left: 5px;\n }\n .renew{\n font-size: 20px;\n padding: 0 12px;\n }\n }\n "]))),
6
6
  followerCount: styled.small(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: #F2F2F2;\n border-radius: 3px;\n font-size: smaller;\n line-height: 1em;\n margin-left: 3px;\n padding: 2px 3px;\n\n "]))),
7
7
  notLoginValid: styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: 5px;\n\n "])))
8
8
  };
@@ -4,8 +4,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  import React, { useState } from "react";
6
6
  import styles from "./index.css";
7
- import { Alert, Button, ConfigProvider, DatePicker, Divider, Form, InputNumber, Radio, Select, Switch, Tag } from "antd";
8
- import { PlusOutlined, ShoppingOutlined, UsergroupAddOutlined, VideoCameraOutlined } from "@ant-design/icons";
7
+ import { Alert, Button, ConfigProvider, DatePicker, Divider, Form, InputNumber, Radio, Select, Switch, Tag, Tooltip } from "antd";
8
+ import { PlusOutlined, RedoOutlined, ShoppingOutlined, UsergroupAddOutlined, VideoCameraOutlined } from "@ant-design/icons";
9
9
  import PageContentWarp from "../../UI/PageContentWarp";
10
10
  import { TreeSelect } from 'antd';
11
11
  import isInClient from "../../lib/isInClient";
@@ -123,9 +123,9 @@ var VideoPublishCreateTask = function VideoPublishCreateTask(_ref) {
123
123
  setTreeVideoAccountData(treeData);
124
124
  }
125
125
  }),
126
- run = _useRequest.run,
127
- loading = _useRequest.loading,
128
- error = _useRequest.error;
126
+ runAccountList = _useRequest.run,
127
+ loadingAccountList = _useRequest.loading,
128
+ errorAccountList = _useRequest.error;
129
129
  var _useRequest2 = useRequest(function (data) {
130
130
  return VideoPublishController.taskCreate(data, {
131
131
  env: env
@@ -248,12 +248,38 @@ var VideoPublishCreateTask = function VideoPublishCreateTask(_ref) {
248
248
  console.log('values:', data);
249
249
  runTask(data);
250
250
  };
251
+ var onAccountList = /*#__PURE__*/function () {
252
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
253
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
254
+ while (1) switch (_context2.prev = _context2.next) {
255
+ case 0:
256
+ if (!loadingAccountList) {
257
+ _context2.next = 2;
258
+ break;
259
+ }
260
+ return _context2.abrupt("return");
261
+ case 2:
262
+ _context2.next = 4;
263
+ return runAccountList().catch(function (err) {});
264
+ case 4:
265
+ Tool.toast('账户列表已刷新');
266
+ case 5:
267
+ case "end":
268
+ return _context2.stop();
269
+ }
270
+ }, _callee2);
271
+ }));
272
+ return function onAccountList() {
273
+ return _ref3.apply(this, arguments);
274
+ };
275
+ }();
251
276
  var formLabelSpan = 3;
252
277
  return /*#__PURE__*/_jsx(styles.videoPublishCreateTask, {
253
- children: /*#__PURE__*/_jsxs(PageContentWarp, {
254
- loading: loading,
255
- error: error,
256
- onReload: run,
278
+ children: /*#__PURE__*/_jsxs(PageContentWarp
279
+ // loading={loading}
280
+ , {
281
+ error: errorAccountList,
282
+ onReload: runAccountList,
257
283
  children: [disabled && /*#__PURE__*/_jsx(Alert, {
258
284
  message: "\u529F\u80FD\u5347\u7EA7\u4E2D\uFF0C\u5373\u5C06\u5F00\u653E\uFF0C\u656C\u8BF7\u671F\u5F85",
259
285
  type: "warning",
@@ -344,25 +370,39 @@ var VideoPublishCreateTask = function VideoPublishCreateTask(_ref) {
344
370
  }), /*#__PURE__*/_jsx(Divider, {
345
371
  orientation: "left",
346
372
  children: "\u9009\u62E9\u8D26\u6237"
347
- }), /*#__PURE__*/_jsx(Form.Item, {
348
- label: "\u8D26\u53F7",
349
- extra: "\u6BCF\u4E2A\u89C6\u9891\u53EA\u53D1\u4E00\u4E2A\u8D26\u6237",
350
- name: "accountList",
351
- rules: [{
352
- required: true,
353
- message: '请选择账户'
354
- }],
355
- children: /*#__PURE__*/_jsx(TreeSelect, {
356
- treeData: treeVideoAccountData
357
- // value={ [] }
358
- ,
359
- onChange: function onChange(idList) {
360
- console.log('TreeSelect:', idList);
373
+ }), /*#__PURE__*/_jsxs("div", {
374
+ className: "accountListWarp",
375
+ children: [/*#__PURE__*/_jsx(Form.Item, {
376
+ label: "\u8D26\u53F7",
377
+ extra: "\u6BCF\u4E2A\u89C6\u9891\u53EA\u53D1\u4E00\u4E2A\u8D26\u6237",
378
+ name: "accountList",
379
+ className: "accountList",
380
+ rules: [{
381
+ required: true,
382
+ message: '请选择账户'
383
+ }],
384
+ children: /*#__PURE__*/_jsx(TreeSelect, {
385
+ disabled: loadingAccountList,
386
+ treeData: treeVideoAccountData
387
+ // value={ [] }
388
+ ,
389
+ onChange: function onChange(idList) {
390
+ console.log('TreeSelect:', idList);
391
+ },
392
+ treeCheckable: !loadingAccountList,
393
+ showCheckedStrategy: TreeSelect.SHOW_PARENT,
394
+ placeholder: "\u8BF7\u9009\u62E9 \u8D26\u6237/\u7EC4"
395
+ })
396
+ }), /*#__PURE__*/_jsx("a", {
397
+ className: "renew ".concat(loadingAccountList ? 'disabled' : ''),
398
+ onClick: function onClick() {
399
+ return onAccountList();
361
400
  },
362
- treeCheckable: true,
363
- showCheckedStrategy: TreeSelect.SHOW_PARENT,
364
- placeholder: "\u8BF7\u9009\u62E9 \u8D26\u6237/\u7EC4"
365
- })
401
+ children: /*#__PURE__*/_jsx(Tooltip, {
402
+ title: "\u5237\u65B0\u8D26\u6237\u5217\u8868",
403
+ children: /*#__PURE__*/_jsx(RedoOutlined, {})
404
+ })
405
+ })]
366
406
  }), /*#__PURE__*/_jsxs(Divider, {
367
407
  orientation: "left",
368
408
  children: [/*#__PURE__*/_jsx(VideoCameraOutlined, {
@@ -53,7 +53,7 @@ var VideoPublishSelectList = function VideoPublishSelectList(_ref) {
53
53
  className: "title",
54
54
  children: /*#__PURE__*/_jsx(TextInput, {
55
55
  className: "remarkInput",
56
- maxLength: 20,
56
+ maxLength: 30,
57
57
  label: title || '',
58
58
  value: title || '',
59
59
  onFinish: function onFinish(title) {
package/dist/global.less CHANGED
@@ -5,4 +5,13 @@
5
5
 
6
6
  #root{
7
7
  min-height: 100vh;
8
+
9
+
10
+ }
11
+
12
+ a{
13
+ &.disabled{
14
+ color: #CCC;
15
+ cursor: not-allowed;
16
+ }
8
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",