@zgfe/modules-settings 1.0.1-a.1 → 1.0.1-a.10

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.
Files changed (104) hide show
  1. package/dist/esm/components/demo.d.ts +8 -0
  2. package/dist/esm/components/demo.js +25 -0
  3. package/dist/esm/components/settingTabs/index.d.ts +12 -0
  4. package/dist/esm/components/settingTabs/index.js +52 -0
  5. package/dist/esm/components/settingTabs/index.less +32 -0
  6. package/dist/esm/constants/api.d.ts +15 -0
  7. package/dist/esm/constants/api.js +24 -2
  8. package/dist/esm/index.d.ts +1 -0
  9. package/dist/esm/index.js +2 -1
  10. package/dist/esm/modules/appSettings/appInfo/index.d.ts +3 -1
  11. package/dist/esm/modules/appSettings/appInfo/index.js +88 -22
  12. package/dist/esm/modules/appSettings/dataAccessFilter/index.d.ts +5 -0
  13. package/dist/esm/modules/appSettings/dataAccessFilter/index.js +107 -19
  14. package/dist/esm/modules/appSettings/dataAccessFilter/index.less +5 -0
  15. package/dist/esm/modules/appSettings/demo/index.d.ts +3 -0
  16. package/dist/esm/modules/appSettings/demo/index.js +6 -0
  17. package/dist/esm/modules/appSettings/index.d.ts +3 -1
  18. package/dist/esm/modules/appSettings/index.js +80 -17
  19. package/dist/esm/modules/appSettings/index.less +21 -0
  20. package/dist/esm/modules/appSettings/member/index.js +224 -11
  21. package/dist/esm/modules/appSettings/virtualSource/index.d.ts +4 -0
  22. package/dist/esm/modules/appSettings/virtualSource/index.js +160 -0
  23. package/dist/esm/modules/appSettings/virtualSource/styles/index.less +28 -0
  24. package/dist/esm/modules/appSettings/virtualSource/styles/table.less +51 -0
  25. package/dist/esm/modules/companySetting/appList/index.d.ts +3 -3
  26. package/dist/esm/modules/companySetting/appList/index.js +37 -32
  27. package/dist/esm/modules/companySetting/appList/index.less +0 -7
  28. package/dist/esm/modules/companySetting/cost/index.d.ts +1 -0
  29. package/dist/esm/modules/companySetting/cost/index.js +123 -29
  30. package/dist/esm/modules/companySetting/edit/authConfig.d.ts +2 -1
  31. package/dist/esm/modules/companySetting/edit/authConfig.js +7 -10
  32. package/dist/esm/modules/companySetting/edit/authConfigCEP.d.ts +2 -1
  33. package/dist/esm/modules/companySetting/edit/authConfigCEP.js +6 -20
  34. package/dist/esm/modules/companySetting/edit/authGroup.js +0 -1
  35. package/dist/esm/modules/companySetting/edit/authModule.d.ts +1 -1
  36. package/dist/esm/modules/companySetting/edit/authModule.js +1 -2
  37. package/dist/esm/modules/companySetting/edit/multiAuthModule.d.ts +1 -1
  38. package/dist/esm/modules/companySetting/edit/multiAuthModule.js +0 -1
  39. package/dist/esm/modules/companySetting/edit/styles/user.less +22 -0
  40. package/dist/esm/modules/companySetting/edit/user.d.ts +2 -1
  41. package/dist/esm/modules/companySetting/edit/user.js +95 -23
  42. package/dist/esm/modules/companySetting/edit/userGroup.d.ts +1 -2
  43. package/dist/esm/modules/companySetting/edit/userGroup.js +74 -22
  44. package/dist/esm/modules/companySetting/index.d.ts +11 -15
  45. package/dist/esm/modules/companySetting/index.js +234 -54
  46. package/dist/esm/modules/companySetting/info/index.d.ts +3 -2
  47. package/dist/esm/modules/companySetting/info/index.js +21 -14
  48. package/dist/esm/modules/companySetting/style/common.less +1 -1
  49. package/dist/esm/modules/companySetting/style/reset.less +117 -0
  50. package/dist/esm/modules/companySetting/user/index.d.ts +9 -20
  51. package/dist/esm/modules/companySetting/user/index.js +23 -15
  52. package/dist/esm/modules/companySetting/user/index.less +7 -7
  53. package/dist/esm/modules/companySetting/user/invite.d.ts +2 -0
  54. package/dist/esm/modules/companySetting/user/invite.js +75 -25
  55. package/dist/esm/modules/companySetting/userGroup/authConfigDetail.d.ts +3 -3
  56. package/dist/esm/modules/companySetting/userGroup/authConfigDetail.js +12 -5
  57. package/dist/esm/modules/companySetting/userGroup/groupItem.d.ts +1 -1
  58. package/dist/esm/modules/companySetting/userGroup/index.d.ts +3 -4
  59. package/dist/esm/modules/companySetting/userGroup/index.js +2 -4
  60. package/dist/esm/modules/companySetting/virtualApp/config.d.ts +11 -0
  61. package/dist/esm/modules/companySetting/virtualApp/config.js +144 -0
  62. package/dist/esm/modules/companySetting/virtualApp/index.d.ts +12 -0
  63. package/dist/esm/modules/companySetting/virtualApp/index.js +240 -0
  64. package/dist/esm/modules/companySetting/virtualApp/panels/list.d.ts +12 -0
  65. package/dist/esm/modules/companySetting/virtualApp/panels/list.js +169 -0
  66. package/dist/esm/modules/companySetting/virtualApp/panels/sourceItem.d.ts +10 -0
  67. package/dist/esm/modules/companySetting/virtualApp/panels/sourceItem.js +163 -0
  68. package/dist/esm/modules/companySetting/virtualApp/styles/config.less +36 -0
  69. package/dist/esm/modules/companySetting/virtualApp/styles/index.less +21 -0
  70. package/dist/esm/modules/companySetting/virtualApp/styles/list.less +28 -0
  71. package/dist/esm/modules/companySetting/virtualApp/styles/sourceItem.less +33 -0
  72. package/dist/esm/modules/companySetting/virtualApp/styles/table.less +44 -0
  73. package/dist/esm/modules/companySetting/wechatBinding/index.d.ts +4 -0
  74. package/dist/esm/modules/companySetting/wechatBinding/index.js +130 -0
  75. package/dist/esm/modules/companySetting/wechatBinding/index.less +48 -0
  76. package/dist/esm/modules/personalSetting/index.d.ts +3 -1
  77. package/dist/esm/modules/personalSetting/index.js +56 -11
  78. package/dist/esm/modules/personalSetting/index.less +1 -0
  79. package/dist/esm/modules/personalSetting/info/index.js +54 -21
  80. package/dist/esm/modules/personalSetting/reset/index.d.ts +3 -1
  81. package/dist/esm/modules/personalSetting/reset/index.js +133 -18
  82. package/dist/esm/modules/systemSetting/index.d.ts +4 -0
  83. package/dist/esm/modules/systemSetting/index.js +18 -0
  84. package/dist/esm/modules/systemSetting/index.less +2 -0
  85. package/dist/esm/modules/systemSetting/notice/configItem/index.d.ts +7 -0
  86. package/dist/esm/modules/systemSetting/notice/configItem/index.js +48 -0
  87. package/dist/esm/modules/systemSetting/notice/configItem/index.less +15 -0
  88. package/dist/esm/modules/systemSetting/notice/edit/index.d.ts +15 -0
  89. package/dist/esm/modules/systemSetting/notice/edit/index.js +125 -0
  90. package/dist/esm/modules/systemSetting/notice/edit/index.less +26 -0
  91. package/dist/esm/modules/systemSetting/notice/index.d.ts +9 -0
  92. package/dist/esm/modules/systemSetting/notice/index.js +101 -0
  93. package/dist/esm/utils/ajax.d.ts +2 -0
  94. package/dist/esm/utils/ajax.js +37 -0
  95. package/dist/esm/utils/functionalPermissions.d.ts +2 -382
  96. package/dist/esm/utils/util.d.ts +10 -13
  97. package/dist/esm/utils/util.js +2 -2
  98. package/package.json +4 -3
  99. package/dist/esm/constants/styles/base.sass +0 -9
  100. package/dist/esm/constants/styles/cleverUI.css +0 -7
  101. package/dist/esm/constants/styles/constants.sass +0 -60
  102. package/dist/esm/constants/styles/customUITheme.sass +0 -54
  103. package/dist/esm/constants/styles/reset.sass +0 -61
  104. package/dist/esm/modules/dsfdsf +0 -0
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import 'antd/dist/antd.less';
3
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
4
+ import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
5
+ declare const DemoWrapper: React.FC<{
6
+ children?: any;
7
+ }>;
8
+ export default DemoWrapper;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import 'antd/dist/antd.less';
3
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
4
+ import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
5
+ import { BizGlobalDataContext } from '@zgfe/business-lib';
6
+ import { ConfigProvider } from 'antd';
7
+ import zhCN from 'antd/es/locale/zh_CN';
8
+ var DemoWrapper = function DemoWrapper(props) {
9
+ return /*#__PURE__*/React.createElement(ConfigProvider, {
10
+ locale: zhCN
11
+ }, /*#__PURE__*/React.createElement("div", {
12
+ style: {
13
+ background: '#F5F5F5',
14
+ padding: '24px',
15
+ height: 800
16
+ }
17
+ }, /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
18
+ value: {
19
+ currentApp: {
20
+ appId: 184
21
+ }
22
+ }
23
+ }, props.children)));
24
+ };
25
+ export default DemoWrapper;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface ISettingTabsItem {
4
+ key: string;
5
+ label: string;
6
+ content: JSX.Element;
7
+ }
8
+ declare const SettingTabs: React.FC<{
9
+ items: ISettingTabsItem[];
10
+ title: JSX.Element;
11
+ }>;
12
+ export default SettingTabs;
@@ -0,0 +1,52 @@
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, { useState } from 'react';
8
+ import Sider from 'antd/lib/layout/Sider';
9
+ import Layout, { Content } from 'antd/lib/layout/layout';
10
+ import { Menu } from 'antd';
11
+ import "./index.less";
12
+ var SettingTabs = function SettingTabs(props) {
13
+ var _items$;
14
+ var title = props.title,
15
+ items = props.items;
16
+ var filterItems = items.filter(function (item) {
17
+ return !item.hidden;
18
+ });
19
+ var _useState = useState([(_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.key]),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ selectedKeys = _useState2[0],
22
+ setSelectedKeys = _useState2[1];
23
+ var selectedContent = function selectedContent() {
24
+ // withRouter
25
+ var index = items.findIndex(function (item) {
26
+ return item.key === selectedKeys[0];
27
+ });
28
+ return items[index].content;
29
+ };
30
+ // 菜单点击
31
+ var menuClick = function menuClick(_ref) {
32
+ var key = _ref.key;
33
+ setSelectedKeys([key]);
34
+ };
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ className: "settings-container"
37
+ }, /*#__PURE__*/React.createElement("h3", null, title), /*#__PURE__*/React.createElement(Layout, {
38
+ className: "settings-layout"
39
+ }, /*#__PURE__*/React.createElement(Sider, {
40
+ className: "settings-sider"
41
+ }, /*#__PURE__*/React.createElement(Menu, {
42
+ style: {
43
+ width: 200
44
+ },
45
+ selectedKeys: selectedKeys,
46
+ items: filterItems,
47
+ onClick: menuClick
48
+ })), /*#__PURE__*/React.createElement(Content, {
49
+ className: "settings-content"
50
+ }, selectedContent())));
51
+ };
52
+ export default SettingTabs;
@@ -0,0 +1,32 @@
1
+ .settings-container {
2
+ padding: 24px;
3
+ background: #f0f2f5;
4
+
5
+ .app-name {
6
+ font-weight: normal;
7
+ font-size: 14px;
8
+ }
9
+
10
+ .settings-layout {
11
+ height: calc(100vh - 130px);
12
+ // overflow: auto;
13
+ padding: 24px 0px 24px;
14
+
15
+ .settings-sider {
16
+ display: contents;
17
+ background: white;
18
+ }
19
+
20
+ .settings-content {
21
+ max-width: 920px;
22
+ margin-left: 24px;
23
+ padding: 40px;
24
+ overflow: auto;
25
+ background: white;
26
+
27
+ .ant-menu-vertical .ant-menu-item {
28
+ margin: 0px !important;
29
+ }
30
+ }
31
+ }
32
+ }
@@ -8,6 +8,11 @@ declare let apis: {
8
8
  createApp: string;
9
9
  queryAppList: string;
10
10
  queryPackageInfo: string;
11
+ queryVirtualApps: string;
12
+ getCompanyAppList: string;
13
+ editVirtualApp: string;
14
+ queryAccountEvents: string;
15
+ editVirtualSourceApp: string;
11
16
  };
