dlt-for-react 1.1.16 → 1.1.18

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 (87) hide show
  1. package/README.md +20 -1
  2. package/assets/HqCheckButton/index.less +13 -0
  3. package/assets/HqImage/index.less +11 -0
  4. package/assets/HqInputPicker/index.less +8 -0
  5. package/assets/selector/resultview/index.less +53 -0
  6. package/assets/selector/selectormodal/index.less +15 -0
  7. package/assets/selector/table/index.less +211 -0
  8. package/assets/selector/tree/index.less +138 -0
  9. package/assets/stuSelector/index.less +24 -0
  10. package/assets/teaSelector/index.less +4 -0
  11. package/lib/components/HqButton/index.js +95 -0
  12. package/lib/components/HqCascader/index.js +306 -0
  13. package/lib/components/HqCheckBox/index.js +375 -0
  14. package/lib/components/HqCheckButton/index.js +284 -0
  15. package/lib/components/HqConfirm/index.js +81 -0
  16. package/lib/components/HqFormItem/FormRules.js +27 -0
  17. package/lib/components/HqFormItem/index.js +309 -0
  18. package/lib/components/HqImage/index.js +553 -0
  19. package/lib/components/HqInputPicker/edit-page.js +585 -0
  20. package/lib/components/HqInputPicker/index.js +226 -0
  21. package/lib/components/HqInputPicker/input-const.js +134 -0
  22. package/lib/components/HqInputPicker/render.js +2496 -0
  23. package/lib/components/HqInputPicker/setting-checkbox.js +853 -0
  24. package/lib/components/HqInputPicker/setting-datepicker.js +430 -0
  25. package/lib/components/HqInputPicker/setting-datetimepicker.js +443 -0
  26. package/lib/components/HqInputPicker/setting-input.js +555 -0
  27. package/lib/components/HqInputPicker/setting-inputNumber.js +658 -0
  28. package/lib/components/HqInputPicker/setting-monthpicker.js +434 -0
  29. package/lib/components/HqInputPicker/setting-multiSelect.js +533 -0
  30. package/lib/components/HqInputPicker/setting-nhcascader.js +588 -0
  31. package/lib/components/HqInputPicker/setting-old-upload.js +428 -0
  32. package/lib/components/HqInputPicker/setting-radio.js +468 -0
  33. package/lib/components/HqInputPicker/setting-rangepicker.js +466 -0
  34. package/lib/components/HqInputPicker/setting-select.js +534 -0
  35. package/lib/components/HqInputPicker/setting-stu-selector.js +508 -0
  36. package/lib/components/HqInputPicker/setting-switch.js +274 -0
  37. package/lib/components/HqInputPicker/setting-tea-selector.js +508 -0
  38. package/lib/components/HqInputPicker/setting-textarea.js +619 -0
  39. package/lib/components/HqInputPicker/setting-timepicker.js +437 -0
  40. package/lib/components/HqInputPicker/setting-upload.js +795 -0
  41. package/lib/components/HqMultiSelect/index.js +495 -0
  42. package/lib/components/HqOldUpload/index.js +350 -0
  43. package/lib/components/HqSelect/getSelectName.js +20 -0
  44. package/lib/components/HqSelect/index.js +495 -0
  45. package/lib/components/HqSelector/HqLsrySelector/index.js +269 -267
  46. package/lib/components/HqSelector/HqRySelector/index.js +4 -2
  47. package/lib/components/HqSelector/HqWzSelector/index.js +4 -2
  48. package/lib/components/HqStuSelector/index.js +267 -0
  49. package/lib/components/HqSwitch/index.js +280 -0
  50. package/lib/components/HqTeaSelector/index.js +221 -0
  51. package/lib/components/KyCollapse/index.js +23 -24
  52. package/lib/components/KyContainerFrame/index.js +2 -2
  53. package/lib/components/KyEditableTable/component.js +38 -38
  54. package/lib/components/KyEditableTable/index.js +203 -181
  55. package/lib/components/KyExcel/index.js +191 -153
  56. package/lib/components/KyModal/index.js +43 -33
  57. package/lib/components/KyTable/AddFieldsModal.js +66 -59
  58. package/lib/components/KyTable/checkButtons.js +3 -13
  59. package/lib/components/KyTable/index.js +2 -2
  60. package/lib/components/KyTableCardList/AddFieldsModal.js +280 -282
  61. package/lib/components/KyTableCardList/index.js +15 -26
  62. package/lib/components/KyTree/index.js +7 -7
  63. package/lib/components/KyUpload/index.js +170 -165
  64. package/lib/components/NHSelector/ListSort/index.js +411 -0
  65. package/lib/components/NHSelector/index.js +636 -0
  66. package/lib/components/NHSelector/resultview/index.js +408 -0
  67. package/lib/components/NHSelector/selectormodal/index.js +303 -0
  68. package/lib/components/NHSelector/table/index.js +784 -0
  69. package/lib/components/NHSelector/tree/index.js +554 -0
  70. package/lib/index.js +164 -36
  71. package/lib/layouts/LeftMenu/index.js +6 -6
  72. package/lib/layouts/Login/index-pre.js +107 -103
  73. package/lib/layouts/Login/index.js +2 -2
  74. package/lib/layouts/Login/login.js +178 -172
  75. package/lib/layouts/NavigationBar/index.js +67 -67
  76. package/lib/layouts/Top/editPassWord.js +84 -64
  77. package/lib/layouts/Top/index.js +117 -117
  78. package/lib/layouts/TopMenu/index.js +53 -53
  79. package/lib/layouts/layout/index.js +115 -118
  80. package/lib/layouts/mixTop/index.js +95 -95
  81. package/lib/layouts/settingDrawer/index.js +96 -96
  82. package/lib/routes/AuthorizedRoute.js +33 -32
  83. package/lib/utils/NHCore.js +65 -65
  84. package/package.json +2 -2
  85. package/lib/utils/createUuid.js +0 -40
  86. package/lib/utils/getLoginUser.js +0 -10
  87. package/lib/utils/getSize.js +0 -27
