@zgfe/modules-settings 1.1.2-alpha.0 → 1.1.2

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,4 +1,10 @@
1
- import React from 'react';
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, useState } from 'react';
2
8
  import PersonalInfo from './info';
3
9
  import PersonalReset from './reset';
4
10
  import { UserOutlined } from '@ant-design/icons';
@@ -6,39 +12,45 @@ import SettingTabs from '../../components/settingTabs';
6
12
  import PersonalUnbinding from './unbinding';
7
13
  import { useContext } from 'react';
8
14
  import { BizGlobalDataContext } from '@zgfe/business-lib';
15
+ import util from '../../utils/util';
9
16
  var PersonalSetting = function PersonalSetting(_ref) {
10
17
  var settingsCallback = _ref.settingsCallback;
11
18
  var _useContext = useContext(BizGlobalDataContext),
12
- currentUser = _useContext.currentUser,
13
- isDemo = _useContext.isDemo;
19
+ currentUser = _useContext.currentUser;
20
+ var _useState = useState('1'),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ currentKey = _useState2[0],
23
+ setCurrentKey = _useState2[1];
14
24
  var title = /*#__PURE__*/React.createElement("div", {
15
25
  className: "tab-header"
16
26
  }, /*#__PURE__*/React.createElement(UserOutlined, null), /*#__PURE__*/React.createElement("span", {
17
27
  className: "tab-header-title"
18
28
  }, "\u4E2A\u4EBA\u8BBE\u7F6E"));
29
+ useEffect(function () {
30
+ var query = util.getHrefData(window.location.href);
31
+ if (query.password) setCurrentKey('2');
32
+ }, []);
19
33
  var items = [{
20
34
  key: '1',
21
35
  label: '个人资料',
22
- content: /*#__PURE__*/React.createElement(PersonalInfo, {
23
- settingsCallback: settingsCallback
24
- })
36
+ content: /*#__PURE__*/React.createElement(PersonalInfo, null)
25
37
  }, {
26
38
  key: '2',
27
39
  label: '修改密码',
28
- hidden: isDemo,
29
40
  content: /*#__PURE__*/React.createElement(PersonalReset, {
30
41
  settingsCallback: settingsCallback
31
42
  })
32
43
  }, {
33
44
  key: '3',
34
45
  label: '解绑虚拟MFA',
35
- hidden: !(currentUser === null || currentUser === void 0 ? void 0 : currentUser.secret) || isDemo,
46
+ hidden: !(currentUser === null || currentUser === void 0 ? void 0 : currentUser.secret),
36
47
  content: /*#__PURE__*/React.createElement(PersonalUnbinding, null)
37
48
  }];
38
49
  return /*#__PURE__*/React.createElement(SettingTabs, {
39
50
  typeName: "personal",
40
51
  title: title,
41
- items: items
52
+ items: items,
53
+ currentKey: currentKey
42
54
  });
43
55
  };
44
56
  export default PersonalSetting;
@@ -1,5 +1,3 @@
1
1
  import React from 'react';
2
- declare const PersonalInfo: React.FC<{
3
- settingsCallback: (type: string) => void;
4
- }>;
2
+ declare const PersonalInfo: React.FC;
5
3
  export default PersonalInfo;
@@ -11,11 +11,9 @@ import React, { useContext, useState } from 'react';
11
11
  import apis from '../../../constants/api';
12
12
  import { urlRequest } from '../../../utils/ajax';
13
13
  import constants from '../../../utils/constants';
