dlt-for-react 1.1.3 → 1.1.4

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 (187) hide show
  1. package/README.md +4 -0
  2. package/lib/index.js +7 -1
  3. package/lib/layouts/Top/index.js +1 -1
  4. package/lib/layouts/layout/index.js +77 -31
  5. package/lib/layouts/mixTop/index.js +3 -3
  6. package/lib/utils/createUuid.js +31 -11
  7. package/lib/utils/getLoginUser.js +1 -1
  8. package/lib/utils/getSize.js +11 -2
  9. package/lib/utils/index.js +35 -2
  10. package/package.json +1 -1
  11. package/lib/components/Button/index.js +0 -79
  12. package/lib/components/NHAuditPanel/config/Axios.js +0 -263
  13. package/lib/components/NHAuditPanel/config/api.js +0 -479
  14. package/lib/components/NHAuditPanel/config/data.js +0 -156
  15. package/lib/components/NHAuditPanel/config/typeMap.js +0 -1234
  16. package/lib/components/NHAuditPanel/config/uiValidate.js +0 -92
  17. package/lib/components/NHAuditPanel/index.js +0 -413
  18. package/lib/components/NHAuditPanel/node.js +0 -619
  19. package/lib/components/NHCascader/index.js +0 -355
  20. package/lib/components/NHCheckboxGroup/index.js +0 -135
  21. package/lib/components/NHDynamicFormShow/baseInfo/index.js +0 -194
  22. package/lib/components/NHDynamicFormShow/custom/index.js +0 -553
  23. package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +0 -43
  24. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +0 -1113
  25. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +0 -263
  26. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +0 -880
  27. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +0 -171
  28. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +0 -865
  29. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +0 -138
  30. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +0 -571
  31. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +0 -147
  32. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +0 -474
  33. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +0 -139
  34. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +0 -506
  35. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +0 -143
  36. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +0 -1074
  37. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +0 -172
  38. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +0 -927
  39. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +0 -195
  40. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +0 -1064
  41. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +0 -183
  42. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +0 -763
  43. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +0 -137
  44. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +0 -819
  45. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +0 -137
  46. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +0 -700
  47. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +0 -162
  48. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +0 -743
  49. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +0 -177
  50. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +0 -848
  51. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +0 -138
  52. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +0 -777
  53. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +0 -161
  54. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +0 -706
  55. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +0 -130
  56. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +0 -413
  57. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +0 -135
  58. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +0 -1013
  59. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +0 -175
  60. package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +0 -1345
  61. package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +0 -274
  62. package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +0 -669
  63. package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +0 -134
  64. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +0 -378
  65. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +0 -120
  66. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +0 -638
  67. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +0 -133
  68. package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +0 -965
  69. package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +0 -237
  70. package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +0 -823
  71. package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +0 -188
  72. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +0 -401
  73. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +0 -472
  74. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +0 -304
  75. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +0 -375
  76. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +0 -118
  77. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +0 -62
  78. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +0 -55
  79. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +0 -1238
  80. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +0 -375
  81. package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +0 -554
  82. package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +0 -130
  83. package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +0 -542
  84. package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +0 -133
  85. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +0 -575
  86. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +0 -130
  87. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +0 -563
  88. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +0 -133
  89. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +0 -745
  90. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +0 -164
  91. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +0 -587
  92. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +0 -143
  93. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +0 -743
  94. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +0 -172
  95. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +0 -1410
  96. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +0 -274
  97. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +0 -755
  98. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +0 -130
  99. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +0 -814
  100. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +0 -188
  101. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +0 -769
  102. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +0 -130
  103. package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +0 -1004
  104. package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +0 -126
  105. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +0 -503
  106. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +0 -149
  107. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +0 -379
  108. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +0 -148
  109. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +0 -748
  110. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +0 -135
  111. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +0 -762
  112. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +0 -134
  113. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +0 -682
  114. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +0 -135
  115. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +0 -152
  116. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +0 -783
  117. package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +0 -764
  118. package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +0 -138
  119. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +0 -677
  120. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +0 -138
  121. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +0 -1173
  122. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +0 -242
  123. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +0 -862
  124. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +0 -201
  125. package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +0 -196
  126. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +0 -167
  127. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +0 -1096
  128. package/lib/components/NHDynamicFormShow/index.js +0 -647
  129. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +0 -279
  130. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +0 -206
  131. package/lib/components/NHDynamicFormShow/oneOnMany/index.js +0 -419
  132. package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +0 -401
  133. package/lib/components/NHDynamicFormShow/oneOnOne/index.js +0 -271
  134. package/lib/components/NHImagePicker/index.js +0 -554
  135. package/lib/components/NHInputPicker/RadioGroup.js +0 -118
  136. package/lib/components/NHInputPicker/index.js +0 -62
  137. package/lib/components/NHInputPicker/input-const.js +0 -55
  138. package/lib/components/NHInputPicker/render.js +0 -1271
  139. package/lib/components/NHListView/index.js +0 -374
  140. package/lib/components/NHMapGeolocation/index.js +0 -537
  141. package/lib/components/NHMapGeolocation/initMap/initGdMap.js +0 -104
  142. package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +0 -138
  143. package/lib/components/NHMapGeolocation/style.js +0 -51
  144. package/lib/components/NHMultiSelect/index.js +0 -272
  145. package/lib/components/NHRadioGroup/index.js +0 -118
  146. package/lib/components/NHSelect/index.js +0 -364
  147. package/lib/components/NHTreeMenu/index.js +0 -126
  148. package/lib/components/NHTreeMenu/treeNode.js +0 -164
  149. package/lib/components/StuSelector/index.js +0 -611
  150. package/lib/layouts/KyInputPicker/edit-page.js +0 -585
  151. package/lib/layouts/KyInputPicker/index.js +0 -220
  152. package/lib/layouts/KyInputPicker/input-const.js +0 -134
  153. package/lib/layouts/KyInputPicker/render.js +0 -2477
  154. package/lib/layouts/KyInputPicker/setting-checkbox.js +0 -850
  155. package/lib/layouts/KyInputPicker/setting-datepicker.js +0 -430
  156. package/lib/layouts/KyInputPicker/setting-datetimepicker.js +0 -443
  157. package/lib/layouts/KyInputPicker/setting-input.js +0 -555
  158. package/lib/layouts/KyInputPicker/setting-inputNumber.js +0 -612
  159. package/lib/layouts/KyInputPicker/setting-monthpicker.js +0 -434
  160. package/lib/layouts/KyInputPicker/setting-multiSelect.js +0 -532
  161. package/lib/layouts/KyInputPicker/setting-nhcascader.js +0 -584
  162. package/lib/layouts/KyInputPicker/setting-old-upload.js +0 -428
  163. package/lib/layouts/KyInputPicker/setting-radio.js +0 -468
  164. package/lib/layouts/KyInputPicker/setting-rangepicker.js +0 -466
  165. package/lib/layouts/KyInputPicker/setting-select.js +0 -534
  166. package/lib/layouts/KyInputPicker/setting-stu-selector.js +0 -507
  167. package/lib/layouts/KyInputPicker/setting-switch.js +0 -274
  168. package/lib/layouts/KyInputPicker/setting-tea-selector.js +0 -507
  169. package/lib/layouts/KyInputPicker/setting-textarea.js +0 -619
  170. package/lib/layouts/KyInputPicker/setting-timepicker.js +0 -437
  171. package/lib/layouts/KyInputPicker/setting-upload.js +0 -766
  172. package/lib/layouts/KyModal/buildTitle.js +0 -81
  173. package/lib/layouts/KyModal/dragM.js +0 -127
  174. package/lib/layouts/KyModal/index.js +0 -321
  175. package/lib/layouts/KyPreview/index.js +0 -219
  176. package/lib/layouts/KyUpload/index.js +0 -1155
  177. package/lib/utils/browserJudge.js +0 -33
  178. package/lib/utils/dynamicLoadCss.js +0 -14
  179. package/lib/utils/dynamicLoadJs.js +0 -21
  180. package/lib/utils/getStyle.js +0 -26
  181. package/lib/utils/getSuitHeight.js +0 -49
  182. package/lib/utils/hasAuth.js +0 -11
  183. package/lib/utils/loadJS.js +0 -40
  184. /package/lib/layouts/{login → Login}/index-pre.js +0 -0
  185. /package/lib/layouts/{login → Login}/index.js +0 -0
  186. /package/lib/layouts/{login → Login}/login.js +0 -0
  187. /package/lib/layouts/{login → Login}/lyPassword.js +0 -0
