dlt-for-react 1.0.2 → 1.0.3

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 (40) hide show
  1. package/README.md +3 -1
  2. package/assets/components/KyInputPicker/index.less +8 -0
  3. package/assets/components/KyModal/index.less +21 -0
  4. package/assets/components/KyPreview/index.less +38 -0
  5. package/assets/components/KyUpload/index.less +41 -0
  6. package/lib/components/DragM/index.js +127 -0
  7. package/lib/components/KyInputPicker/edit-page.js +585 -0
  8. package/lib/components/KyInputPicker/index.js +220 -0
  9. package/lib/components/KyInputPicker/input-const.js +134 -0
  10. package/lib/components/KyInputPicker/render.js +2480 -0
  11. package/lib/components/KyInputPicker/setting-checkbox.js +850 -0
  12. package/lib/components/KyInputPicker/setting-datepicker.js +430 -0
  13. package/lib/components/KyInputPicker/setting-datetimepicker.js +443 -0
  14. package/lib/components/KyInputPicker/setting-input.js +555 -0
  15. package/lib/components/KyInputPicker/setting-inputNumber.js +612 -0
  16. package/lib/components/KyInputPicker/setting-monthpicker.js +434 -0
  17. package/lib/components/KyInputPicker/setting-multiSelect.js +532 -0
  18. package/lib/components/KyInputPicker/setting-nhcascader.js +584 -0
  19. package/lib/components/KyInputPicker/setting-old-upload.js +428 -0
  20. package/lib/components/KyInputPicker/setting-radio.js +468 -0
  21. package/lib/components/KyInputPicker/setting-rangepicker.js +466 -0
  22. package/lib/components/KyInputPicker/setting-select.js +534 -0
  23. package/lib/components/KyInputPicker/setting-stu-selector.js +507 -0
  24. package/lib/components/KyInputPicker/setting-switch.js +274 -0
  25. package/lib/components/KyInputPicker/setting-tea-selector.js +507 -0
  26. package/lib/components/KyInputPicker/setting-textarea.js +619 -0
  27. package/lib/components/KyInputPicker/setting-timepicker.js +437 -0
  28. package/lib/components/KyInputPicker/setting-upload.js +766 -0
  29. package/lib/components/KyModal/buildTitle.js +81 -0
  30. package/lib/components/KyModal/dragM.js +127 -0
  31. package/lib/components/KyModal/index.js +321 -0
  32. package/lib/components/KyPreview/index.js +209 -0
  33. package/lib/components/KyUpload/index.js +1156 -0
  34. package/lib/index.js +84 -31
  35. package/lib/layouts/Login/index.js +522 -458
  36. package/lib/layouts/Login/lyPassword.js +8 -10
  37. package/lib/layouts/Top/index.js +308 -254
  38. package/lib/layouts/TopMenu/index.js +270 -265
  39. package/lib/layouts/mixTop/index.js +274 -243
  40. package/package.json +10 -4
@@ -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 _tooltip = require('antd/lib/tooltip');
@@ -90,14 +90,9 @@ var _hexSha2 = _interopRequireDefault(_hexSha);
90
90
 
91
91
  var _jsencrypt = require('jsencrypt');
92
92
 
93
- var _lyPassword = require('./lyPassword.js');
94
-
95
- var _lyPassword2 = _interopRequireDefault(_lyPassword);
96
-
97
93
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
98
94
 
99
- var pubKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8DUCb0CEFATRWU8BtBL42RvsdFBcpxYNfsg0P1f7Rd1qKLtqLSBBVGrJu148CdCAkxwKOsjvj5D4eMeDQCd18CAwEAAQ==";
100
- //网关密码加密
95
+ // import LyPassword from './lyPassword.js'
101
96
 
102
97
  // import ReactSimpleVerify from 'react-simple-verify'
103
98
  // import 'react-simple-verify/dist/react-simple-verify.css'
@@ -108,487 +103,556 @@ var pubKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8DUCb0CEFATRWU8BtBL42RvsdFBcpxYN
108
103
  * @LastEditors: lisenlin
109
104
  * @LastEditTime: 2021-12-14 14:31:40
110
105
  */
111
- var URL_PREFIX = ''; //统一前缀
112
- var reqGetCaptcha = URL_PREFIX + 'captchaServlet?v='; //验证码下载路径
106
+ var pubKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8DUCb0CEFATRWU8BtBL42RvsdFBcpxYNfsg0P1f7Rd1qKLtqLSBBVGrJu148CdCAkxwKOsjvj5D4eMeDQCd18CAwEAAQ==';
107
+ //网关密码加密
108
+
109
+ var URL_PREFIX = ''; //统一前缀
110
+ var reqGetCaptcha = URL_PREFIX + 'captchaServlet?v='; //验证码下载路径
113
111
  var FormItem = _form2.default.Item;
114
112
 
115
113
  var defaultLogo = require('../../../assets/login/images/defaultLogo.png');
116
- var unValidatedPic = require('../../../assets/login/images/yz.png');
117
- var validatedPic = require('../../../assets/login/images/yz_success.png');
114
+ // const unValidatedPic = require('../../../assets/login/images/yz.png')
115
+ // const validatedPic = require('../../../assets/login/images/yz_success.png')
118
116
 
