tplus-portaltouch 3.22.3 → 3.22.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.
@@ -1,825 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = undefined;
7
-
8
- var _regenerator = require('babel-runtime/regenerator');
9
-
10
- var _regenerator2 = _interopRequireDefault(_regenerator);
11
-
12
- var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
13
-
14
- var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
15
-
16
- var _promise = require('babel-runtime/core-js/promise');
17
-
18
- var _promise2 = _interopRequireDefault(_promise);
19
-
20
- var _stringify = require('babel-runtime/core-js/json/stringify');
21
-
22
- var _stringify2 = _interopRequireDefault(_stringify);
23
-
24
- var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
25
-
26
- var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
27
-
28
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
29
-
30
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
31
-
32
- var _createClass2 = require('babel-runtime/helpers/createClass');
33
-
34
- var _createClass3 = _interopRequireDefault(_createClass2);
35
-
36
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
37
-
38
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
39
-
40
- var _inherits2 = require('babel-runtime/helpers/inherits');
41
-
42
- var _inherits3 = _interopRequireDefault(_inherits2);
43
-
44
- var _class, _class2, _temp, _initialiseProps; /*
45
- * @Description:
46
- * @Date: 2019-08-13 08:42:18
47
- * @LastEditTime: 2021-03-18 11:02:04
48
- * @LastEditors: chenlongad
49
- * @modify:修改跳转到T+的查询方案方式
50
- */
51
-
52
-
53
- var _react = require('react');
54
-
55
- var _react2 = _interopRequireDefault(_react);
56
-
57
- var _mobxReact = require('mobx-react');
58
-
59
- var _antd = require('antd');
60
-
61
- var _mutantsMicrofx = require('mutants-microfx');
62
-
63
- var _tplusComponentsTouch = require('tplus-components-touch');
64
-
65
- var _tplusApi = require('tplus-api');
66
-
67
- var _tplusPoslogin = require('tplus-poslogin');
68
-
69
- var _mutantsUtil = require('mutants-util');
70
-
71
- var _propTypes = require('prop-types');
72
-
73
- var _propTypes2 = _interopRequireDefault(_propTypes);
74
-
75
- var _ModifyPassApi = require('../../api/ModifyPassApi');
76
-
77
- var _data = require('./data');
78
-
79
- var _data2 = _interopRequireDefault(_data);
80
-
81
- var _middleWare = require('../../middleWare');
82
-
83
- var _middleWare2 = _interopRequireDefault(_middleWare);
84
-
85
- var _verticalPortal = require('./verticalPortal');
86
-
87
- var _verticalPortal2 = _interopRequireDefault(_verticalPortal);
88
-
89
- var _horizontalPadPortal = require('./horizontalPadPortal');
90
-
91
- var _horizontalPadPortal2 = _interopRequireDefault(_horizontalPadPortal);
92
-
93
- require('./index.less');
94
-
95
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
96
-
97
- var hasElectron = _mutantsMicrofx.env.platform === _mutantsMicrofx.env.constant.platform.electron;
98
- var Content = _tplusComponentsTouch.Layout.Content,
99
- Footer = _tplusComponentsTouch.Layout.Footer;
100
-
101
- var tplusWindow = null;
102
-
103
- var _default = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_Component) {
104
- (0, _inherits3.default)(_default, _Component);
105
-
106
- function _default(props) {
107
- (0, _classCallCheck3.default)(this, _default);
108
-
109
- var _this = (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || (0, _getPrototypeOf2.default)(_default)).call(this, props));
110
-
111
- _initialiseProps.call(_this);
112
-
113
- _this.hasElectron = hasElectron;
114
- _this.state = {
115
- id: Date.now(),
116
- operations: [],
117
- showModal: false,
118
- frameUrl: ''
119
- };
120
-
121
- var _ref = _mutantsUtil.platform || {},
122
- isVerticalTouch = _ref.isVerticalTouch,
123
- isHorizontalPad = _ref.isHorizontalPad,
124
- isHorizontalSunMi = _ref.isHorizontalSunMi;
125
-
126
- _this.isVerticalTouch = !!isVerticalTouch;
127
- _this.isHorizontalPad = !!isHorizontalPad;
128
- _this.isHorizontalSunMi = !!isHorizontalSunMi;
129
- _this.isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
130
- _this.FuPingIsLoaded = false;
131
-
132
- //首页布局
133
- var leftMenu = _data2.default.leftMenu,
134
- centerLeftMenu = _data2.default.centerLeftMenu,
135
- centerRightMenu = _data2.default.centerRightMenu,
136
- rightMenu = _data2.default.rightMenu;
137
-
138
- _this.leftMenu = leftMenu;
139
- _this.centerLeftMenu = centerLeftMenu;
140
- _this.centerRightMenu = centerRightMenu;
141
- _this.rightMenu = rightMenu;
142
- return _this;
143
- }
144
-
145
- (0, _createClass3.default)(_default, [{
146
- key: 'componentWillMount',
147
- value: function componentWillMount() {
148
- var _this2 = this;
149
-
150
- var _context = this.context,
151
- _context$stores = _context.stores;
152
- _context$stores = _context$stores === undefined ? {} : _context$stores;
153
- var portalStore = _context$stores.portalStore,
154
- _context$headHook = _context.headHook;
155
- _context$headHook = _context$headHook === undefined ? {} : _context$headHook;
156
- var addClass = _context$headHook.addClass;
157
- var homeOperation = _ModifyPassApi.Request.homeOperation,
158
- functionData = _ModifyPassApi.Request.functionData;
159
-
160
- _tplusComponentsTouch.Loading.show({
161
- text: '首页权限加载中...',
162
- delay: 2500
163
- });
164
- homeOperation().then(function (operations) {
165
- _mutantsMicrofx.localStore.set('operationsAuth', (0, _stringify2.default)(operations));
166
- _this2.setState({ operations: operations });
167
- _tplusComponentsTouch.Loading.hide();
168
- }).catch(function (err) {
169
- console.log('homeOperation.error======', err);
170
- _tplusComponentsTouch.Loading.hide();
171
- });
172
- functionData().then(function (data) {
173
- // 加载权限数据 DR-29735 by majian
174
- (0, _tplusPoslogin.PosSetData)(data);
175
- });
176
- // portalStore && portalStore.getPortalMenu();
177
- addClass && addClass(this.state.id, 'portalHead');
178
- // 初始化参数设置。
179
- _mutantsMicrofx.stores.setStore.initSetParams().then(function (ret) {
180
- // 在客户端中,如果开启了副屏设置,尝试这打开副屏。
181
- if (_this2.getScreenType() === true) {
182
- if (_this2.isHorizontalSunMi) {
183
- _this2.sunMiPresentationInit(ret);
184
- return;
185
- }
186
- window.open('vicescreen?ts=' + new Date().getTime(), 'screen');
187
- }
188
- });
189
- }
190
- // 初始化商米副屏
191
-
192
- }, {
193
- key: 'componentWillUnmount',
194
- value: function componentWillUnmount() {
195
- var _context$headHook2 = this.context.headHook;
196
- _context$headHook2 = _context$headHook2 === undefined ? {} : _context$headHook2;
197
- var removeClass = _context$headHook2.removeClass;
198
-
199
- removeClass && removeClass(this.state.id, 'portalHead');
200
- }
201
- }, {
202
- key: 'componentWillReceiveProps',
203
- value: function componentWillReceiveProps() {
204
- if (this.getScreenType() === true) {
205
- //副屏幕交互。硬件改动20200428
206
- if (this.isHorizontalSunMi && this.FuPingIsLoaded) {
207
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 1 });
208
- } else {
209
- _mutantsMicrofx.nativeMs && _mutantsMicrofx.nativeMs.setIpcRendererMethod('ReplyScreen', { step: 1 });
210
- }
211
- }
212
- }
213
-
214
- // 获取副屏的状态
215
-
216
- }, {
217
- key: 'menuClick',
218
- value: function menuClick(item, e) {
219
- _mutantsMicrofx.history.push(item.path);
220
- }
221
- //跳转到T+
222
-
223
- }, {
224
- key: 'render',
225
- value: function render() {
226
- var _state = this.state,
227
- showModal = _state.showModal,
228
- frameUrl = _state.frameUrl;
229
-
230
- var screenHeight = window.screen.availHeight - 100;
231
- var htmlContent = null;
232
- if (this.isVerticalTouch) {
233
- htmlContent = _react2.default.createElement(_verticalPortal2.default, { handelClick: this.handelClick });
234
- } else if (this.isHorizontalPad) {
235
- htmlContent = _react2.default.createElement(_horizontalPadPortal2.default, { handelClick: this.handelClick });
236
- }
237
- // else if (this.isHorizontalSunMi) {
238
- // htmlContent = <HorizontalSunMiPortal handelClick={this.handelClick} />
239
- // }
240
- else {
241
- htmlContent = _react2.default.createElement(
242
- _tplusComponentsTouch.Layout,
243
- { style: { height: '100%' }, className: 'portal-content' },
244
- _react2.default.createElement(
245
- Content,
246
- { style: { paddingLeft: '50px', paddingRight: '50px' }, className: 'portal-container' },
247
- _react2.default.createElement(
248
- _antd.Row,
249
- null,
250
- _react2.default.createElement(
251
- _antd.Col,
252
- { xl: 7, md: 7, className: 'portal-left-col', key: 'left' },
253
- _react2.default.createElement(
254
- 'div',
255
- { className: 'portal-left-content' },
256
- this.createLeftNode()
257
- )
258
- ),
259
- _react2.default.createElement(
260
- _antd.Col,
261
- { xl: 10, md: 10, className: 'portal-center-col', key: 'center' },
262
- _react2.default.createElement(
263
- 'div',
264
- { className: 'portal-center-content' },
265
- this.createCenterNode()
266
- )
267
- ),
268
- _react2.default.createElement(
269
- _antd.Col,
270
- { xl: 7, md: 7, className: 'portal-right-col', key: 'right' },
271
- _react2.default.createElement(
272
- 'div',
273
- { className: 'portal-right-content' },
274
- this.createRightNode()
275
- )
276
- )
277
- )
278
- ),
279
- this.isMobileEnvironment && _react2.default.createElement(
280
- _antd.Modal,
281
- { visible: showModal,
282
- onCancel: this.closeFrameModal,
283
- width: '99%',
284
- height: '99%',
285
- footer: null
286
- },
287
- _react2.default.createElement('iframe', { src: frameUrl, width: '100%', height: screenHeight, frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true' })
288
- )
289
- );
290
- }
291
- return htmlContent;
292
- }
293
- }]);
294
- return _default;
295
- }(_react.Component), _class2.propTypes = {
296
- routes: _propTypes2.default.array
297
- }, _class2.contextTypes = {
298
- stores: _propTypes2.default.object,
299
- infoRender: _propTypes2.default.func,
300
- headHook: _propTypes2.default.object
301
- }, _initialiseProps = function _initialiseProps() {
302
- var _this3 = this;
303
-
304
- this.sunMiPresentationInit = function (result) {
305
- //SunMi初始化参数设置。
306
- //副屏幕交互。硬件改动20200428 需要在商米页面加载成功后才能发送 初始化命令
307
- // 进行主副屏数据交互 初始化
308
- var _ref2 = _mutantsMicrofx.localStore.get('user') || {},
309
- _ref2$store = _ref2.store;
310
-
311
- _ref2$store = _ref2$store === undefined ? {} : _ref2$store;
312
- var _ref2$store$storeName = _ref2$store.storeName,
313
- storeName = _ref2$store$storeName === undefined ? '' : _ref2$store$storeName;
314
-
315
- console.log(result);
316
- var filterResult = result && result.filter ? result.filter(function (settingItem) {
317
- return settingItem.ParamType.Id === "56181";
318
- }) : [];
319
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sharedPreferencesSet("setting_setData", filterResult).then(function () {
320
- console.log("缓存数据成功");
321
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 0, storeName: storeName });
322
- });
323
- };
324
-
325
- this.getScreenType = function () {
326
- var flag = false;
327
- if (_this3.hasElectron === true || _this3.isHorizontalSunMi) {
328
- var data = _mutantsMicrofx.localStore.get('setting_setData') || [];
329
- data = data.filter(function (item) {
330
- return item.Name === 'EnableDoubleScreen';
331
- });
332
- data = data && data.length > 0 ? data.shift() : null;
333
- if (data && data.Value === '1') {
334
- flag = true;
335
- }
336
- }
337
- return flag;
338
- };
339
-
340
- this.saveLog = function (name) {
341
- var saveLogo = _ModifyPassApi.Request.saveLogo;
342
-
343
- name = "进入模块:" + name;
344
- saveLogo('进入模块', undefined, name);
345
- };
346
-
347
- this.handelClick = function () {
348
- var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
349
- var type = values.key,
350
- isModal = values.isModal,
351
- title = values.title,
352
- Name = values.Name,
353
- search = values.search;
354
- var tmenuCode = values.tmenuCode;
355
- var operations = _this3.state.operations;
356
-
357
- var controllable = operations.find(function (vv) {
358
- return vv.Name === Name;
359
- });
360
-
361
- var _ref3 = controllable || {},
362
- Visibility = _ref3.Visibility,
363
- HoldFunctionAuth = _ref3.HoldFunctionAuth,
364
- Title = _ref3.Title,
365
- MenuCode = _ref3.MenuCode;
366
-
367
- var errorTip = void 0;
368
- if (!Title) {
369
- return _tplusComponentsTouch.ModalWraper.warning({
370
- title: '提示',
371
- content: '您的权限配置请求失败,请重新登录',
372
- onOk: function onOk() {
373
- _tplusApi.User.logout();
374
- },
375
-
376
- okType: 'primary'
377
- });
378
- }
379
- if (!Visibility) {
380
- errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
381
- } else if (!HoldFunctionAuth) {
382
- errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
383
- }
384
- var portalStore = _this3.context.stores.portalStore;
385
-
386
- if (errorTip) {
387
- return _tplusComponentsTouch.Message.warn(errorTip);
388
- }
389
- if (isModal) {
390
- return _mutantsMicrofx.stores.modalRouter.show({ url: '/' + type, width: 800, title: title });
391
- }
392
- switch (type) {
393
- case 'cashier':
394
- portalStore.checkDuty().then(function (onDutyMessage) {
395
- if (!!onDutyMessage) {
396
- var Code = onDutyMessage.Code,
397
- IdShiftVoucher = onDutyMessage.IdShiftVoucher,
398
- Shift = onDutyMessage.Shift,
399
- IdDailyVoucher = onDutyMessage.IdDailyVoucher,
400
- DailyCode = onDutyMessage.DailyCode;
401
-
402
- (0, _tplusPoslogin.PosSetData)({ ShiftCode: Code, IdShiftVoucher: IdShiftVoucher, Shift: Shift, IdDailyVoucher: IdDailyVoucher, DailyCode: DailyCode });
403
- console.log('onDutyMessage======', onDutyMessage);
404
- _this3.saveLog(title);
405
- _mutantsMicrofx.history.push('/RE/RE01');
406
- }
407
- }).catch(function (data) {
408
- console.log("进入前台收银检查是否当班返回错误");
409
- console.log(data);
410
- });
411
- break;
412
- case 'onDuty':
413
- portalStore.onDuty().then(function (onDutyMessage) {
414
- if (onDutyMessage && onDutyMessage.shift) {
415
- _middleWare2.default.execute('onDuty');
416
- }
417
- });
418
- break;
419
- case 'offDuty':
420
- _mutantsMicrofx.history.push('/offDuty?type=offDuty');
421
- break;
422
- case 'settleDialy':
423
- if (portalStore.bPosDaily()) {
424
- _mutantsMicrofx.history.push('/offDuty?type=settleDaily');
425
- } else {
426
- portalStore.onMakerDaily();
427
- }
428
- break;
429
- default:
430
- if (tmenuCode || MenuCode) {
431
- _this3.saveLog(title);
432
- if (MenuCode) {
433
- _this3.toTplusPage(type, MenuCode, search);
434
- } else {
435
- _this3.toTplusPage(type, tmenuCode, search);
436
- }
437
- } else {
438
- _mutantsMicrofx.history.push('/' + type);
439
- }
440
- break;
441
- }
442
- };
443
-
444
- this.getTplusUrlFromCloudServer = function () {
445
- //获取T+服务器配置地址。
446
- var userStore = _tplusApi.User.restore();
447
- var cloudUrl = 'http://tfproxy.chanjet.com/?url=';
448
- var data = 'accesstoken=' + ('' + userStore.accessToken) + '&cloudOrgId=' + ('' + userStore.orgId);
449
- var url = '' + cloudUrl + encodeURIComponent('http://mns.chanapp.chanjet.com/web/WebServer/get?' + ('' + data));
450
- console.log(url);
451
- var fetchHeader = {
452
- headers: {
453
- 'Content-Type': 'application/x-www-form-urlencoded'
454
- }
455
- };
456
- return new _promise2.default(function (resolve, reject) {
457
- fetch(url, fetchHeader).then(function (response) {
458
- return response.json();
459
- }).then(function (json) {
460
- console.log(json);
461
- resolve(json);
462
- }).catch(function (ex) {
463
- console.log(ex);
464
- reject(err);
465
- });
466
- });
467
- };
468
-
469
- this.toTplusPage = function () {
470
- var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(type, tmenuCode, search) {
471
- var userStore, sid, tplusUrl, tplusinnersite, msg, dsearchPlanID, portalStore, baseUrl, ossjumpUrl, user, loginInfo, pwd, userName, accNum, menu, posCode, storeID, fromUrl;
472
- return _regenerator2.default.wrap(function _callee$(_context2) {
473
- while (1) {
474
- switch (_context2.prev = _context2.next) {
475
- case 0:
476
- userStore = _tplusApi.User.restore();
477
- sid = userStore.sid;
478
- tplusUrl = (0, _tplusPoslogin.PosInitData)("TplusSite");
479
- tplusinnersite = (0, _tplusPoslogin.PosInitData)("tplusinnersite");
480
-
481
- tplusUrl = tplusUrl ? tplusUrl : tplusinnersite;
482
- if (!tplusUrl && !sid && _this3.hasElectron === true) {
483
- //软件包,并且electron读取electron配置的地址
484
- tplusUrl = location.origin + "/tplus";
485
- }
486
-
487
- if (tplusUrl) {
488
- _context2.next = 10;
489
- break;
490
- }
491
-
492
- msg = "请用admin登录,在服务器配置–地址配置处,设置“内部或外部网络访问T+服务器的地址”!";
493
-
494
- _tplusComponentsTouch.ModalWraper.warning({
495
- title: '温馨提示',
496
- content: msg,
497
- okText: '确定',
498
- okType: 'primary'
499
- });
500
- return _context2.abrupt('return');
501
-
502
- case 10:
503
- dsearchPlanID = void 0;
504
-
505
- if (!(search && search.id)) {
506
- _context2.next = 16;
507
- break;
508
- }
509
-
510
- portalStore = _this3.context.stores.portalStore;
511
- _context2.next = 15;
512
- return portalStore.getSearchPlanId(search);
513
-
514
- case 15:
515
- dsearchPlanID = _context2.sent;
516
-
517
- case 16:
518
- if (tplusUrl.substring(tplusUrl.length - 1) !== '/') tplusUrl += '/';
519
- baseUrl = tplusUrl;
520
- // if(!isProxy){
521
- // tplusUrl = targetUrl;
522
- // }
523
-
524
- ossjumpUrl = tplusUrl + 'view/portal/portal.html?t=' + new Date().getTime();
525
-
526
- if (sid) {
527
- ossjumpUrl = tplusUrl + 'view/ossjump.html?t=' + new Date().getTime() + '&sid=' + sid;
528
- }
529
- user = _this3.context.stores.user;
530
- loginInfo = user.options.get('loginInfo');
531
- pwd = user.options.get("password");
532
- userName = _this3.tplusEncode(loginInfo.UserCode);
533
- accNum = _this3.tplusEncode(loginInfo.AccountNum);
534
- menu = _this3.tplusEncode(tmenuCode);
535
- posCode = _this3.tplusEncode(loginInfo.posCode);
536
- storeID = _this3.tplusEncode(loginInfo.storeID + "");
537
-
538
- pwd = _this3.tplusEncode(pwd);
539
- fromUrl = _this3.tplusEncode(location.origin);
540
-
541
- ossjumpUrl += '&fromApp=nretail&user=' + userName + '&pwd=' + pwd + '&accNum=' + accNum + '&menu=' + menu + '&posCode=' + posCode + '&storeID=' + storeID + '&fromUrl=' + fromUrl;
542
- if (dsearchPlanID) {
543
- ossjumpUrl += '&searchPlanID=' + _this3.tplusEncode(dsearchPlanID);
544
- }
545
- if (_this3.isHorizontalSunMi) {
546
- window.android_CommonFun.openWebUrlByOutBrowser(ossjumpUrl);
547
- } else if (_this3.hasElectron === true) {
548
- _mutantsMicrofx.nativeMs.useDefaultBrowser(ossjumpUrl);
549
- } else if (_this3.isMobileEnvironment) {
550
- _this3.setState({ showModal: true, frameUrl: ossjumpUrl });
551
- } else {
552
- if (!tplusWindow || tplusWindow.closed) {
553
- tplusWindow = window.open(ossjumpUrl, "tplus", "location=no");
554
- } else {
555
- tplusWindow.postMessage({ tmenuCode: tmenuCode, searchPlanID: dsearchPlanID, ossjumpUrl: ossjumpUrl }, baseUrl);
556
- window.open("", "tplus", "location=no");
557
- }
558
- }
559
-
560
- case 33:
561
- case 'end':
562
- return _context2.stop();
563
- }
564
- }
565
- }, _callee, _this3);
566
- }));
567
-
568
- return function (_x2, _x3, _x4) {
569
- return _ref4.apply(this, arguments);
570
- };
571
- }();
572
-
573
- this.closeFrameModal = function () {
574
- _this3.setState({ showModal: false });
575
- };
576
-
577
- this.tplusEncode = function (code) {
578
- var c = String.fromCharCode(code.charCodeAt(0) + code.length);
579
- for (var i = 1; i < code.length; i++) {
580
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
581
- }
582
- var ret = _this3.TplusBase64Encode(c);
583
- return ret;
584
- };
585
-
586
- this.TplusBase64Encode = function (input) {
587
- var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
588
- var output = "";
589
- var chr1 = void 0,
590
- chr2 = void 0,
591
- chr3 = void 0,
592
- enc1 = void 0,
593
- enc2 = void 0,
594
- enc3 = void 0,
595
- enc4 = void 0;
596
- var i = 0;
597
- input = _this3._utf8_encode(input);
598
- while (i < input.length) {
599
- chr1 = input.charCodeAt(i++);
600
- chr2 = input.charCodeAt(i++);
601
- chr3 = input.charCodeAt(i++);
602
- enc1 = chr1 >> 2;
603
- enc2 = (chr1 & 3) << 4 | chr2 >> 4;
604
- enc3 = (chr2 & 15) << 2 | chr3 >> 6;
605
- enc4 = chr3 & 63;
606
- if (isNaN(chr2)) {
607
- enc3 = enc4 = 64;
608
- } else if (isNaN(chr3)) {
609
- enc4 = 64;
610
- }
611
- output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
612
- }
613
- return output;
614
- };
615
-
616
- this._utf8_encode = function (string) {
617
- string = string.replace(/\r\n/g, "\n");
618
- var utftext = "";
619
- for (var n = 0; n < string.length; n++) {
620
- var c = string.charCodeAt(n);
621
- if (c < 128) {
622
- utftext += String.fromCharCode(c);
623
- } else if (c > 127 && c < 2048) {
624
- utftext += String.fromCharCode(c >> 6 | 192);
625
- utftext += String.fromCharCode(c & 63 | 128);
626
- } else {
627
- utftext += String.fromCharCode(c >> 12 | 224);
628
- utftext += String.fromCharCode(c >> 6 & 63 | 128);
629
- utftext += String.fromCharCode(c & 63 | 128);
630
- }
631
- }
632
- return utftext;
633
- };
634
-
635
- this.operationControl = function () {
636
- var menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
637
- var operations = _this3.state.operations;
638
-
639
- console.log(operations, 11111);
640
- menu.forEach(function (v) {
641
- if (v.sub) {
642
- return _this3.operationControl(v.sub);
643
- }
644
- var controllable = operations.find(function (vv) {
645
- return vv.Name === v.Name;
646
- });
647
-
648
- var _ref5 = controllable || {},
649
- Visibility = _ref5.Visibility,
650
- HoldFunctionAuth = _ref5.HoldFunctionAuth,
651
- Title = _ref5.Title;
652
-
653
- var errorTip = void 0;
654
- if (!Visibility) {
655
- errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
656
- } else if (!HoldFunctionAuth) {
657
- errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
658
- }
659
- v.errorTip = errorTip;
660
- });
661
- return menu;
662
- };
663
-
664
- this.createLeftNode = function () {
665
- var menu = _this3.leftMenu;
666
- var menuNode = menu.map(function (v) {
667
- return v.container ? _react2.default.createElement(
668
- 'div',
669
- { style: v.container.style, className: v.container.className, key: v.container.className },
670
- v.sub.map(function (vv) {
671
- return _react2.default.createElement(
672
- 'div',
673
- {
674
- className: 'member-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
675
- key: vv.className,
676
- onClick: _this3.handelClick.bind(_this3, vv)
677
- },
678
- !!vv.title && _react2.default.createElement(
679
- 'h1',
680
- null,
681
- vv.title
682
- ),
683
- !!vv.label && _react2.default.createElement(
684
- 'p',
685
- null,
686
- vv.label
687
- ),
688
- !!vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
689
- );
690
- })
691
- ) : _react2.default.createElement(
692
- 'div',
693
- {
694
- className: 'member-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
695
- key: v.className,
696
- onClick: _this3.handelClick.bind(_this3, v)
697
- },
698
- v.title && _react2.default.createElement(
699
- 'h1',
700
- null,
701
- v.title
702
- ),
703
- v.label && _react2.default.createElement(
704
- 'p',
705
- null,
706
- v.label
707
- ),
708
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
709
- );
710
- });
711
- return menuNode;
712
- };
713
-
714
- this.createCenterNode = function () {
715
- var leftMenu = _this3.centerLeftMenu;
716
- var rightMenu = _this3.centerRightMenu;
717
- var menuLeftNode = leftMenu.map(function (v) {
718
- return _react2.default.createElement(
719
- 'div',
720
- {
721
- className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
722
- style: v.style,
723
- key: v.className,
724
- onClick: _this3.handelClick.bind(_this3, v)
725
- },
726
- v.title && _react2.default.createElement(
727
- 'h1',
728
- null,
729
- v.title
730
- ),
731
- v.label && _react2.default.createElement(
732
- 'p',
733
- null,
734
- v.label
735
- ),
736
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon }),
737
- v.disabled && _react2.default.createElement('div', { className: 'item-disabled-placeholder' })
738
- );
739
- });
740
- var menuRightNode = rightMenu.map(function (v) {
741
- return v.container ? _react2.default.createElement(
742
- 'div',
743
- { style: v.container.style, className: v.container.className, key: v.container.className },
744
- v.sub.map(function (vv) {
745
- return _react2.default.createElement(
746
- 'div',
747
- {
748
- className: 'worktop-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
749
- key: vv.className,
750
- onClick: _this3.handelClick.bind(_this3, vv)
751
- },
752
- vv.title && _react2.default.createElement(
753
- 'h1',
754
- null,
755
- vv.title
756
- ),
757
- vv.label && _react2.default.createElement(
758
- 'p',
759
- null,
760
- vv.label
761
- ),
762
- vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
763
- );
764
- })
765
- ) : _react2.default.createElement(
766
- 'div',
767
- {
768
- className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
769
- key: v.className,
770
- onClick: _this3.handelClick.bind(_this3, v)
771
- },
772
- v.title && _react2.default.createElement(
773
- 'h1',
774
- null,
775
- v.title
776
- ),
777
- v.label && _react2.default.createElement(
778
- 'p',
779
- null,
780
- v.label
781
- ),
782
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
783
- );
784
- });
785
- return _react2.default.createElement(
786
- 'div',
787
- null,
788
- _react2.default.createElement(
789
- 'div',
790
- { className: 'worktop-container-left' },
791
- menuLeftNode
792
- ),
793
- _react2.default.createElement(
794
- 'div',
795
- { className: 'worktop-container-right' },
796
- menuRightNode
797
- )
798
- );
799
- };
800
-
801
- this.createRightNode = function () {
802
- var menu = _this3.rightMenu;
803
- var node = menu.map(function (v, i) {
804
- return _react2.default.createElement(
805
- 'div',
806
- {
807
- className: 'stock-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
808
- style: v.style,
809
- key: v.className,
810
- onClick: _this3.handelClick.bind(_this3, v)
811
- },
812
- !!v.title && _react2.default.createElement(
813
- 'h1',
814
- null,
815
- v.title
816
- ),
817
- !!v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
818
- );
819
- });
820
- return node;
821
- };
822
- }, _temp)) || _class;
823
-
824
- exports.default = _default;
825
- //# sourceMappingURL=index.js.map