@@ -0,0 +1,553 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _modal = require("antd/lib/modal");
8
+
9
+ var _modal2 = _interopRequireDefault(_modal);
10
+
11
+ var _upload = require("antd/lib/upload");
12
+
13
+ var _upload2 = _interopRequireDefault(_upload);
14
+
15
+ var _icon = require("antd/lib/icon");
16
+
17
+ var _icon2 = _interopRequireDefault(_icon);
18
+
19
+ var _promise = require("babel-runtime/core-js/promise");
20
+
21
+ var _promise2 = _interopRequireDefault(_promise);
22
+
23
+ var _message2 = require("antd/lib/message");
24
+
25
+ var _message3 = _interopRequireDefault(_message2);
26
+
27
+ var _regenerator = require("babel-runtime/regenerator");
28
+
29
+ var _regenerator2 = _interopRequireDefault(_regenerator);
30
+
31
+ var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
32
+
33
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
34
+
35
+ var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
36
+
37
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
38
+
39
+ var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
40
+
41
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
42
+
43
+ var _createClass2 = require("babel-runtime/helpers/createClass");
44
+
45
+ var _createClass3 = _interopRequireDefault(_createClass2);
46
+
47
+ var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
48
+
49
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
50
+
51
+ var _inherits2 = require("babel-runtime/helpers/inherits");
52
+
53
+ var _inherits3 = _interopRequireDefault(_inherits2);
54
+
55
+ require("antd/lib/modal/style");
56
+
57
+ require("antd/lib/upload/style");
58
+
59
+ require("antd/lib/icon/style");
60
+
61
+ require("antd/lib/message/style");
62
+
63
+ var _react = require("react");
64
+
65
+ var _react2 = _interopRequireDefault(_react);
66
+
67
+ var _propTypes = require("prop-types");
68
+
69
+ var _propTypes2 = _interopRequireDefault(_propTypes);
70
+
71
+ var _NHCore = require("../../utils/NHCore");
72
+
73
+ require("../../../assets/HqImage/index.less");
74
+
75
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
76
+
77
+ var fileDocDownloadPath = "zuul/docrepo/download?attachmentId=";
78
+ var redisDownloadPath = window.baseUrl || "" + "/proData/downloadRedisCacheImage?uuid=";
79
+
80
+ /**
81
+ * @author weishihuai
82
+ * @date 2018/9/12
83
+ * @time 9:52
84
+ * @Description: 图片墙上传组件
85
+ *
86
+ * 图片墙使用说明:
87
+ * onRemove: this.onImageRemove.bind(this), 非必须, 图片删除之后回传删除图片给父组件的方法
88
+ * onChange: this.onChange.bind(this), 非必须, 值改变时执行的方法
89
+ * numberOfLimit: 2, 必须, 图片墙允许上传的图片张数,超过numberOfLimit上传按钮自动隐藏
90
+ * numberOfSize: 5, 必须, 图片墙允许上传图片大小的最大值,超过numberOfSize的话直接不上传
91
+ * saveType: 'file', 必须, 图片墙图片保存的格式,默认为‘file’保存在文档库,‘redis’为缓存在redis,‘base64’保存在内存中,如果需要永久保存文件,建议保存在文档库
92
+ * cacheTime: 30, 非必须, Redis缓存时长,单位:分钟 超过30分钟redis会删除缓存的图片信息
93
+ * imageList: ['0264a687-baa4-490f-92f5-e988dcd8d976','0264a687-baa4-490f-92f5-e988dcd8d976'] 非必须, 如果是编辑模式下,需要回显已经保存的图片信息,注意一下需要构造如下类型数据才能显示出来:
94
+ */
95
+
96
+ var HqImage = function (_React$Component) {
97
+ (0, _inherits3.default)(HqImage, _React$Component);
98
+
99
+ function HqImage(props) {
100
+ var _this2 = this;
101
+
102
+ (0, _classCallCheck3.default)(this, HqImage);
103
+
104
+ var _this = (0, _possibleConstructorReturn3.default)(this, (HqImage.__proto__ || (0, _getPrototypeOf2.default)(HqImage)).call(this, props));
105
+
106
+ _this.handlePreview = function () {
107
+ var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(file) {
108
+ return _regenerator2.default.wrap(function _callee$(_context) {
109
+ while (1) {
110
+ switch (_context.prev = _context.next) {
111
+ case 0:
112
+ if (!(!file.url && !file.preview)) {
113
+ _context.next = 4;
114
+ break;
115
+ }
116
+
117
+ _context.next = 3;
118
+ return _this.getBase64(file.originFileObj);
119
+
120
+ case 3:
121
+ file.preview = _context.sent;
122
+
123
+ case 4:
124
+
125
+ _this.setState({
126
+ previewImageUrl: file.url || file.preview,
127
+ previewImageName: file.name,
128
+ previewImageVisible: true
129
+ });
130
+
131
+ case 5:
132
+ case "end":
133
+ return _context.stop();
134
+ }
135
+ }
136
+ }, _callee, _this2);
137
+ }));
138
+
139
+ return function (_x) {
140
+ return _ref.apply(this, arguments);
141
+ };
142
+ }();
143
+
144
+ _this.handlePreviewCancel = function () {
145
+ _this.setState({
146
+ previewImageVisible: false
147
+ });
148
+ };
149
+
150
+ _this.handleChange = function (e) {
151
+ var saveType = _this.props.saveType || "file";
152
+ var fileList = e.fileList;
153
+ var fileStatus = e.file.status;
154
+
155
+ if (fileStatus === "uploading") {
156
+ //上传中
157
+ } else if (fileStatus === "done") {
158
+ //上传成功
159
+ var response = e.file.response;
160
+ if (!response) {
161
+ _message3.default.error("抱歉,文件由于未知原因上传失败!");
162
+ return;
163
+ }
164
+ var responseMeta = response.meta;
165
+ if (saveType === "file") {
166
+ //上传到文档库
167
+ //上传成功(success为true并且响应码为200)
168
+ if (responseMeta && responseMeta.success && responseMeta.statusCode === 200) {
169
+ fileList = fileList.map(function (file) {
170
+ if (file.uid === e.file.uid) {
171
+ // file.uuid = response.data.ssbh;
172
+ file.uuid = response.data.bh;
173
+ }
174
+ return file;
175
+ });
176
+
177
+ _this.getUploadedImage(fileList, "file");
178
+ } else {
179
+ _message3.default.error("抱歉,文件由于未知原因上传失败!");
180
+ //过滤上传失败的图片
181
+ fileList = _this.filterUploadFailFile(e.fileList, e.file);
182
+ }
183
+ } else if (saveType === "redis") {
184
+ //缓存Redis
185
+ //缓存成功(响应码为200)
186
+ if (response.code === 200) {
187
+ fileList = fileList.map(function (file) {
188
+ if (file.uid === e.file.uid) {
189
+ file.uuid = response.data;
190
+ }
191
+ return file;
192
+ });
193
+ _this.getUploadedImage(fileList, "redis");
194
+ } else {
195
+ _message3.default.error("抱歉,文件由于未知原因上传失败!");
196
+ //过滤上传失败的图片
197
+ fileList = _this.filterUploadFailFile(e.fileList, e.file);
198
+ }
199
+ } else if (saveType === "base64") {
200
+ //用于保存数据库
201
+ _this.getImageBase64(e.file.originFileObj, function (imageUrl) {
202
+ //上传成功
203
+ if (response.code === 200) {
204
+ fileList = fileList.map(function (file) {
205
+ if (file.uid === e.file.uid) {
206
+ file.uuid = imageUrl;
207
+ file.base64Url = imageUrl;
208
+ } else {
209
+ file.base64Url = file.thumbUrl || file.url;
210
+ }
211
+ return file;
212
+ });
213
+ _this.getUploadedImage(fileList, "base64");
214
+ } else {
215
+ _message3.default.error("抱歉,文件由于未知原因上传失败!");
216
+ //过滤上传失败的图片
217
+ fileList = _this.filterUploadFailFile(e.fileList, e.file);
218
+ }
219
+ });
220
+ }
221
+ } else if (fileStatus === "error") {
222
+ //上传出错
223
+ _message3.default.error("抱歉,文件由于未知原因上传失败!");
224
+ //过滤上传失败的图片
225
+ fileList = _this.filterUploadFailFile(e.fileList, e.file);
226
+ }
227
+ if (fileStatus) {
228
+ _this.setState({
229
+ uploadedImageList: fileList
230
+ });
231
+ }
232
+ };
233
+
234
+ _this.getBase64 = function (file) {
235
+ return new _promise2.default(function (resolve, reject) {
236
+ var reader = new FileReader();
237
+ reader.readAsDataURL(file);
238
+ reader.onload = function () {
239
+ return resolve(reader.result);
240
+ };
241
+ reader.onerror = function (error) {
242
+ return reject(error);
243
+ };
244
+ });
245
+ };
246
+
247
+ _this.getImageBase64 = function (img, callback) {
248
+ var reader = new FileReader();
249
+ reader.addEventListener("load", function () {
250
+ return callback(reader.result);
251
+ });
252
+ reader.readAsDataURL(img);
253
+ };
254
+
255
+ _this.filterUploadFailFile = function (list, failUploadedFile) {
256
+ return list.filter(function (file) {
257
+ return file.uid !== failUploadedFile.uid;
258
+ });
259
+ };
260
+
261
+ _this.getUploadedImage = function (fileList, saveType) {
262
+ if (saveType === "base64") {
263
+ var uploadedImageList = [];
264
+ fileList.map(function (file) {
265
+ var obj = {
266
+ uuid: file.uuid,
267
+ base64Url: file.base64Url
268
+ };
269
+ uploadedImageList.push(obj);
270
+ });
271
+
272
+ //父组件回调方法,在父组件可以拿到已经上传成功的图片信息
273
+ if (_this.props.onChange && typeof _this.props.onChange === "function") {
274
+ _this.props.onChange(uploadedImageList);
275
+ }
276
+ } else {
277
+ var _uploadedImageList = [];
278
+ fileList.map(function (file) {
279
+ var obj = {
280
+ uuid: file.uuid
281
+ };
282
+ _uploadedImageList.push(obj);
283
+ });
284
+
285
+ //父组件回调方法,在父组件可以拿到已经上传成功的图片信息
286
+ if (_this.props.onChange && typeof _this.props.onChange === "function") {
287
+ _this.props.onChange(_uploadedImageList);
288
+ }
289
+ }
290
+ };
291
+
292
+ _this.handelBeforeUpload = function (file) {
293
+ var fileType = file.type;
294
+ var fileName = file.name;
295
+ //判断是否支持该文件格式
296
+ var isInvalidFileType = !fileType || fileType.length < 1;
297
+ if (isInvalidFileType) {
298
+ _message3.default.error("抱歉,不支持上传该格式的文件!");
299
+ return !isInvalidFileType;
300
+ }
301
+
302
+ var availFileSuffix = [".png", ".PNG", ".jpg", ".JPG", ".bpm", ".BPM", ".gif", ".GIF"];
303
+ var fileSuffixName = fileName.substring(file.name.lastIndexOf("."));
304
+ var isAvailableSuffix = availFileSuffix.includes(fileSuffixName);
305
+ if (!isAvailableSuffix) {
306
+ var msg = "抱歉,只支持上传【" + availFileSuffix.join(" || ") + "】格式的文件!";
307
+ _message3.default.error(msg);
308
+ return isAvailableSuffix;
309
+ }
310
+
311
+ //限制上传文件大小(默认上传大小限制2MB)
312
+ var availSize = _this.props.numberOfSize || 2;
313
+ var fileSize = file.size / 1024 / 1024;
314
+ var isOverSize = fileSize > availSize;
315
+
316
+ if (isOverSize) {
317
+ var _msg = "抱歉,上传文件大小最大不能超过" + availSize + "M!";
318
+ _message3.default.error(_msg);
319
+ return !isOverSize;
320
+ }
321
+ return true;
322
+ };
323
+
324
+ _this.handleRemove = function (file) {
325
+ var uploadedImageList = _this.state.uploadedImageList;
326
+ for (var index = 0, len = uploadedImageList.length; index < len; index++) {
327
+ if (uploadedImageList[index].uid === file.uid) {
328
+ uploadedImageList.splice(index, 1);
329
+ break;
330
+ }
331
+ }
332
+ _this.setState({
333
+ uploadedImageList: uploadedImageList
334
+ });
335
+
336
+ //组装数据返回给父组件,包含文档库的uuid以及文件名称
337
+ var imageList = [];
338
+ uploadedImageList.length > 0 && uploadedImageList.map(function (file) {
339
+ var obj = { uuid: file.uuid };
340
+ imageList.push(obj);
341
+ });
342
+
343
+ if (_this.props.onChange && typeof _this.props.onChange === "function") {
344
+ _this.props.onChange(imageList);
345
+ }
346
+
347
+ //如果有需要对删除的图片做删除文档库等操作,回传给父组件进行处理
348
+ if (_this.props.onRemove && typeof _this.props.onRemove === "function") {
349
+ _this.props.onRemove(file.uuid);
350
+ }
351
+ };
352
+
353
+ _this.state = {
354
+ uploadedImageList: [], //已上传图片
355
+ previewImageVisible: false, //是否预览图片标识
356
+ previewImageUrl: "", //预览图片的URL
357
+ previewImageName: "" //预览图片的名称
358
+ };
359
+ return _this;
360
+ }
361
+
362
+ //设置props默认值
363
+
364
+
365
+ (0, _createClass3.default)(HqImage, [{
366
+ key: "componentWillMount",
367
+
368
+
369
+ //组件render之前组装已经上传成功的图片信息uploadedImageList,主要用于回显图片
370
+ value: function componentWillMount() {
371
+ var saveType = this.props.saveType || "file";
372
+ if (saveType === "base64") {
373
+ if (this.props.imageList.length > 0) {
374
+ var uploadedImageList = [];
375
+ this.props.imageList.map(function (base64Code) {
376
+ uploadedImageList.push({
377
+ uuid: base64Code,
378
+ uid: base64Code,
379
+ url: base64Code
380
+ });
381
+ });
382
+ this.setState({
383
+ uploadedImageList: uploadedImageList
384
+ });
385
+
386
+ var imageList = [];
387
+ uploadedImageList.map(function (file) {
388
+ var obj = {
389
+ uuid: file.uuid,
390
+ base64Url: file.url
391
+ };
392
+ imageList.push(obj);
393
+ });
394
+
395
+ if (this.props.onChange && typeof this.props.onChange === "function") {
396
+ this.props.onChange(imageList);
397
+ }
398
+ }
399
+ } else {
400
+ if (this.props.imageList.length > 0) {
401
+ var _uploadedImageList2 = [];
402
+ this.props.imageList.map(function (uuid) {
403
+ _uploadedImageList2.push({
404
+ uuid: uuid,
405
+ uid: uuid,
406
+ url: saveType === "file" ? fileDocDownloadPath + uuid : redisDownloadPath + uuid
407
+ });
408
+ });
409
+ this.setState({
410
+ uploadedImageList: _uploadedImageList2
411
+ });
412
+
413
+ var _imageList = [];
414
+ _uploadedImageList2.map(function (file) {
415
+ var obj = { uuid: file.uuid };
416
+ _imageList.push(obj);
417
+ });
418
+
419
+ if (this.props.onChange && typeof this.props.onChange === "function") {
420
+ this.props.onChange(_imageList);
421
+ }
422
+ }
423
+ }
424
+ }
425
+
426
+ //图片预览事件
427
+
428
+
429
+ //取消图片预览事件
430
+
431
+
432
+ //文件上传改变事件
433
+
434
+
435
+ //获取图片Base64
436
+
437
+
438
+ //过滤上传失败的图片
439
+
440
+
441
+ //获取上传成功的图片
442
+
443
+
444
+ //上传文件之前的钩子,参数为准备上传的文件,若返回 false 则停止上传
445
+ //一般在beforeUpload方法内限制文件上传的格式以及大小
446
+
447
+
448
+ //删除图片事件
449
+
450
+ }, {
451
+ key: "render",
452
+ value: function render() {
453
+ var _state = this.state,
454
+ previewImageVisible = _state.previewImageVisible,
455
+ previewImageUrl = _state.previewImageUrl,
456
+ uploadedImageList = _state.uploadedImageList,
457
+ previewImageName = _state.previewImageName;
458
+
459
+ var numberOfLimit = this.props.numberOfLimit || 1; //默认最多上传一张图片
460
+ var saveType = this.props.saveType || "file"; //默认上传到文档库
461
+ var redisCacheTime = this.props.cacheTime || 30; //Redis默认保存时长,单位:分钟
462
+
463
+ var uploadButton = _react2.default.createElement(
464
+ "div",
465
+ null,
466
+ _react2.default.createElement(_icon2.default, { type: "plus" }),
467
+ _react2.default.createElement(
468
+ "div",
469
+ { className: "xgui-picturewall-ant-upload-text" },
470
+ "Upload"
471
+ )
472
+ );
473
+
474
+ //根据saveType构造上传的url
475
+ var action = saveType === "file" ? "zuul/docrepo/upload" : saveType === "redis" ? window.baseUrl + "/proData/uploadRedis" : this.props.base64UploadUrl;
476
+ //请求发送的数据
477
+ var requestData = saveType === "file" ? {
478
+ uuid: (0, _NHCore.createUuid)(),
479
+ type: "1"
480
+ } : saveType === "redis" ? {
481
+ redisData: redisCacheTime
482
+ } : {};
483
+
484
+ var params = {
485
+ name: "file",
486
+ action: action, //图片上传路径
487
+ accept: "image/*", //接受上传的文件类型,指定为image/**的话,弹出选择文件窗口的时候只会显示图片类型文件,过滤掉.txt、.xsl等非图片文件
488
+ listType: "picture-card", //图片墙样式
489
+ multiple: false, //是否允许多选
490
+ fileList: uploadedImageList, //已上传的图片
491
+ data: requestData, //上传所需参数
492
+ onRemove: this.handleRemove, //删除执行的方法
493
+ beforeUpload: this.handelBeforeUpload, //图片上传前执行的方法
494
+ onPreview: this.handlePreview, //预览图片执行的方法
495
+ onChange: this.handleChange //值改变执行的方法
496
+ };
497
+
498
+ return _react2.default.createElement(
499
+ "div",
500
+ { className: "clearfix" },
501
+ _react2.default.createElement(
502
+ _upload2.default,
503
+ params,
504
+ uploadedImageList.length >= numberOfLimit ? null : uploadButton
505
+ ),
506
+ _react2.default.createElement(
507
+ _modal2.default,
508
+ {
509
+ visible: previewImageVisible,
510
+ footer: null,
511
+ onCancel: this.handlePreviewCancel
512
+ },
513
+ _react2.default.createElement("img", {
514
+ alt: previewImageName,
515
+ style: { width: "100%" },
516
+ src: previewImageUrl
517
+ })
518
+ )
519
+ );
520
+ }
521
+ }]);
522
+ return HqImage;
523
+ }(_react2.default.Component);
524
+
525
+ //属性检查
526
+
527
+
528
+ HqImage.defaultProps = {
529
+ saveType: "file", //保存的类型,默认为file文档库,可选的值: 'file'(上传文档库)、'base64'(保存数据库)、'redis'(缓存redis)
530
+ imageList: [], //设置默认上传的图片 格式:imageList: [{ uid: '对应文档库uuid', name: '图片名称',status: 'done', url: '图片url'}]
531
+ cacheTime: 30, //设置Redis缓存的时间,单位:分钟 表示Redis超过30分钟会删除缓存的信息
532
+ numberOfLimit: 1, //最多允许上传多少张图片 默认为1张
533
+ numberOfSize: 2, //默认上传大小限制2MB
534
+ disabled: false, //是否禁用
535
+ onRemove: function onRemove() {
536
+ //删除成功回调
537
+ },
538
+ onChange: function onChange() {}, //值改变时的回调
539
+ base64UploadUrl: "" //base64上传图片路径
540
+ };
541
+ HqImage.PropTypes = {
542
+ saveType: _propTypes2.default.string, //保存的类型
543
+ imageList: _propTypes2.default.array, //初始化图片信息
544
+ cacheTime: _propTypes2.default.number, //Redis缓存时间
545
+ numberOfLimit: _propTypes2.default.number, //允许上传的图片张数
546
+ numberOfSize: _propTypes2.default.number, //允许上传的图片大小
547
+ disabled: _propTypes2.default.bool, //是否禁用
548
+ base64UploadUrl: _propTypes2.default.string, //base64图片上传路径
549
+ onRemove: _propTypes2.default.func, //删除成功回调
550
+ onChange: _propTypes2.default.func //值改变回调
551
+ };
552
+
553
+ exports.default = HqImage;