12
17
  setting: {
13
18
  updateCompanyName: string;
@@ -17,6 +22,7 @@ declare let apis: {
17
22
  removeMember: string;
18
23
  resetpwd: string;
19
24
  updateUserAuth: string;
25
+ delSubscribeUser: string;
20
26
  queryFunConfigList: string;
21
27
  queryAppList: string;
22
28
  queryFunConfigByUserId: string;
@@ -25,8 +31,17 @@ declare let apis: {
25
31
  updateUserAuthCEP: string;
26
32
  updateGroupAuth: string;
27
33
  deleteGroup: string;
34
+ wxSubscribeUserList: string;
28
35
  updateUserInfo: string;
29
36
  resetPassword: string;
37
+ updateAppName: string;
38
+ createFilter: string;
39
+ queryFilter: string;
40
+ queryNoticeConfig: string;
41
+ editNoticeConfig: string;
42
+ };
43
+ eventMeta: {
44
+ queryEventMeta: string;
30
45
  };
31
46
  };
32
47
  export default apis;
@@ -9,8 +9,17 @@ var apis = {
9
9
  deleteApp: apiPrefix + '/common/proxy/user/deleteApp.jsp',
10
10
  createApp: apiPrefix + '/system/createApp',
11
11
  queryAppList: apiPrefix + '/common/proxy/data/v2ajaxGetDataByApp.jsp',
12
- queryPackageInfo: apiPrefix + '/system/packageInfo'
12
+ queryPackageInfo: apiPrefix + '/system/packageInfo',
13
+ queryVirtualApps: apiPrefix + '/common/proxy/user/sourceApp.jsp',
14
+ // 查询虚拟应用列表
15
+ getCompanyAppList: apiPrefix + '/common/proxy/user/getCompanyAppList.jsp',
16
+ // 查询公司下所有应用列表
17
+ editVirtualApp: apiPrefix + '/common/proxy/user/editDataSource.jsp',
18
+ // 修改虚拟应用
19
+ queryAccountEvents: apiPrefix + '/common/proxy/contract/v2queryAccountEvent.jsp',
20
+ editVirtualSourceApp: apiPrefix + '/common/proxy/user/editSourceApp.jsp' // 修改虚拟应用的来源应用配置
13
21
  },
22
+
14
23
  setting: {
15
24
  updateCompanyName: apiPrefix + '/common/proxy/company/v2updateInfo.jsp',
16
25
  updateLicense: apiPrefix + '/system/license',
@@ -19,6 +28,7 @@ var apis = {
19
28
  removeMember: apiPrefix + '/common/proxy/company/v2deleteUser.jsp',
20
29
  resetpwd: apiPrefix + '/common/proxy/user/resetpwd.jsp',
21
30
  updateUserAuth: apiPrefix + '/common/proxy/auth/updateUserAuth.jsp',
31
+ delSubscribeUser: apiPrefix + '/common/proxy//wx_subscribe/deleteWxUserRelation.jsp',
22
32
  queryFunConfigList: '/cep-console/api/v1/permission/queryFunConfigList',
23
33
  queryAppList: '/cep-console/api/v1/permission/queryAppList',
24
34
  queryFunConfigByUserId: '/cep-console/api/v1/permission/queryFunConfigByUserId',
@@ -27,8 +37,20 @@ var apis = {
27
37
  updateUserAuthCEP: '/cep-console/api/v1/permission/updateUserAuth',
28
38
  updateGroupAuth: apiPrefix + '/common/proxy/auth/updateGroupAuth.jsp',
29
39
  deleteGroup: apiPrefix + '/common/proxy/auth/deleteGroup.jsp',
40
+ wxSubscribeUserList: apiPrefix + '/common/proxy/wx_subscribe/getWxSubscribeUserInfoList.jsp',
41
+ // 个人设置
30
42
  updateUserInfo: apiPrefix + '/common/proxy/user/v2ajaxUpdateUserInfo.jsp',
31
- resetPassword: apiPrefix + '/common/proxy/user/v2ajaxmodifypwd.jsp'
43
+ resetPassword: apiPrefix + '/common/proxy/user/v2ajaxmodifypwd.jsp',
44
+ // 应用设置
45
+ updateAppName: apiPrefix + '/common/proxy/user/updateAppName.jsp',
46
+ createFilter: apiPrefix + '/common/proxy/user/createFilter.jsp',
47
+ queryFilter: apiPrefix + '/common/proxy/user/queryFilter.jsp',
48
+ //系统设置
49
+ queryNoticeConfig: apiPrefix + '/systemSettings/queryNoticeSettings',
50
+ editNoticeConfig: apiPrefix + '/systemSettings/setNoticeSettings'
51
+ },
52
+ eventMeta: {
53
+ queryEventMeta: apiPrefix + '/common/proxy/data/queryEventMetasOfGroup.jsp'
32
54
  }
33
55
  };
34
56
  export default apis;
@@ -1,3 +1,4 @@
1
1
  export { default as CompanySetting } from './modules/companySetting';
2
2
  export { default as PersonalSetting } from './modules/personalSetting';
3
3
  export { default as AppSettings } from './modules/appSettings';
4
+ export { default as SystemSetting } from './modules/systemSetting';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as CompanySetting } from "./modules/companySetting";
2
2
  export { default as PersonalSetting } from "./modules/personalSetting";
3
- export { default as AppSettings } from "./modules/appSettings";
3
+ export { default as AppSettings } from "./modules/appSettings";
4
+ export { default as SystemSetting } from "./modules/systemSetting";
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- declare const AppInfo: React.FC;
2
+ declare const AppInfo: React.FC<{
3
+ settingsCallback: (type: string) => void;
4
+ }>;
3
5
  export default AppInfo;
@@ -1,45 +1,111 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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
+ // 缺少环境配置:SHOW_APP_ACCOUNT(备注)
8
+ // 缺少isVirtualApp
7
9
  import React, { useContext } from 'react';
8
- import { Button, Form, Input } from 'antd';
10
+ import { Button, Form, Input, notification } from 'antd';
9
11
  import { BizGlobalDataContext } from '@zgfe/business-lib';
10
- import request from "../../../utils/ajax";
12
+ import { urlRequest } from "../../../utils/ajax";
11
13
  import apis from "../../../constants/api";
12
- // 缺少备注
13
- var AppInfo = function AppInfo() {
14
+ import { useState } from 'react';
15
+ import constants from "../../../utils/constants";
16
+ var AppInfo = function AppInfo(props) {
17
+ var settingsCallback = props.settingsCallback;
14
18
  var _useContext = useContext(BizGlobalDataContext),
15
19
  currentApp = _useContext.currentApp;
20
+ var _useState = useState({
21
+ appName: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName
22
+ }),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ initialValues = _useState2[0],
25
+ setInitialValues = _useState2[1];
26
+ var _useState3 = useState(false),
27
+ _useState4 = _slicedToArray(_useState3, 2),
28
+ loading = _useState4[0],
29
+ setLoading = _useState4[1];
30
+ var _Form$useForm = Form.useForm(),
31
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
32
+ form = _Form$useForm2[0];
33
+
34
+ // 保存
16
35
  var onSubmit = function onSubmit(value) {
17
- request(apis.setting.updateUserInfo, _objectSpread(_objectSpread({}, value), {}, {
18
- email: 'init@zg.com'
19
- })).then(function (res) {}, function (err) {});
36
+ setLoading(true);
37
+ var appName = value.appName;
38
+ urlRequest(apis.setting.updateAppName, {
39
+ method: 'post',
40
+ data: {
41
+ app_name: appName,
42
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
43
+ }
44
+ }).then(function (res) {
45
+ if (res.flag === 101) {
46
+ notification.success({
47
+ message: '更改成功'
48
+ });
49
+ // 重置表单
50
+ setInitialValues({
51
+ appName: appName
52
+ });
53
+ form.resetFields();
54
+ // 主应用更新appList
55
+ settingsCallback('updateAppList');
56
+ } else if (res.flag === -102) {
57
+ notification.error({
58
+ message: '开发者角色无权限修改'
59
+ });
60
+ } else if (res.flag === 202) {
61
+ notification.error({
62
+ message: '应用名称已存在'
63
+ });
64
+ }
65
+ }).catch(function (err) {
66
+ notification.error({
67
+ message: '修改失败,请重试'
68
+ });
69
+ }).finally(function () {
70
+ setLoading(false);
71
+ });
20
72
  };
21
- return /*#__PURE__*/React.createElement(Form, {
73
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
74
+ form: form,
22
75
  layout: "vertical",
23
76
  wrapperCol: {
24
77
  span: 8
25
78
  },
26
79
  onFinish: onSubmit,
27
- initialValues: currentApp
80
+ initialValues: initialValues
28
81
  }, /*#__PURE__*/React.createElement(Form.Item, {
29
82
  label: "\u5E94\u7528\u540D\u79F0",
83
+ name: "appName",
30
84
  rules: [{
31
85
  required: true,
32
- message: '请输入姓名'
86
+ message: '请输入应用名称'
87
+ }, {
88
+ pattern: constants.regExp.teamAndAppName,
89
+ message: '请输入1~20位字符'
33
90
  }]
34
91
  }, /*#__PURE__*/React.createElement(Input, {
35
92
  placeholder: "\u59D3\u540D"
36
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
37
- type: "primary",
38
- htmlType: "submit"
39
- }, "\u4FDD\u5B58")), /*#__PURE__*/React.createElement(Form.Item, {
93
+ })), /*#__PURE__*/React.createElement(Form.Item, {
94
+ shouldUpdate: true
95
+ }, function () {
96
+ return /*#__PURE__*/React.createElement(Button, {
97
+ type: "primary",
98
+ htmlType: "submit",
99
+ loading: loading,
100
+ disabled: !form.isFieldTouched('appName') || !!form.getFieldsError().filter(function (_ref) {
101
+ var errors = _ref.errors;
102
+ return errors.length;
103
+ }).length || JSON.stringify(initialValues) === JSON.stringify(form.getFieldsValue())
104
+ }, "\u4FDD\u5B58");
105
+ }), /*#__PURE__*/React.createElement(Form.Item, {
40
106
  label: "\u5E94\u7528ID"
41
107
  }, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId), /*#__PURE__*/React.createElement(Form.Item, {
42
- label: "\u90AE\u7BB1"
43
- }, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey));
108
+ label: "App Key"
109
+ }, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey)));
44
110
  };