119
117
  var GetCsz = function GetCsz(csbz, callback) {
120
- fetch('front/zhxg-unauth/openapi/getCssz?csbz=' + csbz, {
121
- method: "GET",
122
- credentials: "include",
123
- headers: {
124
- "Content-Type": "application/x-www-form-urlencoded",
125
- "X-Requested-With": "XMLHttpRequest",
126
- "appId": "ly-zhxg"
127
- }
128
- }).then(function (response) {
129
- return response.json();
130
- }).then(function (res) {
131
- if (callback && typeof callback === 'function') {
132
- callback(res);
133
- }
134
- return res;
135
- }).catch(function (error) {});
118
+ fetch('front/zhxg-unauth/openapi/getCssz?csbz=' + csbz, {
119
+ method: 'GET',
120
+ credentials: 'include',
121
+ headers: {
122
+ 'Content-Type': 'application/x-www-form-urlencoded',
123
+ 'X-Requested-With': 'XMLHttpRequest',
124
+ appId: 'ly-zhxg'
125
+ }
126
+ }).then(function (response) {
127
+ return response.json();
128
+ }).then(function (res) {
129
+ if (callback && typeof callback === 'function') {
130
+ callback(res);
131
+ }
132
+ return res;
133
+ }).catch(function (error) {});
136
134
  };
137
135
 
