tplus-portaltouch 3.22.7 → 3.22.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,926 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = undefined;
7
-
8
- var _stringify = require('babel-runtime/core-js/json/stringify');
9
-
10
- var _stringify2 = _interopRequireDefault(_stringify);
11
-
12
- var _promise = require('babel-runtime/core-js/promise');
13
-
14
- var _promise2 = _interopRequireDefault(_promise);
15
-
16
- var _regenerator = require('babel-runtime/regenerator');
17
-
18
- var _regenerator2 = _interopRequireDefault(_regenerator);
19
-
20
- var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
21
-
22
- var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
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-09-02 14:35:59
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 () {
148
- var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
149
- return _regenerator2.default.wrap(function _callee$(_context) {
150
- while (1) {
151
- switch (_context.prev = _context.next) {
152
- case 0:
153
- _context.next = 2;
154
- return this.catchOfflineData();
155
-
156
- case 2:
157
- _context.next = 4;
158
- return this.getOperation();
159
-
160
- case 4:
161
- case 'end':
162
- return _context.stop();
163
- }
164
- }
165
- }, _callee, this);
166
- }));
167
-
168
- function componentWillMount() {
169
- return _ref2.apply(this, arguments);
170
- }
171
-
172
- return componentWillMount;
173
- }()
174
-
175
- // 初始化商米副屏
176
-
177
- }, {
178
- key: 'componentWillUnmount',
179
- value: function componentWillUnmount() {
180
- var _context$headHook = this.context.headHook;
181
- _context$headHook = _context$headHook === undefined ? {} : _context$headHook;
182
- var removeClass = _context$headHook.removeClass;
183
-
184
- removeClass && removeClass(this.state.id, 'portalHead');
185
- }
186
- }, {
187
- key: 'componentWillReceiveProps',
188
- value: function componentWillReceiveProps() {
189
- if (this.getScreenType() === true) {
190
- //副屏幕交互。硬件改动20200428
191
- if (this.isHorizontalSunMi && this.FuPingIsLoaded) {
192
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 1 });
193
- } else {
194
- _mutantsMicrofx.nativeMs && _mutantsMicrofx.nativeMs.setIpcRendererMethod('ReplyScreen', { step: 1 });
195
- }
196
- }
197
- }
198
-
199
- // 获取副屏的状态
200
-
201
- }, {
202
- key: 'menuClick',
203
- value: function menuClick(item, e) {
204
- _mutantsMicrofx.history.push(item.path);
205
- }
206
- //跳转到T+
207
-
208
- }, {
209
- key: 'render',
210
- value: function render() {
211
- var _state = this.state,
212
- showModal = _state.showModal,
213
- frameUrl = _state.frameUrl;
214
-
215
- var screenHeight = window.screen.availHeight - 100;
216
- var htmlContent = null;
217
- if (this.isVerticalTouch) {
218
- htmlContent = _react2.default.createElement(_verticalPortal2.default, { handelClick: this.handelClick });
219
- } else if (this.isHorizontalPad) {
220
- htmlContent = _react2.default.createElement(_horizontalPadPortal2.default, { handelClick: this.handelClick });
221
- }
222
- // else if (this.isHorizontalSunMi) {
223
- // htmlContent = <HorizontalSunMiPortal handelClick={this.handelClick} />
224
- // }
225
- else {
226
- htmlContent = _react2.default.createElement(
227
- _tplusComponentsTouch.Layout,
228
- { style: { height: '100%' }, className: 'portal-content' },
229
- _react2.default.createElement(
230
- Content,
231
- { style: { paddingLeft: '50px', paddingRight: '50px' }, className: 'portal-container' },
232
- _react2.default.createElement(
233
- _antd.Row,
234
- null,
235
- _react2.default.createElement(
236
- _antd.Col,
237
- { xl: 7, md: 7, className: 'portal-left-col', key: 'left' },
238
- _react2.default.createElement(
239
- 'div',
240
- { className: 'portal-left-content' },
241
- this.createLeftNode()
242
- )
243
- ),
244
- _react2.default.createElement(
245
- _antd.Col,
246
- { xl: 10, md: 10, className: 'portal-center-col', key: 'center' },
247
- _react2.default.createElement(
248
- 'div',
249
- { className: 'portal-center-content' },
250
- this.createCenterNode()
251
- )
252
- ),
253
- _react2.default.createElement(
254
- _antd.Col,
255
- { xl: 7, md: 7, className: 'portal-right-col', key: 'right' },
256
- _react2.default.createElement(
257
- 'div',
258
- { className: 'portal-right-content' },
259
- this.createRightNode()
260
- )
261
- )
262
- )
263
- ),
264
- this.isMobileEnvironment && _react2.default.createElement(
265
- _antd.Modal,
266
- { visible: showModal,
267
- onCancel: this.closeFrameModal,
268
- width: '99%',
269
- height: '99%',
270
- footer: null
271
- },
272
- _react2.default.createElement('iframe', { src: frameUrl, width: '100%', height: screenHeight, frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true' })
273
- )
274
- );
275
- }
276
- return htmlContent;
277
- }
278
- }]);
279
- return _default;
280
- }(_react.Component), _class2.propTypes = {
281
- routes: _propTypes2.default.array
282
- }, _class2.contextTypes = {
283
- stores: _propTypes2.default.object,
284
- infoRender: _propTypes2.default.func,
285
- headHook: _propTypes2.default.object
286
- }, _initialiseProps = function _initialiseProps() {
287
- var _this2 = this;
288
-
289
- this.getOperation = function () {
290
- return new _promise2.default(function (resolve, reject) {
291
- var _context2 = _this2.context,
292
- _context2$stores = _context2.stores;
293
- _context2$stores = _context2$stores === undefined ? {} : _context2$stores;
294
- var portalStore = _context2$stores.portalStore,
295
- _context2$headHook = _context2.headHook;
296
- _context2$headHook = _context2$headHook === undefined ? {} : _context2$headHook;
297
- var addClass = _context2$headHook.addClass;
298
- var homeOperation = _ModifyPassApi.Request.homeOperation,
299
- functionData = _ModifyPassApi.Request.functionData;
300
-
301
- _tplusComponentsTouch.Loading.show({
302
- text: '首页权限加载中',
303
- delay: 2500
304
- });
305
- homeOperation().then(function (operations) {
306
- _mutantsMicrofx.localStore.set('operationsAuth', (0, _stringify2.default)(operations));
307
- _this2.setState({ operations: operations });
308
- _tplusComponentsTouch.Loading.hide();
309
- resolve();
310
- }).catch(function (err) {
311
- console.log('homeOperation.error======', err);
312
- _tplusComponentsTouch.Loading.hide();
313
- resolve();
314
- });
315
- functionData().then(function (data) {
316
- // 加载权限数据 DR-29735 by majian
317
- (0, _tplusPoslogin.PosSetData)(data);
318
- });
319
- // portalStore && portalStore.getPortalMenu();
320
- addClass && addClass(_this2.state.id, 'portalHead');
321
- // 初始化参数设置。
322
- _mutantsMicrofx.stores.setStore.initSetParams().then(function (ret) {
323
- // 在客户端中,如果开启了副屏设置,尝试这打开副屏。
324
- if (_this2.getScreenType() === true) {
325
- if (_this2.isHorizontalSunMi) {
326
- _this2.sunMiPresentationInit(ret);
327
- return;
328
- }
329
- window.open('vicescreen?ts=' + new Date().getTime(), 'screen');
330
- }
331
- });
332
- });
333
- };
334
-
335
- this.catchOfflineData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
336
- var offlineSys, isLoginAfter;
337
- return _regenerator2.default.wrap(function _callee2$(_context3) {
338
- while (1) {
339
- switch (_context3.prev = _context3.next) {
340
- case 0:
341
- offlineSys = _this2.context.stores.offlineSys;
342
- isLoginAfter = _mutantsMicrofx.localStore.get("isLoginAfter");
343
-
344
- if (!(isLoginAfter == 1)) {
345
- _context3.next = 8;
346
- break;
347
- }
348
-
349
- _tplusComponentsTouch.Loading.show({
350
- text: '离线数据下载中',
351
- delay: 2500
352
- });
353
- _context3.next = 6;
354
- return offlineSys.downloadCatcherData();
355
-
356
- case 6:
357
- _tplusComponentsTouch.Loading.hide();
358
- _mutantsMicrofx.localStore.set("isLoginAfter", 0);
359
-
360
- case 8:
361
- case 'end':
362
- return _context3.stop();
363
- }
364
- }
365
- }, _callee2, _this2);
366
- }));
367
-
368
- this.sunMiPresentationInit = function (result) {
369
- //SunMi初始化参数设置。
370
- //副屏幕交互。硬件改动20200428 需要在商米页面加载成功后才能发送 初始化命令
371
- // 获取是否缓存副屏地址 只在app打开的生命周期缓存 读取 关闭重新缓存
372
-
373
-
374
- var SunMi_fuping_url = sessionStorage.getItem("SunMi_fuping_url");
375
- // 如果存在缓存地址 使用缓存地址 否则使用新hash地址
376
- if (!SunMi_fuping_url) {
377
- var url = location.origin + location.pathname + '?ts=' + new Date().getTime() + '&vt=3&fuping=3';
378
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.secondScreenLoadUrl(url).then(function () {
379
- _this2.FuPingIsLoaded = true;
380
- // 加载副屏页面成功 缓存地址
381
- sessionStorage.setItem("SunMi_fuping_url", url);
382
- setTimeout(function () {
383
- // 进行主副屏数据交互 初始化
384
- var _ref4 = _mutantsMicrofx.localStore.get('user') || {},
385
- _ref4$store = _ref4.store;
386
-
387
- _ref4$store = _ref4$store === undefined ? {} : _ref4$store;
388
- var _ref4$store$storeName = _ref4$store.storeName,
389
- storeName = _ref4$store$storeName === undefined ? '' : _ref4$store$storeName;
390
-
391
- console.log(result);
392
-
393
- var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
394
- RE_POSParamType = _enumController$getEn.RE_POSParamType;
395
-
396
- var DUAL_SCREEN_SETTING = RE_POSParamType.DUAL_SCREEN_SETTING;
397
-
398
- var filterResult = result && result.filter ? result.filter(function (settingItem) {
399
- return settingItem.ParamType && (settingItem.ParamType.Id === DUAL_SCREEN_SETTING || settingItem.ParamType === DUAL_SCREEN_SETTING);
400
- }) : [];
401
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sharedPreferencesSet("setting_setData", filterResult).then(function () {
402
- console.log("缓存数据成功");
403
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 0, storeName: storeName });
404
- });
405
- }, 2000);
406
- });
407
- } else {
408
- // 表示已经加载过页面只需要重置状态即可
409
- var _ref5 = _mutantsMicrofx.localStore.get('user') || {},
410
- _ref5$store = _ref5.store;
411
-
412
- _ref5$store = _ref5$store === undefined ? {} : _ref5$store;
413
- var _ref5$store$storeName = _ref5$store.storeName,
414
- storeName = _ref5$store$storeName === undefined ? '' : _ref5$store$storeName;
415
-
416
- window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 0, storeName: storeName });
417
- }
418
- };
419
-
420
- this.getScreenType = function () {
421
- var flag = false;
422
- if (_this2.hasElectron === true || _this2.isHorizontalSunMi) {
423
- var data = _mutantsMicrofx.localStore.get('setting_setData') || [];
424
- data = data.filter(function (item) {
425
- return item.Name === 'EnableDoubleScreen';
426
- });
427
- data = data && data.length > 0 ? data.shift() : null;
428
- if (data && data.Value === '1') {
429
- flag = true;
430
- }
431
- }
432
- return flag;
433
- };
434
-
435
- this.saveLog = function (name) {
436
- var saveLogo = _ModifyPassApi.Request.saveLogo;
437
-
438
- name = "进入模块:" + name;
439
- saveLogo('进入模块', undefined, name);
440
- };
441
-
442
- this.handelClick = function () {
443
- var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
444
- var type = values.key,
445
- isModal = values.isModal,
446
- title = values.title,
447
- Name = values.Name,
448
- search = values.search;
449
- var tmenuCode = values.tmenuCode;
450
- var operations = _this2.state.operations;
451
-
452
- var controllable = operations.find(function (vv) {
453
- return vv.Name === Name;
454
- });
455
-
456
- var _ref6 = controllable || {},
457
- Visibility = _ref6.Visibility,
458
- HoldFunctionAuth = _ref6.HoldFunctionAuth,
459
- Title = _ref6.Title,
460
- MenuCode = _ref6.MenuCode;
461
-
462
- var errorTip = void 0;
463
- if (!Title) {
464
- return _tplusComponentsTouch.ModalWraper.warning({
465
- title: '提示',
466
- content: '您的权限配置请求失败,请重新登录',
467
- onOk: function onOk() {
468
- _tplusApi.User.logout();
469
- },
470
-
471
- okType: 'primary'
472
- });
473
- }
474
-
475
- if (_mutantsMicrofx.stores.offlineSys.shouldOpenHomeOperation(Name)) {
476
- _tplusComponentsTouch.Message.warn("离线模式下此操作不可用");
477
- return;
478
- }
479
-
480
- if (!Visibility) {
481
- errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
482
- } else if (!HoldFunctionAuth) {
483
- errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
484
- }
485
- var portalStore = _this2.context.stores.portalStore;
486
-
487
- if (errorTip) {
488
- return _tplusComponentsTouch.Message.warn(errorTip);
489
- }
490
- if (isModal) {
491
- return _mutantsMicrofx.stores.modalRouter.show({ url: '/' + type, width: 800, title: title });
492
- }
493
- switch (type) {
494
- case 'cashier':
495
- portalStore.checkDuty().then(function (onDutyMessage) {
496
- if (!!onDutyMessage) {
497
- var Code = onDutyMessage.Code,
498
- IdShiftVoucher = onDutyMessage.IdShiftVoucher,
499
- Shift = onDutyMessage.Shift,
500
- IdDailyVoucher = onDutyMessage.IdDailyVoucher,
501
- DailyCode = onDutyMessage.DailyCode;
502
-
503
- (0, _tplusPoslogin.PosSetData)({ ShiftCode: Code, IdShiftVoucher: IdShiftVoucher, Shift: Shift, IdDailyVoucher: IdDailyVoucher, DailyCode: DailyCode });
504
- console.log('onDutyMessage======', onDutyMessage);
505
- _this2.saveLog(title);
506
- _mutantsMicrofx.history.push('/RE/RE01');
507
- }
508
- }).catch(function (data) {
509
- console.log("进入前台收银检查是否当班返回错误");
510
- console.log(data);
511
- });
512
- break;
513
- case 'onDuty':
514
- portalStore.onDuty().then(function (onDutyMessage) {
515
- if (onDutyMessage && onDutyMessage.shift) {
516
- _middleWare2.default.execute('onDuty');
517
- }
518
- });
519
- break;
520
- case 'offDuty':
521
- _mutantsMicrofx.history.push('/offDuty?type=offDuty');
522
- break;
523
- case 'settleDialy':
524
- if (portalStore.bPosDaily()) {
525
- _mutantsMicrofx.history.push('/offDuty?type=settleDaily');
526
- } else {
527
- portalStore.onMakerDaily();
528
- }
529
- break;
530
- default:
531
- if (tmenuCode || MenuCode) {
532
- _this2.saveLog(title);
533
- if (MenuCode) {
534
- _this2.toTplusPage(type, MenuCode, search);
535
- } else {
536
- _this2.toTplusPage(type, tmenuCode, search);
537
- }
538
- } else {
539
- _mutantsMicrofx.history.push('/' + type);
540
- }
541
- break;
542
- }
543
- };
544
-
545
- this.getTplusUrlFromCloudServer = function () {
546
- //获取T+服务器配置地址。
547
- var userStore = _tplusApi.User.restore();
548
- var cloudUrl = 'http://tfproxy.chanjet.com/?url=';
549
- var data = 'accesstoken=' + ('' + userStore.accessToken) + '&cloudOrgId=' + ('' + userStore.orgId);
550
- var url = '' + cloudUrl + encodeURIComponent('http://mns.chanapp.chanjet.com/web/WebServer/get?' + ('' + data));
551
- console.log(url);
552
- var fetchHeader = {
553
- headers: {
554
- 'Content-Type': 'application/x-www-form-urlencoded'
555
- }
556
- };
557
- return new _promise2.default(function (resolve, reject) {
558
- fetch(url, fetchHeader).then(function (response) {
559
- return response.json();
560
- }).then(function (json) {
561
- console.log(json);
562
- resolve(json);
563
- }).catch(function (ex) {
564
- console.log(ex);
565
- reject(err);
566
- });
567
- });
568
- };
569
-
570
- this.toTplusPage = function () {
571
- var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(type, tmenuCode, search) {
572
- var userStore, sid, tplusUrl, tplusinnersite, msg, dsearchPlanID, portalStore, baseUrl, ossjumpUrl, user, loginInfo, pwd, userName, accNum, menu, posCode, storeID, fromUrl;
573
- return _regenerator2.default.wrap(function _callee3$(_context4) {
574
- while (1) {
575
- switch (_context4.prev = _context4.next) {
576
- case 0:
577
- userStore = _tplusApi.User.restore();
578
- sid = userStore.sid;
579
- tplusUrl = (0, _tplusPoslogin.PosInitData)("TplusSite");
580
- tplusinnersite = (0, _tplusPoslogin.PosInitData)("tplusinnersite");
581
-
582
- tplusUrl = tplusUrl ? tplusUrl : tplusinnersite;
583
- if (!tplusUrl && !sid && _this2.hasElectron === true) {
584
- //软件包,并且electron读取electron配置的地址
585
- tplusUrl = location.origin + "/tplus";
586
- }
587
-
588
- if (tplusUrl) {
589
- _context4.next = 10;
590
- break;
591
- }
592
-
593
- msg = "请用admin登录,在服务器配置–地址配置处,设置“内部或外部网络访问T+服务器的地址”!";
594
-
595
- _tplusComponentsTouch.ModalWraper.warning({
596
- title: '温馨提示',
597
- content: msg,
598
- okText: '确定',
599
- okType: 'primary'
600
- });
601
- return _context4.abrupt('return');
602
-
603
- case 10:
604
- dsearchPlanID = void 0;
605
-
606
- if (!(search && search.id)) {
607
- _context4.next = 16;
608
- break;
609
- }
610
-
611
- portalStore = _this2.context.stores.portalStore;
612
- _context4.next = 15;
613
- return portalStore.getSearchPlanId(search);
614
-
615
- case 15:
616
- dsearchPlanID = _context4.sent;
617
-
618
- case 16:
619
- if (tplusUrl.substring(tplusUrl.length - 1) !== '/') tplusUrl += '/';
620
- baseUrl = tplusUrl;
621
- // if(!isProxy){
622
- // tplusUrl = targetUrl;
623
- // }
624
-
625
- ossjumpUrl = tplusUrl + 'view/portal/portal.html?t=' + new Date().getTime();
626
-
627
- if (sid) {
628
- ossjumpUrl = tplusUrl + 'view/ossjump.html?t=' + new Date().getTime() + '&sid=' + sid;
629
- }
630
- user = _this2.context.stores.user;
631
- loginInfo = user.options.get('loginInfo');
632
- pwd = user.options.get("password");
633
- userName = _this2.tplusEncode(loginInfo.UserCode);
634
- accNum = _this2.tplusEncode(loginInfo.AccountNum);
635
- menu = _this2.tplusEncode(tmenuCode);
636
- posCode = _this2.tplusEncode(loginInfo.posCode);
637
- storeID = _this2.tplusEncode(loginInfo.storeID + "");
638
-
639
- pwd = _this2.tplusEncode(pwd);
640
- fromUrl = _this2.tplusEncode(location.origin);
641
-
642
- ossjumpUrl += '&fromApp=nretail&user=' + userName + '&pwd=' + pwd + '&accNum=' + accNum + '&menu=' + menu + '&posCode=' + posCode + '&storeID=' + storeID + '&fromUrl=' + fromUrl;
643
- if (dsearchPlanID) {
644
- ossjumpUrl += '&searchPlanID=' + _this2.tplusEncode(dsearchPlanID);
645
- }
646
- if (_this2.isHorizontalSunMi) {
647
- window.android_CommonFun.openWebUrlByOutBrowser(ossjumpUrl);
648
- } else if (_this2.hasElectron === true) {
649
- _mutantsMicrofx.nativeMs.useDefaultBrowser(ossjumpUrl);
650
- } else if (_this2.isMobileEnvironment) {
651
- _this2.setState({ showModal: true, frameUrl: ossjumpUrl });
652
- } else {
653
- if (!tplusWindow || tplusWindow.closed) {
654
- tplusWindow = window.open(ossjumpUrl, "tplus", "location=no");
655
- } else {
656
- tplusWindow.postMessage({ tmenuCode: tmenuCode, searchPlanID: dsearchPlanID, ossjumpUrl: ossjumpUrl }, baseUrl);
657
- window.open("", "tplus", "location=no");
658
- }
659
- }
660
-
661
- case 33:
662
- case 'end':
663
- return _context4.stop();
664
- }
665
- }
666
- }, _callee3, _this2);
667
- }));
668
-
669
- return function (_x2, _x3, _x4) {
670
- return _ref7.apply(this, arguments);
671
- };
672
- }();
673
-
674
- this.closeFrameModal = function () {
675
- _this2.setState({ showModal: false });
676
- };
677
-
678
- this.tplusEncode = function (code) {
679
- var c = String.fromCharCode(code.charCodeAt(0) + code.length);
680
- for (var i = 1; i < code.length; i++) {
681
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
682
- }
683
- var ret = _this2.TplusBase64Encode(c);
684
- return ret;
685
- };
686
-
687
- this.TplusBase64Encode = function (input) {
688
- var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
689
- var output = "";
690
- var chr1 = void 0,
691
- chr2 = void 0,
692
- chr3 = void 0,
693
- enc1 = void 0,
694
- enc2 = void 0,
695
- enc3 = void 0,
696
- enc4 = void 0;
697
- var i = 0;
698
- input = _this2._utf8_encode(input);
699
- while (i < input.length) {
700
- chr1 = input.charCodeAt(i++);
701
- chr2 = input.charCodeAt(i++);
702
- chr3 = input.charCodeAt(i++);
703
- enc1 = chr1 >> 2;
704
- enc2 = (chr1 & 3) << 4 | chr2 >> 4;
705
- enc3 = (chr2 & 15) << 2 | chr3 >> 6;
706
- enc4 = chr3 & 63;
707
- if (isNaN(chr2)) {
708
- enc3 = enc4 = 64;
709
- } else if (isNaN(chr3)) {
710
- enc4 = 64;
711
- }
712
- output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
713
- }
714
- return output;
715
- };
716
-
717
- this._utf8_encode = function (string) {
718
- string = string.replace(/\r\n/g, "\n");
719
- var utftext = "";
720
- for (var n = 0; n < string.length; n++) {
721
- var c = string.charCodeAt(n);
722
- if (c < 128) {
723
- utftext += String.fromCharCode(c);
724
- } else if (c > 127 && c < 2048) {
725
- utftext += String.fromCharCode(c >> 6 | 192);
726
- utftext += String.fromCharCode(c & 63 | 128);
727
- } else {
728
- utftext += String.fromCharCode(c >> 12 | 224);
729
- utftext += String.fromCharCode(c >> 6 & 63 | 128);
730
- utftext += String.fromCharCode(c & 63 | 128);
731
- }
732
- }
733
- return utftext;
734
- };
735
-
736
- this.operationControl = function () {
737
- var menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
738
- var operations = _this2.state.operations;
739
-
740
- console.log(operations, 11111);
741
- menu.forEach(function (v) {
742
- if (v.sub) {
743
- return _this2.operationControl(v.sub);
744
- }
745
- var controllable = operations.find(function (vv) {
746
- return vv.Name === v.Name;
747
- });
748
-
749
- var _ref8 = controllable || {},
750
- Visibility = _ref8.Visibility,
751
- HoldFunctionAuth = _ref8.HoldFunctionAuth,
752
- Title = _ref8.Title;
753
-
754
- var errorTip = void 0;
755
- if (!Visibility) {
756
- errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
757
- } else if (!HoldFunctionAuth) {
758
- errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
759
- }
760
- v.errorTip = errorTip;
761
- });
762
- return menu;
763
- };
764
-
765
- this.createLeftNode = function () {
766
- var menu = _this2.leftMenu;
767
- var menuNode = menu.map(function (v) {
768
- return v.container ? _react2.default.createElement(
769
- 'div',
770
- { style: v.container.style, className: v.container.className, key: v.container.className },
771
- v.sub.map(function (vv) {
772
- return _react2.default.createElement(
773
- 'div',
774
- {
775
- className: 'member-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
776
- key: vv.className,
777
- onClick: _this2.handelClick.bind(_this2, vv)
778
- },
779
- !!vv.title && _react2.default.createElement(
780
- 'h1',
781
- null,
782
- vv.title
783
- ),
784
- !!vv.label && _react2.default.createElement(
785
- 'p',
786
- null,
787
- vv.label
788
- ),
789
- !!vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
790
- );
791
- })
792
- ) : _react2.default.createElement(
793
- 'div',
794
- {
795
- className: 'member-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
796
- key: v.className,
797
- onClick: _this2.handelClick.bind(_this2, v)
798
- },
799
- v.title && _react2.default.createElement(
800
- 'h1',
801
- null,
802
- v.title
803
- ),
804
- v.label && _react2.default.createElement(
805
- 'p',
806
- null,
807
- v.label
808
- ),
809
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
810
- );
811
- });
812
- return menuNode;
813
- };
814
-
815
- this.createCenterNode = function () {
816
- var leftMenu = _this2.centerLeftMenu;
817
- var rightMenu = _this2.centerRightMenu;
818
- var menuLeftNode = leftMenu.map(function (v) {
819
- return _react2.default.createElement(
820
- 'div',
821
- {
822
- className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
823
- style: v.style,
824
- key: v.className,
825
- onClick: _this2.handelClick.bind(_this2, v)
826
- },
827
- v.title && _react2.default.createElement(
828
- 'h1',
829
- null,
830
- v.title
831
- ),
832
- v.label && _react2.default.createElement(
833
- 'p',
834
- null,
835
- v.label
836
- ),
837
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon }),
838
- v.disabled && _react2.default.createElement('div', { className: 'item-disabled-placeholder' })
839
- );
840
- });
841
- var menuRightNode = rightMenu.map(function (v) {
842
- return v.container ? _react2.default.createElement(
843
- 'div',
844
- { style: v.container.style, className: v.container.className, key: v.container.className },
845
- v.sub.map(function (vv) {
846
- return _react2.default.createElement(
847
- 'div',
848
- {
849
- className: 'worktop-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
850
- key: vv.className,
851
- onClick: _this2.handelClick.bind(_this2, vv)
852
- },
853
- vv.title && _react2.default.createElement(
854
- 'h1',
855
- null,
856
- vv.title
857
- ),
858
- vv.label && _react2.default.createElement(
859
- 'p',
860
- null,
861
- vv.label
862
- ),
863
- vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
864
- );
865
- })
866
- ) : _react2.default.createElement(
867
- 'div',
868
- {
869
- className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
870
- key: v.className,
871
- onClick: _this2.handelClick.bind(_this2, v)
872
- },
873
- v.title && _react2.default.createElement(
874
- 'h1',
875
- null,
876
- v.title
877
- ),
878
- v.label && _react2.default.createElement(
879
- 'p',
880
- null,
881
- v.label
882
- ),
883
- v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
884
- );
885
- });
886
- return _react2.default.createElement(
887
- 'div',
888
- null,
889
- _react2.default.createElement(
890
- 'div',
891
- { className: 'worktop-container-left' },
892
- menuLeftNode
893
- ),
894
- _react2.default.createElement(
895
- 'div',
896
- { className: 'worktop-container-right' },
897
- menuRightNode
898
- )
899
- );
900
- };
901
-
902
- this.createRightNode = function () {
903
- var menu = _this2.rightMenu;
904
- var node = menu.map(function (v, i) {
905
- return _react2.default.createElement(
906
- 'div',
907
- {
908
- className: 'stock-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
909
- style: v.style,
910
- key: v.className,
911
- onClick: _this2.handelClick.bind(_this2, v)
912
- },
913
- !!v.title && _react2.default.createElement(
914
- 'h1',
915
- null,
916
- v.title
917
- ),
918
- !!v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
919
- );
920
- });
921
- return node;
922
- };
923
- }, _temp)) || _class;
924
-
925
- exports.default = _default;
926
- //# sourceMappingURL=index.js.map