@fonixtree/magic-design 0.0.52 → 0.0.54
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.
- package/es/common/LinkModal/ProductDetailPage/index.js +3 -3
- package/es/composite-comp/dito/components/Recommend/pc/index.js +113 -12
- package/es/composite-comp/dito/components/Recommend/pc/index.less +40 -9
- package/es/utils/coreUtil.js +3 -1
- package/lib/common/LinkModal/ProductDetailPage/index.js +3 -3
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +113 -12
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +40 -9
- package/lib/utils/coreUtil.js +3 -1
- package/package.json +1 -1
|
@@ -232,7 +232,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
232
232
|
|
|
233
233
|
var _j = (0, _react.useState)({
|
|
234
234
|
pageSize: 20,
|
|
235
|
-
|
|
235
|
+
pageIndex: 1
|
|
236
236
|
}),
|
|
237
237
|
paginationParams = _j[0],
|
|
238
238
|
setPaginationParams = _j[1];
|
|
@@ -399,7 +399,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
399
399
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
400
400
|
onClick: function onClick() {
|
|
401
401
|
setLoading(true);
|
|
402
|
-
paginationParams.
|
|
402
|
+
paginationParams.pageIndex = 1;
|
|
403
403
|
|
|
404
404
|
var total = paginationParams.total,
|
|
405
405
|
params = __rest(paginationParams, ["total"]);
|
|
@@ -468,7 +468,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
468
468
|
pagination: __assign(__assign({}, paginationParams), {
|
|
469
469
|
onChange: function onChange(page) {
|
|
470
470
|
setLoading(true);
|
|
471
|
-
paginationParams.
|
|
471
|
+
paginationParams.pageIndex = page;
|
|
472
472
|
|
|
473
473
|
var total = paginationParams.total,
|
|
474
474
|
params = __rest(paginationParams, ["total"]);
|
|
@@ -13,6 +13,8 @@ require("./index.less");
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _lodash = _interopRequireDefault(require("lodash.throttle"));
|
|
17
|
+
|
|
16
18
|
var _mobx = require("../../../../../mobx");
|
|
17
19
|
|
|
18
20
|
var _ProductItem = _interopRequireDefault(require("../../../../common/components/ProductItem"));
|
|
@@ -25,6 +27,8 @@ var _commonUtil = require("../../../../../utils/commonUtil");
|
|
|
25
27
|
|
|
26
28
|
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
27
29
|
|
|
30
|
+
var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
|
|
31
|
+
|
|
28
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
33
|
|
|
30
34
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -231,13 +235,21 @@ var LAYOUT_IMAGE_SIZE = {
|
|
|
231
235
|
w: '100%',
|
|
232
236
|
h: 180
|
|
233
237
|
},
|
|
234
|
-
|
|
238
|
+
layout2_col6: {
|
|
235
239
|
w: 160,
|
|
236
240
|
h: 160
|
|
237
241
|
},
|
|
238
|
-
|
|
239
|
-
w:
|
|
240
|
-
h:
|
|
242
|
+
layout2_col5: {
|
|
243
|
+
w: 200,
|
|
244
|
+
h: 200
|
|
245
|
+
},
|
|
246
|
+
layout3_col6: {
|
|
247
|
+
w: 160,
|
|
248
|
+
h: 160
|
|
249
|
+
},
|
|
250
|
+
layout3_col5: {
|
|
251
|
+
w: 200,
|
|
252
|
+
h: 200
|
|
241
253
|
}
|
|
242
254
|
};
|
|
243
255
|
|
|
@@ -254,14 +266,27 @@ function (_super) {
|
|
|
254
266
|
_this._cache = (0, _coreUtil.isDesignMode)() ? {} : (0, _commonUtil.ensure)(function () {
|
|
255
267
|
return (0, _storeUtil.getMagicStore)("recommend_" + _this.props.panelProps.id);
|
|
256
268
|
}, {});
|
|
269
|
+
_this.scrollRef = /*#__PURE__*/_react["default"].createRef();
|
|
257
270
|
_this.state = __assign({
|
|
258
271
|
tabIndex: 0,
|
|
259
272
|
tabLeft: 0,
|
|
260
273
|
tabWidth: 0,
|
|
261
274
|
groupSource: [],
|
|
262
|
-
hideTabs: false
|
|
275
|
+
hideTabs: false,
|
|
276
|
+
scrollToLeftDisabled: true,
|
|
277
|
+
scrollToRightDisabled: true
|
|
263
278
|
}, _this._cache);
|
|
264
279
|
|
|
280
|
+
_this.setScrollDisabled = function (scrollDom) {
|
|
281
|
+
var scrollToLeftDisabled = scrollDom.scrollLeft === 0;
|
|
282
|
+
var scrollToRightDisabled = scrollDom.clientWidth + scrollDom.scrollLeft >= scrollDom.scrollWidth;
|
|
283
|
+
|
|
284
|
+
_this.setState({
|
|
285
|
+
scrollToLeftDisabled: scrollToLeftDisabled,
|
|
286
|
+
scrollToRightDisabled: scrollToRightDisabled
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
|
|
265
290
|
_this.initTab = function (index, hideTabs) {
|
|
266
291
|
var selectedTabDom = document.querySelector(".tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
|
|
267
292
|
var tabLeft = 0;
|
|
@@ -462,6 +487,34 @@ function (_super) {
|
|
|
462
487
|
});
|
|
463
488
|
|
|
464
489
|
_this.getProductList(index);
|
|
490
|
+
|
|
491
|
+
setTimeout(function () {
|
|
492
|
+
var scrollDom = _this.scrollRef.current;
|
|
493
|
+
|
|
494
|
+
if (scrollDom) {
|
|
495
|
+
_this.setScrollDisabled(scrollDom);
|
|
496
|
+
|
|
497
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
498
|
+
_this.setScrollDisabled(scrollDom);
|
|
499
|
+
}, 500);
|
|
500
|
+
}
|
|
501
|
+
}, 0);
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
_this.scrollToRight = function () {
|
|
505
|
+
var scrollDom = _this.scrollRef.current;
|
|
506
|
+
|
|
507
|
+
if (scrollDom.clientWidth + scrollDom.scrollLeft < scrollDom.scrollWidth) {
|
|
508
|
+
scrollDom.scrollTo(scrollDom.scrollLeft + scrollDom.clientWidth, 0);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
_this.scrollToLeft = function () {
|
|
513
|
+
var scrollDom = _this.scrollRef.current;
|
|
514
|
+
|
|
515
|
+
if (scrollDom.scrollLeft > 0) {
|
|
516
|
+
scrollDom.scrollTo(scrollDom.scrollLeft - scrollDom.clientWidth, 0);
|
|
517
|
+
}
|
|
465
518
|
};
|
|
466
519
|
|
|
467
520
|
return _this;
|
|
@@ -483,6 +536,17 @@ function (_super) {
|
|
|
483
536
|
|
|
484
537
|
_this.getProductList(0);
|
|
485
538
|
});
|
|
539
|
+
setTimeout(function () {
|
|
540
|
+
var scrollDom = _this.scrollRef.current;
|
|
541
|
+
|
|
542
|
+
if (scrollDom) {
|
|
543
|
+
_this.setScrollDisabled(scrollDom);
|
|
544
|
+
|
|
545
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
546
|
+
_this.setScrollDisabled(scrollDom);
|
|
547
|
+
}, 500);
|
|
548
|
+
}
|
|
549
|
+
}, 0);
|
|
486
550
|
};
|
|
487
551
|
|
|
488
552
|
RecommendMobile.prototype.componentWillReceiveProps = function () {
|
|
@@ -528,6 +592,17 @@ function (_super) {
|
|
|
528
592
|
|
|
529
593
|
if (curLayout !== this.preLayout) {
|
|
530
594
|
this.resetLayout();
|
|
595
|
+
setTimeout(function () {
|
|
596
|
+
var scrollDom = _this.scrollRef.current;
|
|
597
|
+
|
|
598
|
+
if (scrollDom) {
|
|
599
|
+
_this.setScrollDisabled(scrollDom);
|
|
600
|
+
|
|
601
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
602
|
+
_this.setScrollDisabled(scrollDom);
|
|
603
|
+
}, 500);
|
|
604
|
+
}
|
|
605
|
+
}, 0);
|
|
531
606
|
}
|
|
532
607
|
|
|
533
608
|
this.preLayout = curLayout;
|
|
@@ -542,7 +617,9 @@ function (_super) {
|
|
|
542
617
|
tabLeft = _a.tabLeft,
|
|
543
618
|
tabWidth = _a.tabWidth,
|
|
544
619
|
groupSource = _a.groupSource,
|
|
545
|
-
hideTabs = _a.hideTabs
|
|
620
|
+
hideTabs = _a.hideTabs,
|
|
621
|
+
scrollToLeftDisabled = _a.scrollToLeftDisabled,
|
|
622
|
+
scrollToRightDisabled = _a.scrollToRightDisabled;
|
|
546
623
|
var bgStyle = this.getBackgroundStyle();
|
|
547
624
|
var products = this.state["products" + tabIndex] || [];
|
|
548
625
|
var isDivide = groupSource.length <= 3;
|
|
@@ -553,10 +630,10 @@ function (_super) {
|
|
|
553
630
|
}, '');
|
|
554
631
|
|
|
555
632
|
var imgHeight = (0, _commonUtil.ensure)(function () {
|
|
556
|
-
return LAYOUT_IMAGE_SIZE[layout].h;
|
|
633
|
+
return layout === 'layout1' ? LAYOUT_IMAGE_SIZE[layout].h : LAYOUT_IMAGE_SIZE[layout + "_col" + panelProps.customize.pcRowNum].h;
|
|
557
634
|
}, 140);
|
|
558
635
|
var imgWidth = (0, _commonUtil.ensure)(function () {
|
|
559
|
-
return LAYOUT_IMAGE_SIZE[layout].w;
|
|
636
|
+
return layout === 'layout1' ? LAYOUT_IMAGE_SIZE[layout].w : LAYOUT_IMAGE_SIZE[layout + "_col" + panelProps.customize.pcRowNum].w;
|
|
560
637
|
}, 140);
|
|
561
638
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
562
639
|
className: "m-recommend-pc",
|
|
@@ -598,8 +675,22 @@ function (_super) {
|
|
|
598
675
|
transform: "translateX(" + tabLeft + "px)",
|
|
599
676
|
background: this.getTabBarActiveColor(panelProps)
|
|
600
677
|
}
|
|
601
|
-
})),
|
|
678
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
679
|
+
className: "tab-content"
|
|
680
|
+
}, layout !== 'layout1' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
681
|
+
className: "arrow-icon left",
|
|
682
|
+
onClick: function onClick() {
|
|
683
|
+
return _this.scrollToLeft();
|
|
684
|
+
}
|
|
685
|
+
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
686
|
+
color: scrollToLeftDisabled ? '#BDC1C8' : '#232F46',
|
|
687
|
+
size: 20,
|
|
688
|
+
type: "icon-outlined-left"
|
|
689
|
+
})), layout === 'layout1' ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
690
|
+
className: "tab-list"
|
|
691
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
602
692
|
key: "macyContainer",
|
|
693
|
+
ref: this.scrollRef,
|
|
603
694
|
className: "macyContainer"
|
|
604
695
|
}, products.map(function (item) {
|
|
605
696
|
return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
|
|
@@ -609,7 +700,7 @@ function (_super) {
|
|
|
609
700
|
imgHeight: imgHeight,
|
|
610
701
|
imgWidth: imgWidth,
|
|
611
702
|
onItemClick: function onItemClick() {
|
|
612
|
-
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId
|
|
703
|
+
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId);
|
|
613
704
|
},
|
|
614
705
|
panelProps: panelProps.content,
|
|
615
706
|
showProgress: false
|
|
@@ -621,6 +712,7 @@ function (_super) {
|
|
|
621
712
|
data: _seeAll
|
|
622
713
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
623
714
|
key: "scrollContainer",
|
|
715
|
+
ref: this.scrollRef,
|
|
624
716
|
className: (0, _classnames["default"])('scrollContainer', {
|
|
625
717
|
pl_100: layout === 'layout3'
|
|
626
718
|
})
|
|
@@ -634,7 +726,7 @@ function (_super) {
|
|
|
634
726
|
imgHeight: imgHeight,
|
|
635
727
|
imgWidth: imgWidth,
|
|
636
728
|
onItemClick: function onItemClick() {
|
|
637
|
-
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId
|
|
729
|
+
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId);
|
|
638
730
|
},
|
|
639
731
|
panelProps: panelProps.content,
|
|
640
732
|
showProgress: false
|
|
@@ -642,7 +734,16 @@ function (_super) {
|
|
|
642
734
|
}), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
643
735
|
className: "btnSeeAll",
|
|
644
736
|
data: _seeAll
|
|
645
|
-
}))
|
|
737
|
+
})), layout !== 'layout1' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
738
|
+
className: "arrow-icon right",
|
|
739
|
+
onClick: function onClick() {
|
|
740
|
+
return _this.scrollToRight();
|
|
741
|
+
}
|
|
742
|
+
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
743
|
+
color: scrollToRightDisabled ? '#BDC1C8' : '#232F46',
|
|
744
|
+
size: 20,
|
|
745
|
+
type: "icon-outlined-right"
|
|
746
|
+
}))));
|
|
646
747
|
};
|
|
647
748
|
|
|
648
749
|
RecommendMobile.defaultProps = {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
.m-recommend-pc {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
+
position: relative;
|
|
4
5
|
|
|
5
6
|
.ant-tabs-nav-operations {
|
|
6
7
|
display: none !important;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
::-webkit-scrollbar {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
10
|
+
// ::-webkit-scrollbar {
|
|
11
|
+
// width: 0;
|
|
12
|
+
// height: 0;
|
|
13
|
+
// display: none;
|
|
14
|
+
// }
|
|
15
15
|
|
|
16
16
|
.tab-select-wrap {
|
|
17
17
|
display: flex;
|
|
@@ -49,16 +49,47 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
.tab-content {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
.tab-list {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.arrow-icon {
|
|
63
|
+
display: block;
|
|
64
|
+
width: 36px;
|
|
65
|
+
height: 36px;
|
|
66
|
+
line-height: 42px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
background: #FFFFFF;
|
|
69
|
+
box-shadow: -1px -1px 4px rgba(45, 48, 64, 0.08), 1px 1px 4px rgba(45, 48, 64, 0.08);
|
|
70
|
+
border-radius: 100px;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
|
|
73
|
+
&.left {
|
|
74
|
+
margin-right: 40px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.right {
|
|
78
|
+
margin-left: 40px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
52
82
|
.macyContainer {
|
|
53
83
|
display: flex;
|
|
54
|
-
margin: 0
|
|
84
|
+
margin: 0;
|
|
55
85
|
}
|
|
56
86
|
|
|
57
87
|
.scrollContainer {
|
|
58
88
|
display: flex;
|
|
59
89
|
flex-direction: row;
|
|
60
90
|
align-items: center;
|
|
61
|
-
|
|
91
|
+
flex: 1;
|
|
92
|
+
margin: 0;
|
|
62
93
|
overflow-x: auto;
|
|
63
94
|
padding-bottom: 15px;
|
|
64
95
|
|
|
@@ -67,7 +98,7 @@
|
|
|
67
98
|
}
|
|
68
99
|
|
|
69
100
|
.productCard {
|
|
70
|
-
margin-right:
|
|
101
|
+
margin-right: 20px;
|
|
71
102
|
}
|
|
72
103
|
}
|
|
73
104
|
|
package/es/utils/coreUtil.js
CHANGED
|
@@ -87,7 +87,9 @@ var clickUrl = function clickUrl(url) {
|
|
|
87
87
|
if (url.startsWith('/')) {
|
|
88
88
|
(0, _commonUtil.navigateTo)(url);
|
|
89
89
|
} else {
|
|
90
|
-
location.href = url;
|
|
90
|
+
// location.href = url;
|
|
91
|
+
var newUrl = isPc() ? pcLink : h5Link;
|
|
92
|
+
(0, _commonUtil.navigateTo)(newUrl);
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
return;
|
|
@@ -232,7 +232,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
232
232
|
|
|
233
233
|
var _j = (0, _react.useState)({
|
|
234
234
|
pageSize: 20,
|
|
235
|
-
|
|
235
|
+
pageIndex: 1
|
|
236
236
|
}),
|
|
237
237
|
paginationParams = _j[0],
|
|
238
238
|
setPaginationParams = _j[1];
|
|
@@ -399,7 +399,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
399
399
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
400
400
|
onClick: function onClick() {
|
|
401
401
|
setLoading(true);
|
|
402
|
-
paginationParams.
|
|
402
|
+
paginationParams.pageIndex = 1;
|
|
403
403
|
|
|
404
404
|
var total = paginationParams.total,
|
|
405
405
|
params = __rest(paginationParams, ["total"]);
|
|
@@ -468,7 +468,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
|
|
|
468
468
|
pagination: __assign(__assign({}, paginationParams), {
|
|
469
469
|
onChange: function onChange(page) {
|
|
470
470
|
setLoading(true);
|
|
471
|
-
paginationParams.
|
|
471
|
+
paginationParams.pageIndex = page;
|
|
472
472
|
|
|
473
473
|
var total = paginationParams.total,
|
|
474
474
|
params = __rest(paginationParams, ["total"]);
|
|
@@ -13,6 +13,8 @@ require("./index.less");
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _lodash = _interopRequireDefault(require("lodash.throttle"));
|
|
17
|
+
|
|
16
18
|
var _mobx = require("../../../../../mobx");
|
|
17
19
|
|
|
18
20
|
var _ProductItem = _interopRequireDefault(require("../../../../common/components/ProductItem"));
|
|
@@ -25,6 +27,8 @@ var _commonUtil = require("../../../../../utils/commonUtil");
|
|
|
25
27
|
|
|
26
28
|
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
27
29
|
|
|
30
|
+
var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
|
|
31
|
+
|
|
28
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
33
|
|
|
30
34
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -231,13 +235,21 @@ var LAYOUT_IMAGE_SIZE = {
|
|
|
231
235
|
w: '100%',
|
|
232
236
|
h: 180
|
|
233
237
|
},
|
|
234
|
-
|
|
238
|
+
layout2_col6: {
|
|
235
239
|
w: 160,
|
|
236
240
|
h: 160
|
|
237
241
|
},
|
|
238
|
-
|
|
239
|
-
w:
|
|
240
|
-
h:
|
|
242
|
+
layout2_col5: {
|
|
243
|
+
w: 200,
|
|
244
|
+
h: 200
|
|
245
|
+
},
|
|
246
|
+
layout3_col6: {
|
|
247
|
+
w: 160,
|
|
248
|
+
h: 160
|
|
249
|
+
},
|
|
250
|
+
layout3_col5: {
|
|
251
|
+
w: 200,
|
|
252
|
+
h: 200
|
|
241
253
|
}
|
|
242
254
|
};
|
|
243
255
|
|
|
@@ -254,14 +266,27 @@ function (_super) {
|
|
|
254
266
|
_this._cache = (0, _coreUtil.isDesignMode)() ? {} : (0, _commonUtil.ensure)(function () {
|
|
255
267
|
return (0, _storeUtil.getMagicStore)("recommend_" + _this.props.panelProps.id);
|
|
256
268
|
}, {});
|
|
269
|
+
_this.scrollRef = /*#__PURE__*/_react["default"].createRef();
|
|
257
270
|
_this.state = __assign({
|
|
258
271
|
tabIndex: 0,
|
|
259
272
|
tabLeft: 0,
|
|
260
273
|
tabWidth: 0,
|
|
261
274
|
groupSource: [],
|
|
262
|
-
hideTabs: false
|
|
275
|
+
hideTabs: false,
|
|
276
|
+
scrollToLeftDisabled: true,
|
|
277
|
+
scrollToRightDisabled: true
|
|
263
278
|
}, _this._cache);
|
|
264
279
|
|
|
280
|
+
_this.setScrollDisabled = function (scrollDom) {
|
|
281
|
+
var scrollToLeftDisabled = scrollDom.scrollLeft === 0;
|
|
282
|
+
var scrollToRightDisabled = scrollDom.clientWidth + scrollDom.scrollLeft >= scrollDom.scrollWidth;
|
|
283
|
+
|
|
284
|
+
_this.setState({
|
|
285
|
+
scrollToLeftDisabled: scrollToLeftDisabled,
|
|
286
|
+
scrollToRightDisabled: scrollToRightDisabled
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
|
|
265
290
|
_this.initTab = function (index, hideTabs) {
|
|
266
291
|
var selectedTabDom = document.querySelector(".tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
|
|
267
292
|
var tabLeft = 0;
|
|
@@ -462,6 +487,34 @@ function (_super) {
|
|
|
462
487
|
});
|
|
463
488
|
|
|
464
489
|
_this.getProductList(index);
|
|
490
|
+
|
|
491
|
+
setTimeout(function () {
|
|
492
|
+
var scrollDom = _this.scrollRef.current;
|
|
493
|
+
|
|
494
|
+
if (scrollDom) {
|
|
495
|
+
_this.setScrollDisabled(scrollDom);
|
|
496
|
+
|
|
497
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
498
|
+
_this.setScrollDisabled(scrollDom);
|
|
499
|
+
}, 500);
|
|
500
|
+
}
|
|
501
|
+
}, 0);
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
_this.scrollToRight = function () {
|
|
505
|
+
var scrollDom = _this.scrollRef.current;
|
|
506
|
+
|
|
507
|
+
if (scrollDom.clientWidth + scrollDom.scrollLeft < scrollDom.scrollWidth) {
|
|
508
|
+
scrollDom.scrollTo(scrollDom.scrollLeft + scrollDom.clientWidth, 0);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
_this.scrollToLeft = function () {
|
|
513
|
+
var scrollDom = _this.scrollRef.current;
|
|
514
|
+
|
|
515
|
+
if (scrollDom.scrollLeft > 0) {
|
|
516
|
+
scrollDom.scrollTo(scrollDom.scrollLeft - scrollDom.clientWidth, 0);
|
|
517
|
+
}
|
|
465
518
|
};
|
|
466
519
|
|
|
467
520
|
return _this;
|
|
@@ -483,6 +536,17 @@ function (_super) {
|
|
|
483
536
|
|
|
484
537
|
_this.getProductList(0);
|
|
485
538
|
});
|
|
539
|
+
setTimeout(function () {
|
|
540
|
+
var scrollDom = _this.scrollRef.current;
|
|
541
|
+
|
|
542
|
+
if (scrollDom) {
|
|
543
|
+
_this.setScrollDisabled(scrollDom);
|
|
544
|
+
|
|
545
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
546
|
+
_this.setScrollDisabled(scrollDom);
|
|
547
|
+
}, 500);
|
|
548
|
+
}
|
|
549
|
+
}, 0);
|
|
486
550
|
};
|
|
487
551
|
|
|
488
552
|
RecommendMobile.prototype.componentWillReceiveProps = function () {
|
|
@@ -528,6 +592,17 @@ function (_super) {
|
|
|
528
592
|
|
|
529
593
|
if (curLayout !== this.preLayout) {
|
|
530
594
|
this.resetLayout();
|
|
595
|
+
setTimeout(function () {
|
|
596
|
+
var scrollDom = _this.scrollRef.current;
|
|
597
|
+
|
|
598
|
+
if (scrollDom) {
|
|
599
|
+
_this.setScrollDisabled(scrollDom);
|
|
600
|
+
|
|
601
|
+
scrollDom.onscroll = (0, _lodash["default"])(function () {
|
|
602
|
+
_this.setScrollDisabled(scrollDom);
|
|
603
|
+
}, 500);
|
|
604
|
+
}
|
|
605
|
+
}, 0);
|
|
531
606
|
}
|
|
532
607
|
|
|
533
608
|
this.preLayout = curLayout;
|
|
@@ -542,7 +617,9 @@ function (_super) {
|
|
|
542
617
|
tabLeft = _a.tabLeft,
|
|
543
618
|
tabWidth = _a.tabWidth,
|
|
544
619
|
groupSource = _a.groupSource,
|
|
545
|
-
hideTabs = _a.hideTabs
|
|
620
|
+
hideTabs = _a.hideTabs,
|
|
621
|
+
scrollToLeftDisabled = _a.scrollToLeftDisabled,
|
|
622
|
+
scrollToRightDisabled = _a.scrollToRightDisabled;
|
|
546
623
|
var bgStyle = this.getBackgroundStyle();
|
|
547
624
|
var products = this.state["products" + tabIndex] || [];
|
|
548
625
|
var isDivide = groupSource.length <= 3;
|
|
@@ -553,10 +630,10 @@ function (_super) {
|
|
|
553
630
|
}, '');
|
|
554
631
|
|
|
555
632
|
var imgHeight = (0, _commonUtil.ensure)(function () {
|
|
556
|
-
return LAYOUT_IMAGE_SIZE[layout].h;
|
|
633
|
+
return layout === 'layout1' ? LAYOUT_IMAGE_SIZE[layout].h : LAYOUT_IMAGE_SIZE[layout + "_col" + panelProps.customize.pcRowNum].h;
|
|
557
634
|
}, 140);
|
|
558
635
|
var imgWidth = (0, _commonUtil.ensure)(function () {
|
|
559
|
-
return LAYOUT_IMAGE_SIZE[layout].w;
|
|
636
|
+
return layout === 'layout1' ? LAYOUT_IMAGE_SIZE[layout].w : LAYOUT_IMAGE_SIZE[layout + "_col" + panelProps.customize.pcRowNum].w;
|
|
560
637
|
}, 140);
|
|
561
638
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
562
639
|
className: "m-recommend-pc",
|
|
@@ -598,8 +675,22 @@ function (_super) {
|
|
|
598
675
|
transform: "translateX(" + tabLeft + "px)",
|
|
599
676
|
background: this.getTabBarActiveColor(panelProps)
|
|
600
677
|
}
|
|
601
|
-
})),
|
|
678
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
679
|
+
className: "tab-content"
|
|
680
|
+
}, layout !== 'layout1' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
681
|
+
className: "arrow-icon left",
|
|
682
|
+
onClick: function onClick() {
|
|
683
|
+
return _this.scrollToLeft();
|
|
684
|
+
}
|
|
685
|
+
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
686
|
+
color: scrollToLeftDisabled ? '#BDC1C8' : '#232F46',
|
|
687
|
+
size: 20,
|
|
688
|
+
type: "icon-outlined-left"
|
|
689
|
+
})), layout === 'layout1' ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
690
|
+
className: "tab-list"
|
|
691
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
602
692
|
key: "macyContainer",
|
|
693
|
+
ref: this.scrollRef,
|
|
603
694
|
className: "macyContainer"
|
|
604
695
|
}, products.map(function (item) {
|
|
605
696
|
return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
|
|
@@ -609,7 +700,7 @@ function (_super) {
|
|
|
609
700
|
imgHeight: imgHeight,
|
|
610
701
|
imgWidth: imgWidth,
|
|
611
702
|
onItemClick: function onItemClick() {
|
|
612
|
-
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId
|
|
703
|
+
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId);
|
|
613
704
|
},
|
|
614
705
|
panelProps: panelProps.content,
|
|
615
706
|
showProgress: false
|
|
@@ -621,6 +712,7 @@ function (_super) {
|
|
|
621
712
|
data: _seeAll
|
|
622
713
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
623
714
|
key: "scrollContainer",
|
|
715
|
+
ref: this.scrollRef,
|
|
624
716
|
className: (0, _classnames["default"])('scrollContainer', {
|
|
625
717
|
pl_100: layout === 'layout3'
|
|
626
718
|
})
|
|
@@ -634,7 +726,7 @@ function (_super) {
|
|
|
634
726
|
imgHeight: imgHeight,
|
|
635
727
|
imgWidth: imgWidth,
|
|
636
728
|
onItemClick: function onItemClick() {
|
|
637
|
-
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId
|
|
729
|
+
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId);
|
|
638
730
|
},
|
|
639
731
|
panelProps: panelProps.content,
|
|
640
732
|
showProgress: false
|
|
@@ -642,7 +734,16 @@ function (_super) {
|
|
|
642
734
|
}), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
643
735
|
className: "btnSeeAll",
|
|
644
736
|
data: _seeAll
|
|
645
|
-
}))
|
|
737
|
+
})), layout !== 'layout1' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
738
|
+
className: "arrow-icon right",
|
|
739
|
+
onClick: function onClick() {
|
|
740
|
+
return _this.scrollToRight();
|
|
741
|
+
}
|
|
742
|
+
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
743
|
+
color: scrollToRightDisabled ? '#BDC1C8' : '#232F46',
|
|
744
|
+
size: 20,
|
|
745
|
+
type: "icon-outlined-right"
|
|
746
|
+
}))));
|
|
646
747
|
};
|
|
647
748
|
|
|
648
749
|
RecommendMobile.defaultProps = {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
.m-recommend-pc {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
+
position: relative;
|
|
4
5
|
|
|
5
6
|
.ant-tabs-nav-operations {
|
|
6
7
|
display: none !important;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
::-webkit-scrollbar {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
10
|
+
// ::-webkit-scrollbar {
|
|
11
|
+
// width: 0;
|
|
12
|
+
// height: 0;
|
|
13
|
+
// display: none;
|
|
14
|
+
// }
|
|
15
15
|
|
|
16
16
|
.tab-select-wrap {
|
|
17
17
|
display: flex;
|
|
@@ -49,16 +49,47 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
.tab-content {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
.tab-list {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.arrow-icon {
|
|
63
|
+
display: block;
|
|
64
|
+
width: 36px;
|
|
65
|
+
height: 36px;
|
|
66
|
+
line-height: 42px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
background: #FFFFFF;
|
|
69
|
+
box-shadow: -1px -1px 4px rgba(45, 48, 64, 0.08), 1px 1px 4px rgba(45, 48, 64, 0.08);
|
|
70
|
+
border-radius: 100px;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
|
|
73
|
+
&.left {
|
|
74
|
+
margin-right: 40px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.right {
|
|
78
|
+
margin-left: 40px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
52
82
|
.macyContainer {
|
|
53
83
|
display: flex;
|
|
54
|
-
margin: 0
|
|
84
|
+
margin: 0;
|
|
55
85
|
}
|
|
56
86
|
|
|
57
87
|
.scrollContainer {
|
|
58
88
|
display: flex;
|
|
59
89
|
flex-direction: row;
|
|
60
90
|
align-items: center;
|
|
61
|
-
|
|
91
|
+
flex: 1;
|
|
92
|
+
margin: 0;
|
|
62
93
|
overflow-x: auto;
|
|
63
94
|
padding-bottom: 15px;
|
|
64
95
|
|
|
@@ -67,7 +98,7 @@
|
|
|
67
98
|
}
|
|
68
99
|
|
|
69
100
|
.productCard {
|
|
70
|
-
margin-right:
|
|
101
|
+
margin-right: 20px;
|
|
71
102
|
}
|
|
72
103
|
}
|
|
73
104
|
|
package/lib/utils/coreUtil.js
CHANGED
|
@@ -87,7 +87,9 @@ var clickUrl = function clickUrl(url) {
|
|
|
87
87
|
if (url.startsWith('/')) {
|
|
88
88
|
(0, _commonUtil.navigateTo)(url);
|
|
89
89
|
} else {
|
|
90
|
-
location.href = url;
|
|
90
|
+
// location.href = url;
|
|
91
|
+
var newUrl = isPc() ? pcLink : h5Link;
|
|
92
|
+
(0, _commonUtil.navigateTo)(newUrl);
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
return;
|