@@ -1,554 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _toast = require('antd-mobile/lib/toast');
8
-
9
- var _toast2 = _interopRequireDefault(_toast);
10
-
11
- var _imagePicker = require('antd-mobile/lib/image-picker');
12
-
13
- var _imagePicker2 = _interopRequireDefault(_imagePicker);
14
-
15
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
16
-
17
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
18
-
19
- require('antd-mobile/lib/toast/style/css');
20
-
21
- require('antd-mobile/lib/image-picker/style/css');
22
-
23
- var _react = require('react');
24
-
25
- var _react2 = _interopRequireDefault(_react);
26
-
27
- var _propTypes = require('prop-types');
28
-
29
- var _propTypes2 = _interopRequireDefault(_propTypes);
30
-
31
- var _NHFetch = require('../../utils/NHFetch');
32
-
33
- var _NHFetch2 = _interopRequireDefault(_NHFetch);
34
-
35
- var _createUuid = require('../../utils/createUuid');
36
-
37
- var _createUuid2 = _interopRequireDefault(_createUuid);
38
-
39
- var _reactMobileImageViewer = require('react-mobile-image-viewer');
40
-
41
- var _reactMobileImageViewer2 = _interopRequireDefault(_reactMobileImageViewer);
42
-
43
- require('react-mobile-image-viewer/lib/index.css');
44
-
45
- var _reactRouterDom = require('react-router-dom');
46
-
47
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
48
-
49
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
50
-
51
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
52
-
53
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
54
-
55
- // const fileDocDownloadPath = 'api/docrepo/download?attachmentId=';
56
- var redisDownloadPath = '/proData/downloadRedisCacheImage?uuid=';
57
-
58
- var NHImagePicker = function (_React$Component) {
59
- _inherits(NHImagePicker, _React$Component);
60
-
61
- function NHImagePicker(props) {
62
- _classCallCheck(this, NHImagePicker);
63
-
64
- var _this = _possibleConstructorReturn(this, (NHImagePicker.__proto__ || Object.getPrototypeOf(NHImagePicker)).call(this, props));
65
-
66
- _initialiseProps.call(_this);
67
-
68
- var value = props.value || props.defaultValue;
69
- _this.state = {
70
- uploadedImageList: [], //已上传图片
71
- previewImageVisible: false, //是否预览图片标识
72
- previewImageUrl: '', //预览图片的URL
73
- previewImageName: '', //预览图片的名称
74
- value: value !== undefined && value !== null && value.trim() !== '' ? value : (0, _createUuid2.default)()
75
- };
76
- return _this;
77
- }
78
-
79
- _createClass(NHImagePicker, [{
80
- key: 'componentDidMount',
81
- value: function componentDidMount() {
82
- this.loadFileList();
83
- }
84
- }, {
85
- key: 'componentWillReceiveProps',
86
- value: function componentWillReceiveProps(nextprops) {
87
- if ('value' in nextprops && this.props.value !== nextprops.value) {
88
- var value = nextprops.value !== undefined && nextprops.value !== null && nextprops.value.trim() !== '' ? nextprops.value : (0, _createUuid2.default)();
89
- this.setState({ value: value }, this.loadFileList);
90
- }
91
- }
92
-
93
- //处理fileList
94
-
95
- //新增附件主表和明细
96
-
97
- //文件上传改变事件
98
-
99
- }, {
100
- key: 'handlePropsOnChange',
101
- value: function handlePropsOnChange(uploadedImageList) {
102
- //父组件回调方法,在父组件可以拿到已经上传成功的图片信息
103
- if (this.props.onChange && typeof this.props.onChange === "function") {
104
- this.props.onChange(uploadedImageList);
105
- }
106
- }
107
- // handleDownloadClick = (index,fileList) => {
108
- // const file = fileList[index];
109
- // window.open(file.url);
110
- // }
111
-
112
- //上传图片
113
-
114
-
115
- //将base64转换为blob
116
-
117
- }, {
118
- key: 'blobToFile',
119
-
120
- //将blob转换为file
121
- value: function blobToFile(theBlob, fileName, lastModifiedDate) {
122
- theBlob.lastModifiedDate = lastModifiedDate;
123
- theBlob.name = fileName;
124
- return theBlob;
125
- }
126
-
127
- /**
128
- * 判断文件是否超出最大限制
129
- * @param {*} file 文件
130
- * @returns true/false
131
- */
132
-
133
- }, {
134
- key: 'render',
135
- value: function render() {
136
- var uploadedImageList = this.state.uploadedImageList;
137
- var _props = this.props,
138
- numberOfLimit = _props.numberOfLimit,
139
- isEdit = _props.isEdit,
140
- _props$accept = _props.accept,
141
- accept = _props$accept === undefined ? 'image/*' : _props$accept,
142
- capture = _props.capture;
143
-
144
- if (isEdit) {
145
- return _react2.default.createElement(
146
- _react2.default.Fragment,
147
- null,
148
- _react2.default.createElement(_imagePicker2.default, {
149
- files: uploadedImageList,
150
- onChange: this.handleChange,
151
- onImageClick: this.preview,
152
- accept: accept,
153
- selectable: uploadedImageList.length < numberOfLimit,
154
- capture: capture
155
- }),
156
- this.renderCommon()
157
- );
158
- }
159
- return _react2.default.createElement(
160
- _react2.default.Fragment,
161
- null,
162
- _react2.default.createElement(_imagePicker2.default, {
163
- files: uploadedImageList,
164
- onChange: this.handleChange,
165
- onImageClick: this.preview,
166
- selectable: false,
167
- disableDelete: true,
168
- capture: capture
169
- }),
170
- this.renderCommon()
171
- );
172
- }
173
- }]);
174
-
175
- return NHImagePicker;
176
- }(_react2.default.Component);
177
-
178
- NHImagePicker.propTypes = {
179
- saveType: _propTypes2.default.string, //保存的类型
180
- imageList: _propTypes2.default.array, //初始化图片信息
181
- cacheTime: _propTypes2.default.number, //Redis缓存时间
182
- numberOfLimit: _propTypes2.default.number, //允许上传的图片张数
183
- numberOfSize: _propTypes2.default.number, //允许上传的图片大小
184
- disabled: _propTypes2.default.bool, //是否禁用
185
- base64UploadUrl: _propTypes2.default.string, //base64图片上传路径
186
- onRemove: _propTypes2.default.func, //删除成功回调
187
- onChange: _propTypes2.default.func, //值改变回调
188
- serviceMark: _propTypes2.default.string, //所属服务
189
- moduleName: _propTypes2.default.string, //模块名称
190
- value: _propTypes2.default.string, //附件主表id
191
- isEdit: _propTypes2.default.bool, //编辑模式
192
-
193
- compressThreshold: _propTypes2.default.number, //压缩的阈值
194
- isPictureCompress: _propTypes2.default.bool, //是否开启图片压缩
195
- pictureQuality: _propTypes2.default.number, //指定压缩的图片质量,取值范围为0~1,quality值越小,图像越模糊
196
- picScale: _propTypes2.default.number, // 每次图片(宽高)压缩的比例
197
- accept: _propTypes2.default.string, //图片类型
198
- maxFileSize: _propTypes2.default.number, //默认上传文件的最大限制
199
- sizeWord: _propTypes2.default.string //文件大小单位 M/KB, 默认为M
200
-
201
- //设置props默认值
202
- };
203
- NHImagePicker.defaultProps = {
204
- saveType: 'file', //保存的类型,默认为file文档库,可选的值: 'file'(上传文档库)、
205
- cacheTime: 30, //设置Redis缓存的时间,单位:分钟 表示Redis超过30分钟会删除缓存的信息
206
- numberOfLimit: 1, //最多允许上传多少张图片 默认为1张
207
- numberOfSize: 2, //默认上传大小限制2MB
208
- disabled: false, //是否禁用
209
- onRemove: function onRemove() {//删除成功回调
210
- },
211
- onChange: function onChange() {}, //值改变时的回调
212
- base64UploadUrl: undefined, //base64上传图片路径
213
- serviceMark: undefined, //服务标志,说明是属于哪个服务
214
- moduleName: undefined, //模块名称,说明是属于哪个服务的哪个模块
215
- value: undefined, //附件主表id
216
- isEdit: true, //是否可以编辑,默认为true,查看模式必须传value
217
-
218
- compressThreshold: 5, //压缩的阈值,图片大小超过5M,则需要进行压缩
219
- isPictureCompress: false, //是否开启图片压缩
220
- pictureQuality: 0.92, //指定压缩的图片质量,取值范围为0~1,quality值越小,图像越模糊,默认图片质量为0.92
221
- picScale: 0.9, // 每次图片(宽高)压缩的比例
222
- accept: 'image/*', //默认支持上传所有图片类型
223
- capture: false, //图片捕获设置, 具体请参考MDN中关于capture的说明, camera为只拍照
224
- maxFileSize: 20, //默认上传文件的最大限制 20, 单位默认为MB
225
- sizeWord: 'M' //大小单位 M/KB,默认为M
226
- };
227
-
228
- var _initialiseProps = function _initialiseProps() {
229
- var _this2 = this;
230
-
231
- this.loadFileList = function () {
232
- var _props2 = _this2.props,
233
- serviceMark = _props2.serviceMark,
234
- moduleName = _props2.moduleName;
235
-
236
- if (serviceMark && moduleName) {
237
- var value = _this2.state.value;
238
- var t = new Date().getTime();
239
- (0, _NHFetch2.default)('front/zhxg-unauth/dynamic/' + value + '/getDetailed', 'GET', t).then(function (res) {
240
- if (res && res.data && res.data.length > 0) {
241
- _this2.handleFileList(res.data);
242
- }
243
- });
244
- } else {
245
- _toast2.default.fail("服务标志和模块名称不能为空");
246
- }
247
- };
248
-
249
- this.handleFileList = function (propsfileList) {
250
- if (propsfileList.length > 0) {
251
- var uploadedImageList = [];
252
- propsfileList.map(function (item) {
253
- uploadedImageList.push({
254
- uuid: item.uuid,
255
- url: 'zuul/docrepo/download/file?attachmentId=' + item.uuid,
256
- name: item.name
257
- });
258
- });
259
- _this2.setState({
260
- uploadedImageList: uploadedImageList
261
- });
262
- }
263
- };
264
-
265
- this.handleMasterTable = function (res, fileList, fileName) {
266
- var value = _this2.state.value;
267
- var _props3 = _this2.props,
268
- serviceMark = _props3.serviceMark,
269
- moduleName = _props3.moduleName,
270
- describe = _props3.describe,
271
- fileMainName = _props3.fileMainName;
272
-
273
- var param = {
274
- fjzbid: value,
275
- fwbz: serviceMark,
276
- mkmc: moduleName,
277
- ms: describe,
278
- fjzbm: fileMainName,
279
-
280
- fjid: res.data.ssbh,
281
- fjmc: fileName,
282
- cjsid: res.data.scyh,
283
- ztm: '1' // 1 为 指定上传的附件是否默认在附件主表有效
284
- };
285
- (0, _NHFetch2.default)("front/zhxg-unauth/dynamic/insert", 'POST', param).then(function (res) {
286
- if (res && res.code === 200) {
287
- _this2.setState({ uploadedImageList: fileList });
288
- _this2.handlePropsOnChange(value, fileList);
289
- } else {
290
- _toast2.default.fail("附件上传失败!");
291
- }
292
- }).catch(function () {
293
- _toast2.default.fail("附件上传失败!");
294
- });
295
- };
296
-
297
- this.removeFile = function (files, operationType, index) {
298
- var uploadedImageList = _this2.state.uploadedImageList;
299
-
300
- var file = uploadedImageList[index];
301
- (0, _NHFetch2.default)("front/zhxg-unauth/dynamic/updateDel", 'POST', file.uuid).then(function (res) {
302
- if (res && res.code === 200) {
303
- _this2.setState({ uploadedImageList: files });
304
- _this2.handlePropsOnChange(files.length === 0 ? undefined : _this2.state.value, files);
305
- } else {
306
- _toast2.default.fail("删除失败!");
307
- }
308
- }).catch(function (e) {
309
- _toast2.default.fail('网络异常,删除失败');
310
- });
311
- };
312
-
313
- this.handleChange = function (files, operationType, index) {
314
- if (operationType === 'remove') {
315
- _this2.removeFile(files, operationType, index);
316
- //this.setState({uploadedImageList:files});
317
- return;
318
- }
319
- var saveType = _this2.props.saveType || 'file';
320
-
321
- var file = files[files.length - 1].file;
322
- var _props4 = _this2.props,
323
- _props4$compressThres = _props4.compressThreshold,
324
- compressThreshold = _props4$compressThres === undefined ? 5 : _props4$compressThres,
325
- _props4$isPictureComp = _props4.isPictureCompress,
326
- isPictureCompress = _props4$isPictureComp === undefined ? false : _props4$isPictureComp,
327
- _props4$pictureQualit = _props4.pictureQuality,
328
- pictureQuality = _props4$pictureQualit === undefined ? 0.92 : _props4$pictureQualit,
329
- _props4$picScale = _props4.picScale,
330
- picScale = _props4$picScale === undefined ? 0.9 : _props4$picScale;
331
- // 设置的图片大小Max值
332
-
333
- var MaxSize = compressThreshold * 1024 * 1024;
334
- // 若需要压缩且图片大小大于Max值
335
- if (isPictureCompress && file.size > MaxSize) {
336
- //判断浏览器内核是否支持base64图片压缩
337
- if ((typeof FileReader === 'undefined' ? 'undefined' : _typeof(FileReader)) === undefined) {
338
- return file;
339
- } else {
340
- try {
341
- // return new Promise( resolve => {
342
- var fileReader = new FileReader();
343
- fileReader.readAsDataURL(file);
344
- fileReader.onload = function () {
345
- var canvas = document.createElement('canvas');
346
- var img = document.createElement('img');
347
- img.src = fileReader.result;
348
- img.onload = function () {
349
- var ctx = canvas.getContext('2d');
350
- //图片宽、高
351
- var imgWidth = img.width;
352
- var imgHeight = img.height;
353
- var newFile = file;
354
- var imageDataURL = undefined;
355
- while (newFile.size > MaxSize) {
356
- imgWidth = imgWidth * picScale;
357
- imgHeight = imgHeight * picScale;
358
- canvas.width = imgWidth;
359
- canvas.height = imgHeight;
360
- //清除画布
361
- ctx.clearRect(0, 0, imgWidth, imgHeight);
362
- //canvas绘制img
363
- ctx.drawImage(img, 0, 0, imgWidth, imgHeight);
364
-
365
- //设置图片质量,默认为0.92
366
- imageDataURL = canvas.toDataURL(file.type || 'image/jpeg', pictureQuality);
367
- // 去掉URL的头,并转换为byte
368
- var imageBytes = window.atob(imageDataURL.split(',')[1]);
369
- // 处理异常,将ascii码小于0的转换为大于0
370
- var arrayBuffer = new ArrayBuffer(imageBytes.length);
371
- var uint8Array = new Uint8Array(arrayBuffer);
372
- for (var i = 0; i < imageBytes.length; i++) {
373
- uint8Array[i] = imageBytes.charCodeAt(i);
374
- }
375
- var mimeType = imageDataURL.split(',')[0].match(/:(.*?);/)[1];
376
- newFile = new File([uint8Array], file.name, { type: mimeType || 'image/jpeg' });
377
- console.log('after compress, the file size is : ', newFile.size / 1024 / 1024 + "M");
378
- // resolve(newFile);
379
- // return newFile;
380
- }
381
- _this2.postImg(saveType, files, newFile, imageDataURL);
382
- };
383
- };
384
- // fileReader.onerror = () => {
385
- // return file;
386
- // }
387
- // }).then(res => {
388
- // return res;
389
- // })
390
- } catch (error) {
391
- // return file;
392
- _this2.postImg(saveType, files, file, files[files.length - 1].url);
393
- }
394
- }
395
- } else {
396
- // return file;
397
- _this2.postImg(saveType, files, file, files[files.length - 1].url);
398
- }
399
- };
400
-
401
- this.postImg = function (saveType, files, file, url) {
402
- //判断文件是否超出最大限制
403
- var flag = _this2.judgeFileSize(file);
404
- if (!flag) {
405
- return;
406
- }
407
- if (saveType === 'file') {
408
- //上传到文档库
409
- //上传成功(success为true并且响应码为200)
410
- var fileName = files[files.length - 1].file.name;
411
- // let file = file;
412
- var param = new FormData();
413
- param.append('uuid', (0, _createUuid2.default)());
414
- param.append('type', '1');
415
- param.append('file', file);
416
- fetch('zuul/docrepo/upload', { method: 'POST', body: param, headers: { Authorization: window.sessionStorage.getItem("access_token") } }).then(function (response) {
417
- return response.json();
418
- }).then(function (res) {
419
- if (res && res.meta && res.meta.statusCode === 200) {
420
- var newFiles = files.map(function (file) {
421
- if (file.uuid === undefined) {
422
- file.uuid = res.data.ssbh;
423
- file.name = fileName;
424
- file.url = 'zuul/docrepo/download/file?attachmentId=' + file.uuid;
425
- }
426
- return file;
427
- });
428
- _this2.handleMasterTable(res, newFiles, fileName);
429
- // this.setState({ uploadedImageList: newFiles })
430
- // this.handlePropsOnChange(newFiles);
431
- } else {
432
- _toast2.default.fail('上传失败');
433
- }
434
- }).catch(function () {
435
- return _toast2.default.fail('图片上传失败', 1);
436
- });
437
- } else if (saveType === 'redis') {
438
- //缓存Redis
439
- //缓存成功(响应码为200)
440
- // let url = files[files.length-1].url;
441
- // let lastModifiedDate = files[files.length-1].file.lastModifiedDate;
442
- // let fileName = files[files.length-1].file.name;
443
- var lastModifiedDate = file.lastModifiedDate;
444
- var _fileName = file.name;
445
- var blob = _this2.dataURLtoBlob(url);
446
- file = _this2.blobToFile(blob, _fileName, lastModifiedDate);
447
- var _param = new FormData();
448
- _param.append('redisData', _this2.props.cacheTime || 30);
449
- _param.append('file', file);
450
- fetch(window.baseUrl + '/proData/uploadRedis', { method: 'POST', body: _param }).then(function (response) {
451
- return response.json();
452
- }).then(function (res) {
453
- if (res && res.code === 200) {
454
- var newFiles = files.map(function (file) {
455
- if (file.uuid === undefined) {
456
- file.uuid = res.data;
457
- file.url = window.baseUrl + redisDownloadPath + file.uuid;
458
- }
459
- return file;
460
- });
461
- _this2.setState({ uploadedImageList: newFiles });
462
- _this2.handlePropsOnChange(newFiles);
463
- }
464
- }).catch(function () {
465
- return _toast2.default.info('图片上传失败', 1);
466
- });
467
- } else if (saveType === 'base64') {
468
- //用于保存数据库
469
- // let url = files[files.length-1].url;
470
- var _param2 = new FormData();
471
- _param2.append('file', url);
472
- fetch(_this2.props.base64UploadUrl, { method: 'POST', body: _param2 }).then(function (response) {
473
- return response.json();
474
- }).then(function (res) {
475
- if (res && res.code === 200) {
476
- var newFiles = files.map(function (file) {
477
- if (file.uuid === undefined) {
478
- file.uuid = res.data;
479
- }
480
- return file;
481
- });
482
- _this2.setState({ uploadedImageList: newFiles });
483
- _this2.handlePropsOnChange(newFiles);
484
- }
485
- }).catch(function () {
486
- return _toast2.default.info('图片上传失败', 1);
487
- });
488
- }
489
- };
490
-
491
- this.preview = function (index, fileList) {
492
- // const file = fileList[index];
493
- _this2.v = (0, _reactMobileImageViewer2.default)({
494
- urls: fileList.map(function (item) {
495
- return item.url;
496
- }),
497
- index: index
498
- });
499
- };
500
-
501
- this.dataURLtoBlob = function (dataurl) {
502
- console.log(dataurl);
503
- var arr = dataurl.split(',');
504
- var mime = arr[0].match(/:(.*?);/)[1];
505
- var bstr = atob(arr[1]);
506
- var n = bstr.length;
507
- var u8arr = new Uint8Array(n);
508
- while (n--) {
509
- u8arr[n] = bstr.charCodeAt(n);
510
- }
511
- return new Blob([u8arr], { type: mime });
512
- };
513
-
514
- this.renderCommon = function () {
515
- // 监听页面返回操作,如果是图片预览状态,就退出图片预览状态,否则进行正常的返回操作
516
- return _react2.default.createElement(_reactRouterDom.Prompt, {
517
- when: true,
518
- message: function message(location) {
519
- if (_this2.v) {
520
- _this2.v.destroy();
521
- _this2.v = undefined;
522
- return false;
523
- }
524
- return true;
525
- }
526
- });
527
- };
528
-
529
- this.judgeFileSize = function (file) {
530
- var _props5 = _this2.props,
531
- _props5$maxFileSize = _props5.maxFileSize,
532
- maxFileSize = _props5$maxFileSize === undefined ? 20 : _props5$maxFileSize,
533
- _props5$sizeWord = _props5.sizeWord,
534
- sizeWord = _props5$sizeWord === undefined ? 'M' : _props5$sizeWord;
535
-
536
- var isOverSize = false; //是否超出文件最大限制
537
- if (sizeWord.toLocaleLowerCase() === 'kb') {
538
- // 若单位为kb则按kb的比较
539
- var fileSize = file.size / 1024;
540
- isOverSize = fileSize > maxFileSize;
541
- } else {
542
- var _fileSize = file.size / 1024 / 1024;
543
- isOverSize = _fileSize > maxFileSize;
544
- }
545
-
546
- if (isOverSize) {
547
- _toast2.default.info('\u62B1\u6B49\uFF0C\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u6700\u5927\u4E0D\u80FD\u8D85\u8FC7' + maxFileSize + sizeWord + '!');
548
- return false;
549
- }
550
- return true;
551
- };
552
- };
553
-
554
- exports.default = NHImagePicker;
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _list = require('antd-mobile/lib/list');
8
-
9
- var _list2 = _interopRequireDefault(_list);
10
-
11
- var _radio = require('antd-mobile/lib/radio');
12
-
13
- var _radio2 = _interopRequireDefault(_radio);
14
-
15
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
16
-
17
- require('antd-mobile/lib/list/style/css');
18
-
19
- require('antd-mobile/lib/radio/style/css');
20
-
21
- var _react = require('react');
22
-
23
- var _react2 = _interopRequireDefault(_react);
24
-
25
- var _propTypes = require('prop-types');
26
-
27
- var _propTypes2 = _interopRequireDefault(_propTypes);
28
-
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
-
31
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32
-
33
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
34
-
35
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
36
- * @Description:移动端RadioGroup,方便对一组Radio进行处理
37
- * @Author: zengweijin
38
- * @Date: 2019-07-12 11:50:25
39
- * @LastEditors : zengweijin
40
- * @LastEditTime : 2020-01-07 14:08:31
41
- */
42
-
43
-
44
- var RadioGroup = function (_React$Component) {
45
- _inherits(RadioGroup, _React$Component);
46
-
47
- function RadioGroup(props) {
48
- _classCallCheck(this, RadioGroup);
49
-
50
- var _this = _possibleConstructorReturn(this, (RadioGroup.__proto__ || Object.getPrototypeOf(RadioGroup)).call(this, props));
51
-
52
- _this.state = {
53
- value: props.value || props.defaultValue || ''
54
- };
55
- return _this;
56
- }
57
-
58
- _createClass(RadioGroup, [{
59
- key: 'render',
60
- value: function render() {
61
- var _this2 = this;
62
-
63
- var _props = this.props,
64
- options = _props.options,
65
- disabled = _props.disabled,
66
- defaultValue = _props.defaultValue,
67
- value = _props.value,
68
- _onChange = _props.onChange,
69
- label = _props.label;
70
-
71
- var RadioItem = _radio2.default.RadioItem;
72
- return _react2.default.createElement(
73
- 'div',
74
- null,
75
- _react2.default.createElement(
76
- _list2.default,
77
- { renderHeader: function renderHeader() {
78
- return label;
79
- } },
80
- options.map(function (item) {
81
- return _react2.default.createElement(
82
- RadioItem,
83
- {
84
- key: item.value,
85
- defaultChecked: item.value === defaultValue,
86
- checked: item.value === (value || _this2.state.value),
87
- disabled: disabled || item.disabled,
88
- onChange: function onChange(e) {
89
- if (!('value' in _this2.props)) {
90
- _this2.setState({ value: item.value });
91
- }
92
- if (_onChange) {
93
- _onChange(item.value, item.label, e);
94
- }
95
- }
96
- },
97
- item.label
98
- );
99
- })
100
- )
101
- );
102
- }
103
- }]);
104
-
105
- return RadioGroup;
106
- }(_react2.default.Component);
107
-
108
- //属性检查
109
-
110
-
111
- exports.default = RadioGroup;
112
- RadioGroup.propTypes = {
113
- disabled: _propTypes2.default.bool, //是否禁用
114
- defaultValue: _propTypes2.default.any, //默认选中项
115
- value: _propTypes2.default.any, //初始值
116
- onChange: _propTypes2.default.func, //选择完成后的回调
117
- options: _propTypes2.default.arrayOf(_propTypes2.default.object) // radio数组Array<{ label: string value: string disabled?: boolean }>
118
- };