138
136
  var LoginPage = function (_React$Component) {
139
- (0, _inherits3.default)(LoginPage, _React$Component);
140
-
141
- function LoginPage(props) {
142
- (0, _classCallCheck3.default)(this, LoginPage);
143
-
144
- var _this = (0, _possibleConstructorReturn3.default)(this, (LoginPage.__proto__ || (0, _getPrototypeOf2.default)(LoginPage)).call(this, props));
145
-
146
- _this.getLytype = function () {
147
- try {
148
- GetCsz("XTGL_LYTYPE", function (res) {
149
- if (res && res.code === 200 && res.data) {
150
- _this.setState({ lytype: res.data });
151
- }
152
- });
153
- } catch (err) {};
154
- };
155
-
156
- _this.handelWindowResize = function () {
157
- if (window.innerWidth < 700) {
158
- _this.setState({
159
- smallScreen: true
160
- });
161
- } else {
162
- if (_this.state.smallScreen) {
163
- _this.setState({
164
- smallScreen: false
165
- });
166
- }
167
- }
168
-
169
- if (window.innerHeight < 750) {
170
- _this.setState({
171
- shortScreen: true
172
- });
173
- } else {
174
- if (_this.state.shortScreen) {
175
- _this.setState({
176
- shortScreen: false
177
- });
178
- }
137
+ (0, _inherits3.default)(LoginPage, _React$Component);
138
+
139
+ function LoginPage(props) {
140
+ (0, _classCallCheck3.default)(this, LoginPage);
141
+
142
+ var _this = (0, _possibleConstructorReturn3.default)(this, (LoginPage.__proto__ || (0, _getPrototypeOf2.default)(LoginPage)).call(this, props));
143
+
144
+ _this.getLytype = function () {
145
+ try {
146
+ GetCsz('XTGL_LYTYPE', function (res) {
147
+ if (res && res.code === 200 && res.data) {
148
+ _this.setState({ lytype: res.data });
149
+ }
150
+ });
151
+ } catch (err) {}
152
+ };
153
+
154
+ _this.handelWindowResize = function () {
155
+ if (window.innerWidth < 700) {
156
+ _this.setState({
157
+ smallScreen: true
158
+ });
159
+ } else {
160
+ if (_this.state.smallScreen) {
161
+ _this.setState({
162
+ smallScreen: false
163
+ });
164
+ }
165
+ }
166
+
167
+ if (window.innerHeight < 750) {
168
+ _this.setState({
169
+ shortScreen: true
170
+ });
171
+ } else {
172
+ if (_this.state.shortScreen) {
173
+ _this.setState({
174
+ shortScreen: false
175
+ });
176
+ }
177
+ }
178
+ };
179
+
180
+ _this.getCookiePwd = function () {
181
+ var uupd = _this.getCookie('dlt-uupd');
182
+ if (uupd && uupd !== '') {
183
+ var userNameFromCookie = uupd.split('///')[0];
184
+ var passwordFromCookie = uupd.split('///')[1];
185
+ var privateKey = window.localStorage.getItem('privateKey');
186
+ var password = undefined;
187
+ if (privateKey) {
188
+ var decrypt = new _jsencrypt.JSEncrypt();
189
+ decrypt.setPrivateKey(privateKey);
190
+ password = decrypt.decrypt(passwordFromCookie);
191
+ }
192
+ _this.setState({
193
+ userNameFromCookie: userNameFromCookie,
194
+ passwordFromCookie: password
195
+ });
196
+ }
197
+ };
198
+
199
+ _this.handleAccountSubmit = function (e) {
200
+ e.preventDefault();
201
+ if (_this.state.type === 'tab1') {
202
+ _this.props.form.validateFields(function (err, values) {
203
+ if (!err) {
204
+ // if(!this.state.validation) {
205
+ // message.info('请先滑动滑块验证!');
206
+ // return ;
207
+ // }
208
+ var encrypt = new _jsencrypt.JSEncrypt();
209
+ encrypt.setPublicKey(pubKey);
210
+ var password = values.password;
211
+ var encryptPassword = encrypt.encrypt(password); //password为需要加密的字段
212
+ var timestamp = new Date().getTime();
213
+ var arr = [];
214
+ arr.push('username=' + values.username, 'password=' + encryptPassword, 'timestamp=' + timestamp);
215
+ var digest = (0, _hexSha2.default)(arr.join(','));
216
+ //若记住密码 则保存在cookie中,默认保存7天
217
+ if (_this.state.rememberPW) {
218
+ var JsEncrypt = new _jsencrypt.JSEncrypt();
219
+ var privateKey = JsEncrypt.getPrivateKey();
220
+ window.localStorage.setItem('privateKey', privateKey);
221
+ var encryptPwd = JsEncrypt.encrypt(password); //password为需要加密的字段
222
+ _this.setCookie('dlt-uupd', values.username + '///' + encryptPwd);
179
223
  }
180
- };
181
-
182
- _this.getCookiePwd = function () {
183
- var uupd = _this.getCookie('uupd');
184
- if (uupd && uupd !== '') {
185
- var userNameFromCookie = uupd.split('///')[0];
186
- var passwordFromCookie = uupd.split('///')[1];
187
- _this.setState({
188
- userNameFromCookie: userNameFromCookie, passwordFromCookie: passwordFromCookie
189
- });
224
+ var params = {
225
+ username: values.username,
226
+ password: encryptPassword,
227
+ encryptTransfer: true,
228
+ timestamp: timestamp,
229
+ digest: digest,
230
+ systemId: 'ly-dlt'
231
+ };
232
+ if (_this.state.lytype) {
233
+ params.lytype = _this.state.lytype;
190
234
  }
191
- };
192
-
193
- _this.handleAccountSubmit = function (e) {
194
- e.preventDefault();
195
- if (_this.state.type === 'tab1') {
196
- _this.props.form.validateFields(function (err, values) {
197
- if (!err) {
198
- // if(!this.state.validation) {
199
- // message.info('请先滑动滑块验证!');
200
- // return ;
201
- // }
202
- var encrypt = new _jsencrypt.JSEncrypt();
203
- encrypt.setPublicKey(pubKey);
204
- var encryptPassword = values.password;
205
- // let encryptPassword = encrypt.encrypt(values.password); //password为需要加密的字段
206
- if (_this.state.userNameFromCookie + '///' + _this.state.passwordFromCookie !== values.username + '///' + values.password) {
207
- // 如果密码和cookie的密码不一样就需要重新加密
208
- encryptPassword = encrypt.encrypt(values.password); //password为需要加密的字段
209
- }
210
- var timestamp = new Date().getTime();
211
- var arr = [];
212
- arr.push("username=" + values.username, "password=" + encryptPassword, "timestamp=" + timestamp);
213
- var digest = (0, _hexSha2.default)(arr.join(","));
214
- //若记住密码 则保存在cookie中,默认保存7天
215
- if (_this.state.rememberPW) {
216
- _this.setCookie('uupd', values.username + '///' + encryptPassword);
217
- }
218
- var params = {
219
- username: values.username,
220
- password: encryptPassword,
221
- encryptTransfer: true,
222
- timestamp: timestamp,
223
- digest: digest,
224
- systemId: 'ly-zhxg'
225
- };
226
- if (_this.state.lytype) {
227
- params.lytype = _this.state.lytype;
228
- }
229
- //验证码开启
230
- if (_this.state.captchaVisible) {
231
- params = (0, _extends3.default)({}, params, {
232
- captcha: values.captcha
233
- });
234
- }
235
- _this.setState({
236
- loading: true
237
- });
238
-
239
- (0, _login.userLogin)(_this.props.allMenu, params, function () {
240
- _this.setState({
241
- loading: false
242
- }, function () {
243
- _this.getSetting(); /* this.handelReset() */
244
- });
245
- });
246
- } else {}
247
- });
248
- } else {}
249
- };
250
-
251
- _this.isNotIE = function () {
252
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
253
- var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
254
- var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
255
- if (isIE || isIE11) {
256
- return false;
257
- } else return true;
258
- };
259
-
260
- _this.getCookie = function (key) {
261
- var name = key + "=";
262
- var ca = document.cookie.split(';');
263
- for (var i = 0; i < ca.length; i++) {
264
- var c = ca[i].trim();
265
- if (c.indexOf(name) === 0) {
266
- return c.substring(name.length, c.length);
267
- }
235
+ //验证码开启
236
+ if (_this.state.captchaVisible) {
237
+ params = (0, _extends3.default)({}, params, {
238
+ captcha: values.captcha
239
+ });
268
240
  }
269
- return "";
270
- };
271
-
272
- _this.setCookie = function (key, value) {
273
- var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 7;
274
-
275
- var d = new Date();
276
- d.setTime(d.getTime() + day * 24 * 60 * 60 * 1000);
277
- var expires = "expires=" + d.toGMTString();
278
- document.cookie = key + "=" + value + "; " + expires;
279
- };
280
-
281
- _this.handelSuccess = function () {
282
- _this.setState({
283
- validation: true
284
- });
285
- };
286
-
287
- _this.handelReset = function () {
288
241
  _this.setState({
289
- validation: false
242
+ loading: true
290
243
  });
291
- _this.VerifyRef && _this.VerifyRef.reset();
292
- _this.setCookie('uupd', '');
293
- };
294
244
 
295
- _this.checkChange = function (checked) {
296
- _this.setState({
297
- rememberPW: checked
298
- });
299
- };
300
-
301
- _this.state = {
302
- type: 'tab1',
303
- count: 0,
304
- loading: false,
305
- copyright: '', //'Copyright © 2014-2018 LIANYI TECHNOLOGY CO.,LTD. All Rights Reserved. 联奕科技有限公司(V2.0.20170512-31058)',
306
- loginLogoUrl: 'front/zhxg-unauth/xtglSchoolMng/downloadSchoolPictureByType?type=dlylogo',
307
- defaultLoginLogo: 'zhxg',
308
- validateUrl: '',
309
- captchaVisible: false, //验证码是否可见
310
-
311
- background: require('../../../assets/login/images/bgNew.jpg'), //登录页背景
312
-
313
- browserList: [{ key: '1', type: 'chrome', title: '谷歌浏览器', imgSrc: require('../../../assets/login/images/chrome.png') }, { key: '2', type: 'firefox', title: '火狐浏览器', imgSrc: require('../../../assets/login/images/firefox.png') }, { key: '3', type: 'edge', title: 'Microsoft Edge浏览器', imgSrc: require('../../../assets/login/images/edge.png') }, { key: '4', type: '360', title: '360浏览器', imgSrc: require('../../../assets/login/images/360.png') }, { key: '5', type: 'safari', title: 'Safari浏览器', imgSrc: require('../../../assets/login/images/safari.png') }],
314
- success: false, //滚动验证
315
- sologanTitle: '联奕愿景',
316
- sologan: '让校园服务更智慧',
317
-
318
- rememberPW: false, //是否记住密码
319
- userNameFromCookie: undefined, //cookie缓存的登录者
320
- passwordFromCookie: undefined, //cookie缓存的登录密码 - 加密
321
-
322
- validation: false, //验证状态
323
- smallScreen: false, //是否屏幕宽度较小 <700为true
324
- shortScreen: false, //是否屏幕高度较矮 <750为true
325
- lytype: "" // 登录接口处理
326
- };
327
- return _this;
328
- }
329
-
330
- (0, _createClass3.default)(LoginPage, [{
331
- key: 'UNSAFE_componentWillMount',
332
- value: function UNSAFE_componentWillMount() {
333
- var _this2 = this;
334
-
335
- //获取版权信息
336
- if (this.props.config.copyright && this.props.config.copyright.startsWith("front/")) {
337
- (0, _NHFetch3.default)(this.props.config.copyright, "GET").then(function (res) {
338
- if (res) {
339
- _this2.setState({
340
- copyright: res.data,
341
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
342
- });
343
- }
344
- });
345
- } else if (this.props.config.copyright) {
346
- this.setState({
347
- copyright: this.props.config.copyright,
348
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
349
- });
350
- }
351
- this.getSetting(); //获取配置,是否开启验证码
352
- this.getCookiePwd(); //获取cookie的账密
353
- this.getLytype(); //获取登录类型
354
- window.addEventListener('resize', this.handelWindowResize);
355
- }
356
- }, {
357
- key: 'componentWillUnmount',
358
- value: function componentWillUnmount() {
359
- window.removeEventListener('resize', this.handelWindowResize);
360
- }
361
- /**获取lytype值 */
362
-
363
- /** 监听屏幕宽度 */
364
-
365
- }, {
366
- key: 'getSetting',
367
-
368
-
369
- //获取配置,是否开启验证码
370
- value: function getSetting() {
371
- var _this3 = this;
372
-
373
- fetch(URL_PREFIX + 'ng/captcha/status', {
374
- method: "GET",
375
- credentials: "include",
376
- headers: {
377
- "Content-Type": "application/x-www-form-urlencoded",
378
- "X-Requested-With": "XMLHttpRequest",
379
- "appId": "ly-zhxg"
380
- }
381
- }).then(function (response) {
382
- return response.json();
383
- }).then(function (res) {
384
- if (res.meta && res.meta.statusCode === 200) {
385
- _this3.setState({
386
- captchaVisible: res.data
387
- }, function () {
388
- if (res.data) {
389
- _this3.changeCaptcha();
390
- }
391
- });
392
- } else {
393
- _this3.setState({
394
- captchaVisible: false
395
- });
396
- }
397
- return res;
398
- }).catch(function (error) {
399
- // 网络请求失败返回执行该回调函数,得到错误信息
400
- _modal2.default.error({ title: '错误提示', content: '网络请求异常,请联系管理员' });
401
- return error;
245
+ (0, _login.userLogin)(_this.props.allMenu, params, function () {
246
+ _this.setState({
247
+ loading: false
248
+ }, _this.getSetting);
402
249
  });
250
+ } else {}
251
+ });
252
+ } else {}
253
+ };
254
+
255
+ _this.isNotIE = function () {
256
+ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
257
+ var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; //判断是否IE<11浏览器
258
+ var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1;
259
+ if (isIE || isIE11) {
260
+ return false;
261
+ } else return true;
262
+ };
263
+
264
+ _this.getCookie = function (key) {
265
+ var name = key + '=';
266
+ var ca = document.cookie.split(';');
267
+ for (var i = 0; i < ca.length; i++) {
268
+ var c = ca[i].trim();
269
+ if (c.indexOf(name) === 0) {
270
+ return c.substring(name.length, c.length);
403
271
  }
404
- }, {
405
- key: 'changeCaptcha',
406
- value: function changeCaptcha() {
407
- this.setState({
408
- validateUrl: reqGetCaptcha + new Date().getMilliseconds()
272
+ }
273
+ return '';
274
+ };
275
+
276
+ _this.setCookie = function (key, value) {
277
+ var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 7;
278
+
279
+ var d = new Date();
280
+ d.setTime(d.getTime() + day * 24 * 60 * 60 * 1000);
281
+ var expires = 'expires=' + d.toGMTString();
282
+ document.cookie = key + '=' + value + '; ' + expires;
283
+ };
284
+
285
+ _this.handelSuccess = function () {
286
+ _this.setState({
287
+ validation: true
288
+ });
289
+ };
290
+
291
+ _this.handelReset = function () {
292
+ _this.setState({
293
+ validation: false
294
+ });
295
+ _this.VerifyRef && _this.VerifyRef.reset();
296
+ _this.setCookie('dlt-uupd', '');
297
+ };
298
+
299
+ _this.checkChange = function (checked) {
300
+ _this.setState({
301
+ rememberPW: checked
302
+ });
303
+ };
304
+
305
+ _this.state = {
306
+ type: 'tab1',
307
+ count: 0,
308
+ loading: false,
309
+ copyright: '', //'Copyright © 2014-2018 LIANYI TECHNOLOGY CO.,LTD. All Rights Reserved. 联奕科技有限公司(V2.0.20170512-31058)',
310
+ loginLogoUrl: 'front/zhxg-unauth/xtglSchoolMng/downloadSchoolPictureByType?type=dlylogo',
311
+ defaultLoginLogo: 'zhxg',
312
+ validateUrl: '',
313
+ captchaVisible: false, //验证码是否可见
314
+ background: require('../../../assets/login/images/bgNew.jpg'), //登录页背景
315
+ browserList: [{
316
+ key: '1',
317
+ type: 'chrome',
318
+ title: '谷歌浏览器',
319
+ imgSrc: require('../../../assets/login/images/chrome.png')
320
+ }, {
321
+ key: '2',
322
+ type: 'firefox',
323
+ title: '火狐浏览器',
324
+ imgSrc: require('../../../assets/login/images/firefox.png')
325
+ }, {
326
+ key: '3',
327
+ type: 'edge',
328
+ title: 'Microsoft Edge浏览器',
329
+ imgSrc: require('../../../assets/login/images/edge.png')
330
+ }, {
331
+ key: '4',
332
+ type: '360',
333
+ title: '360浏览器',
334
+ imgSrc: require('../../../assets/login/images/360.png')
335
+ }, {
336
+ key: '5',
337
+ type: 'safari',
338
+ title: 'Safari浏览器',
339
+ imgSrc: require('../../../assets/login/images/safari.png')
340
+ }],
341
+ success: false, //滚动验证
342
+ sologanTitle: '联奕愿景',
343
+ sologan: '让校园服务更智慧',
344
+ rememberPW: true, //是否记住密码
345
+ userNameFromCookie: undefined, //cookie缓存的登录者
346
+ passwordFromCookie: undefined, //cookie缓存的登录密码 - 不加密
347
+ validation: false, //验证状态
348
+ smallScreen: false, //是否屏幕宽度较小 <700为true
349
+ shortScreen: false, //是否屏幕高度较矮 <750为true
350
+ lytype: '' // 登录接口处理
351
+ };
352
+ return _this;
353
+ }
354
+
355
+ (0, _createClass3.default)(LoginPage, [{
356
+ key: 'UNSAFE_componentWillMount',
357
+ value: function UNSAFE_componentWillMount() {
358
+ var _this2 = this;
359
+
360
+ //获取版权信息
361
+ if (this.props.config.copyright && this.props.config.copyright.startsWith('front/')) {
362
+ (0, _NHFetch3.default)(this.props.config.copyright, 'GET').then(function (res) {
363
+ if (res) {
364
+ _this2.setState({
365
+ copyright: res.data,
366
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
409
367
  });
410
- }
411
-
412
- /** 获取cookie */
413
-
414
-
415
- /** 设置cookie */
416
-
368
+ }
369
+ });
370
+ } else if (this.props.config.copyright) {
371
+ this.setState({
372
+ copyright: this.props.config.copyright,
373
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
374
+ });
375
+ }
376
+ this.getSetting(); //获取配置,是否开启验证码
377
+ this.getCookiePwd(); //获取cookie的账密
378
+ this.getLytype(); //获取登录类型
379
+ window.addEventListener('resize', this.handelWindowResize);
380
+ }
381
+ }, {
382
+ key: 'componentWillUnmount',
383
+ value: function componentWillUnmount() {
384
+ window.removeEventListener('resize', this.handelWindowResize);
385
+ }
386
+ /**获取lytype值 */
417
387
 
418
- /** 滑动认证成功 */
388
+ /** 监听屏幕宽度 */
419
389
 
390
+ }, {
391
+ key: 'getSetting',
420
392
 
421
- /** 登录失败重置滑动认证器 并清除cookie的登录缓存 */
422
393
 
423
- }, {
424
- key: 'render',
425
- value: function render() {
426
- var _this4 = this;
394
+ //获取配置,是否开启验证码
395
+ value: function getSetting() {
396
+ var _this3 = this;
427
397
 
428
- var _props = this.props,
429
- form = _props.form,
430
- config = _props.config;
431
- var getFieldDecorator = form.getFieldDecorator;
432
- var _state = this.state,
433
- background = _state.background,
434
- browserList = _state.browserList,
435
- copyright = _state.copyright,
436
- sologanTitle = _state.sologanTitle,
437
- sologan = _state.sologan,
438
- validation = _state.validation,
439
- userNameFromCookie = _state.userNameFromCookie,
440
- passwordFromCookie = _state.passwordFromCookie,
441
- smallScreen = _state.smallScreen,
442
- shortScreen = _state.shortScreen;
398
+ fetch(URL_PREFIX + 'ng/captcha/status', {
399
+ method: 'GET',
400
+ credentials: 'include',
401
+ headers: {
402
+ 'Content-Type': 'application/x-www-form-urlencoded',
403
+ 'X-Requested-With': 'XMLHttpRequest',
404
+ appId: 'ly-zhxg'
405
+ }
406
+ }).then(function (response) {
407
+ return response.json();
408
+ }).then(function (res) {
409
+ if (res.meta && res.meta.statusCode === 200) {
410
+ _this3.setState({
411
+ captchaVisible: res.data
412
+ }, function () {
413
+ if (res.data) {
414
+ _this3.changeCaptcha();
415
+ }
416
+ });
417
+ } else {
418
+ _this3.setState({
419
+ captchaVisible: false
420
+ });
421
+ }
422
+ return res;
423
+ }).catch(function (error) {
424
+ // 网络请求失败返回执行该回调函数,得到错误信息
425
+ _modal2.default.error({ title: '错误提示', content: '网络请求异常,请联系管理员' });
426
+ return error;
427
+ });
428
+ }
429
+ }, {
430
+ key: 'changeCaptcha',
431
+ value: function changeCaptcha() {
432
+ this.setState({
433
+ validateUrl: reqGetCaptcha + new Date().getMilliseconds()
434
+ });
435
+ }
443
436
 
444
- var isNotIE = this.isNotIE();
445
- var styleObj = smallScreen ? {} : { paddingLeft: '195px' };
446
- return _react2.default.createElement(
437
+ /** 获取cookie */
438
+
439
+
440
+ /** 设置cookie */
441
+
442
+
443
+ /** 滑动认证成功 */
444
+
445
+
446
+ /** 登录失败重置滑动认证器 并清除cookie的登录缓存 */
447
+
448
+ }, {
449
+ key: 'render',
450
+ value: function render() {
451
+ var _this4 = this;
452
+
453
+ var _props = this.props,
454
+ form = _props.form,
455
+ config = _props.config;
456
+ var getFieldDecorator = form.getFieldDecorator;
457
+ var _state = this.state,
458
+ background = _state.background,
459
+ browserList = _state.browserList,
460
+ copyright = _state.copyright,
461
+ sologanTitle = _state.sologanTitle,
462
+ sologan = _state.sologan,
463
+ userNameFromCookie = _state.userNameFromCookie,
464
+ passwordFromCookie = _state.passwordFromCookie,
465
+ smallScreen = _state.smallScreen,
466
+ rememberPW = _state.rememberPW;
467
+
468
+ var styleObj = smallScreen ? {} : { paddingLeft: '195px' };
469
+ return _react2.default.createElement(
470
+ 'div',
471
+ {
472
+ className: 'xgui-newLogin',
473
+ style: { backgroundImage: 'url(' + background + ')' }
474
+ },
475
+ _react2.default.createElement(
476
+ 'div',
477
+ { className: 'xgui-newlogin-content' },
478
+ _react2.default.createElement(
479
+ 'div',
480
+ { className: 'xgui-login-title', style: styleObj },
481
+ _react2.default.createElement('img', {
482
+ className: 'logo',
483
+ src: config.loginLogoUrl,
484
+ onError: function onError(e) {
485
+ e.target.value === defaultLogo;
486
+ }
487
+ }),
488
+ _react2.default.createElement('span', { className: 'split' }),
489
+ _react2.default.createElement(
490
+ 'span',
491
+ { className: 'titleContnet' },
492
+ '学生工作管理系统'
493
+ )
494
+ ),
495
+ _react2.default.createElement(
496
+ 'div',
497
+ { className: 'xgui-loginMain' },
498
+ !smallScreen && _react2.default.createElement(
499
+ 'div',
500
+ {
501
+ className: 'xgui-login-slogan',
502
+ style: { visibility: 'hidden' }
503
+ },
504
+ _react2.default.createElement(
505
+ 'div',
506
+ { className: 'sloganTitle' },
507
+ sologanTitle
508
+ ),
509
+ _react2.default.createElement(
447
510
  'div',
448
- { className: 'xgui-newLogin', style: { backgroundImage: 'url(' + background + ')' } },
511
+ { className: 'slogan' },
512
+ sologan
513
+ )
514
+ ),
515
+ _react2.default.createElement(
516
+ 'div',
517
+ { className: 'xgui-login-loginWarp' },
518
+ _react2.default.createElement(
519
+ 'p',
520
+ { className: 'welcomeMsg' },
521
+ '\u6B22\u8FCE\u4F7F\u7528'
522
+ ),
523
+ _react2.default.createElement(
524
+ _form2.default,
525
+ { onSubmit: this.handleAccountSubmit },
526
+ _react2.default.createElement(
527
+ FormItem,
528
+ null,
529
+ getFieldDecorator('username', {
530
+ initialValue: userNameFromCookie,
531
+ rules: [{ required: true, message: '请输入您的账号!' }]
532
+ })(_react2.default.createElement(_input2.default, {
533
+ size: 'large',
534
+ prefix: _react2.default.createElement(_icon2.default, {
535
+ type: 'user',
536
+ style: { color: 'rgba(0,0,0,.25)' }
537
+ }),
538
+ placeholder: '\u8BF7\u8F93\u5165\u7528\u6237\u540D'
539
+ }))
540
+ ),
449
541
  _react2.default.createElement(
542
+ FormItem,
543
+ null,
544
+ getFieldDecorator('password', {
545
+ initialValue: passwordFromCookie,
546
+ rules: [{ required: true, message: '请输入密码!' }]
547
+ })(_react2.default.createElement(_input2.default.Password, {
548
+ size: 'large',
549
+ prefix: _react2.default.createElement(_icon2.default, {
550
+ type: 'lock',
551
+ style: { color: 'rgba(0,0,0,.25)' }
552
+ }),
553
+ placeholder: '\u8BF7\u8F93\u5165\u5BC6\u7801'
554
+ })
555
+ // <LyPassword
556
+ // encryptMark='*'
557
+ // placeholder='请输入密码'
558
+ // onChange={password => {
559
+ // this.props.form.setFieldsValue({ password })
560
+ // }}
561
+ // />
562
+ )
563
+ ),
564
+ this.state.captchaVisible ? _react2.default.createElement(
565
+ FormItem,
566
+ null,
567
+ getFieldDecorator('captcha', {
568
+ rules: [{ required: true, message: '请输入验证码!' }]
569
+ })(_react2.default.createElement(
450
570
  'div',
451
- { className: 'xgui-newlogin-content' },
452
- _react2.default.createElement(
453
- 'div',
454
- { className: 'xgui-login-title', style: styleObj },
455
- _react2.default.createElement('img', { className: 'logo', src: config.loginLogoUrl, onError: function onError(e) {
456
- e.target.value === defaultLogo;
457
- } }),
458
- _react2.default.createElement('span', { className: 'split' }),
459
- _react2.default.createElement(
460
- 'span',
461
- { className: 'titleContnet' },
462
- '学生工作管理系统'
463
- )
464
- ),
571
+ { className: 'captchaItem' },
572
+ _react2.default.createElement(_input2.default, {
573
+ className: 'captcha_input',
574
+ size: 'large',
575
+ type: 'text',
576
+ placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801'
577
+ }),
465
578
  _react2.default.createElement(
466
- 'div',
467
- { className: 'xgui-loginMain' },
468
- !smallScreen && _react2.default.createElement(
469
- 'div',
470
- { className: 'xgui-login-slogan', style: { visibility: 'hidden' } },
471
- _react2.default.createElement(
472
- 'div',
473
- { className: 'sloganTitle' },
474
- sologanTitle
475
- ),
476
- _react2.default.createElement(
477
- 'div',
478
- { className: 'slogan' },
479
- sologan
480
- )
481
- ),
482
- _react2.default.createElement(
483
- 'div',
484
- { className: 'xgui-login-loginWarp' },
485
- _react2.default.createElement(
486
- 'p',
487
- { className: 'welcomeMsg' },
488
- '\u6B22\u8FCE\u4F7F\u7528'
489
- ),
490
- _react2.default.createElement(
491
- _form2.default,
492
- { onSubmit: this.handleAccountSubmit },
493
- _react2.default.createElement(
494
- FormItem,
495
- null,
496
- getFieldDecorator('username', {
497
- initialValue: userNameFromCookie,
498
- rules: [{ required: true, message: '请输入您的账号!' }]
499
- })(_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' }))
500
- ),
501
- _react2.default.createElement(
502
- FormItem,
503
- null,
504
- getFieldDecorator('password', {
505
- initialValue: passwordFromCookie,
506
- rules: [{ required: true, message: '请输入密码!' }]
507
- })(
508
- // <Input size="large" prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="请输入密码" />
509
- _react2.default.createElement(_lyPassword2.default, {
510
- encryptMark: '*',
511
- placeholder: '\u8BF7\u8F93\u5165\u5BC6\u7801',
512
- onChange: function onChange(password) {
513
- _this4.props.form.setFieldsValue({ password: password });
514
- }
515
- }))
516
- ),
517
- this.state.captchaVisible ? _react2.default.createElement(
518
- FormItem,
519
- null,
520
- getFieldDecorator('captcha', {
521
- rules: [{ required: true, message: '请输入验证码!' }]
522
- })(_react2.default.createElement(
523
- 'div',
524
- { className: 'captchaItem' },
525
- _react2.default.createElement(_input2.default, { className: 'captcha_input', size: 'large', type: 'text', placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801' }),
526
- _react2.default.createElement(
527
- 'div',
528
- null,
529
- _react2.default.createElement(
530
- 'span',
531
- { onClick: function onClick() {
532
- return _this4.changeCaptcha();
533
- } },
534
- _react2.default.createElement('img', { className: 'captcha_value', src: this.state.validateUrl })
535
- )
536
- )
537
- ))
538
- ) : null,
539
- _react2.default.createElement(
540
- FormItem,
541
- null,
542
- _react2.default.createElement(
543
- _button2.default,
544
- { className: 'xgui-nwelogin-submit', type: 'primary', size: 'large', htmlType: 'submit', loading: this.state.loading },
545
- '\u767B\u5F55'
546
- )
547
- ),
548
- _react2.default.createElement(
549
- FormItem,
550
- { style: { marginTop: '-20px' } },
551
- getFieldDecorator('remember', {
552
- valuePropName: 'checked',
553
- initialValue: false
554
- })(_react2.default.createElement(
555
- _checkbox2.default,
556
- { style: { float: 'left' }, onChange: function onChange(e) {
557
- return _this4.checkChange(e.target.checked);
558
- } },
559
- '\u8BB0\u4F4F\u767B\u5F55'
560
- ))
561
- ),
562
- _react2.default.createElement('div', null)
563
- ),
564
- _react2.default.createElement(
565
- 'div',
566
- { className: 'xgui-nwelogin-recomment' },
567
- _react2.default.createElement(
568
- 'span',
569
- null,
570
- '\u5EFA\u8BAE\u4F7F\u7528\u6D4F\u89C8\u5668\uFF1A'
571
- ),
572
- browserList.map(function (item) {
573
- return _react2.default.createElement(
574
- _tooltip2.default,
575
- { title: item.title },
576
- _react2.default.createElement('img', { src: item.imgSrc, width: 24 })
577
- );
578
- })
579
- )
580
- )
579
+ 'div',
580
+ null,
581
+ _react2.default.createElement(
582
+ 'span',
583
+ { onClick: function onClick() {
584
+ return _this4.changeCaptcha();
585
+ } },
586
+ _react2.default.createElement('img', {
587
+ className: 'captcha_value',
588
+ src: this.state.validateUrl
589
+ })
590
+ )
581
591
  )
592
+ ))
593
+ ) : null,
594
+ _react2.default.createElement(
595
+ FormItem,
596
+ null,
597
+ _react2.default.createElement(
598
+ _button2.default,
599
+ {
600
+ className: 'xgui-nwelogin-submit',
601
+ type: 'primary',
602
+ size: 'large',
603
+ htmlType: 'submit',
604
+ loading: this.state.loading
605
+ },
606
+ '\u767B\u5F55'
607
+ )
582
608
  ),
583
609
  _react2.default.createElement(
584
- 'div',
585
- { className: 'xgui-nwelogin-copyright' },
586
- copyright
587
- )
588
- );
589
- }
590
- }]);
591
- return LoginPage;
610
+ FormItem,
611
+ { style: { marginTop: '-20px' } },
612
+ getFieldDecorator('remember', {
613
+ valuePropName: 'checked',
614
+ initialValue: rememberPW
615
+ })(_react2.default.createElement(
616
+ _checkbox2.default,
617
+ {
618
+ style: { float: 'left' },
619
+ onChange: function onChange(e) {
620
+ return _this4.checkChange(e.target.checked);
621
+ }
622
+ },
623
+ '\u8BB0\u4F4F\u767B\u5F55'
624
+ ))
625
+ ),
626
+ _react2.default.createElement('div', null)
627
+ ),
628
+ _react2.default.createElement(
629
+ 'div',
630
+ { className: 'xgui-nwelogin-recomment' },
631
+ _react2.default.createElement(
632
+ 'span',
633
+ null,
634
+ '\u5EFA\u8BAE\u4F7F\u7528\u6D4F\u89C8\u5668\uFF1A'
635
+ ),
636
+ browserList.map(function (item) {
637
+ return _react2.default.createElement(
638
+ _tooltip2.default,
639
+ { title: item.title },
640
+ _react2.default.createElement('img', { src: item.imgSrc, width: 24 })
641
+ );
642
+ })
643
+ )
644
+ )
645
+ )
646
+ ),
647
+ _react2.default.createElement(
648
+ 'div',
649
+ { className: 'xgui-nwelogin-copyright' },
650
+ copyright
651
+ )
652
+ );
653
+ }
654
+ }]);
655
+ return LoginPage;
592
656
  }(_react2.default.Component);
593
657
 
594
658
  var Login = _form2.default.create()(LoginPage);