tplus-portaltouch 3.39.2 → 3.39.5

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.
@@ -0,0 +1,1484 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = undefined;
7
+
8
+ var _assign = require('babel-runtime/core-js/object/assign');
9
+
10
+ var _assign2 = _interopRequireDefault(_assign);
11
+
12
+ var _extends2 = require('babel-runtime/helpers/extends');
13
+
14
+ var _extends3 = _interopRequireDefault(_extends2);
15
+
16
+ var _stringify = require('babel-runtime/core-js/json/stringify');
17
+
18
+ var _stringify2 = _interopRequireDefault(_stringify);
19
+
20
+ var _promise = require('babel-runtime/core-js/promise');
21
+
22
+ var _promise2 = _interopRequireDefault(_promise);
23
+
24
+ var _regenerator = require('babel-runtime/regenerator');
25
+
26
+ var _regenerator2 = _interopRequireDefault(_regenerator);
27
+
28
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
29
+
30
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
31
+
32
+ var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
33
+
34
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
35
+
36
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
37
+
38
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
39
+
40
+ var _createClass2 = require('babel-runtime/helpers/createClass');
41
+
42
+ var _createClass3 = _interopRequireDefault(_createClass2);
43
+
44
+ var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
45
+
46
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
47
+
48
+ var _inherits2 = require('babel-runtime/helpers/inherits');
49
+
50
+ var _inherits3 = _interopRequireDefault(_inherits2);
51
+
52
+ var _class, _class2, _temp; /*
53
+ * @Description:
54
+ * @Date: 2019-08-13 08:42:18
55
+ * @LastEditTime: 2022-02-25 14:49:22
56
+ * @LastEditors: chenlongad
57
+ * @modify:修改跳转到T+的查询方案方式
58
+ */
59
+
60
+
61
+ var _react = require('react');
62
+
63
+ var _react2 = _interopRequireDefault(_react);
64
+
65
+ var _mobxReact = require('mobx-react');
66
+
67
+ var _mobx = require('mobx');
68
+
69
+ var _antd = require('antd');
70
+
71
+ var _mutantsMicrofx = require('mutants-microfx');
72
+
73
+ var _tplusComponentsTouch = require('tplus-components-touch');
74
+
75
+ var _tplusApi = require('tplus-api');
76
+
77
+ var _tplusPoslogin = require('tplus-poslogin');
78
+
79
+ var _mutantsUtil = require('mutants-util');
80
+
81
+ var _propTypes = require('prop-types');
82
+
83
+ var _propTypes2 = _interopRequireDefault(_propTypes);
84
+
85
+ var _ModifyPassApi = require('../../api/ModifyPassApi');
86
+
87
+ var _data = require('./data');
88
+
89
+ var _data2 = _interopRequireDefault(_data);
90
+
91
+ var _middleWare = require('../../middleWare');
92
+
93
+ var _middleWare2 = _interopRequireDefault(_middleWare);
94
+
95
+ var _verticalPortal = require('./verticalPortal');
96
+
97
+ var _verticalPortal2 = _interopRequireDefault(_verticalPortal);
98
+
99
+ var _horizontalPadPortal = require('./horizontalPadPortal');
100
+
101
+ var _horizontalPadPortal2 = _interopRequireDefault(_horizontalPadPortal);
102
+
103
+ require('./index.less');
104
+
105
+ var _rxjs = require('rxjs');
106
+
107
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
108
+
109
+ var hasElectron = _mutantsMicrofx.env.platform === _mutantsMicrofx.env.constant.platform.electron;
110
+ var Content = _tplusComponentsTouch.Layout.Content,
111
+ Footer = _tplusComponentsTouch.Layout.Footer;
112
+
113
+ var tplusWindow = null;
114
+ var HTTP_PROXY_URL = 'http://tfproxy.chanjet.com/?url=';
115
+ var CC_FRAME_CONF = { id: 'external-frame-cc', initConnect: 'initConnect', HsyLoadFinish: 'HsyLoadFinish', HsyRouterClean: 'HsyRouterClean', HsyRouterJump: 'HsyRouterJump' };
116
+
117
+ var _default = (0, _mobxReact.observer)(_class = (_temp = _class2 = function (_Component) {
118
+ (0, _inherits3.default)(_default, _Component);
119
+
120
+ function _default(props) {
121
+ var _this2 = this;
122
+
123
+ (0, _classCallCheck3.default)(this, _default);
124
+
125
+ var _this = (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || (0, _getPrototypeOf2.default)(_default)).call(this, props));
126
+
127
+ _this.catchOfflineData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
128
+ var offlineSys, isLoginAfter, downloadCatcherDay, currentDay, downProgress, result;
129
+ return _regenerator2.default.wrap(function _callee$(_context) {
130
+ while (1) {
131
+ switch (_context.prev = _context.next) {
132
+ case 0:
133
+ offlineSys = _this.context.stores.offlineSys;
134
+ isLoginAfter = _mutantsMicrofx.localStore.get("isLoginAfter");
135
+ downloadCatcherDay = _mutantsMicrofx.localStore.get("downloadCatcherDay");
136
+ currentDay = Math.ceil(new Date() / 1000 / 60 / 60 / 24);
137
+
138
+ if (!(isLoginAfter == 1)) {
139
+ _context.next = 24;
140
+ break;
141
+ }
142
+
143
+ if (!(!downloadCatcherDay || currentDay > downloadCatcherDay)) {
144
+ _context.next = 23;
145
+ break;
146
+ }
147
+
148
+ _context.prev = 6;
149
+
150
+ downProgress = function downProgress(params) {
151
+ _tplusComponentsTouch.Loading.transfer(params);
152
+ };
153
+
154
+ _tplusComponentsTouch.Loading.show({
155
+ text: '离线数据下载中,请稍等...',
156
+ delay: 0,
157
+ showProgress: true
158
+ });
159
+ _context.next = 11;
160
+ return offlineSys.downloadCatcherData(downProgress);
161
+
162
+ case 11:
163
+ result = _context.sent;
164
+
165
+ if (result) _mutantsMicrofx.localStore.set("downloadCatcherDay", currentDay);
166
+ _tplusComponentsTouch.Loading.hide();
167
+ _context.next = 20;
168
+ break;
169
+
170
+ case 16:
171
+ _context.prev = 16;
172
+ _context.t0 = _context['catch'](6);
173
+
174
+ console.log('downloadCatcherData下载离线数据', _context.t0);
175
+ _tplusComponentsTouch.Loading.hide();
176
+
177
+ case 20:
178
+ _context.prev = 20;
179
+
180
+ _tplusComponentsTouch.Loading.hide();
181
+ return _context.finish(20);
182
+
183
+ case 23:
184
+ _mutantsMicrofx.localStore.set("isLoginAfter", 0);
185
+
186
+ case 24:
187
+ case 'end':
188
+ return _context.stop();
189
+ }
190
+ }
191
+ }, _callee, _this2, [[6, 16, 20, 23]]);
192
+ }));
193
+
194
+ _this.getOperation = function () {
195
+ return new _promise2.default(function (resolve, reject) {
196
+ var homeOperation = _ModifyPassApi.Request.homeOperation,
197
+ functionData = _ModifyPassApi.Request.functionData;
198
+
199
+ homeOperation().then(function (operations) {
200
+ _mutantsMicrofx.localStore.set('operationsAuth', (0, _stringify2.default)(operations));
201
+ _this.setState({ operations: operations || [] });
202
+ resolve();
203
+ }).catch(function (err) {
204
+ console.log('homeOperation.error======', err);
205
+ _tplusComponentsTouch.Loading.hide();
206
+ resolve();
207
+ });
208
+ functionData().then(function (data) {
209
+ (0, _tplusPoslogin.PosSetData)(data);
210
+ });
211
+ });
212
+ };
213
+
214
+ _this.initPageData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
215
+ var _this$context, _this$context$stores, stores, _this$context$headHoo, addClass, hasUseOffline;
216
+
217
+ return _regenerator2.default.wrap(function _callee2$(_context2) {
218
+ while (1) {
219
+ switch (_context2.prev = _context2.next) {
220
+ case 0:
221
+ _this$context = _this.context, _this$context$stores = _this$context.stores, stores = _this$context$stores === undefined ? {} : _this$context$stores, _this$context$headHoo = _this$context.headHook;
222
+ _this$context$headHoo = _this$context$headHoo === undefined ? {} : _this$context$headHoo;
223
+ addClass = _this$context$headHoo.addClass;
224
+ hasUseOffline = (0, _tplusPoslogin.PosInitData)('IsOfflineCash') === "1" && !(_this.isVerticalTouch || _this.isMobileEnvironment); //是否允许离线
225
+ // const hasUseOffline = true;
226
+
227
+ if (!(hasUseOffline == true)) {
228
+ _context2.next = 7;
229
+ break;
230
+ }
231
+
232
+ _context2.next = 7;
233
+ return _this.catchOfflineData();
234
+
235
+ case 7:
236
+ _tplusComponentsTouch.Loading.show({
237
+ text: '权限加载中,请稍等...',
238
+ delay: 2500
239
+ });
240
+ //权限加载
241
+ _context2.prev = 8;
242
+ _context2.next = 11;
243
+ return _this.getOperation();
244
+
245
+ case 11:
246
+ _context2.next = 16;
247
+ break;
248
+
249
+ case 13:
250
+ _context2.prev = 13;
251
+ _context2.t0 = _context2['catch'](8);
252
+
253
+ _tplusComponentsTouch.Loading.hide();
254
+
255
+ case 16:
256
+ _context2.prev = 16;
257
+
258
+ _tplusComponentsTouch.Loading.hide();
259
+ return _context2.finish(16);
260
+
261
+ case 19:
262
+ addClass && addClass(_this.state.id, 'portalHead');
263
+ // 初始化参数设置。
264
+ stores.setStore.initSetParams().then(function (ret) {
265
+ // 在客户端中,如果开启了副屏设置,尝试这打开副屏。
266
+ if (_this.getScreenType() === true) {
267
+ if (_this.isHorizontalSunMi) {
268
+ _this.sunMiPresentationInit(ret);
269
+ return;
270
+ }
271
+ console.log('副屏页面打开之前,user信息', (0, _stringify2.default)(stores.user));
272
+ window.open('vicescreen?ts=' + new Date().getTime(), 'screen');
273
+ setTimeout(function () {
274
+ console.log('副屏页面打开之后,user信息', (0, _stringify2.default)(stores.user));
275
+ }, 3000);
276
+ }
277
+ });
278
+ _this.hsyBasicInfoInit();
279
+
280
+ case 22:
281
+ case 'end':
282
+ return _context2.stop();
283
+ }
284
+ }
285
+ }, _callee2, _this2, [[8, 13, 16, 19]]);
286
+ }));
287
+
288
+ _this.initHsyFrameListener = function () {
289
+ var that = _this;
290
+ window.addEventListener('message', function (e) {
291
+ if (new URL(that.hsy_domain).origin !== e.origin) {
292
+ return;
293
+ };
294
+ console.log("ccFrameWin e.data=", e.data, e, "^^^^^^^^^^^^^^^^^^^");
295
+ if (e.data === CC_FRAME_CONF.HsyLoadFinish) {
296
+ !that.state.isHsyLoadFinish && that.setState({ isHsyLoadFinish: true });
297
+ }
298
+ });
299
+ };
300
+
301
+ _this.sunMiPresentationInit = function (result) {
302
+ //SunMi初始化参数设置。
303
+ //副屏幕交互。硬件改动20200428 需要在商米页面加载成功后才能发送 初始化命令
304
+ // 进行主副屏数据交互 初始化
305
+ console.log(result);
306
+
307
+ var _ref3 = _mutantsMicrofx.stores.user.options.get('store') || {},
308
+ _ref3$storeName = _ref3.storeName,
309
+ storeName = _ref3$storeName === undefined ? '' : _ref3$storeName;
310
+
311
+ var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
312
+ RE_POSParamType = _enumController$getEn.RE_POSParamType;
313
+
314
+ var DUAL_SCREEN_SETTING = RE_POSParamType.DUAL_SCREEN_SETTING;
315
+
316
+ var filterResult = result && result.filter ? result.filter(function (settingItem) {
317
+ return settingItem.ParamType === DUAL_SCREEN_SETTING;
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.getTcBasicInfoInit = function () {
326
+ var userStore = _tplusApi.User.restore();
327
+ var sid = userStore.sid;
328
+ var tplusUrl = (0, _tplusPoslogin.PosInitData)("TplusSite") || (0, _tplusPoslogin.PosInitData)("tplusinnersite");
329
+ if (!tplusUrl) {
330
+ var msg = "请用admin登录,在服务器配置–地址配置处,设置“内部或外部网络访问T+服务器的地址”!";
331
+ _tplusComponentsTouch.ModalWraper.warning({
332
+ title: '温馨提示',
333
+ content: msg,
334
+ okText: '确定',
335
+ okType: 'primary'
336
+ });
337
+ return false;
338
+ }
339
+ if (tplusUrl.substring(tplusUrl.length - 1) !== '/') {
340
+ tplusUrl += '/';
341
+ }
342
+ var ossjumpUrl = tplusUrl + 'view/portal/portal.html?t=' + new Date().getTime();
343
+ if (sid) {
344
+ ossjumpUrl = tplusUrl + 'view/ossjump.html?t=' + new Date().getTime() + '&sid=' + sid;
345
+ }
346
+ var postMsgUrl = ossjumpUrl;
347
+ var user = _this.context.stores.user;
348
+
349
+ var loginInfo = user.options.get('loginInfo');
350
+
351
+ var _ref4 = loginInfo || {},
352
+ UserCode = _ref4.UserCode,
353
+ AccountNum = _ref4.AccountNum,
354
+ posCode = _ref4.posCode,
355
+ TplusStoreId = _ref4.TplusStoreId;
356
+
357
+ var uid = _this.tplusEncode(UserCode);
358
+ var pwd = _this.tplusEncode(user.options.get("password"));
359
+ var accNum = _this.tplusEncode(AccountNum);
360
+ var code = _this.tplusEncode(posCode);
361
+ var store = _this.tplusEncode(TplusStoreId + '');
362
+ ossjumpUrl += '&fromApp=nretail&way=inframe&user=' + uid + '&pwd=' + pwd + '&accNum=' + accNum + '&posCode=' + code + '&storeID=' + store;
363
+ return { ossjumpUrl: ossjumpUrl, postMessageUrl: postMsgUrl };
364
+ };
365
+
366
+ _this.getScreenType = function () {
367
+ var flag = false;
368
+ if (_this.hasElectron === true || _this.isHorizontalSunMi) {
369
+ var data = _mutantsMicrofx.localStore.get('setting_setData') || [];
370
+ data = data.filter(function (item) {
371
+ return item.Name === 'EnableDoubleScreen';
372
+ });
373
+ data = data && data.length > 0 ? data.shift() : null;
374
+ if (data && data.Value === '1') {
375
+ flag = true;
376
+ }
377
+ }
378
+ return flag;
379
+ };
380
+
381
+ _this.saveLog = function (name) {
382
+ var saveLogo = _ModifyPassApi.Request.saveLogo;
383
+
384
+ name = "进入模块:" + name;
385
+ saveLogo('进入模块', undefined, name);
386
+ };
387
+
388
+ _this.handelClick = function () {
389
+ var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
390
+ var type = values.key,
391
+ isModal = values.isModal,
392
+ iframe = values.iframe,
393
+ app = values.app,
394
+ title = values.title,
395
+ Name = values.Name,
396
+ style = values.style,
397
+ search = values.search,
398
+ tmenuCode = values.tmenuCode;
399
+ var _this$state = _this.state,
400
+ operations = _this$state.operations,
401
+ isHsyLoadFinish = _this$state.isHsyLoadFinish;
402
+
403
+ var controllable = operations.find(function (vv) {
404
+ return vv.Name === Name;
405
+ });
406
+
407
+ var _ref5 = controllable || {},
408
+ Visibility = _ref5.Visibility,
409
+ HoldFunctionAuth = _ref5.HoldFunctionAuth,
410
+ Title = _ref5.Title,
411
+ MenuCode = _ref5.MenuCode;
412
+
413
+ var errorTip = void 0;
414
+
415
+ if (!_mutantsMicrofx.stores.offlineSys.shouldOpenHomeOperation(Name)) {
416
+ _tplusComponentsTouch.Message.warn("离线模式下此操作不可用");
417
+ return;
418
+ }
419
+
420
+ if (type == 'more') {
421
+ // if (this.isMobileEnvironment) { //暂时不支持android系统跳转
422
+ // return Message.warn('新功能正在研发中,敬请期待。');
423
+ // }
424
+ return _this.setState({ showMoreModal: true });
425
+ }
426
+ if (!Title) {
427
+ return _tplusComponentsTouch.ModalWraper.warning({
428
+ title: '提示',
429
+ content: '您的权限配置请求失败,请重新登录',
430
+ onOk: function onOk() {
431
+ _tplusApi.User.logout();
432
+ },
433
+
434
+ okType: 'primary'
435
+ });
436
+ }
437
+
438
+ if (!Visibility) {
439
+ errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
440
+ } else if (!HoldFunctionAuth) {
441
+ errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
442
+ }
443
+ var portalStore = _this.context.stores.portalStore;
444
+
445
+ if (errorTip) {
446
+ return _tplusComponentsTouch.Message.warn(errorTip);
447
+ }
448
+ if (isModal) {
449
+ return _mutantsMicrofx.stores.modalRouter.show({ url: '/' + type, width: 800, title: title });
450
+ }
451
+ // 支持页面内打开,减少再次加载页面的时间。
452
+ if (iframe === true) return _this.toFramePage({ type: type, app: app, title: title, style: style, search: search, MenuCode: MenuCode, tmenuCode: tmenuCode, isHsyLoadFinish: isHsyLoadFinish });
453
+ switch (type) {
454
+ case 'cashier':
455
+ portalStore.checkDuty().then(function (onDutyMessage) {
456
+ if (!!onDutyMessage) {
457
+ var Code = onDutyMessage.Code,
458
+ IdShiftVoucher = onDutyMessage.IdShiftVoucher,
459
+ Shift = onDutyMessage.Shift,
460
+ IdDailyVoucher = onDutyMessage.IdDailyVoucher,
461
+ DailyCode = onDutyMessage.DailyCode;
462
+
463
+ (0, _tplusPoslogin.PosSetData)({ ShiftCode: Code, IdShiftVoucher: IdShiftVoucher, Shift: Shift, IdDailyVoucher: IdDailyVoucher, DailyCode: DailyCode });
464
+ console.log('onDutyMessage======', onDutyMessage);
465
+ _this.saveLog(title);
466
+ _mutantsMicrofx.history.push('/RE/RE01');
467
+ }
468
+ }).catch(function (data) {
469
+ console.log("进入前台收银检查是否当班返回错误", data);
470
+ });
471
+ break;
472
+ case 'onDuty':
473
+ portalStore.onDuty().then(function (onDutyMessage) {
474
+ if (onDutyMessage && onDutyMessage.shift) {
475
+ _middleWare2.default.execute('onDuty');
476
+ }
477
+ });
478
+ break;
479
+ case 'offDuty':
480
+ _mutantsMicrofx.history.push('/offDuty?type=offDuty');
481
+ break;
482
+ case 'settleDialy':
483
+ if (portalStore.bPosDaily()) {
484
+ _mutantsMicrofx.history.push('/offDuty?type=settleDaily');
485
+ } else {
486
+ portalStore.onMakerDaily();
487
+ }
488
+ break;
489
+ default:
490
+ _mutantsMicrofx.history.push('/' + type);
491
+ break;
492
+ }
493
+ };
494
+
495
+ _this.toFramePage = function (params) {
496
+ var _ref6 = params || {},
497
+ app = _ref6.app,
498
+ title = _ref6.title,
499
+ style = _ref6.style,
500
+ search = _ref6.search,
501
+ tmenuCode = _ref6.tmenuCode,
502
+ MenuCode = _ref6.MenuCode,
503
+ isHsyLoadFinish = _ref6.isHsyLoadFinish;
504
+
505
+ switch (app) {
506
+ case 'cc':
507
+ var sh = '';
508
+ // if (this.isMobileEnvironment) { //暂时不支持android系统跳转
509
+ // return Message.warn('新功能正在研发中,敬请期待。');
510
+ // }
511
+ if (!isHsyLoadFinish && !_this.isMobileEnvironment) {
512
+ return _tplusComponentsTouch.Message.warn('正在加载资源中,请稍后。');
513
+ }
514
+ if (!search) {
515
+ return _tplusComponentsTouch.Message.warn('正在紧急研发中...');
516
+ } else if (search && search.length > 0) {
517
+ sh = search.length > 1 && MenuCode ? search.find(function (v) {
518
+ return v.menu === MenuCode;
519
+ }) : search[0];
520
+ sh = sh || search[0];
521
+ }
522
+ if (!sh) {
523
+ return _tplusComponentsTouch.Message.warn('传递参数有误,请查证。');
524
+ }
525
+ _this.toHsyPage((0, _extends3.default)({}, style, sh));
526
+ break;
527
+ case 'tc':
528
+ if (tmenuCode || MenuCode) {
529
+ _this.saveLog(title);
530
+ if (MenuCode) {
531
+ _this.toTplusPage(MenuCode, search);
532
+ } else {
533
+ _this.toTplusPage(tmenuCode, search);
534
+ }
535
+ }
536
+ break;
537
+ }
538
+ };
539
+
540
+ _this.getTplusUrlFromCloudServer = function () {
541
+ //获取T+服务器配置地址。
542
+ var userStore = _tplusApi.User.restore();
543
+ var data = 'accesstoken=' + ('' + userStore.accessToken) + '&cloudOrgId=' + ('' + userStore.orgId);
544
+ var url = '' + HTTP_PROXY_URL + encodeURIComponent('http://mns.chanapp.chanjet.com/web/WebServer/get?' + ('' + data));
545
+ console.log(url);
546
+ var fetchHeader = {
547
+ headers: {
548
+ 'Content-Type': 'application/x-www-form-urlencoded'
549
+ }
550
+ };
551
+ return new _promise2.default(function (resolve, reject) {
552
+ fetch(url, fetchHeader).then(function (response) {
553
+ return response.json();
554
+ }).then(function (json) {
555
+ console.log(json);
556
+ resolve(json);
557
+ }).catch(function (ex) {
558
+ console.log(ex);
559
+ reject(err);
560
+ });
561
+ });
562
+ };
563
+
564
+ _this.toTplusPage = function () {
565
+ var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(tmenuCode, search) {
566
+ var ret, _ref8, ossjumpUrl, postMessageUrl, dsearchPlanID, portalStore, menu, external_frame_tc, win, loadTcURL;
567
+
568
+ return _regenerator2.default.wrap(function _callee3$(_context3) {
569
+ while (1) {
570
+ switch (_context3.prev = _context3.next) {
571
+ case 0:
572
+ ret = _this.getTcBasicInfoInit();
573
+
574
+ if (!(ret === false)) {
575
+ _context3.next = 3;
576
+ break;
577
+ }
578
+
579
+ return _context3.abrupt('return');
580
+
581
+ case 3:
582
+ _ref8 = ret || {}, ossjumpUrl = _ref8.ossjumpUrl, postMessageUrl = _ref8.postMessageUrl;
583
+ dsearchPlanID = '';
584
+
585
+ if (!(search && search.id)) {
586
+ _context3.next = 10;
587
+ break;
588
+ }
589
+
590
+ portalStore = _this.context.stores.portalStore;
591
+ _context3.next = 9;
592
+ return portalStore.getSearchPlanId(search);
593
+
594
+ case 9:
595
+ dsearchPlanID = _context3.sent;
596
+
597
+ case 10:
598
+ menu = _this.tplusEncode(tmenuCode);
599
+
600
+ ossjumpUrl += '&menu=' + menu + '&fromUrl=' + _this.tplusEncode(location.origin);
601
+ if (dsearchPlanID) {
602
+ ossjumpUrl += '&searchPlanID=' + _this.tplusEncode(dsearchPlanID);
603
+ }
604
+
605
+ if (!_this.isHorizontalSunMi) {
606
+ _context3.next = 17;
607
+ break;
608
+ }
609
+
610
+ window.android_CommonFun.openWebUrlByOutBrowser(ossjumpUrl);
611
+ _context3.next = 25;
612
+ break;
613
+
614
+ case 17:
615
+ if (!(_this.new_retail_app == 'tc' || _this.new_retail_app == 'tczsy' || _this.new_retail_app == 'tcyzj')) {
616
+ _context3.next = 20;
617
+ break;
618
+ }
619
+
620
+ _mutantsMicrofx.nativeMs.useDefaultBrowser(ossjumpUrl);
621
+ return _context3.abrupt('return');
622
+
623
+ case 20:
624
+ external_frame_tc = document.getElementById('external-frame-tc');
625
+ win = external_frame_tc.contentWindow;
626
+ loadTcURL = _this.state.loadTcURL;
627
+
628
+ if (loadTcURL) {
629
+ win && win.postMessage({ doType: 'openMenuFromPos', tmenuCode: tmenuCode, ossjumpUrl: ossjumpUrl, dsearchPlanID: dsearchPlanID }, postMessageUrl);
630
+ _this.setState({ loadTcPage: true });
631
+ } else {
632
+ _this.setState({ loadTcURL: ossjumpUrl, loadTcPage: true });
633
+ }
634
+ rx$.changeHsy.next({
635
+ back: true, fn: function fn() {
636
+ win && win.postMessage({ doType: 'closeCurrentMenuFromPos' }, postMessageUrl);
637
+ _this.setState({ loadTcPage: false });
638
+ rx$.changeHsy.next({ back: false });
639
+ }
640
+ });
641
+
642
+ case 25:
643
+ case 'end':
644
+ return _context3.stop();
645
+ }
646
+ }
647
+ }, _callee3, _this2);
648
+ }));
649
+
650
+ return function (_x2, _x3) {
651
+ return _ref7.apply(this, arguments);
652
+ };
653
+ }();
654
+
655
+ _this.toHsyPage = function () {
656
+ var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(params) {
657
+ var content_only, bar_bg, bar_active_bg, menu, secondRouter, activePrompt, closePrompt, closeable, leavePrompt, lock, pageId, pageParams, path, tabId, tabLabel, pageType, _k, filter, IdWarehouse, WarehouseName, IsPerformanceDistribution, _ref10, _ref10$IdStore, IdStore, _ref10$PosId, PosId, _ref11, _ref11$storeName, storeName, commonArgs, actionUrl, cc_url, CC_WEB_URL;
658
+
659
+ return _regenerator2.default.wrap(function _callee4$(_context4) {
660
+ while (1) {
661
+ switch (_context4.prev = _context4.next) {
662
+ case 0:
663
+ content_only = params.content_only, bar_bg = params.bar_bg, bar_active_bg = params.bar_active_bg, menu = params.menu, secondRouter = params.secondRouter, activePrompt = params.activePrompt, closePrompt = params.closePrompt, closeable = params.closeable, leavePrompt = params.leavePrompt, lock = params.lock, pageId = params.pageId, pageParams = params.pageParams, path = params.path, tabId = params.tabId, tabLabel = params.tabLabel, pageType = params.pageType, _k = params._k;
664
+ filter = {};
665
+ //对仓库参数的处理
666
+
667
+ IdWarehouse = (0, _tplusPoslogin.PosInitData)('IdWarehouse') || '';
668
+ WarehouseName = (0, _tplusPoslogin.PosInitData)('WarehouseName') || '';
669
+ IsPerformanceDistribution = (0, _tplusPoslogin.PosInitData)('PerformanceDistribution') === 'SHIPPER_STORE' || false;
670
+ _ref10 = _mutantsMicrofx.stores.user.options.get('loginInfo') || {}, _ref10$IdStore = _ref10.IdStore, IdStore = _ref10$IdStore === undefined ? '' : _ref10$IdStore, _ref10$PosId = _ref10.PosId, PosId = _ref10$PosId === undefined ? '' : _ref10$PosId;
671
+ _ref11 = _mutantsMicrofx.stores.user.options.get('store') || {}, _ref11$storeName = _ref11.storeName, storeName = _ref11$storeName === undefined ? '' : _ref11$storeName;
672
+ _context4.t0 = pageType;
673
+ _context4.next = _context4.t0 === 'voucher' ? 10 : _context4.t0 === 'report' ? 13 : 17;
674
+ break;
675
+
676
+ case 10:
677
+ filter = {
678
+ defaultValue: {
679
+ storeId: {
680
+ id: IdStore,
681
+ storeName: storeName
682
+ },
683
+ warehouseId: {
684
+ id: IdWarehouse,
685
+ name: WarehouseName
686
+ }
687
+ }
688
+ //要货单特殊处理
689
+ };if (menu == 'require-goods-new') {
690
+ filter = {
691
+ defaultValue: {
692
+ storeId: {
693
+ id: IdStore,
694
+ storeName: storeName
695
+ },
696
+ requireWarehouseId: {
697
+ id: IdWarehouse,
698
+ name: WarehouseName
699
+ }
700
+ }
701
+ };
702
+ }
703
+ return _context4.abrupt('break', 17);
704
+
705
+ case 13:
706
+ filter = {
707
+ filterValue: {
708
+ storeId: {
709
+ value: {
710
+ id: IdStore,
711
+ storeName: storeName
712
+ }
713
+ },
714
+ warehouseId: {
715
+ value: [{
716
+ id: IdWarehouse,
717
+ name: WarehouseName
718
+ }]
719
+ }
720
+ }
721
+ // 收银统计表
722
+ };if (IsPerformanceDistribution && menu == 'retail-cash-report') {
723
+ filter = {
724
+ filterValue: {
725
+ deliveryStoreId: {
726
+ value: {
727
+ id: IdStore,
728
+ storeName: storeName
729
+ }
730
+ },
731
+ warehouseId: {
732
+ value: [{
733
+ id: IdWarehouse,
734
+ name: WarehouseName
735
+ }]
736
+ }
737
+ }
738
+ };
739
+ }
740
+ // 售后、配送
741
+ if (menu == 'return-order' || menu == 'order-manage') {
742
+ filter = {
743
+ filterValue: {
744
+ storeId: {
745
+ value: {
746
+ id: IdStore,
747
+ storeName: storeName
748
+ }
749
+ },
750
+ deliveryWarehouseId: {
751
+ value: [{
752
+ id: IdWarehouse,
753
+ name: WarehouseName
754
+ }]
755
+ }
756
+ }
757
+ };
758
+ }
759
+ return _context4.abrupt('break', 17);
760
+
761
+ case 17:
762
+ bar_bg = encodeURIComponent(bar_bg);
763
+ bar_active_bg = encodeURIComponent(bar_active_bg);
764
+ menu = secondRouter ? menu + '/' + _this.randomWord(true, 13) : menu;
765
+ pageId = menu;
766
+ pageParams = (0, _assign2.default)(pageParams, filter);
767
+ path = encodeURIComponent(path);
768
+ _k = _this.randomWord(false, 6);
769
+
770
+ commonArgs = '?posid=' + PosId + '&content_only=' + content_only + '&bar_bg=' + bar_bg + '&bar_active_bg=' + bar_active_bg;
771
+ actionUrl = '#/' + menu + '?activePrompt=' + activePrompt + '&closePrompt=' + closePrompt + '&closeable=' + closeable + '&leavePrompt=' + leavePrompt + '&lock=' + lock + '&pageId=' + pageId + '&pageParams=' + encodeURIComponent((0, _stringify2.default)(pageParams)) + '&path=' + path + '&tabId=' + tabId + '&tabLabel=' + encodeURIComponent(tabLabel) + '&_k=' + _k;
772
+ cc_url = _this.hsy_domain.replace('#/', '') + commonArgs + actionUrl;
773
+
774
+ console.log('web_hsy_url:', cc_url);
775
+
776
+ if (!_this.isHorizontalSunMi) {
777
+ _context4.next = 36;
778
+ break;
779
+ }
780
+
781
+ _context4.next = 31;
782
+ return _tplusApi.User.getLoginCCMidWebUrl(cc_url);
783
+
784
+ case 31:
785
+ CC_WEB_URL = _context4.sent;
786
+
787
+ console.log('CC_WEB_URL:', CC_WEB_URL);
788
+ window.android_CommonFun.openWebUrlByOutBrowser(CC_WEB_URL);
789
+ _context4.next = 39;
790
+ break;
791
+
792
+ case 36:
793
+ // this.ccFrameWin && this.ccFrameWin.HsyRouterJump && this.ccFrameWin.HsyRouterJump(pageId, pageParams, { closeable, tabLabel });
794
+ _this.ccFrameWin && _this.ccFrameWin.postMessage({ type: CC_FRAME_CONF.HsyRouterJump, pageId: pageId, pageParams: pageParams, extStateParams: { closeable: closeable, tabLabel: tabLabel }, fr: 'pos' }, _this.state.loadHsyURL || "*");
795
+ if (_this.state.showMoreModal === true) {
796
+ _this.setState({ loadHsyPage: true, showMoreModal: false });
797
+ } else {
798
+ _this.setState({ loadHsyPage: true });
799
+ }
800
+ rx$.changeHsy.next({
801
+ back: true, fn: function fn() {
802
+ _this.setState({ loadHsyPage: false });
803
+ rx$.changeHsy.next({ back: false });
804
+ // 在打开页签之前,关闭之前的,返回键的回调函数
805
+ // this.ccFrameWin && this.ccFrameWin.HsyRouterClean && this.ccFrameWin.HsyRouterClean();
806
+ _this.ccFrameWin && _this.ccFrameWin.postMessage({ type: CC_FRAME_CONF.HsyRouterClean, fr: 'pos' }, _this.state.loadHsyURL || '*');
807
+ }
808
+ });
809
+
810
+ case 39:
811
+ case 'end':
812
+ return _context4.stop();
813
+ }
814
+ }
815
+ }, _callee4, _this2);
816
+ }));
817
+
818
+ return function (_x4) {
819
+ return _ref9.apply(this, arguments);
820
+ };
821
+ }();
822
+
823
+ _this.randomWord = function (only, digits) {
824
+ var str = "";
825
+ var number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
826
+ var letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
827
+ var arr = only ? [].concat(number) : [].concat(number, letter);
828
+ for (var i = 0; i < digits; i++) {
829
+ var pos = Math.round(Math.random() * (arr.length - 1));
830
+ str += arr[pos];
831
+ }
832
+ return str;
833
+ };
834
+
835
+ _this.closeFrameModal = function () {
836
+ _this.setState({ showModal: false });
837
+ };
838
+
839
+ _this.closeMoreModal = function () {
840
+ _this.setState({ showMoreModal: false });
841
+ };
842
+
843
+ _this.tplusEncode = function (code) {
844
+ var c = String.fromCharCode(code.charCodeAt(0) + code.length);
845
+ for (var i = 1; i < code.length; i++) {
846
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
847
+ }
848
+ var ret = _this.TplusBase64Encode(c);
849
+ return ret;
850
+ };
851
+
852
+ _this.TplusBase64Encode = function (input) {
853
+ var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
854
+ var output = "";
855
+ var chr1 = void 0,
856
+ chr2 = void 0,
857
+ chr3 = void 0,
858
+ enc1 = void 0,
859
+ enc2 = void 0,
860
+ enc3 = void 0,
861
+ enc4 = void 0;
862
+ var i = 0;
863
+ input = _this._utf8_encode(input);
864
+ while (i < input.length) {
865
+ chr1 = input.charCodeAt(i++);
866
+ chr2 = input.charCodeAt(i++);
867
+ chr3 = input.charCodeAt(i++);
868
+ enc1 = chr1 >> 2;
869
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4;
870
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6;
871
+ enc4 = chr3 & 63;
872
+ if (isNaN(chr2)) {
873
+ enc3 = enc4 = 64;
874
+ } else if (isNaN(chr3)) {
875
+ enc4 = 64;
876
+ }
877
+ output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
878
+ }
879
+ return output;
880
+ };
881
+
882
+ _this._utf8_encode = function (string) {
883
+ string = string.replace(/\r\n/g, "\n");
884
+ var utftext = "";
885
+ for (var n = 0; n < string.length; n++) {
886
+ var c = string.charCodeAt(n);
887
+ if (c < 128) {
888
+ utftext += String.fromCharCode(c);
889
+ } else if (c > 127 && c < 2048) {
890
+ utftext += String.fromCharCode(c >> 6 | 192);
891
+ utftext += String.fromCharCode(c & 63 | 128);
892
+ } else {
893
+ utftext += String.fromCharCode(c >> 12 | 224);
894
+ utftext += String.fromCharCode(c >> 6 & 63 | 128);
895
+ utftext += String.fromCharCode(c & 63 | 128);
896
+ }
897
+ }
898
+ return utftext;
899
+ };
900
+
901
+ _this.operationControl = function () {
902
+ var menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
903
+ var operations = _this.state.operations;
904
+
905
+ menu.forEach(function (v) {
906
+ if (v.sub) {
907
+ return _this.operationControl(v.sub);
908
+ }
909
+ var controllable = operations.find(function (vv) {
910
+ return vv.Name === v.Name;
911
+ });
912
+
913
+ var _ref12 = controllable || {},
914
+ Visibility = _ref12.Visibility,
915
+ HoldFunctionAuth = _ref12.HoldFunctionAuth,
916
+ Title = _ref12.Title;
917
+
918
+ var errorTip = void 0;
919
+ if (!Visibility) {
920
+ errorTip = '\u60A8\u7684 ' + Title + ' \u6A21\u5757\u6CA1\u6709\u542F\u7528';
921
+ } else if (!HoldFunctionAuth) {
922
+ errorTip = '\u60A8\u6CA1\u6709\u64CD\u4F5C ' + Title + ' \u7684\u6743\u9650';
923
+ }
924
+ v.errorTip = errorTip;
925
+ });
926
+ return menu;
927
+ };
928
+
929
+ _this.createLeftNode = function () {
930
+ var menu = _this.leftMenu;
931
+ var width = menu.length == 0 ? _this.isMobileEnvironment & !_this.isNewRetailBCPosTC ? 5 : 4 : 7;
932
+ if (menu.length == 0) {
933
+ return _react2.default.createElement(
934
+ _antd.Col,
935
+ { xl: width, md: width, className: 'portal-left-col', key: 'left' },
936
+ _react2.default.createElement('div', { className: 'portal-left-content' })
937
+ );
938
+ // return null;
939
+ }
940
+ var menuNode = menu.map(function (v) {
941
+ return v.container ? _react2.default.createElement(
942
+ 'div',
943
+ { style: v.container.style, className: v.container.className, key: v.container.className },
944
+ v.sub.map(function (vv) {
945
+ var item = vv;
946
+ if (vv.maybe === true) {
947
+ var status = !!(0, _tplusPoslogin.PosInitData)('ShowStorePrice');
948
+ item = status ? vv : vv.second;
949
+ }
950
+ return _react2.default.createElement(
951
+ 'div',
952
+ {
953
+ className: 'member-item ' + item.className + ' ' + (item.disabled ? 'menu-item-disabled' : ''),
954
+ key: item.className,
955
+ onClick: _this.handelClick.bind(_this, item)
956
+ },
957
+ !!item.title && _react2.default.createElement(
958
+ 'h1',
959
+ null,
960
+ item.title
961
+ ),
962
+ !!item.label && _react2.default.createElement(
963
+ 'p',
964
+ null,
965
+ item.label
966
+ ),
967
+ !!item.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: item.icon })
968
+ );
969
+ })
970
+ ) : _react2.default.createElement(
971
+ 'div',
972
+ {
973
+ className: 'member-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
974
+ key: v.className,
975
+ onClick: _this.handelClick.bind(_this, v)
976
+ },
977
+ v.title && _react2.default.createElement(
978
+ 'h1',
979
+ null,
980
+ v.title
981
+ ),
982
+ v.label && _react2.default.createElement(
983
+ 'p',
984
+ null,
985
+ v.label
986
+ ),
987
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
988
+ );
989
+ });
990
+ return _react2.default.createElement(
991
+ _antd.Col,
992
+ { xl: 7, md: 7, className: 'portal-left-col', key: 'left' },
993
+ _react2.default.createElement(
994
+ 'div',
995
+ { className: 'portal-left-content' },
996
+ menuNode
997
+ )
998
+ );
999
+ };
1000
+
1001
+ _this.createCenterNode = function () {
1002
+ var menuLeftNode = _this.centerLeftMenu.map(function (v) {
1003
+ return _react2.default.createElement(
1004
+ 'div',
1005
+ {
1006
+ className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1007
+ style: v.style,
1008
+ key: v.className,
1009
+ onClick: _this.handelClick.bind(_this, v)
1010
+ },
1011
+ v.title && _react2.default.createElement(
1012
+ 'h1',
1013
+ null,
1014
+ v.title
1015
+ ),
1016
+ v.label && _react2.default.createElement(
1017
+ 'p',
1018
+ null,
1019
+ v.label
1020
+ ),
1021
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon }),
1022
+ v.disabled && _react2.default.createElement('div', { className: 'item-disabled-placeholder' })
1023
+ );
1024
+ });
1025
+ var menuRightNode = _this.centerRightMenu.map(function (v) {
1026
+ return v.container ? _react2.default.createElement(
1027
+ 'div',
1028
+ { style: v.container.style, className: v.container.className, key: v.container.className },
1029
+ v.sub.map(function (vv) {
1030
+ return _react2.default.createElement(
1031
+ 'div',
1032
+ {
1033
+ className: 'worktop-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
1034
+ key: vv.className,
1035
+ onClick: _this.handelClick.bind(_this, vv)
1036
+ },
1037
+ vv.title && _react2.default.createElement(
1038
+ 'h1',
1039
+ null,
1040
+ vv.title
1041
+ ),
1042
+ vv.label && _react2.default.createElement(
1043
+ 'p',
1044
+ null,
1045
+ vv.label
1046
+ ),
1047
+ vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
1048
+ );
1049
+ })
1050
+ ) : _react2.default.createElement(
1051
+ 'div',
1052
+ {
1053
+ className: 'worktop-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1054
+ key: v.className,
1055
+ onClick: _this.handelClick.bind(_this, v)
1056
+ },
1057
+ v.title && _react2.default.createElement(
1058
+ 'h1',
1059
+ null,
1060
+ v.title
1061
+ ),
1062
+ v.label && _react2.default.createElement(
1063
+ 'p',
1064
+ null,
1065
+ v.label
1066
+ ),
1067
+ v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1068
+ );
1069
+ });
1070
+ return _react2.default.createElement(
1071
+ 'div',
1072
+ null,
1073
+ _react2.default.createElement(
1074
+ 'div',
1075
+ { className: 'worktop-container-left' },
1076
+ menuLeftNode
1077
+ ),
1078
+ _react2.default.createElement(
1079
+ 'div',
1080
+ { className: 'worktop-container-right' },
1081
+ menuRightNode
1082
+ )
1083
+ );
1084
+ };
1085
+
1086
+ _this.createRightNode = function () {
1087
+ var width = _this.leftMenu.length == 0 ? _this.isMobileEnvironment & !_this.isNewRetailBCPosTC ? 9 : 10 : 7;
1088
+ var node = _this.rightMenu.map(function (v) {
1089
+ return v.container ? _react2.default.createElement(
1090
+ 'div',
1091
+ { style: v.container.style, className: v.container.className, key: v.container.className },
1092
+ v.sub.map(function (vv) {
1093
+ return _react2.default.createElement(
1094
+ 'div',
1095
+ {
1096
+ className: 'stock-item ' + vv.className + ' ' + (vv.disabled ? 'menu-item-disabled' : ''),
1097
+ key: vv.className,
1098
+ onClick: _this.handelClick.bind(_this, vv)
1099
+ },
1100
+ vv.title && _react2.default.createElement(
1101
+ 'h1',
1102
+ null,
1103
+ vv.title
1104
+ ),
1105
+ vv.label && _react2.default.createElement(
1106
+ 'p',
1107
+ null,
1108
+ vv.label
1109
+ ),
1110
+ vv.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: vv.icon })
1111
+ );
1112
+ })
1113
+ ) : _react2.default.createElement(
1114
+ 'div',
1115
+ {
1116
+ className: 'stock-item ' + v.className + ' ' + (v.disabled ? 'menu-item-disabled' : ''),
1117
+ style: v.style,
1118
+ key: v.className,
1119
+ onClick: _this.handelClick.bind(_this, v)
1120
+ },
1121
+ !!v.title && _react2.default.createElement(
1122
+ 'h1',
1123
+ null,
1124
+ v.title
1125
+ ),
1126
+ !!v.icon && _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1127
+ );
1128
+ });
1129
+ return _react2.default.createElement(
1130
+ _antd.Col,
1131
+ { xl: width, md: width, className: 'portal-right-col', key: 'right' },
1132
+ _react2.default.createElement(
1133
+ 'div',
1134
+ { className: 'portal-right-content' },
1135
+ node
1136
+ )
1137
+ );
1138
+ };
1139
+
1140
+ _this.createMoreNode = function () {
1141
+ var arrs = _this.getMoreNodeInfo();
1142
+ var items = _this.isNewRetailBCPosTC ? arrs.sub_tc : arrs.sub_cc || [];
1143
+ var node = items.length > 0 && items.map(function (v) {
1144
+ return _react2.default.createElement(
1145
+ 'div',
1146
+ {
1147
+ className: 'modal-quick ' + v.className,
1148
+ style: v.style,
1149
+ key: v.className,
1150
+ onClick: _this.handelClick.bind(_this, v)
1151
+ },
1152
+ !!v.icon && _react2.default.createElement(
1153
+ 'div',
1154
+ { className: 'quick' },
1155
+ _react2.default.createElement(_tplusComponentsTouch.Ticon, { icon: v.icon })
1156
+ ),
1157
+ !!v.title && _react2.default.createElement(
1158
+ 'h1',
1159
+ null,
1160
+ v.title
1161
+ )
1162
+ );
1163
+ });
1164
+ return node;
1165
+ };
1166
+
1167
+ _this.getMoreNodeInfo = function () {
1168
+ if (_this.isNewRetailBCPosTC) {
1169
+ // if (this.isMobileEnvironment) {
1170
+ // return this.centerRightMenu.find(vv => vv.key == 'more') || {};
1171
+ // } else {
1172
+ return _this.centerRightMenu.find(function (v) {
1173
+ return v.sub && v.sub.find(function (vv) {
1174
+ return vv.key == 'more';
1175
+ });
1176
+ }).sub[1] || {};
1177
+ // }
1178
+ } else {
1179
+ // if (this.isMobileEnvironment) {
1180
+ // return this.centerRightMenu.find(vv => vv.key == 'more') || {};
1181
+ // } else {
1182
+ return _this.centerRightMenu.find(function (v) {
1183
+ return v.sub && v.sub.find(function (vv) {
1184
+ return vv.key == 'more';
1185
+ });
1186
+ }).sub[1] || {};
1187
+ // }
1188
+ }
1189
+ };
1190
+
1191
+ _this.hasElectron = hasElectron;
1192
+ _this.state = {
1193
+ id: Date.now(),
1194
+ operations: [],
1195
+ showModal: false,
1196
+ showMoreModal: false,
1197
+ loadHsyPage: false,
1198
+ loadHsyURL: '',
1199
+ isHsyLoadFinish: false,
1200
+ loadTcPage: false,
1201
+ loadTcURL: '',
1202
+ modalURL: ''
1203
+ };
1204
+
1205
+ var _ref13 = _mutantsUtil.platform || {},
1206
+ isVerticalTouch = _ref13.isVerticalTouch,
1207
+ isHorizontalPad = _ref13.isHorizontalPad,
1208
+ isHorizontalSunMi = _ref13.isHorizontalSunMi,
1209
+ isNewRetailBCPosTC = _ref13.isNewRetailBCPosTC;
1210
+
1211
+ _this.isVerticalTouch = !!isVerticalTouch;
1212
+ _this.isHorizontalPad = !!isHorizontalPad;
1213
+ _this.isHorizontalSunMi = !!isHorizontalSunMi;
1214
+ _this.isMobileEnvironment = !!isHorizontalPad || !!isHorizontalSunMi;
1215
+ _this.FuPingIsLoaded = false;
1216
+ _this.isNewRetailBCPosTC = !!isNewRetailBCPosTC;
1217
+ _this.new_retail_app = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('newRetailAppType');
1218
+ _this.hsy_domain = _tplusApi.User && _tplusApi.User.getWebEntry();
1219
+ // 是否嵌套好生意的iframe
1220
+ _this.isHsyIframeInclude = !_this.isVerticalTouch && !_this.isMobileEnvironment;
1221
+ // 初始化hsy iframe
1222
+ _this.isHsyIframeInclude && _this.initHsyFrameListener();
1223
+ //首页布局
1224
+ _this.leftMenu = _this.getMenuByPosition('left');
1225
+ _this.centerLeftMenu = _this.getMenuByPosition('centerLeft');
1226
+ _this.centerRightMenu = _this.getMenuByPosition('centerRight');
1227
+ _this.rightMenu = _this.getMenuByPosition('right');
1228
+ _this.randomWord = _this.randomWord.bind(_this);
1229
+ (0, _mobx.autorun)(function () {
1230
+ _this.hsyBasicInfoInit();
1231
+ });
1232
+ return _this;
1233
+ }
1234
+
1235
+ (0, _createClass3.default)(_default, [{
1236
+ key: 'getMenuByPosition',
1237
+ value: function getMenuByPosition(position) {
1238
+ var leftMenu = _data2.default.leftMenu,
1239
+ centerLeftMenu = _data2.default.centerLeftMenu,
1240
+ centerRightMenu = _data2.default.centerRightMenu,
1241
+ rightMenu = _data2.default.rightMenu,
1242
+ leftMenuTC = _data2.default.leftMenuTC,
1243
+ rightMenuTC = _data2.default.rightMenuTC,
1244
+ centerLeftMenuMobileCC = _data2.default.centerLeftMenuMobileCC,
1245
+ centerLeftMenuMobileTC = _data2.default.centerLeftMenuMobileTC,
1246
+ centerRightMenuMobileCC = _data2.default.centerRightMenuMobileCC,
1247
+ centerRightMenuMobileTC = _data2.default.centerRightMenuMobileTC,
1248
+ rightMenuMobileTC = _data2.default.rightMenuMobileTC,
1249
+ rightMenuMobileCC = _data2.default.rightMenuMobileCC;
1250
+
1251
+ switch (position) {
1252
+ case "left":
1253
+ {
1254
+ return this.getMenuByEnvironment(leftMenu, leftMenuTC, [], []);
1255
+ }
1256
+ case "centerLeft":
1257
+ {
1258
+ return this.getMenuByEnvironment(centerLeftMenu, centerLeftMenu, centerLeftMenuMobileTC, centerLeftMenuMobileCC);
1259
+ }
1260
+ case "centerRight":
1261
+ {
1262
+ return this.getMenuByEnvironment(centerRightMenu, centerRightMenu, centerRightMenuMobileTC, centerRightMenuMobileCC);
1263
+ }
1264
+ case "right":
1265
+ {
1266
+ return this.getMenuByEnvironment(rightMenu, rightMenuTC, rightMenuMobileTC, rightMenuMobileCC);
1267
+ }
1268
+ }
1269
+ }
1270
+ }, {
1271
+ key: 'getMenuByEnvironment',
1272
+ value: function getMenuByEnvironment(ccMenu, tcMenu, tcMobilMenu, ccMobilMenu) {
1273
+ if (this.isNewRetailBCPosTC) {
1274
+ // if(this.isMobileEnvironment){
1275
+ // return tcMobilMenu;
1276
+ // }else{
1277
+ // return tcMenu;
1278
+ // }
1279
+ return tcMenu;
1280
+ } else {
1281
+ // if(this.isMobileEnvironment){
1282
+ // return ccMobilMenu;
1283
+ // }else{
1284
+ // return ccMenu;
1285
+ // }
1286
+ return ccMenu;
1287
+ }
1288
+ }
1289
+ }, {
1290
+ key: 'componentDidMount',
1291
+ value: function componentDidMount() {
1292
+ this.initPageData();
1293
+ // console.error(stores, this.context.stores, 'ppppppppppp')
1294
+ // this.k = new stores.IframeStore();
1295
+ // console.error(this.k, '///////////?????????????????')
1296
+ this.isHsyIframeInclude && this.initCCFrameWin();
1297
+ }
1298
+ // 初始化好生意页面
1299
+
1300
+ }, {
1301
+ key: 'initCCFrameWin',
1302
+ value: function initCCFrameWin() {
1303
+ var that = this;
1304
+ if (this.ccFrameWin) {
1305
+ return this.ccFrameWin;
1306
+ };
1307
+ var external_frame = document.getElementById(CC_FRAME_CONF.id);
1308
+
1309
+ this.ccFrameWin = external_frame && external_frame.contentWindow;
1310
+ external_frame && external_frame.addEventListener('load', function () {
1311
+ console.log("ccFrameWin 加载成功^^^^^^^^^^^^^^^^^^^");
1312
+ // 初始化建立一个连接
1313
+ that.ccFrameWin && that.ccFrameWin.postMessage({ type: CC_FRAME_CONF.initConnect, fr: 'pos' }, that.state.loadHsyURL || that.hsy_domain || '*');
1314
+ });
1315
+ return this.ccFrameWin;
1316
+ }
1317
+ // 初始化商米副屏
1318
+
1319
+ }, {
1320
+ key: 'hsyBasicInfoInit',
1321
+
1322
+
1323
+ // 初始化智+模块信息
1324
+ value: function hsyBasicInfoInit() {
1325
+ var theme = _mutantsMicrofx.stores.portalStore.themeStore;
1326
+ var color = '#FF8C25';
1327
+ switch (theme) {
1328
+ case 'orange':
1329
+ color = "#FF8C25";
1330
+ break;
1331
+ case 'blue':
1332
+ color = "#3491FF";
1333
+ break;
1334
+ case 'dark':
1335
+ color = "#26A0DE";
1336
+ break;
1337
+ case 'pink':
1338
+ color = "#FF6B8C";
1339
+ break;
1340
+ }
1341
+
1342
+ var _ref14 = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('StoreKey') || {},
1343
+ _ref14$PosId = _ref14.PosId,
1344
+ PosId = _ref14$PosId === undefined ? '' : _ref14$PosId;
1345
+
1346
+ var cc_url = this.hsy_domain.replace('#/', '') + '?fromApp=nretail&posid=' + PosId + '&content_only=true&bar_bg=' + encodeURIComponent('#FFFFFF') + '&bar_active_bg=' + encodeURIComponent(color);
1347
+ this.setState({ loadHsyURL: cc_url });
1348
+ }
1349
+
1350
+ //初始化tc、tcyzj、tczsy信息
1351
+
1352
+ }, {
1353
+ key: 'componentWillUnmount',
1354
+ value: function componentWillUnmount() {
1355
+ var _context$headHook = this.context.headHook;
1356
+ _context$headHook = _context$headHook === undefined ? {} : _context$headHook;
1357
+ var removeClass = _context$headHook.removeClass;
1358
+
1359
+ removeClass && removeClass(this.state.id, 'portalHead');
1360
+ }
1361
+ }, {
1362
+ key: 'componentWillReceiveProps',
1363
+ value: function componentWillReceiveProps() {
1364
+ if (this.getScreenType() === true) {
1365
+ if (this.isHorizontalSunMi && this.FuPingIsLoaded) {
1366
+ window.sunMi_PresentationManager && window.sunMi_PresentationManager.sendMessageToSecondScreen({ step: 1 });
1367
+ } else {
1368
+ _mutantsMicrofx.nativeMs && _mutantsMicrofx.nativeMs.setIpcRendererMethod('ReplyScreen', { step: 1 });
1369
+ }
1370
+ }
1371
+ }
1372
+
1373
+ // 获取副屏的状态
1374
+
1375
+ }, {
1376
+ key: 'menuClick',
1377
+ value: function menuClick(item, e) {
1378
+ _mutantsMicrofx.history.push(item.path);
1379
+ }
1380
+
1381
+ //跳转其他页面,以内嵌形式打开
1382
+
1383
+
1384
+ //跳转到T+
1385
+
1386
+
1387
+ //跳转CC
1388
+
1389
+ }, {
1390
+ key: 'render',
1391
+ value: function render() {
1392
+ var _state = this.state,
1393
+ showModal = _state.showModal,
1394
+ showMoreModal = _state.showMoreModal,
1395
+ modalURL = _state.modalURL,
1396
+ loadHsyPage = _state.loadHsyPage,
1397
+ loadHsyURL = _state.loadHsyURL,
1398
+ loadTcPage = _state.loadTcPage,
1399
+ loadTcURL = _state.loadTcURL;
1400
+
1401
+ var screenHeight = window.screen.availHeight - 100;
1402
+ var htmlContent = null;
1403
+ if (this.isVerticalTouch) {
1404
+ htmlContent = _react2.default.createElement(_verticalPortal2.default, { handelClick: this.handelClick });
1405
+ }
1406
+ // else if (this.isHorizontalPad) {
1407
+ // htmlContent = <HorizontalPadPortal handelClick={this.handelClick} />
1408
+ // }
1409
+ else {
1410
+ htmlContent = _react2.default.createElement(
1411
+ _tplusComponentsTouch.Layout,
1412
+ { style: { height: '100%' }, className: 'portal-content' },
1413
+ _react2.default.createElement(
1414
+ Content,
1415
+ { style: { paddingLeft: '50px', paddingRight: '50px' }, className: 'portal-container portal-container-center' },
1416
+ _react2.default.createElement(
1417
+ _antd.Row,
1418
+ { className: 'portal-content-row' },
1419
+ this.createLeftNode(),
1420
+ _react2.default.createElement(
1421
+ _antd.Col,
1422
+ { xl: 10, md: 10, className: 'portal-center-col', key: 'center' },
1423
+ _react2.default.createElement(
1424
+ 'div',
1425
+ { className: 'portal-center-content' },
1426
+ this.createCenterNode()
1427
+ )
1428
+ ),
1429
+ this.createRightNode()
1430
+ )
1431
+ ),
1432
+ _react2.default.createElement(
1433
+ 'div',
1434
+ { className: loadHsyPage ? 'portal-hsy-tc-container' : 'portal-hsy-tc-container portal-hsy-tc-container-hide' },
1435
+ _react2.default.createElement('iframe', { src: loadHsyURL, width: '100%', height: '93%', frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true', id: CC_FRAME_CONF.id })
1436
+ ),
1437
+ _react2.default.createElement(
1438
+ 'div',
1439
+ { className: loadTcPage ? 'portal-hsy-tc-container' : 'portal-hsy-tc-container portal-hsy-tc-container-hide' },
1440
+ _react2.default.createElement('iframe', { src: loadTcURL, width: '100%', height: '93%', frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true', id: 'external-frame-tc' })
1441
+ ),
1442
+ this.isMobileEnvironment && _react2.default.createElement(
1443
+ _antd.Modal,
1444
+ {
1445
+ visible: showModal,
1446
+ onCancel: this.closeFrameModal,
1447
+ width: '99%',
1448
+ height: '99%',
1449
+ footer: null
1450
+ },
1451
+ _react2.default.createElement('iframe', { src: modalURL, width: '100%', height: screenHeight, frameborder: 'no', border: '0', marginwidth: '0', marginheight: '0', scrolling: 'yes', allowtransparency: 'true' })
1452
+ ),
1453
+ _react2.default.createElement(
1454
+ _antd.Modal,
1455
+ {
1456
+ title: '更多',
1457
+ className: 'portal-container-modal-more',
1458
+ visible: showMoreModal,
1459
+ onCancel: this.closeMoreModal,
1460
+ width: 800,
1461
+ height: 375,
1462
+ footer: null,
1463
+ centered: true,
1464
+ maskClosable: false,
1465
+ keyboard: false
1466
+ },
1467
+ this.createMoreNode()
1468
+ )
1469
+ );
1470
+ }
1471
+ return htmlContent;
1472
+ }
1473
+ }]);
1474
+ return _default;
1475
+ }(_react.Component), _class2.propTypes = {
1476
+ routes: _propTypes2.default.array
1477
+ }, _class2.contextTypes = {
1478
+ stores: _propTypes2.default.object,
1479
+ infoRender: _propTypes2.default.func,
1480
+ headHook: _propTypes2.default.object
1481
+ }, _temp)) || _class;
1482
+
1483
+ exports.default = _default;
1484
+ //# sourceMappingURL=index.bak.js.map