14
- var PersonalInfo = function PersonalInfo(_ref) {
15
- var settingsCallback = _ref.settingsCallback;
14
+ var PersonalInfo = function PersonalInfo() {
16
15
  var _useContext = useContext(BizGlobalDataContext),
17
- currentUser = _useContext.currentUser,
18
- isDemo = _useContext.isDemo;
16
+ currentUser = _useContext.currentUser;
19
17
  var _useState = useState({
20
18
  username: currentUser === null || currentUser === void 0 ? void 0 : currentUser.username,
21
19
  emailNote: currentUser === null || currentUser === void 0 ? void 0 : currentUser.emailNote
@@ -55,8 +53,7 @@ var PersonalInfo = function PersonalInfo(_ref) {
55
53
  emailNote: emailNote
56
54
  });
57
55
  form.resetFields();
58
- // 主应用更新currentUser,同公司设置-更新应用名称回调
59
- settingsCallback('settingChangeCompanyNameCallback');
56
+ // 主应用更新currentUser
60
57
  } else {
61
58
  notification.error({
62
59
  message: '修改失败'
@@ -89,8 +86,7 @@ var PersonalInfo = function PersonalInfo(_ref) {
89
86
  message: '姓名最多为10个字符'
90
87
  }]
91
88
  }, /*#__PURE__*/React.createElement(Input, {
92
- placeholder: "\u59D3\u540D",
93
- disabled: isDemo
89
+ placeholder: "\u59D3\u540D"
94
90
  })), /*#__PURE__*/React.createElement(Form.Item, {
95
91
  label: "\u90AE\u7BB1",
96
92
  name: "emailNote",
@@ -102,8 +98,7 @@ var PersonalInfo = function PersonalInfo(_ref) {
102
98
  message: '邮箱格式错误'
103
99
  }]
104
100
  }, /*#__PURE__*/React.createElement(Input, {
105
- placeholder: "\u8BF7\u8F93\u5165\u90AE\u7BB1",
106
- disabled: isDemo
101
+ placeholder: "\u8BF7\u8F93\u5165\u90AE\u7BB1"
107
102
  })), /*#__PURE__*/React.createElement(Form.Item, {
108
103
  shouldUpdate: true
109
104
  }, function () {
@@ -111,8 +106,8 @@ var PersonalInfo = function PersonalInfo(_ref) {
111
106
  type: "primary",
112
107
  htmlType: "submit",
113
108
  loading: loading,
114
- disabled: isDemo || !(form.isFieldTouched('username') || form.isFieldTouched('emailNote')) || !!form.getFieldsError().filter(function (_ref2) {
115
- var errors = _ref2.errors;
109
+ disabled: !(form.isFieldTouched('username') || form.isFieldTouched('emailNote')) || !!form.getFieldsError().filter(function (_ref) {
110
+ var errors = _ref.errors;
116
111
  return errors.length;
117
112
  }).length || JSON.stringify(initialValues) === JSON.stringify(form.getFieldsValue())
118
113
  }, "\u4FDD\u5B58");
@@ -7,11 +7,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { BizGlobalDataContext } from '@zgfe/business-lib';
8
8
  import { Button, Form, notification } from 'antd';
9
9
  import Input from 'antd/lib/input/Input';
10
- import React, { useContext } from 'react';
10
+ import React, { useContext, useEffect } from 'react';
11
11
  import { useState } from 'react';
12
12
  import apis from '../../../constants/api';
13
13
  import { urlRequest } from '../../../utils/ajax';
14
14
  import base64 from '../../../utils/base64';
15
+ import util from '../../../utils/util';
15
16
  var PersonalReset = function PersonalReset(_ref) {
16
17
  var settingsCallback = _ref.settingsCallback;
17
18
  var _useContext = useContext(BizGlobalDataContext),
@@ -27,6 +28,16 @@ var PersonalReset = function PersonalReset(_ref) {
27
28
  _useState2 = _slicedToArray(_useState, 2),
28
29
  loading = _useState2[0],
29
30
  setLoading = _useState2[1];
31
+ useEffect(function () {
32
+ var query = util.getHrefData(window.location.href);
33
+ // 密码过期提示
34
+ if (query.password) {
35
+ var passwordReset = JSON.parse(decodeURIComponent(query.password));
36
+ notification.error({
37
+ message: "\u60A8\u7684\u5BC6\u7801\u5DF2\u7ECF".concat(passwordReset.period, "\u5929\u672A\u4FEE\u6539\uFF0C\u8BF7\u4FEE\u6539\u60A8\u7684\u5BC6\u7801\u4EE5\u786E\u4FDD\u8D26\u6237\u5B89\u5168")
38
+ });
39
+ }
40
+ }, []);
30
41
  var onSubmit = function onSubmit(value) {
31
42
  setLoading(true);
32
43
  var pwd = value.pwd,
@@ -30,8 +30,8 @@ var PersonalUnbinding = function PersonalUnbinding() {
30
30
  }
31
31
  }).then(function (res) {
32
32
  setLoading(false);
33
- if ((res === null || res === void 0 ? void 0 : res.success) === 101) {
34
- location.href = '/app/login';
33
+ if ((res === null || res === void 0 ? void 0 : res.success) == 101) {
34
+ location.href = '/webapp/app/login';
35
35
  } else {
36
36
  form.setFields([{
37
37
  name: 'code',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-settings",
3
- "version": "1.1.2-alpha.0",
3
+ "version": "1.1.2",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -50,7 +50,7 @@
50
50
  "umi-request": "^1.4.0",
51
51
  "yorkie": "^2.0.0"
52
52
  },
53
- "gitHead": "70563b3604238c6e3fa32a0c2fbf24ca281268c7",
53
+ "gitHead": "f2bcc19c9990231e0029aa41baf875921f283a33",
54
54
  "gitHooks": {
55
55
  "pre-commit": "lint-staged"
56
56
  }