dlt-for-react 1.0.9 → 1.0.11

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
6
 
7
7
  var _checkbox = require('antd/lib/checkbox');
@@ -82,274 +82,299 @@ var _lyPassword2 = _interopRequireDefault(_lyPassword);
82
82
 
83
83
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
84
84
 
85
- var pubKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8DUCb0CEFATRWU8BtBL42RvsdFBcpxYNfsg0P1f7Rd1qKLtqLSBBVGrJu148CdCAkxwKOsjvj5D4eMeDQCd18CAwEAAQ==";
85
+ var pubKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8DUCb0CEFATRWU8BtBL42RvsdFBcpxYNfsg0P1f7Rd1qKLtqLSBBVGrJu148CdCAkxwKOsjvj5D4eMeDQCd18CAwEAAQ==';
86
86
  //网关密码加密
87
87
 
88
- var URL_PREFIX = ''; //统一前缀
89
- var reqGetCaptcha = URL_PREFIX + 'captchaServlet?v='; //验证码下载路径
88
+ var URL_PREFIX = ''; //统一前缀
89
+ var reqGetCaptcha = URL_PREFIX + 'captchaServlet?v='; //验证码下载路径
90
90
  var FormItem = _form2.default.Item;
91
91
 
92
92
  var LoginPage = function (_React$Component) {
93
- (0, _inherits3.default)(LoginPage, _React$Component);
94
-
95
- function LoginPage(props) {
96
- (0, _classCallCheck3.default)(this, LoginPage);
97
-
98
- var _this = (0, _possibleConstructorReturn3.default)(this, (LoginPage.__proto__ || (0, _getPrototypeOf2.default)(LoginPage)).call(this, props));
99
-
100
- _this.handleAccountSubmit = function (e) {
101
- e.preventDefault();
102
- if (_this.state.type === 'tab1') {
103
- _this.props.form.validateFields(['username', 'password', 'captcha'], { force: true }, function (err, values) {
104
- if (!err) {
105
- var encrypt = new _jsencrypt.JSEncrypt();
106
- encrypt.setPublicKey(pubKey);
107
- var encryptPassword = encrypt.encrypt(values.password); //password为需要加密的字段
108
- var timestamp = new Date().getTime();
109
- var arr = [];
110
- arr.push("username=" + values.username, "password=" + encryptPassword, "timestamp=" + timestamp);
111
- var digest = (0, _hexSha2.default)(arr.join(","));
112
-
113
- var params = {
114
- username: values.username,
115
- password: encryptPassword,
116
- encryptTransfer: true,
117
- timestamp: timestamp,
118
- digest: digest
119
- };
120
-
121
- //验证码开启
122
- if (_this.state.captchaVisible) {
123
- params = (0, _extends3.default)({}, params, {
124
- captcha: values.captcha,
125
- systemId: 'ly-zhxg'
126
- });
127
- }
128
- _this.setState({
129
- loading: true
130
- });
131
-
132
- (0, _login.userLogin)(_this.props.allMenu, params, function () {
133
- _this.setState({
134
- loading: false
135
- }, function () {
136
- _this.getSetting();
137
- });
138
- });
139
- } else {}
140
- });
141
- } else {}
142
- };
143
-
144
- _this.isNotIE = function () {
145
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
146
- var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
147
- var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
148
- if (isIE || isIE11) {
149
- return false;
150
- } else return true;
151
- };
152
-
153
- _this.state = {
154
- type: 'tab1',
155
- count: 0,
156
- loading: false,
157
- copyright: '', //'Copyright © 2014-2018 LIANYI TECHNOLOGY CO.,LTD. All Rights Reserved. 联奕科技有限公司(V2.0.20170512-31058)',
158
- loginLogoUrl: 'front/zhxg-unauth/xtglSchoolMng/downloadSchoolPictureByType?type=dlylogo',
159
- defaultLoginLogo: 'zhxg',
160
- validateUrl: '',
161
- captchaVisible: false //验证码是否可见
162
- };
163
- return _this;
164
- }
165
-
166
- (0, _createClass3.default)(LoginPage, [{
167
- key: 'UNSAFE_componentWillMount',
168
- value: function UNSAFE_componentWillMount() {
169
- var _this2 = this;
170
-
171
- //获取版权信息
172
- if (this.props.config.copyright && this.props.config.copyright.startsWith("front/")) {
173
- (0, _NHFetch3.default)(this.props.config.copyright, "GET").then(function (res) {
174
- if (res) {
175
- _this2.setState({
176
- copyright: res.data,
177
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
178
- });
179
- }
180
- });
181
- } else if (this.props.config.copyright) {
182
- this.setState({
183
- copyright: this.props.config.copyright,
184
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
185
- });
93
+ (0, _inherits3.default)(LoginPage, _React$Component);
94
+
95
+ function LoginPage(props) {
96
+ (0, _classCallCheck3.default)(this, LoginPage);
97
+
98
+ var _this = (0, _possibleConstructorReturn3.default)(this, (LoginPage.__proto__ || (0, _getPrototypeOf2.default)(LoginPage)).call(this, props));
99
+
100
+ _this.handleAccountSubmit = function (e) {
101
+ e.preventDefault();
102
+ if (_this.state.type === 'tab1') {
103
+ _this.props.form.validateFields(['username', 'password', 'captcha'], { force: true }, function (err, values) {
104
+ if (!err) {
105
+ var encrypt = new _jsencrypt.JSEncrypt();
106
+ encrypt.setPublicKey(pubKey);
107
+ var encryptPassword = encrypt.encrypt(values.password); //password为需要加密的字段
108
+ var timestamp = new Date().getTime();
109
+ var arr = [];
110
+ arr.push('username=' + values.username, 'password=' + encryptPassword, 'timestamp=' + timestamp);
111
+ var digest = (0, _hexSha2.default)(arr.join(','));
112
+
113
+ var params = {
114
+ username: values.username,
115
+ password: encryptPassword,
116
+ encryptTransfer: true,
117
+ timestamp: timestamp,
118
+ digest: digest
119
+
120
+ //验证码开启
121
+ };if (_this.state.captchaVisible) {
122
+ params = (0, _extends3.default)({}, params, {
123
+ captcha: values.captcha,
124
+ systemId: 'ly-hq'
125
+ });
186
126
  }
187
- this.getSetting(); //获取配置,是否开启验证码
188
- }
189
-
190
- //获取配置,是否开启验证码
191
-
192
- }, {
193
- key: 'getSetting',
194
- value: function getSetting() {
195
- var _this3 = this;
127
+ _this.setState({
128
+ loading: true
129
+ });
196
130
 
197
- fetch(URL_PREFIX + 'ng/captcha/status', {
198
- method: "GET",
199
- credentials: "include",
200
- headers: {
201
- "Content-Type": "application/x-www-form-urlencoded",
202
- "X-Requested-With": "XMLHttpRequest",
203
- "appId": "ly-zhxg"
204
- }
205
- }).then(function (response) {
206
- return response.json();
207
- }).then(function (res) {
208
- if (res.meta && res.meta.statusCode === 200) {
209
- _this3.setState({
210
- captchaVisible: res.data
211
- }, function () {
212
- if (res.data) {
213
- _this3.changeCaptcha();
214
- }
215
- });
216
- } else {
217
- _this3.setState({
218
- captchaVisible: false
219
- });
220
- }
221
- return res;
222
- }).catch(function (error) {
223
- // 网络请求失败返回执行该回调函数,得到错误信息
224
- Modal.error({ title: '错误提示', content: '网络请求异常,请联系管理员' });
225
- return error;
131
+ (0, _login.userLogin)(_this.props.allMenu, params, function () {
132
+ _this.setState({
133
+ loading: false
134
+ }, function () {
135
+ _this.getSetting();
136
+ });
226
137
  });
227
- }
228
- }, {
229
- key: 'changeCaptcha',
230
- value: function changeCaptcha() {
231
- this.setState({
232
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
138
+ } else {}
139
+ });
140
+ } else {}
141
+ };
142
+
143
+ _this.isNotIE = function () {
144
+ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
145
+ var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; //判断是否IE<11浏览器
146
+ var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1;
147
+ if (isIE || isIE11) {
148
+ return false;
149
+ } else return true;
150
+ };
151
+
152
+ _this.state = {
153
+ type: 'tab1',
154
+ count: 0,
155
+ loading: false,
156
+ copyright: '', //'Copyright © 2014-2018 LIANYI TECHNOLOGY CO.,LTD. All Rights Reserved. 联奕科技有限公司(V2.0.20170512-31058)',
157
+ loginLogoUrl: 'front/zhxg-unauth/xtglSchoolMng/downloadSchoolPictureByType?type=dlylogo',
158
+ defaultLoginLogo: 'zhxg',
159
+ validateUrl: '',
160
+ captchaVisible: false //验证码是否可见
161
+ };
162
+ return _this;
163
+ }
164
+
165
+ (0, _createClass3.default)(LoginPage, [{
166
+ key: 'UNSAFE_componentWillMount',
167
+ value: function UNSAFE_componentWillMount() {
168
+ var _this2 = this;
169
+
170
+ //获取版权信息
171
+ if (this.props.config.copyright && this.props.config.copyright.startsWith('front/')) {
172
+ (0, _NHFetch3.default)(this.props.config.copyright, 'GET').then(function (res) {
173
+ if (res) {
174
+ _this2.setState({
175
+ copyright: res.data,
176
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
233
177
  });
234
- }
235
- }, {
236
- key: 'render',
237
- value: function render() {
238
- var _this4 = this;
178
+ }
179
+ });
180
+ } else if (this.props.config.copyright) {
181
+ this.setState({
182
+ copyright: this.props.config.copyright,
183
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
184
+ });
185
+ }
186
+ this.getSetting(); //获取配置,是否开启验证码
187
+ }
239
188
 
240
- var getFieldDecorator = this.props.form.getFieldDecorator;
189
+ //获取配置,是否开启验证码
241
190
 
242
- var isNotIE = this.isNotIE();
243
- return _react2.default.createElement(
244
- 'div',
245
- { className: 'xgui-login-container' },
246
- _react2.default.createElement(
191
+ }, {
192
+ key: 'getSetting',
193
+ value: function getSetting() {
194
+ var _this3 = this;
195
+
196
+ fetch(URL_PREFIX + 'ng/captcha/status', {
197
+ method: 'GET',
198
+ credentials: 'include',
199
+ headers: {
200
+ 'Content-Type': 'application/x-www-form-urlencoded',
201
+ 'X-Requested-With': 'XMLHttpRequest',
202
+ appId: 'ly-hq'
203
+ }
204
+ }).then(function (response) {
205
+ return response.json();
206
+ }).then(function (res) {
207
+ if (res.meta && res.meta.statusCode === 200) {
208
+ _this3.setState({
209
+ captchaVisible: res.data
210
+ }, function () {
211
+ if (res.data) {
212
+ _this3.changeCaptcha();
213
+ }
214
+ });
215
+ } else {
216
+ _this3.setState({
217
+ captchaVisible: false
218
+ });
219
+ }
220
+ return res;
221
+ }).catch(function (error) {
222
+ // 网络请求失败返回执行该回调函数,得到错误信息
223
+ Modal.error({ title: '错误提示', content: '网络请求异常,请联系管理员' });
224
+ return error;
225
+ });
226
+ }
227
+ }, {
228
+ key: 'changeCaptcha',
229
+ value: function changeCaptcha() {
230
+ this.setState({
231
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
232
+ });
233
+ }
234
+ }, {
235
+ key: 'render',
236
+ value: function render() {
237
+ var _this4 = this;
238
+
239
+ var getFieldDecorator = this.props.form.getFieldDecorator;
240
+
241
+ var isNotIE = this.isNotIE();
242
+ return _react2.default.createElement(
243
+ 'div',
244
+ { className: 'xgui-login-container' },
245
+ _react2.default.createElement(
246
+ 'div',
247
+ { className: 'xgui-login-content' },
248
+ _react2.default.createElement(
249
+ 'header',
250
+ { style: { textAlign: 'center', height: '100px' } },
251
+ _react2.default.createElement(
252
+ 'a',
253
+ null,
254
+ _react2.default.createElement('img', {
255
+ alt: 'logo',
256
+ style: { maxWidth: 500, maxHeight: 100 },
257
+ src: this.props.config.loginLogoUrl,
258
+ onError: function onError(e) {
259
+ e.target.src = _this4.props.config.defaultLoginLogo;
260
+ }
261
+ })
262
+ )
263
+ ),
264
+ _react2.default.createElement(
265
+ 'div',
266
+ { className: 'xgui-login-main' },
267
+ _react2.default.createElement(
268
+ _form2.default,
269
+ { onSubmit: this.handleAccountSubmit },
270
+ _react2.default.createElement(
271
+ FormItem,
272
+ null,
273
+ getFieldDecorator('username', {
274
+ rules: [{ required: true, message: '请输入您的账号!' }]
275
+ })(_react2.default.createElement(_input2.default, {
276
+ size: 'large',
277
+ prefix: _react2.default.createElement(_icon2.default, { type: 'user', style: { color: 'rgba(0,0,0,.25)' } }),
278
+ placeholder: '\u8BF7\u8F93\u5165\u7528\u6237\u540D'
279
+ }))
280
+ ),
281
+ _react2.default.createElement(
282
+ FormItem,
283
+ null,
284
+ getFieldDecorator('password', {
285
+ rules: [{ required: true, message: '请输入密码!' }]
286
+ })(
287
+ // <Input size="large" prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="请输入密码" />
288
+ _react2.default.createElement(_lyPassword2.default, {
289
+ encryptMark: '*',
290
+ placeholder: '\u8BF7\u8F93\u5165\u5BC6\u7801',
291
+ onChange: function onChange(password) {
292
+ _this4.props.form.setFieldsValue({ password: password });
293
+ }
294
+ }))
295
+ ),
296
+ this.state.captchaVisible ? _react2.default.createElement(
297
+ FormItem,
298
+ null,
299
+ getFieldDecorator('captcha', {
300
+ rules: [{ required: true, message: '请输入验证码!' }]
301
+ })(_react2.default.createElement(
302
+ 'div',
303
+ null,
304
+ _react2.default.createElement(_input2.default, {
305
+ size: 'large',
306
+ type: 'text',
307
+ placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801',
308
+ style: { width: '58%', float: 'left' }
309
+ }),
310
+ _react2.default.createElement(
247
311
  'div',
248
- { className: 'xgui-login-content' },
312
+ null,
249
313
  _react2.default.createElement(
250
- 'header',
251
- { style: { textAlign: 'center', height: '100px' } },
252
- _react2.default.createElement(
253
- 'a',
254
- null,
255
- _react2.default.createElement('img', { alt: 'logo', style: { maxWidth: 500, maxHeight: 100 },
256
- src: this.props.config.loginLogoUrl, onError: function onError(e) {
257
- e.target.src = _this4.props.config.defaultLoginLogo;
258
- } })
259
- )
260
- ),
261
- _react2.default.createElement(
262
- 'div',
263
- { className: 'xgui-login-main' },
264
- _react2.default.createElement(
265
- _form2.default,
266
- { onSubmit: this.handleAccountSubmit },
267
- _react2.default.createElement(
268
- FormItem,
269
- null,
270
- getFieldDecorator('username', {
271
- rules: [{ required: true, message: '请输入您的账号!' }]
272
- })(_react2.default.createElement(_input2.default, { size: 'large', prefix: _react2.default.createElement(_icon2.default, { type: 'user', style: { color: 'rgba(0,0,0,.25)' } }), placeholder: '\u8BF7\u8F93\u5165\u7528\u6237\u540D' }))
273
- ),
274
- _react2.default.createElement(
275
- FormItem,
276
- null,
277
- getFieldDecorator('password', {
278
- rules: [{ required: true, message: '请输入密码!' }]
279
- })(
280
- // <Input size="large" prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="请输入密码" />
281
- _react2.default.createElement(_lyPassword2.default, {
282
- encryptMark: '*',
283
- placeholder: '\u8BF7\u8F93\u5165\u5BC6\u7801',
284
- onChange: function onChange(password) {
285
- _this4.props.form.setFieldsValue({ password: password });
286
- }
287
- }))
288
- ),
289
- this.state.captchaVisible ? _react2.default.createElement(
290
- FormItem,
291
- null,
292
- getFieldDecorator('captcha', {
293
- rules: [{ required: true, message: '请输入验证码!' }]
294
- })(_react2.default.createElement(
295
- 'div',
296
- null,
297
- _react2.default.createElement(_input2.default, { size: 'large', type: 'text', placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801', style: { width: '58%', float: 'left' } }),
298
- _react2.default.createElement(
299
- 'div',
300
- null,
301
- _react2.default.createElement(
302
- 'span',
303
- { onClick: function onClick() {
304
- return _this4.changeCaptcha();
305
- } },
306
- _react2.default.createElement('img', { src: this.state.validateUrl })
307
- )
308
- )
309
- ))
310
- ) : null,
311
- _react2.default.createElement(
312
- FormItem,
313
- null,
314
- _react2.default.createElement(
315
- _button2.default,
316
- { className: 'xgui-login-submit', type: 'primary', size: 'large', htmlType: 'submit', loading: this.state.loading },
317
- '\u767B\u5F55'
318
- )
319
- ),
320
- _react2.default.createElement(
321
- FormItem,
322
- null,
323
- getFieldDecorator('remember', {
324
- valuePropName: 'checked',
325
- initialValue: true
326
- })(_react2.default.createElement(
327
- _checkbox2.default,
328
- { style: { float: 'right' } },
329
- '\u8BB0\u4F4F\u767B\u5F55'
330
- ))
331
- )
332
- )
314
+ 'span',
315
+ { onClick: function onClick() {
316
+ return _this4.changeCaptcha();
317
+ } },
318
+ _react2.default.createElement('img', { src: this.state.validateUrl })
333
319
  )
334
- ),
320
+ )
321
+ ))
322
+ ) : null,
323
+ _react2.default.createElement(
324
+ FormItem,
325
+ null,
335
326
  _react2.default.createElement(
336
- 'div',
337
- { style: { margin: '48px 0 24px', minHeight: '50px' } },
338
- _react2.default.createElement(
339
- 'div',
340
- { style: { fontSize: '12px', color: '#7d7d7d', textAlign: 'center', lineHeight: '40px' } },
341
- this.state.copyright
342
- )
343
- ),
344
- isNotIE ? _react2.default.createElement(
345
- 'style',
346
- { jsx: 'true', global: 'true' },
347
- '\n .xgui-login-content{\n flex: 1;\n }\n '
348
- ) : null
349
- );
350
- }
351
- }]);
352
- return LoginPage;
327
+ _button2.default,
328
+ {
329
+ className: 'xgui-login-submit',
330
+ type: 'primary',
331
+ size: 'large',
332
+ htmlType: 'submit',
333
+ loading: this.state.loading
334
+ },
335
+ '\u767B\u5F55'
336
+ )
337
+ ),
338
+ _react2.default.createElement(
339
+ FormItem,
340
+ null,
341
+ getFieldDecorator('remember', {
342
+ valuePropName: 'checked',
343
+ initialValue: true
344
+ })(_react2.default.createElement(
345
+ _checkbox2.default,
346
+ { style: { float: 'right' } },
347
+ '\u8BB0\u4F4F\u767B\u5F55'
348
+ ))
349
+ )
350
+ )
351
+ )
352
+ ),
353
+ _react2.default.createElement(
354
+ 'div',
355
+ { style: { margin: '48px 0 24px', minHeight: '50px' } },
356
+ _react2.default.createElement(
357
+ 'div',
358
+ {
359
+ style: {
360
+ fontSize: '12px',
361
+ color: '#7d7d7d',
362
+ textAlign: 'center',
363
+ lineHeight: '40px'
364
+ }
365
+ },
366
+ this.state.copyright
367
+ )
368
+ ),
369
+ isNotIE ? _react2.default.createElement(
370
+ 'style',
371
+ { jsx: 'true', global: 'true' },
372
+ '\n .xgui-login-content {\n flex: 1;\n }\n '
373
+ ) : null
374
+ );
375
+ }
376
+ }]);
377
+ return LoginPage;
353
378
  }(_react2.default.Component);
354
379
 
355
380
  var Login = _form2.default.create()(LoginPage);
@@ -121,7 +121,7 @@ var GetCsz = function GetCsz(csbz, callback) {
121
121
  headers: {
122
122
  'Content-Type': 'application/x-www-form-urlencoded',
123
123
  'X-Requested-With': 'XMLHttpRequest',
124
- appId: 'ly-zhxg'
124
+ appId: 'ly-hq'
125
125
  }
126
126
  }).then(function (response) {
127
127
  return response.json();
@@ -401,7 +401,7 @@ var LoginPage = function (_React$Component) {
401
401
  headers: {
402
402
  'Content-Type': 'application/x-www-form-urlencoded',
403
403
  'X-Requested-With': 'XMLHttpRequest',
404
- appId: 'ly-zhxg'
404
+ appId: 'ly-hq'
405
405
  }
406
406
  }).then(function (response) {
407
407
  return response.json();