45
111
  export default AppInfo;
@@ -1,3 +1,8 @@
1
1
  import React from 'react';
2
+ import './index.less';
3
+ export interface IDataAccessFilter {
4
+ ip: string;
5
+ ua: string;
6
+ }
2
7
  declare const AppDataAccessFilter: React.FC;
3
8
  export default AppDataAccessFilter;
@@ -1,37 +1,125 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- import React from 'react';
8
- import { Button, Form, Input } from 'antd';
9
- import request from "../../../utils/ajax";
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';
8
+ import { Button, Form, Input, notification } from 'antd';
9
+ import { BizGlobalDataContext } from '@zgfe/business-lib';
10
+ import { urlRequest } from "../../../utils/ajax";
10
11
  import apis from "../../../constants/api";
12
+ import { useContext } from 'react';
11
13
  var TextArea = Input.TextArea;
14
+ import "./index.less";
12
15
  var AppDataAccessFilter = function AppDataAccessFilter() {
16
+ var _useState = useState({}),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ initialValues = _useState2[0],
19
+ setInitialValues = _useState2[1];
20
+ var _useContext = useContext(BizGlobalDataContext),
21
+ currentApp = _useContext.currentApp;
22
+ var _Form$useForm = Form.useForm(),
23
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
24
+ form = _Form$useForm2[0];
25
+ var _useState3 = useState(false),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ loading = _useState4[0],
28
+ setLoading = _useState4[1];
29
+ useEffect(function () {
30
+ // 获取屏蔽数据
31
+ urlRequest(apis.setting.queryFilter, {
32
+ method: 'post',
33
+ data: {
34
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
35
+ }
36
+ }).then(function (res) {
37
+ if (res.code === 10001) {
38
+ var ip = (res.data_access_filter.ip || []).join('\n');
39
+ var ua = (res.data_access_filter.ua || []).join('\n');
40
+ setInitialValues({
41
+ ip: ip,
42
+ ua: ua
43
+ });
44
+ form.resetFields();
45
+ }
46
+ }).catch(function (err) {});
47
+ }, []);
48
+
49
+ // 保存按钮禁用逻辑
50
+ var disableBtn = function disableBtn(form) {
51
+ var value = form.getFieldsValue();
52
+ return !form.isFieldTouched('ip') && !form.isFieldTouched('ua') || JSON.stringify(initialValues) === JSON.stringify(value);
53
+ };
54
+
55
+ // 保存
13
56
  var onSubmit = function onSubmit(value) {
14
- request(apis.setting.updateUserInfo, _objectSpread(_objectSpread({}, value), {}, {
15
- email: 'init@zg.com'
16
- })).then(function (res) {}, function (err) {});
57
+ var ip = value.ip,
58
+ ua = value.ua;
59
+ urlRequest(apis.setting.createFilter, {
60
+ method: 'post',
61
+ data: {
62
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
63
+ ip: JSON.stringify(ip === null || ip === void 0 ? void 0 : ip.split('\n')),
64
+ ua: JSON.stringify(ua === null || ua === void 0 ? void 0 : ua.split('\n'))
65
+ }
66
+ }).then(function (res) {
67
+ if (res.code === 10001) {
68
+ notification.success({
69
+ message: '设置成功'
70
+ });
71
+ setInitialValues({
72
+ ip: ip,
73
+ ua: ua
74
+ });
75
+ form.resetFields();
76
+ }
77
+ }).catch(function (err) {
78
+ if (err.__CANCEL__) return;
79
+ notification.error({
80
+ message: '设置失败,请重试!'
81
+ });
82
+ }).finally(function () {
83
+ setLoading(false);
84
+ });
85
+ };
86
+ var ipFormLabel = function ipFormLabel() {
87
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "IP\u9ED1\u540D\u5355"), /*#__PURE__*/React.createElement("span", {
88
+ className: "explain"
89
+ }, "\u51FA\u73B0\u5728\u9ED1\u540D\u5355\u4E2D\u7684\u5BA2\u6237\u7AEFIP\uFF0C\u5176\u4E0A\u4F20\u7684\u6570\u636E\u5C06\u4E0D\u88AB\u91C7\u96C6\u5165\u5E93\u3002IP\u5730\u5740\u4E4B\u95F4\u4EE5\u6362\u884C\u7B26\u5206\u9694\u3002"));
90
+ };
91
+ var uaFormLabel = function uaFormLabel() {
92
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, "UserAgent\u9ED1\u540D\u5355"), /*#__PURE__*/React.createElement("span", {
93
+ className: "explain"
94
+ }, "\u4EC5JS\u7AEF\uFF0C\u5982\u679C\u6D4F\u89C8\u5668\u7684UserAgent\u5305\u542B\u9ED1\u540D\u5355\u4E2D\u7684\u6587\u672C\uFF08\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF09\uFF0C\u5219\u5176\u4E0A\u4F20\u7684\u6570\u636E\u5C06\u4E0D\u88AB\u91C7\u96C6\u5165\u5E93\u3002\u591A\u4E2AUserAgent\u4EE5\u6362\u884C\u7B26\u5206\u9694\u3002"));
17
95
  };
