@fonixtree/magic-design 0.0.162 → 0.0.164
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/ColorPicker/index.less +2 -1
- package/es/common/Video/index.js +172 -55
- package/es/common/Video/index.less +3 -2
- package/es/composite-comp/bol/components/Carousel/defaultJSON.js +2 -2
- package/es/composite-comp/bol/components/Carousel/mobile/index.js +2 -1
- package/es/composite-comp/bol/components/Carousel/mobile/index.less +6 -1
- package/es/composite-comp/bol/components/Carousel/pc/index.js +8 -2
- package/es/composite-comp/bol/components/Carousel/pc/index.less +7 -2
- package/es/composite-comp/bol/components/Text/index.js +2 -5
- package/es/composite-comp/bol/components/Text/index.less +2 -2
- package/es/composite-comp/bol/components/Video/components/VideoTag/index.less +1 -0
- package/es/composite-comp/bol/components/Video/imgs/play-circle.png +0 -0
- package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +1 -1
- package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +1 -1
- package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +5 -0
- package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +5 -0
- package/es/composite-comp/bol/components/Video/pc/Layout1/index.less +1 -0
- package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +10 -0
- package/es/composite-comp/bol/components/Video/pc/Layout2/index.less +1 -0
- package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +5 -0
- package/es/composite-comp/bol/components/Video/pc/Layout3/index.less +1 -0
- package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +5 -0
- package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +5 -0
- package/es/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
- package/es/core/Designer/ConfigPanel/index.js +10 -1
- package/es/meta-comp/components/Text/index.js +2 -1
- package/es/utils/commonUtil.js +218 -2
- package/lib/common/ColorPicker/index.less +2 -1
- package/lib/common/Video/index.js +172 -55
- package/lib/common/Video/index.less +3 -2
- package/lib/composite-comp/bol/components/Carousel/defaultJSON.js +2 -2
- package/lib/composite-comp/bol/components/Carousel/mobile/index.js +2 -1
- package/lib/composite-comp/bol/components/Carousel/mobile/index.less +6 -1
- package/lib/composite-comp/bol/components/Carousel/pc/index.js +8 -2
- package/lib/composite-comp/bol/components/Carousel/pc/index.less +7 -2
- package/lib/composite-comp/bol/components/Text/index.js +2 -5
- package/lib/composite-comp/bol/components/Text/index.less +2 -2
- package/lib/composite-comp/bol/components/Video/components/VideoTag/index.less +1 -0
- package/lib/composite-comp/bol/components/Video/imgs/play-circle.png +0 -0
- package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +1 -1
- package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +1 -1
- package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +5 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +5 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout1/index.less +1 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +10 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout2/index.less +1 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +5 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout3/index.less +1 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +5 -0
- package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +5 -0
- package/lib/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
- package/lib/core/Designer/ConfigPanel/index.js +10 -1
- package/lib/meta-comp/components/Text/index.js +2 -1
- package/lib/utils/commonUtil.js +218 -2
- package/package.json +1 -1
|
@@ -205,12 +205,14 @@ function (_super) {
|
|
|
205
205
|
fontSize: data.setting.navigation.size,
|
|
206
206
|
color: data.setting.navigation.color
|
|
207
207
|
};
|
|
208
|
+
var dotsSpace = Math.max(data.setting.dots.size, data.setting.dots.hoverSize) * 1.25 + 20 + "px";
|
|
209
|
+
var sliderWidth = "calc(100% - " + (data.setting.navigation.size + 20) * 2 + "px)";
|
|
208
210
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
209
211
|
className: "m-carousel-pc"
|
|
210
212
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
211
213
|
className: "content",
|
|
212
214
|
style: {
|
|
213
|
-
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ?
|
|
215
|
+
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
|
|
214
216
|
}
|
|
215
217
|
}, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
216
218
|
className: "carousel-icon-left",
|
|
@@ -225,7 +227,11 @@ function (_super) {
|
|
|
225
227
|
ref: function ref(slider) {
|
|
226
228
|
return _this.sliderRef = slider;
|
|
227
229
|
}
|
|
228
|
-
}, settings
|
|
230
|
+
}, settings, {
|
|
231
|
+
style: {
|
|
232
|
+
width: sliderWidth
|
|
233
|
+
}
|
|
234
|
+
}), data.groupSource.map(function (item) {
|
|
229
235
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
230
236
|
key: item.id,
|
|
231
237
|
className: "img-wrap"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.slider-wrap {
|
|
21
|
-
width: calc(100% - 72px);
|
|
21
|
+
// width: calc(100% - 72px);
|
|
22
22
|
margin: 0 auto;
|
|
23
23
|
line-height: 1;
|
|
24
24
|
|
|
@@ -101,11 +101,16 @@
|
|
|
101
101
|
border-radius: 50%;
|
|
102
102
|
background: #FFF;
|
|
103
103
|
cursor: inherit;
|
|
104
|
-
margin-right:
|
|
104
|
+
margin-right: 10px;
|
|
105
105
|
transition: all .5s;
|
|
106
106
|
|
|
107
|
+
&:last-child {
|
|
108
|
+
margin-right: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
107
111
|
&.active {
|
|
108
112
|
width: 2.5em;
|
|
113
|
+
height: 1.25em;
|
|
109
114
|
border-radius: 100px;
|
|
110
115
|
opacity: 1;
|
|
111
116
|
}
|
|
@@ -59,11 +59,6 @@ var __decorate = void 0 && (void 0).__decorate || function (decorators, target,
|
|
|
59
59
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
// import './index.less';
|
|
63
|
-
// less to css 在线地址 https://tool.oschina.net/less
|
|
64
|
-
// css 压缩地址 https://www.runoob.com/csspack
|
|
65
|
-
var style = '.m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{padding:10px 20px;}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}';
|
|
66
|
-
|
|
67
62
|
var Text =
|
|
68
63
|
/** @class */
|
|
69
64
|
function (_super) {
|
|
@@ -80,6 +75,8 @@ function (_super) {
|
|
|
80
75
|
nodeData = _b.nodeData,
|
|
81
76
|
mode = _b.mode,
|
|
82
77
|
outputType = _b.outputType;
|
|
78
|
+
var groupWrapContainerStyle = window.magicDesign.device === 'pc' ? 'padding: 16px 20px;' : 'padding: 12px 20px;';
|
|
79
|
+
var style = ".m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{" + groupWrapContainerStyle + "}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}";
|
|
83
80
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
81
|
className: "m-text",
|
|
85
82
|
onClick: this.onComponentClick
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.m-text {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
.title-wrap {
|
|
6
6
|
font-weight: 500;
|
|
7
7
|
font-size: 20px;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
width: 100%;
|
|
18
18
|
|
|
19
19
|
.group-wrap-container {
|
|
20
|
-
padding:
|
|
20
|
+
padding: 16px 20px;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.group-wrap {
|
|
Binary file
|
|
@@ -136,6 +136,11 @@ function (_super) {
|
|
|
136
136
|
_this.setState({});
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
+
onEnd: function onEnd() {
|
|
140
|
+
_this.videoRefMap[group.id].playing = false;
|
|
141
|
+
|
|
142
|
+
_this.setState({});
|
|
143
|
+
},
|
|
139
144
|
opts: __assign(__assign({}, group.video), {
|
|
140
145
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
141
146
|
source: group.video.sourceUrl
|
|
@@ -133,6 +133,11 @@ function (_super) {
|
|
|
133
133
|
_this.setState({});
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
|
+
onEnd: function onEnd() {
|
|
137
|
+
_this.videoRefMap[group.id].playing = false;
|
|
138
|
+
|
|
139
|
+
_this.setState({});
|
|
140
|
+
},
|
|
136
141
|
opts: __assign(__assign({}, group.video), {
|
|
137
142
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
138
143
|
source: group.video.sourceUrl
|
|
@@ -135,6 +135,11 @@ function (_super) {
|
|
|
135
135
|
_this.setState({});
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
+
onEnd: function onEnd() {
|
|
139
|
+
_this.videoRefMap[firstGroup.id].playing = false;
|
|
140
|
+
|
|
141
|
+
_this.setState({});
|
|
142
|
+
},
|
|
138
143
|
opts: __assign(__assign({}, firstGroup.video), {
|
|
139
144
|
cover: (0, _coreUtil.isPc)() ? firstGroup.overilay.content.pcImgSrc : firstGroup.overilay.content.h5ImgSrc,
|
|
140
145
|
source: firstGroup.video.sourceUrl
|
|
@@ -179,6 +184,11 @@ function (_super) {
|
|
|
179
184
|
_this.setState({});
|
|
180
185
|
}
|
|
181
186
|
},
|
|
187
|
+
onEnd: function onEnd() {
|
|
188
|
+
_this.videoRefMap[group.id].playing = false;
|
|
189
|
+
|
|
190
|
+
_this.setState({});
|
|
191
|
+
},
|
|
182
192
|
opts: __assign(__assign({}, group.video), {
|
|
183
193
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
184
194
|
source: group.video.sourceUrl
|
|
@@ -142,6 +142,11 @@ function (_super) {
|
|
|
142
142
|
_this.setState({});
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
|
+
onEnd: function onEnd() {
|
|
146
|
+
_this.videoRefMap[group.id].playing = false;
|
|
147
|
+
|
|
148
|
+
_this.setState({});
|
|
149
|
+
},
|
|
145
150
|
opts: __assign(__assign({}, group.video), {
|
|
146
151
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
147
152
|
source: group.video.sourceUrl
|
|
@@ -136,6 +136,11 @@ function (_super) {
|
|
|
136
136
|
_this.setState({});
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
+
onEnd: function onEnd() {
|
|
140
|
+
_this.videoRefMap[group.id].playing = false;
|
|
141
|
+
|
|
142
|
+
_this.setState({});
|
|
143
|
+
},
|
|
139
144
|
opts: __assign(__assign({}, group.video), {
|
|
140
145
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
141
146
|
source: group.video.sourceUrl
|
|
@@ -136,6 +136,11 @@ function (_super) {
|
|
|
136
136
|
_this.setState({});
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
+
onEnd: function onEnd() {
|
|
140
|
+
_this.videoRefMap[group.id].playing = false;
|
|
141
|
+
|
|
142
|
+
_this.setState({});
|
|
143
|
+
},
|
|
139
144
|
opts: __assign(__assign({}, group.video), {
|
|
140
145
|
cover: (0, _coreUtil.getVideoCover)(group),
|
|
141
146
|
source: group.video.sourceUrl
|
package/lib/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js
CHANGED
|
@@ -112,7 +112,7 @@ function (_super) {
|
|
|
112
112
|
src: ((0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc) || _defaultImg["default"]
|
|
113
113
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
114
114
|
className: "name"
|
|
115
|
-
}, (0, _coreUtil.isPc)() ? src.image.content.
|
|
115
|
+
}, (0, _coreUtil.isPc)() ? src.image.content.pcName : src.image.content.h5Name));
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -217,7 +217,7 @@ function (_super) {
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
_this.getSecondConfigName = function () {
|
|
220
|
-
var _a, _b, _c, _d, _e;
|
|
220
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
221
221
|
|
|
222
222
|
var selectedNode = _this.state.selectedNode;
|
|
223
223
|
|
|
@@ -237,6 +237,7 @@ function (_super) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
var groupName = '';
|
|
240
|
+
console.log('...', selectedNode.type, panelProps);
|
|
240
241
|
|
|
241
242
|
switch (selectedNode.type) {
|
|
242
243
|
case 'IMAGE_GALLERY':
|
|
@@ -250,11 +251,19 @@ function (_super) {
|
|
|
250
251
|
|
|
251
252
|
break;
|
|
252
253
|
|
|
254
|
+
case 'CAROUSEL':
|
|
255
|
+
groupName = (0, _coreUtil.isPc)() ? (_g = (_f = panelProps.image) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.pcName : (_j = (_h = panelProps.image) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j.h5Name;
|
|
256
|
+
break;
|
|
257
|
+
|
|
253
258
|
case 'MOBILE_NAVIGATION':
|
|
254
259
|
case 'PC_NAVIGATION':
|
|
255
260
|
groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
|
|
256
261
|
break;
|
|
257
262
|
|
|
263
|
+
case 'TEXT':
|
|
264
|
+
groupName = panelProps.content.title.text;
|
|
265
|
+
break;
|
|
266
|
+
|
|
258
267
|
case 'RECOMMEND':
|
|
259
268
|
groupName = panelProps.groupName.text;
|
|
260
269
|
break;
|
|
@@ -481,7 +481,8 @@ function (_super) {
|
|
|
481
481
|
style = __assign(__assign({}, style), {
|
|
482
482
|
textDecorationLine: data.underline.open ? 'underline' : 'none',
|
|
483
483
|
textDecorationColor: data.underline.textDecorationColor,
|
|
484
|
-
textDecorationStyle: data.underline.textDecorationStyle
|
|
484
|
+
textDecorationStyle: data.underline.textDecorationStyle,
|
|
485
|
+
textUnderlineOffset: Math.ceil(style.fontSize * 0.2) + 'px'
|
|
485
486
|
});
|
|
486
487
|
}
|
|
487
488
|
|
package/lib/utils/commonUtil.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addZero = exports.addUrlQuery = void 0;
|
|
7
7
|
exports.asyncDataURLtoImage = asyncDataURLtoImage;
|
|
8
|
-
exports.checkFileName = exports.calcLastTime = void 0;
|
|
8
|
+
exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
|
|
9
9
|
exports.commonFetch = commonFetch;
|
|
10
10
|
exports.convertImageUrl = convertImageUrl;
|
|
11
11
|
exports.copy2ClipBoard = copy2ClipBoard;
|
|
@@ -19,6 +19,7 @@ exports.pushGA = pushGA;
|
|
|
19
19
|
exports.shareFacebook = shareFacebook;
|
|
20
20
|
exports.shareLinkedin = shareLinkedin;
|
|
21
21
|
exports.shareTwitter = shareTwitter;
|
|
22
|
+
exports.sleep = sleep;
|
|
22
23
|
exports.styleStringify = void 0;
|
|
23
24
|
|
|
24
25
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -45,6 +46,149 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
45
46
|
return __assign.apply(this, arguments);
|
|
46
47
|
};
|
|
47
48
|
|
|
49
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
50
|
+
function adopt(value) {
|
|
51
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
52
|
+
resolve(value);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
57
|
+
function fulfilled(value) {
|
|
58
|
+
try {
|
|
59
|
+
step(generator.next(value));
|
|
60
|
+
} catch (e) {
|
|
61
|
+
reject(e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function rejected(value) {
|
|
66
|
+
try {
|
|
67
|
+
step(generator["throw"](value));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
reject(e);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function step(result) {
|
|
74
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
82
|
+
var _ = {
|
|
83
|
+
label: 0,
|
|
84
|
+
sent: function sent() {
|
|
85
|
+
if (t[0] & 1) throw t[1];
|
|
86
|
+
return t[1];
|
|
87
|
+
},
|
|
88
|
+
trys: [],
|
|
89
|
+
ops: []
|
|
90
|
+
},
|
|
91
|
+
f,
|
|
92
|
+
y,
|
|
93
|
+
t,
|
|
94
|
+
g;
|
|
95
|
+
return g = {
|
|
96
|
+
next: verb(0),
|
|
97
|
+
"throw": verb(1),
|
|
98
|
+
"return": verb(2)
|
|
99
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
100
|
+
return this;
|
|
101
|
+
}), g;
|
|
102
|
+
|
|
103
|
+
function verb(n) {
|
|
104
|
+
return function (v) {
|
|
105
|
+
return step([n, v]);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function step(op) {
|
|
110
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
111
|
+
|
|
112
|
+
while (_) {
|
|
113
|
+
try {
|
|
114
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
115
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
116
|
+
|
|
117
|
+
switch (op[0]) {
|
|
118
|
+
case 0:
|
|
119
|
+
case 1:
|
|
120
|
+
t = op;
|
|
121
|
+
break;
|
|
122
|
+
|
|
123
|
+
case 4:
|
|
124
|
+
_.label++;
|
|
125
|
+
return {
|
|
126
|
+
value: op[1],
|
|
127
|
+
done: false
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
case 5:
|
|
131
|
+
_.label++;
|
|
132
|
+
y = op[1];
|
|
133
|
+
op = [0];
|
|
134
|
+
continue;
|
|
135
|
+
|
|
136
|
+
case 7:
|
|
137
|
+
op = _.ops.pop();
|
|
138
|
+
|
|
139
|
+
_.trys.pop();
|
|
140
|
+
|
|
141
|
+
continue;
|
|
142
|
+
|
|
143
|
+
default:
|
|
144
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
145
|
+
_ = 0;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
150
|
+
_.label = op[1];
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
155
|
+
_.label = t[1];
|
|
156
|
+
t = op;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (t && _.label < t[2]) {
|
|
161
|
+
_.label = t[2];
|
|
162
|
+
|
|
163
|
+
_.ops.push(op);
|
|
164
|
+
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (t[2]) _.ops.pop();
|
|
169
|
+
|
|
170
|
+
_.trys.pop();
|
|
171
|
+
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
op = body.call(thisArg, _);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
op = [6, e];
|
|
178
|
+
y = 0;
|
|
179
|
+
} finally {
|
|
180
|
+
f = t = 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (op[0] & 5) throw op[1];
|
|
185
|
+
return {
|
|
186
|
+
value: op[0] ? op[1] : void 0,
|
|
187
|
+
done: true
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
48
192
|
/**
|
|
49
193
|
* 安全获取数据
|
|
50
194
|
* @param {function} func 获取函数
|
|
@@ -499,4 +643,76 @@ var nextTick = function nextTick(func, interval, count) {
|
|
|
499
643
|
}
|
|
500
644
|
};
|
|
501
645
|
|
|
502
|
-
exports.nextTick = nextTick;
|
|
646
|
+
exports.nextTick = nextTick;
|
|
647
|
+
|
|
648
|
+
function sleep(timeout) {
|
|
649
|
+
if (timeout === void 0) {
|
|
650
|
+
timeout = 3000;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return new Promise(function (resolve) {
|
|
654
|
+
return setTimeout(resolve, timeout);
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
var asyncNextTick = function asyncNextTick(asyncFunc, interval, count) {
|
|
659
|
+
if (interval === void 0) {
|
|
660
|
+
interval = 100;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (count === void 0) {
|
|
664
|
+
count = 5;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
668
|
+
var error_1;
|
|
669
|
+
return __generator(this, function (_a) {
|
|
670
|
+
switch (_a.label) {
|
|
671
|
+
case 0:
|
|
672
|
+
_a.trys.push([0, 2,, 5]);
|
|
673
|
+
|
|
674
|
+
return [4
|
|
675
|
+
/*yield*/
|
|
676
|
+
, asyncFunc()];
|
|
677
|
+
|
|
678
|
+
case 1:
|
|
679
|
+
return [2
|
|
680
|
+
/*return*/
|
|
681
|
+
, _a.sent()];
|
|
682
|
+
|
|
683
|
+
case 2:
|
|
684
|
+
error_1 = _a.sent();
|
|
685
|
+
|
|
686
|
+
if (count == 0) {
|
|
687
|
+
console.error('nextTick 失败');
|
|
688
|
+
return [2
|
|
689
|
+
/*return*/
|
|
690
|
+
, null];
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return [4
|
|
694
|
+
/*yield*/
|
|
695
|
+
, sleep(100)];
|
|
696
|
+
|
|
697
|
+
case 3:
|
|
698
|
+
_a.sent();
|
|
699
|
+
|
|
700
|
+
return [4
|
|
701
|
+
/*yield*/
|
|
702
|
+
, asyncNextTick(asyncFunc, interval, count - 1)];
|
|
703
|
+
|
|
704
|
+
case 4:
|
|
705
|
+
return [2
|
|
706
|
+
/*return*/
|
|
707
|
+
, _a.sent()];
|
|
708
|
+
|
|
709
|
+
case 5:
|
|
710
|
+
return [2
|
|
711
|
+
/*return*/
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
exports.asyncNextTick = asyncNextTick;
|