@zgfe/modules-settings 1.1.1-password.1 → 1.1.2-alpha.0

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.
@@ -536,11 +536,11 @@ var User = function User(props) {
536
536
  width: 400
537
537
  }
538
538
  }, dialogContent)), /*#__PURE__*/React.createElement(BizDialog, {
539
- title: pwdPanelUserConfig ? '创建成功' : '密码已生成',
539
+ title: pwdPanelUserConfig && pwdPanelUserConfig.id ? '创建成功' : '密码已生成',
540
540
  visible: showPasswordPanel,
541
541
  closable: true,
542
542
  onCancel: closePwdPanel,
543
- footer: [pwdPanelUserConfig ? /*#__PURE__*/React.createElement(Button, {
543
+ footer: [pwdPanelUserConfig && pwdPanelUserConfig.id ? /*#__PURE__*/React.createElement(Button, {
544
544
  style: {
545
545
  float: 'left'
546
546
  },
@@ -1,10 +1,4 @@
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';
1
+ import React from 'react';
8
2
  import PersonalInfo from './info';
9
3
  import PersonalReset from './reset';
10
4
  import { UserOutlined } from '@ant-design/icons';
@@ -12,45 +6,39 @@ import SettingTabs from '../../components/settingTabs';
12
6
  import PersonalUnbinding from './unbinding';
13
7
  import { useContext } from 'react';
14
8
  import { BizGlobalDataContext } from '@zgfe/business-lib';
15
- import util from '../../utils/util';
16
9
  var PersonalSetting = function PersonalSetting(_ref) {
17
10
  var settingsCallback = _ref.settingsCallback;
18
11
  var _useContext = useContext(BizGlobalDataContext),
19
- currentUser = _useContext.currentUser;
20
- var _useState = useState('1'),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- currentKey = _useState2[0],
23
- setCurrentKey = _useState2[1];
12
+ currentUser = _useContext.currentUser,
13
+ isDemo = _useContext.isDemo;
24
14
  var title = /*#__PURE__*/React.createElement("div", {
25
15
  className: "tab-header"
26
16
  }, /*#__PURE__*/React.createElement(UserOutlined, null), /*#__PURE__*/React.createElement("span", {
27
17
  className: "tab-header-title"
28
18
  }, "\u4E2A\u4EBA\u8BBE\u7F6E"));
29
- useEffect(function () {
30
- var query = util.getHrefData(window.location.href);
31
- if (query.password) setCurrentKey('2');
32
- }, []);
33
19
  var items = [{
34
20
  key: '1',
35
21
  label: '个人资料',
36
- content: /*#__PURE__*/React.createElement(PersonalInfo, null)
22
+ content: /*#__PURE__*/React.createElement(PersonalInfo, {
23
+ settingsCallback: settingsCallback
24
+ })
37
25
  }, {
38
26
  key: '2',
39
27
  label: '修改密码',
28
+ hidden: isDemo,
40
29
  content: /*#__PURE__*/React.createElement(PersonalReset, {
41
30
  settingsCallback: settingsCallback
42
31
  })
43
32
  }, {
44
33
  key: '3',
45
34
  label: '解绑虚拟MFA',
46
- hidden: !(currentUser === null || currentUser === void 0 ? void 0 : currentUser.secret),
35
+ hidden: !(currentUser === null || currentUser === void 0 ? void 0 : currentUser.secret) || isDemo,
47
36
  content: /*#__PURE__*/React.createElement(PersonalUnbinding, null)
48
37
  }];
49
38
  return /*#__PURE__*/React.createElement(SettingTabs, {
50
39
  typeName: "personal",
51
40
  title: title,
52
- items: items,
53
- currentKey: currentKey
41
+ items: items
54
42
  });
55
43
  };
56
44
  export default PersonalSetting;
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- declare const PersonalInfo: React.FC;
2
+ declare const PersonalInfo: React.FC<{
3
+ settingsCallback: (type: string) => void;
4
+ }>;
3
5
  export default PersonalInfo;
@@ -11,9 +11,11 @@ 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() {
14
+ var PersonalInfo = function PersonalInfo(_ref) {
15
+ var settingsCallback = _ref.settingsCallback;
15
16
  var _useContext = useContext(BizGlobalDataContext),
16
- currentUser = _useContext.currentUser;
17
+ currentUser = _useContext.currentUser,
18
+ isDemo = _useContext.isDemo;
17
19
  var _useState = useState({
18
20
  username: currentUser === null || currentUser === void 0 ? void 0 : currentUser.username,
19
21
  emailNote: currentUser === null || currentUser === void 0 ? void 0 : currentUser.emailNote
@@ -53,7 +55,8 @@ var PersonalInfo = function PersonalInfo() {
53
55
  emailNote: emailNote
54
56
  });
55
57
  form.resetFields();
56
- // 主应用更新currentUser
58
+ // 主应用更新currentUser,同公司设置-更新应用名称回调
59
+ settingsCallback('settingChangeCompanyNameCallback');
57
60
  } else {
58
61
  notification.error({
59
62
  message: '修改失败'
@@ -86,7 +89,8 @@ var PersonalInfo = function PersonalInfo() {
86
89
  message: '姓名最多为10个字符'
87
90
  }]
88
91
  }, /*#__PURE__*/React.createElement(Input, {
89
- placeholder: "\u59D3\u540D"
92
+ placeholder: "\u59D3\u540D",
93
+ disabled: isDemo
90
94
  })), /*#__PURE__*/React.createElement(Form.Item, {
91
95
  label: "\u90AE\u7BB1",
92
96
  name: "emailNote",
@@ -98,7 +102,8 @@ var PersonalInfo = function PersonalInfo() {
98
102
  message: '邮箱格式错误'
99
103
  }]
100
104
  }, /*#__PURE__*/React.createElement(Input, {
101
- placeholder: "\u8BF7\u8F93\u5165\u90AE\u7BB1"
105
+ placeholder: "\u8BF7\u8F93\u5165\u90AE\u7BB1",
106
+ disabled: isDemo
102
107
  })), /*#__PURE__*/React.createElement(Form.Item, {
103
108
  shouldUpdate: true
104
109
  }, function () {
@@ -106,8 +111,8 @@ var PersonalInfo = function PersonalInfo() {
106
111
  type: "primary",
107
112
  htmlType: "submit",
108
113
  loading: loading,
109
- disabled: !(form.isFieldTouched('username') || form.isFieldTouched('emailNote')) || !!form.getFieldsError().filter(function (_ref) {
110
- var errors = _ref.errors;
114
+ disabled: isDemo || !(form.isFieldTouched('username') || form.isFieldTouched('emailNote')) || !!form.getFieldsError().filter(function (_ref2) {
115
+ var errors = _ref2.errors;
111
116
  return errors.length;
112
117
  }).length || JSON.stringify(initialValues) === JSON.stringify(form.getFieldsValue())
113
118
  }, "\u4FDD\u5B58");
@@ -7,12 +7,11 @@ 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, useEffect } from 'react';
10
+ import React, { useContext } 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';
16
15
  var PersonalReset = function PersonalReset(_ref) {
17
16
  var settingsCallback = _ref.settingsCallback;
18
17
  var _useContext = useContext(BizGlobalDataContext),
@@ -28,16 +27,6 @@ var PersonalReset = function PersonalReset(_ref) {
28
27
  _useState2 = _slicedToArray(_useState, 2),
29
28
  loading = _useState2[0],
30
29
  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
- }, []);
41
30
  var onSubmit = function onSubmit(value) {
42
31
  setLoading(true);
43
32
  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 = '/webapp/app/login';
33
+ if ((res === null || res === void 0 ? void 0 : res.success) === 101) {
34
+ location.href = '/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.1-password.1",
3
+ "version": "1.1.2-alpha.0",
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": "1750af03407dc16a11e954a523be37f979246751",
53
+ "gitHead": "70563b3604238c6e3fa32a0c2fbf24ca281268c7",
54
54
  "gitHooks": {
55
55
  "pre-commit": "lint-staged"
56
56
  }