18
96
  return /*#__PURE__*/React.createElement(Form, {
97
+ form: form,
19
98
  layout: "vertical",
20
99
  wrapperCol: {
21
100
  span: 24
22
101
  },
23
- onFinish: onSubmit
102
+ onFinish: onSubmit,
103
+ initialValues: initialValues
24
104
  }, /*#__PURE__*/React.createElement(Form.Item, {
25
- label: "IP\u9ED1\u540D\u5355"
105
+ label: ipFormLabel(),
106
+ name: "ip"
26
107
  }, /*#__PURE__*/React.createElement(TextArea, {
27
108
  rows: 6
28
109
  })), /*#__PURE__*/React.createElement(Form.Item, {
29
- label: "UserAgent\u9ED1\u540D\u5355"
110
+ label: uaFormLabel(),
111
+ name: "ua"
30
112
  }, /*#__PURE__*/React.createElement(TextArea, {
31
113
  rows: 6
32
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
33
- type: "primary",
34
- htmlType: "submit"
35
- }, "\u4FDD\u5B58")));
114
+ })), /*#__PURE__*/React.createElement(Form.Item, {
115
+ shouldUpdate: true
116
+ }, function () {
117
+ return /*#__PURE__*/React.createElement(Button, {
118
+ type: "primary",
119
+ htmlType: "submit",
120
+ loading: loading,
121
+ disabled: !form.isFieldTouched('ip') && !form.isFieldTouched('ua') || JSON.stringify(initialValues) === JSON.stringify(form.getFieldsValue())
122
+ }, "\u4FDD\u5B58");
123
+ }));
36
124
  };
37
125
  export default AppDataAccessFilter;
@@ -0,0 +1,5 @@
1
+ .explain {
2
+ margin-left: 12px;
3
+ color: #b2b2b2;
4
+ font-size: 12px;
5
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import DemoWrapper from "../../../components/demo";
3
+ import AppSettings from "../../appSettings";
4
+ export default (function () {
5
+ return /*#__PURE__*/React.createElement(DemoWrapper, null, /*#__PURE__*/React.createElement(AppSettings, null));
6
+ });
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- declare const PersonalSetting: React.FC;
2
+ declare const PersonalSetting: React.FC<{
3
+ settingsCallback: (type: string) => void;
4
+ }>;
3
5
  export default PersonalSetting;