@zgfe/modules-settings 1.2.2-alpha.1 → 1.2.2-node.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.
@@ -13,9 +13,10 @@ import React from 'react';
13
13
  import { useState } from 'react';
14
14
  import { useEffect } from 'react';
15
15
  import apis from '../../../constants/api';
16
- import request, { urlRequest } from '../../../utils/ajax';
16
+ import request from '../../../utils/ajax';
17
17
  import ConfigItem from './configItem';
18
18
  import ItemEdit from './edit';
19
+ import { ajax } from '@zgfe/business-lib';
19
20
  var Notice = function Notice() {
20
21
  var typeMap = new Map([[1, 'email']]);
21
22
  var _useState = useState(new Map().set('email', {
@@ -64,27 +65,26 @@ var Notice = function Notice() {
64
65
  var formData = new FormData();
65
66
  formData.set('type', editSetting.type);
66
67
  formData.set('config', JSON.stringify(values));
67
- urlRequest(apis.setting.editNoticeConfig, {
68
+ ajax(apis.setting.editNoticeConfig, {
68
69
  method: 'post',
69
- // data: formData,
70
70
  data: {
71
71
  type: editSetting.type === 'email' ? 1 : null,
72
72
  config: JSON.stringify(values)
73
73
  }
74
74
  }).then(function (res) {
75
- if ((res === null || res === void 0 ? void 0 : res.status) === 200) {
76
- notification.success({
77
- message: '配置成功'
78
- });
79
- settingMap.get(editSetting.type).config = values;
80
- var newSettingMap = new Map(_toConsumableArray(settingMap));
81
- setSettingMap(newSettingMap);
82
- setIsEdit(false);
83
- } else {
84
- notification.error({
85
- message: '配置失败'
86
- });
87
- }
75
+ if (!res) return;
76
+ notification.success({
77
+ message: '配置成功'
78
+ });
79
+ settingMap.get(editSetting.type).config = values;
80
+ var newSettingMap = new Map(_toConsumableArray(settingMap));
81
+ setSettingMap(newSettingMap);
82
+ setIsEdit(false);
83
+ }).catch(function (err) {
84
+ console.error('配置失败', err);
85
+ notification.error({
86
+ message: '配置失败'
87
+ });
88
88
  });
89
89
  };
90
90
  return /*#__PURE__*/React.createElement("div", null, isEdit ? /*#__PURE__*/React.createElement(ItemEdit, {
@@ -149,7 +149,7 @@ var standard = _objectSpread({
149
149
  key: '/diypage'
150
150
  },
151
151
  user: {
152
- key: '/analysis/user'
152
+ key: '/user'
153
153
  },
154
154
  // cep: {
155
155
  // key: '/cep',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-settings",
3
- "version": "1.2.2-alpha.1",
3
+ "version": "1.2.2-node.0",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -51,7 +51,7 @@
51
51
  "umi-request": "^1.4.0",
52
52
  "yorkie": "^2.0.0"
53
53
  },
54
- "gitHead": "760c7889526c09f2261c832978cc9d68e3874ba2",
54
+ "gitHead": "791b7dce1b31a2c683d3225e84e0c51106b64b74",
55
55
  "gitHooks": {
56
56
  "pre-commit": "lint-staged"
57
57
  }