@fonixtree/magic-design 0.0.167 → 0.0.168
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/SelectVideoModal/index.js +79 -55
- package/es/common/LinkModal/SelectVideoModal/index.less +112 -0
- package/es/common/LinkModal/index.js +23 -2
- package/es/common/LinkModal/index.less +1 -1
- package/es/common/Video/index.js +151 -25
- package/es/common/VideoUpload/index.js +2 -3
- package/es/constants/index.js +2 -1
- package/es/utils/businessUtil.js +15 -0
- package/es/utils/coreUtil.js +17 -4
- package/lib/common/LinkModal/SelectVideoModal/index.js +79 -55
- package/lib/common/LinkModal/SelectVideoModal/index.less +112 -0
- package/lib/common/LinkModal/index.js +23 -2
- package/lib/common/LinkModal/index.less +1 -1
- package/lib/common/Video/index.js +151 -25
- package/lib/common/VideoUpload/index.js +2 -3
- package/lib/constants/index.js +2 -1
- package/lib/utils/businessUtil.js +15 -0
- package/lib/utils/coreUtil.js +17 -4
- package/package.json +1 -1
|
@@ -15,8 +15,16 @@ var _Iconfont = _interopRequireDefault(require("../../Iconfont"));
|
|
|
15
15
|
|
|
16
16
|
var _VideoUpload = _interopRequireDefault(require("../../VideoUpload"));
|
|
17
17
|
|
|
18
|
+
var _locale = require("../../../locale");
|
|
19
|
+
|
|
20
|
+
var _index = require("../../index");
|
|
21
|
+
|
|
22
|
+
require("./index.less");
|
|
23
|
+
|
|
18
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
25
|
|
|
26
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
+
|
|
20
28
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
21
29
|
var _extendStatics = function extendStatics(d, b) {
|
|
22
30
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -43,141 +51,157 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
43
51
|
};
|
|
44
52
|
}();
|
|
45
53
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
var AComponent =
|
|
54
|
+
var SelectVideoModal =
|
|
49
55
|
/** @class */
|
|
50
56
|
function (_super) {
|
|
51
|
-
__extends(
|
|
57
|
+
__extends(SelectVideoModal, _super);
|
|
52
58
|
|
|
53
|
-
function
|
|
59
|
+
function SelectVideoModal() {
|
|
54
60
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
55
61
|
|
|
56
|
-
_this.state = {
|
|
57
|
-
|
|
62
|
+
_this.state = {};
|
|
63
|
+
_this.videoSetting = {
|
|
64
|
+
speed: 1,
|
|
65
|
+
sourceType: 'Upload',
|
|
66
|
+
progressBar: true
|
|
58
67
|
};
|
|
59
|
-
|
|
68
|
+
|
|
69
|
+
_this.onFieldChange = function (data) {
|
|
70
|
+
_extends(_this.videoSetting, data);
|
|
71
|
+
|
|
72
|
+
_this.setState({});
|
|
73
|
+
|
|
74
|
+
_this.props.setUrl('video-' + JSON.stringify(_this.videoSetting));
|
|
75
|
+
};
|
|
76
|
+
|
|
60
77
|
return _this;
|
|
61
78
|
}
|
|
62
79
|
|
|
63
|
-
|
|
80
|
+
SelectVideoModal.prototype.render = function () {
|
|
64
81
|
var _this = this;
|
|
65
82
|
|
|
66
|
-
var title = this.props.title;
|
|
67
|
-
var ready = this.state.ready;
|
|
68
83
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
84
|
className: "SelectVideoModal-container"
|
|
70
|
-
}, /*#__PURE__*/_react["default"].createElement("div",
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
|
+
className: "video-left-wrap"
|
|
87
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
88
|
+
className: "video-upload-wrap"
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
71
90
|
title: "Select Video"
|
|
72
91
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Select, {
|
|
73
92
|
onChange: function onChange(v) {
|
|
74
|
-
_this.
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
_this.onFieldChange({
|
|
94
|
+
sourceType: v
|
|
95
|
+
});
|
|
77
96
|
},
|
|
78
|
-
value: this.
|
|
97
|
+
value: this.videoSetting.sourceType
|
|
79
98
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
|
|
80
99
|
value: "Upload"
|
|
81
100
|
}, "Upload"), /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
|
|
82
101
|
value: "URL"
|
|
83
|
-
}, "URL"))), this.
|
|
102
|
+
}, "URL"))), this.videoSetting.sourceType === 'URL' && /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
84
103
|
title: "URL"
|
|
85
104
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
105
|
className: "input-url"
|
|
87
106
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
88
107
|
onChange: function onChange(e) {
|
|
89
|
-
_this.
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
_this.onFieldChange({
|
|
109
|
+
sourceUrl: e.target.value
|
|
110
|
+
});
|
|
92
111
|
},
|
|
93
|
-
placeholder: i18n('PLEASE_ADD_A_LINK'),
|
|
112
|
+
placeholder: (0, _locale.i18n)('PLEASE_ADD_A_LINK'),
|
|
94
113
|
type: "text",
|
|
95
|
-
value: this.
|
|
114
|
+
value: this.videoSetting.sourceUrl
|
|
96
115
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
97
116
|
className: "icon-btns"
|
|
98
117
|
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
99
118
|
color: "#FF4141",
|
|
100
119
|
onClick: function onClick() {
|
|
101
|
-
_this.
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
_this.onFieldChange({
|
|
121
|
+
sourceUrl: ''
|
|
122
|
+
});
|
|
104
123
|
},
|
|
105
124
|
size: "20px",
|
|
106
125
|
type: "icon-delete1"
|
|
107
|
-
})))), this.
|
|
126
|
+
})))), this.videoSetting.sourceType === 'Upload' && /*#__PURE__*/_react["default"].createElement(_VideoUpload["default"], {
|
|
108
127
|
onChange: function onChange(v) {
|
|
109
|
-
_this.
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
_this.onFieldChange({
|
|
129
|
+
sourceUrl: v
|
|
130
|
+
});
|
|
112
131
|
},
|
|
113
|
-
value: this.
|
|
114
|
-
}))), /*#__PURE__*/_react["default"].createElement("div",
|
|
132
|
+
value: this.videoSetting.sourceUrl
|
|
133
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
134
|
+
className: "video-right-wrap"
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
136
|
+
className: "video-setting-wrap"
|
|
137
|
+
}, /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
115
138
|
layout: "horizontal",
|
|
116
139
|
split: true,
|
|
117
140
|
title: "Progress bar"
|
|
118
141
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Switch, {
|
|
119
|
-
checked: this.
|
|
142
|
+
checked: this.videoSetting.progressBar,
|
|
120
143
|
onChange: function onChange(v) {
|
|
121
|
-
_this.
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
_this.onFieldChange({
|
|
145
|
+
progressBar: v
|
|
146
|
+
});
|
|
124
147
|
}
|
|
125
148
|
})), /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
126
149
|
layout: "horizontal",
|
|
127
150
|
split: true,
|
|
128
151
|
title: "Play in loop"
|
|
129
152
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Switch, {
|
|
130
|
-
checked: this.
|
|
153
|
+
checked: this.videoSetting.loop,
|
|
131
154
|
onChange: function onChange(v) {
|
|
132
|
-
_this.
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
_this.onFieldChange({
|
|
156
|
+
loop: v
|
|
157
|
+
});
|
|
135
158
|
}
|
|
136
159
|
})), /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
137
160
|
layout: "horizontal",
|
|
138
161
|
split: true,
|
|
139
162
|
title: "Autoplays"
|
|
140
163
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Switch, {
|
|
141
|
-
checked: this.
|
|
164
|
+
checked: this.videoSetting.autoplay,
|
|
142
165
|
onChange: function onChange(v) {
|
|
143
|
-
_this.
|
|
144
|
-
|
|
145
|
-
|
|
166
|
+
_this.onFieldChange({
|
|
167
|
+
autoplay: v
|
|
168
|
+
});
|
|
146
169
|
}
|
|
147
170
|
})), /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
148
171
|
layout: "horizontal",
|
|
149
172
|
split: true,
|
|
150
173
|
title: "Video Sound"
|
|
151
174
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Switch, {
|
|
152
|
-
checked: this.
|
|
175
|
+
checked: this.videoSetting.videoSound,
|
|
153
176
|
onChange: function onChange(v) {
|
|
154
|
-
_this.
|
|
155
|
-
|
|
156
|
-
|
|
177
|
+
_this.onFieldChange({
|
|
178
|
+
videoSound: v
|
|
179
|
+
});
|
|
157
180
|
}
|
|
158
181
|
})), /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
159
182
|
title: "Play Speed"
|
|
160
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
183
|
+
}, /*#__PURE__*/_react["default"].createElement(_index.Slider, {
|
|
161
184
|
inputType: "float",
|
|
162
185
|
maxVal: 2,
|
|
163
186
|
minVal: 0.5,
|
|
164
187
|
onChange: function onChange(_a) {
|
|
165
188
|
var count = _a.count;
|
|
166
|
-
_this.search.speed = count;
|
|
167
189
|
|
|
168
|
-
_this.
|
|
190
|
+
_this.onFieldChange({
|
|
191
|
+
speed: count
|
|
192
|
+
});
|
|
169
193
|
},
|
|
170
194
|
value: {
|
|
171
|
-
count: this.
|
|
195
|
+
count: this.videoSetting.speed
|
|
172
196
|
}
|
|
173
197
|
})))));
|
|
174
198
|
};
|
|
175
199
|
|
|
176
|
-
|
|
177
|
-
|
|
200
|
+
SelectVideoModal.defaultProps = {
|
|
201
|
+
setUrl: function setUrl() {}
|
|
178
202
|
};
|
|
179
|
-
return
|
|
203
|
+
return SelectVideoModal;
|
|
180
204
|
}(_react["default"].Component);
|
|
181
205
|
|
|
182
|
-
var _default =
|
|
206
|
+
var _default = SelectVideoModal;
|
|
183
207
|
exports["default"] = _default;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.SelectVideoModal-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: 20px 80px;
|
|
4
|
+
border-top: 1px solid #f0f0f0;
|
|
5
|
+
|
|
6
|
+
.video-left-wrap {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
flex: 1;
|
|
10
|
+
margin-right: 100px;
|
|
11
|
+
|
|
12
|
+
.video-title-wrap {
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.video-upload-wrap {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
.input-url {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 40px;
|
|
24
|
+
background: #FFFFFF;
|
|
25
|
+
border: 1px solid #D2D9E5;
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
display: flex;
|
|
28
|
+
padding: 9px 14px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
|
|
32
|
+
input {
|
|
33
|
+
border: none;
|
|
34
|
+
outline: none;
|
|
35
|
+
height: 24px;
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
font-family: 'Open Sans';
|
|
38
|
+
font-style: normal;
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
color: #232F46;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* 使用webkit内核的浏览器 */
|
|
45
|
+
input::-webkit-input-placeholder {
|
|
46
|
+
font-family: 'Open Sans';
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: 400;
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
color: #8493AF;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Firefox版本4-18 */
|
|
54
|
+
input:-moz-placeholder {
|
|
55
|
+
font-family: 'Open Sans';
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
color: #8493AF;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Firefox版本19+ */
|
|
63
|
+
input::-moz-placeholder {
|
|
64
|
+
font-family: 'Open Sans';
|
|
65
|
+
font-style: normal;
|
|
66
|
+
font-weight: 400;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
color: #8493AF;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* IE浏览器 */
|
|
72
|
+
input:-ms-input-placeholder {
|
|
73
|
+
font-family: 'Open Sans';
|
|
74
|
+
font-style: normal;
|
|
75
|
+
font-weight: 400;
|
|
76
|
+
font-size: 14px;
|
|
77
|
+
color: #8493AF;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.icon-btns {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
|
|
84
|
+
&>span {
|
|
85
|
+
margin-left: 12px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.video-right-wrap {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
flex: 1;
|
|
97
|
+
|
|
98
|
+
.video-title-wrap {
|
|
99
|
+
font-family: 'Open Sans';
|
|
100
|
+
font-style: normal;
|
|
101
|
+
font-weight: 600;
|
|
102
|
+
font-size: 16px;
|
|
103
|
+
color: #232F46;
|
|
104
|
+
margin-bottom: 12px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.video-setting-wrap {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -25,6 +25,8 @@ var _CustomTable = _interopRequireDefault(require("./CustomTable"));
|
|
|
25
25
|
|
|
26
26
|
var _BundleCampaign = _interopRequireDefault(require("./BundleCampaign"));
|
|
27
27
|
|
|
28
|
+
var _SelectVideoModal = _interopRequireDefault(require("./SelectVideoModal"));
|
|
29
|
+
|
|
28
30
|
var _locale = require("../../locale");
|
|
29
31
|
|
|
30
32
|
var _commonUtil = require("../../utils/commonUtil");
|
|
@@ -180,6 +182,20 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
180
182
|
}
|
|
181
183
|
};
|
|
182
184
|
|
|
185
|
+
var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
|
|
186
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
187
|
+
s += arguments[i].length;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
191
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
192
|
+
r[k] = a[j];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return r;
|
|
197
|
+
};
|
|
198
|
+
|
|
183
199
|
var LinkModal = function LinkModal(props) {
|
|
184
200
|
var onConfirm = props.onConfirm,
|
|
185
201
|
onClose = props.onClose,
|
|
@@ -214,7 +230,12 @@ var LinkModal = function LinkModal(props) {
|
|
|
214
230
|
|
|
215
231
|
case 1:
|
|
216
232
|
types = _a.sent();
|
|
217
|
-
setLinkTypes(types
|
|
233
|
+
setLinkTypes(__spreadArrays(types, [{
|
|
234
|
+
comments: 'Video',
|
|
235
|
+
linkTypeCode: 'Video',
|
|
236
|
+
linkTypeName: 'Video',
|
|
237
|
+
seq: 7
|
|
238
|
+
}]));
|
|
218
239
|
setSelected(types[0].linkTypeCode);
|
|
219
240
|
return [2
|
|
220
241
|
/*return*/
|
|
@@ -297,7 +318,7 @@ var LinkModal = function LinkModal(props) {
|
|
|
297
318
|
setUrl: function setUrl(url) {
|
|
298
319
|
return setLinkUrl(url);
|
|
299
320
|
}
|
|
300
|
-
}), selected === 'Video' && /*#__PURE__*/_react["default"].createElement(
|
|
321
|
+
}), selected === 'Video' && /*#__PURE__*/_react["default"].createElement(_SelectVideoModal["default"], {
|
|
301
322
|
setUrl: function setUrl(url) {
|
|
302
323
|
return setLinkUrl(url);
|
|
303
324
|
}
|
package/es/common/Video/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = void 0;
|
|
6
|
+
exports["default"] = exports.createVideoModal = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -204,6 +204,61 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
/** 检查youtube依赖包 */
|
|
208
|
+
var checkYoutuVIdeo = function checkYoutuVIdeo() {
|
|
209
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
210
|
+
return __generator(this, function (_a) {
|
|
211
|
+
switch (_a.label) {
|
|
212
|
+
case 0:
|
|
213
|
+
if (!!window.YT) return [3
|
|
214
|
+
/*break*/
|
|
215
|
+
, 2];
|
|
216
|
+
return [4
|
|
217
|
+
/*yield*/
|
|
218
|
+
, Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
|
|
219
|
+
|
|
220
|
+
case 1:
|
|
221
|
+
_a.sent();
|
|
222
|
+
|
|
223
|
+
_a.label = 2;
|
|
224
|
+
|
|
225
|
+
case 2:
|
|
226
|
+
return [2
|
|
227
|
+
/*return*/
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
/** 检查Ali依赖包 */
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
var checkAliVIdeo = function checkAliVIdeo() {
|
|
237
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
238
|
+
return __generator(this, function (_a) {
|
|
239
|
+
switch (_a.label) {
|
|
240
|
+
case 0:
|
|
241
|
+
if (!!window.Aliplayer) return [3
|
|
242
|
+
/*break*/
|
|
243
|
+
, 2];
|
|
244
|
+
return [4
|
|
245
|
+
/*yield*/
|
|
246
|
+
, Promise.all([(0, _commonUtil.importAsync)('https://g.alicdn.com/de/prismplayer/2.13.2/aliplayer-min.js'), (0, _commonUtil.importAsync)('https://g.alicdn.com/de/prismplayer/2.13.2/skins/default/aliplayer-min.css')])];
|
|
247
|
+
|
|
248
|
+
case 1:
|
|
249
|
+
_a.sent();
|
|
250
|
+
|
|
251
|
+
_a.label = 2;
|
|
252
|
+
|
|
253
|
+
case 2:
|
|
254
|
+
return [2
|
|
255
|
+
/*return*/
|
|
256
|
+
];
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
|
|
207
262
|
var createAliVideo = function createAliVideo(domId, opts) {
|
|
208
263
|
if (opts === void 0) {
|
|
209
264
|
opts = {};
|
|
@@ -328,6 +383,10 @@ var createYoutuVideo = function createYoutuVideo(domId, opts) {
|
|
|
328
383
|
player.mute();
|
|
329
384
|
}
|
|
330
385
|
|
|
386
|
+
if (opts.videoSound) {
|
|
387
|
+
player.unMute();
|
|
388
|
+
}
|
|
389
|
+
|
|
331
390
|
if (opts.speed) {
|
|
332
391
|
player.setPlaybackRate(opts.speed);
|
|
333
392
|
}
|
|
@@ -413,6 +472,83 @@ var getVideoType = function getVideoType(opts) {
|
|
|
413
472
|
|
|
414
473
|
return 'ali';
|
|
415
474
|
};
|
|
475
|
+
/** 创建视频弹框显示 */
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
var createVideoModal = function createVideoModal(videoId, opts) {
|
|
479
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
480
|
+
var modelWrap, shadowWrap, contentWrap, videoDom, closeImgDom, type;
|
|
481
|
+
return __generator(this, function (_a) {
|
|
482
|
+
switch (_a.label) {
|
|
483
|
+
case 0:
|
|
484
|
+
modelWrap = document.createElement('div');
|
|
485
|
+
modelWrap.className = 'pc-video-modal-wrap';
|
|
486
|
+
modelWrap.setAttribute('video-id', videoId);
|
|
487
|
+
shadowWrap = document.createElement('div');
|
|
488
|
+
shadowWrap.className = 'video-shadow-wrap';
|
|
489
|
+
|
|
490
|
+
shadowWrap.onclick = function () {
|
|
491
|
+
var _a;
|
|
492
|
+
|
|
493
|
+
(_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
contentWrap = document.createElement('div');
|
|
497
|
+
contentWrap.className = 'content-wrap';
|
|
498
|
+
videoDom = document.createElement('div');
|
|
499
|
+
videoDom.id = 'video-modal-' + videoId;
|
|
500
|
+
contentWrap.appendChild(videoDom);
|
|
501
|
+
closeImgDom = document.createElement('img');
|
|
502
|
+
closeImgDom.src = _closeImg["default"];
|
|
503
|
+
closeImgDom.className = 'close-img-wrap';
|
|
504
|
+
|
|
505
|
+
closeImgDom.onclick = function () {
|
|
506
|
+
var _a;
|
|
507
|
+
|
|
508
|
+
(_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
contentWrap.appendChild(closeImgDom);
|
|
512
|
+
modelWrap.appendChild(shadowWrap);
|
|
513
|
+
modelWrap.appendChild(contentWrap);
|
|
514
|
+
(document.querySelector('[magic_design]') || document.body).appendChild(modelWrap);
|
|
515
|
+
type = getVideoType(opts);
|
|
516
|
+
if (!(type == 'youtu')) return [3
|
|
517
|
+
/*break*/
|
|
518
|
+
, 2];
|
|
519
|
+
return [4
|
|
520
|
+
/*yield*/
|
|
521
|
+
, checkYoutuVIdeo()];
|
|
522
|
+
|
|
523
|
+
case 1:
|
|
524
|
+
_a.sent();
|
|
525
|
+
|
|
526
|
+
_a.label = 2;
|
|
527
|
+
|
|
528
|
+
case 2:
|
|
529
|
+
if (!(type == 'ali')) return [3
|
|
530
|
+
/*break*/
|
|
531
|
+
, 4];
|
|
532
|
+
return [4
|
|
533
|
+
/*yield*/
|
|
534
|
+
, checkAliVIdeo()];
|
|
535
|
+
|
|
536
|
+
case 3:
|
|
537
|
+
_a.sent();
|
|
538
|
+
|
|
539
|
+
_a.label = 4;
|
|
540
|
+
|
|
541
|
+
case 4:
|
|
542
|
+
createVideo(type, '-modal-' + videoId, opts);
|
|
543
|
+
return [2
|
|
544
|
+
/*return*/
|
|
545
|
+
];
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
exports.createVideoModal = createVideoModal;
|
|
416
552
|
|
|
417
553
|
var Video =
|
|
418
554
|
/** @class */
|
|
@@ -500,30 +636,24 @@ function (_super) {
|
|
|
500
636
|
case 0:
|
|
501
637
|
if (!this.props.opts.source) return [3
|
|
502
638
|
/*break*/
|
|
503
|
-
,
|
|
639
|
+
, 6];
|
|
504
640
|
videoType = getVideoType(this.props.opts);
|
|
505
641
|
if (!(videoType == 'youtu')) return [3
|
|
506
642
|
/*break*/
|
|
507
|
-
,
|
|
508
|
-
if (!!window.YT) return [3
|
|
509
|
-
/*break*/
|
|
510
|
-
, 2];
|
|
643
|
+
, 3];
|
|
511
644
|
return [4
|
|
512
645
|
/*yield*/
|
|
513
|
-
,
|
|
646
|
+
, checkYoutuVIdeo()];
|
|
514
647
|
|
|
515
648
|
case 1:
|
|
516
649
|
_c.sent();
|
|
517
650
|
|
|
518
|
-
_c.label = 2;
|
|
519
|
-
|
|
520
|
-
case 2:
|
|
521
651
|
_a = this;
|
|
522
652
|
return [4
|
|
523
653
|
/*yield*/
|
|
524
654
|
, createVideo('youtu', this.props.videoId, this.props.opts)];
|
|
525
655
|
|
|
526
|
-
case
|
|
656
|
+
case 2:
|
|
527
657
|
_a.ytPlayer = _c.sent();
|
|
528
658
|
this.ytPlayer.addEventListener('onStateChange', function (event) {
|
|
529
659
|
if (!_this.props.opts.loop) {
|
|
@@ -534,31 +664,25 @@ function (_super) {
|
|
|
534
664
|
}
|
|
535
665
|
}
|
|
536
666
|
});
|
|
537
|
-
_c.label =
|
|
667
|
+
_c.label = 3;
|
|
538
668
|
|
|
539
|
-
case
|
|
669
|
+
case 3:
|
|
540
670
|
if (!(videoType == 'ali')) return [3
|
|
541
671
|
/*break*/
|
|
542
|
-
, 8];
|
|
543
|
-
if (!!window.Aliplayer) return [3
|
|
544
|
-
/*break*/
|
|
545
672
|
, 6];
|
|
546
673
|
return [4
|
|
547
674
|
/*yield*/
|
|
548
|
-
,
|
|
675
|
+
, checkAliVIdeo()];
|
|
549
676
|
|
|
550
|
-
case
|
|
677
|
+
case 4:
|
|
551
678
|
_c.sent();
|
|
552
679
|
|
|
553
|
-
_c.label = 6;
|
|
554
|
-
|
|
555
|
-
case 6:
|
|
556
680
|
_b = this;
|
|
557
681
|
return [4
|
|
558
682
|
/*yield*/
|
|
559
683
|
, createVideo('ali', this.props.videoId, this.props.opts)];
|
|
560
684
|
|
|
561
|
-
case
|
|
685
|
+
case 5:
|
|
562
686
|
_b.aliPlayer = _c.sent();
|
|
563
687
|
this.aliPlayer.on('ended', function () {
|
|
564
688
|
if (!_this.props.opts.loop) {
|
|
@@ -567,9 +691,9 @@ function (_super) {
|
|
|
567
691
|
_this.props.onEnd();
|
|
568
692
|
}
|
|
569
693
|
});
|
|
570
|
-
_c.label =
|
|
694
|
+
_c.label = 6;
|
|
571
695
|
|
|
572
|
-
case
|
|
696
|
+
case 6:
|
|
573
697
|
return [2
|
|
574
698
|
/*return*/
|
|
575
699
|
];
|
|
@@ -579,7 +703,9 @@ function (_super) {
|
|
|
579
703
|
};
|
|
580
704
|
|
|
581
705
|
_this.fullPlay = function () {
|
|
582
|
-
_this.
|
|
706
|
+
createVideoModal(_this.props.videoId, __assign(__assign({}, _this.props.opts), {
|
|
707
|
+
autoplay: true
|
|
708
|
+
}));
|
|
583
709
|
};
|
|
584
710
|
|
|
585
711
|
return _this;
|
|
@@ -77,8 +77,7 @@ function (_super) {
|
|
|
77
77
|
VideoUpload.prototype.render = function () {
|
|
78
78
|
var _this = this;
|
|
79
79
|
|
|
80
|
-
var
|
|
81
|
-
value = _a === void 0 ? '/get/resource/20220615/video/haha1536909657474453504.mp4' : _a;
|
|
80
|
+
var value = this.props.value;
|
|
82
81
|
var visible = this.state.visible;
|
|
83
82
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
83
|
className: "video-upload-container",
|
|
@@ -145,7 +144,7 @@ function (_super) {
|
|
|
145
144
|
};
|
|
146
145
|
|
|
147
146
|
VideoUpload.defaultProps = {
|
|
148
|
-
value: '
|
|
147
|
+
value: '',
|
|
149
148
|
onChange: function onChange(v) {
|
|
150
149
|
console.log(v);
|
|
151
150
|
}
|