pixuireactcomponents 1.0.0
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/package.json +11 -0
- package/ui/components/bulletscreen/BulletItemAnimation.tsx +117 -0
- package/ui/components/bulletscreen/BulletScreenAnimation.tsx +278 -0
- package/ui/components/bulletscreen/bullet.less +17 -0
- package/ui/components/dropdown/Dropdown.tsx +115 -0
- package/ui/components/dropdown/DropdownOptionUI.tsx +13 -0
- package/ui/components/dropdown/DropdownSpreadMainUI.tsx +11 -0
- package/ui/components/dropdown/DropdownUnspreadMainUI.tsx +11 -0
- package/ui/components/progress/Progress.tsx +166 -0
- package/ui/components/tab/Tab.tsx +12 -0
- package/ui/components/tab/Tabs.tsx +56 -0
- package/ui/components/videoplayer/VideoPlayer.tsx +200 -0
- package/ui/sample/Images.tsx +34 -0
- package/ui/sample/asset/data_arrow_down.png +0 -0
- package/ui/sample/asset/data_arrow_up.png +0 -0
- package/ui/sample/asset/dot.png +0 -0
- package/ui/sample/asset/inner.png +0 -0
- package/ui/sample/asset/item_reddot.png +0 -0
- package/ui/sample/asset/loading.png +0 -0
- package/ui/sample/asset/money_dropdown.png +0 -0
- package/ui/sample/asset/money_dropdownall.png +0 -0
- package/ui/sample/asset/outer.png +0 -0
- package/ui/sample/asset/tab_choosed.png +0 -0
- package/ui/sample/asset/tabs_bg.png +0 -0
- package/ui/sample/asset/video_pause.png +0 -0
- package/ui/sample/asset/video_play.png +0 -0
- package/ui/sample/asset/video_reload.png +0 -0
- package/ui/sample/bulletscreen/BulletDemo.tsx +86 -0
- package/ui/sample/dropdown/DropdownDemo.tsx +65 -0
- package/ui/sample/dropdown/MoneyDropdownOption.tsx +49 -0
- package/ui/sample/dropdown/MoneyDropdownSpreadMain.tsx +42 -0
- package/ui/sample/dropdown/MoneyDropdownUnspreadMain.tsx +44 -0
- package/ui/sample/less/video.less +143 -0
- package/ui/sample/progress/ProgressDemo.tsx +74 -0
- package/ui/sample/tab/TabDemo.tsx +67 -0
- package/ui/sample/tab/TopTab.tsx +74 -0
- package/ui/sample/videoplayer/VideoPlayerDemo.tsx +57 -0
- package/utils/EventDispatcherJs.tsx +74 -0
- package/utils/GenerateConstructorAndGeterSeter.js +223 -0
- package/utils/Logger.tsx +158 -0
- package/utils/MakeImage.js +204 -0
- package/utils/img/logger.png +0 -0
- package/utils/img/makeImage.png +0 -0
- package/utils/utils.md +145 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CSSProperties } from "preact"
|
|
2
|
+
import { DropdownOptionUI } from "../../components/dropdown/DropdownOptionUI"
|
|
3
|
+
import videoLess from "./../less/video.less"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const rootStyle: CSSProperties = {
|
|
8
|
+
width: '98px',
|
|
9
|
+
height: '29px',
|
|
10
|
+
// backgroundColor: "#FF000044"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const textStyle: CSSProperties = {
|
|
14
|
+
color: "#CDBE91",
|
|
15
|
+
fontSize: 14,
|
|
16
|
+
marginLeft: '17px', // 13 + 4
|
|
17
|
+
|
|
18
|
+
marginTop: '7px'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const lineStyle:CSSProperties = {
|
|
22
|
+
height: '1px',
|
|
23
|
+
width: '65px',
|
|
24
|
+
marginLeft: '17px',
|
|
25
|
+
backgroundColor: '#C4C4C4',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export class MoneyDropdownOption extends DropdownOptionUI<string>{
|
|
30
|
+
private isLast: boolean = false
|
|
31
|
+
constructor(props){
|
|
32
|
+
super(props)
|
|
33
|
+
|
|
34
|
+
if(props["isLast"]) this.isLast = true
|
|
35
|
+
// this.props.isLast : boolean
|
|
36
|
+
// 最后一个不要横线...
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render(){
|
|
40
|
+
return (
|
|
41
|
+
<div style={rootStyle} className={videoLess.column_start_start} onClick={this.props.onChoose}>
|
|
42
|
+
<div style={{width: '100%', height: '28px'}} className={videoLess.row_start_center}>
|
|
43
|
+
<text style={textStyle}>{this.props.info}</text>
|
|
44
|
+
</div>
|
|
45
|
+
{this.isLast ? null : <div style={lineStyle}></div>}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CSSProperties } from "preact"
|
|
2
|
+
import { DropdownSpreadMainUI } from "../../components/dropdown/DropdownSpreadMainUI"
|
|
3
|
+
import { Images } from "../Images"
|
|
4
|
+
import videoLess from "./../less/video.less"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const rootStyle: CSSProperties = {
|
|
8
|
+
width: '98px',
|
|
9
|
+
height: '32px',
|
|
10
|
+
// backgroundColor: '#FF000F77'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const textStyle: CSSProperties = {
|
|
14
|
+
color: "#CDBE91",
|
|
15
|
+
fontSize: 16,
|
|
16
|
+
marginLeft: '13px',
|
|
17
|
+
top: '4px',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const arrowStyle:CSSProperties = {
|
|
21
|
+
width: '15px',
|
|
22
|
+
height: '18px',
|
|
23
|
+
marginRight: '20px',
|
|
24
|
+
top: '-2px',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export class MoneyDropdownSpreadMain extends DropdownSpreadMainUI<string>{
|
|
29
|
+
constructor(props){
|
|
30
|
+
super(props)
|
|
31
|
+
// console.warn("MoneyDropdownSpreadMain constructor ---")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render(){
|
|
35
|
+
return (
|
|
36
|
+
<div style={rootStyle} className={videoLess.row_between_center} onClick={this.props.closeList}>
|
|
37
|
+
<text style={textStyle}>{this.props.info}</text>
|
|
38
|
+
<img style={arrowStyle} src={Images.data_arrow_up}/>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CSSProperties } from "preact"
|
|
2
|
+
import { DropdownUnspreadMainUI } from "../../components/dropdown/DropdownUnspreadMainUI"
|
|
3
|
+
import { Images } from "../Images"
|
|
4
|
+
import videoLess from "./../less/video.less"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const rootStyle: CSSProperties = {
|
|
9
|
+
width: '98px',
|
|
10
|
+
height: '40px',
|
|
11
|
+
top: '4px',
|
|
12
|
+
backgroundImage: `url(${Images.money_dropdown})`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const textStyle: CSSProperties = {
|
|
16
|
+
color: "#CDBE91",
|
|
17
|
+
fontSize: 16,
|
|
18
|
+
marginLeft: '13px',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const arrowStyle:CSSProperties = {
|
|
22
|
+
width: '15px',
|
|
23
|
+
height: '18px',
|
|
24
|
+
marginRight: '20px',
|
|
25
|
+
top: '-4px',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export class MoneyDropdownUnspreadMain extends DropdownUnspreadMainUI<string>{
|
|
30
|
+
constructor(props){
|
|
31
|
+
super(props)
|
|
32
|
+
|
|
33
|
+
// console.warn("UnspreadMain constructor----")
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render(){
|
|
37
|
+
return (
|
|
38
|
+
<div style={rootStyle} className={videoLess.row_between_center} onClick={this.props.openList}>
|
|
39
|
+
<text style={textStyle}>{this.props.info}</text>
|
|
40
|
+
<img style={arrowStyle} src={Images.data_arrow_down}/>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
.row_start_center{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
align-items: center;
|
|
6
|
+
}
|
|
7
|
+
.row_start_end{
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
align-items: flex-end;
|
|
12
|
+
}
|
|
13
|
+
.row_center_center{
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.row_end_end{
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
justify-content: flex-end;
|
|
24
|
+
align-items: flex-end;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.row_end_center{
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.row_end_start{
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
justify-content: flex-end;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.row_center_end{
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-items: flex-end;
|
|
46
|
+
}
|
|
47
|
+
.row_between_center{
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.row_around_center{
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
justify-content: space-around;
|
|
58
|
+
align-items: center;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.column_start_center{
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
justify-content: flex-start;
|
|
65
|
+
align-items: center;
|
|
66
|
+
}
|
|
67
|
+
.column_center_center{
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
}
|
|
73
|
+
.column_between_center{
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
align-items: center;
|
|
78
|
+
}
|
|
79
|
+
.column_end_center{
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
justify-content: flex-end;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
.column_around_start{
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
justify-content: space-around;
|
|
89
|
+
align-items: flex-start;
|
|
90
|
+
}
|
|
91
|
+
.column_start_start{
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
justify-content: flex-start;
|
|
95
|
+
align-items: flex-start;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes rotate_by_myself{
|
|
99
|
+
from {
|
|
100
|
+
transform: rotate(0deg);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
50% {
|
|
104
|
+
transform: rotate(180deg);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
to {
|
|
108
|
+
transform: rotate(360deg);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.loading_anim{
|
|
113
|
+
animation-name: rotate_by_myself;
|
|
114
|
+
animation-duration: 1.5s;
|
|
115
|
+
animation-timing-function: linear;
|
|
116
|
+
animation-iteration-count: infinite
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.row_start_center{
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
justify-content: flex-start;
|
|
123
|
+
align-items: center;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.row_end_center{
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: row;
|
|
129
|
+
justify-content: flex-end;
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.hidden_scrollbar{
|
|
134
|
+
-ms-overflow-style: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// 单行多文本出现省略号
|
|
139
|
+
.ellipsis {
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
text-overflow:ellipsis;
|
|
142
|
+
white-space: nowrap;
|
|
143
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, CSSProperties } from "preact"
|
|
2
|
+
import { Progress, ProgressProps } from "../../components/progress/Progress"
|
|
3
|
+
import { Images } from "../Images"
|
|
4
|
+
|
|
5
|
+
const progressWrapperStyle: CSSProperties = {
|
|
6
|
+
width: '376px',
|
|
7
|
+
height: '34px',
|
|
8
|
+
marginLeft: '32px',
|
|
9
|
+
marginTop: '14px',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const progressData: ProgressProps ={
|
|
13
|
+
percent: 0,
|
|
14
|
+
wrapperHeight: 34,
|
|
15
|
+
wrapperWidth: 376,
|
|
16
|
+
height: 5,
|
|
17
|
+
dotWidth: 26,
|
|
18
|
+
dotHeight: 27,
|
|
19
|
+
dotWrapperWidth: 56,
|
|
20
|
+
dotWrapperHeight: 57,
|
|
21
|
+
|
|
22
|
+
outerBg: Images.outer,
|
|
23
|
+
innerBg: Images.inner,
|
|
24
|
+
dotBg: Images.dot,
|
|
25
|
+
onDragStart: null,
|
|
26
|
+
onDrag: null,
|
|
27
|
+
onDragEnd: null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const percentTextStyle: CSSProperties = {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
width: '60px',
|
|
33
|
+
height: '34px',
|
|
34
|
+
marginLeft: '386px', // 100% + 10px
|
|
35
|
+
color: '#000000',
|
|
36
|
+
fontSize: '20px',
|
|
37
|
+
// backgroundColor: '#FF000055'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class ProgressDemo extends Component<any,
|
|
41
|
+
{
|
|
42
|
+
percent: number
|
|
43
|
+
}>{
|
|
44
|
+
constructor(props){
|
|
45
|
+
super(props)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
this.state = {
|
|
49
|
+
percent: 10
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
progressData.percent = this.state.percent
|
|
53
|
+
progressData.onDrag = this.onDrag
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onDrag = (value: number)=>{
|
|
57
|
+
let formatPercent = Math.floor(value + 0.5)
|
|
58
|
+
formatPercent = Math.max(0, formatPercent)
|
|
59
|
+
formatPercent = Math.min(100, formatPercent)
|
|
60
|
+
|
|
61
|
+
this.setState({
|
|
62
|
+
percent: formatPercent
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render(){
|
|
67
|
+
return (
|
|
68
|
+
<div style={progressWrapperStyle}>
|
|
69
|
+
<Progress {...progressData}/>
|
|
70
|
+
<text style={percentTextStyle}>{this.state.percent + "%"}</text>
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Component, CSSProperties } from "preact"
|
|
2
|
+
import { Tab } from "../../components/tab/Tab"
|
|
3
|
+
import { Tabs } from "../../components/tab/Tabs"
|
|
4
|
+
import { Images } from "../Images"
|
|
5
|
+
import { TopTab } from "./TopTab"
|
|
6
|
+
|
|
7
|
+
import videoLess from "./../less/video.less"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const rootStyle: CSSProperties = {
|
|
11
|
+
width: '448px',
|
|
12
|
+
height: '100%',
|
|
13
|
+
backgroundColor: '#081013'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const tabBarStyle: CSSProperties = {
|
|
17
|
+
width: '100%',
|
|
18
|
+
height: '48px',
|
|
19
|
+
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
justifyContent: 'flex-start',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// backgroundColor: '#00FF3333',
|
|
27
|
+
backgroundRepeat: 'no-repeat',
|
|
28
|
+
backgroundPosition: 'bottom center',
|
|
29
|
+
backgroundImage: `url(${Images.tabs_bg})`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const tabsData = ["赛程","福利"] // tabs列表
|
|
34
|
+
|
|
35
|
+
export class TabDemo extends Component<any,
|
|
36
|
+
{
|
|
37
|
+
choosedTabIndex: number
|
|
38
|
+
}>{
|
|
39
|
+
constructor(props){
|
|
40
|
+
super(props)
|
|
41
|
+
|
|
42
|
+
this.state = {
|
|
43
|
+
choosedTabIndex : 0
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
componentWillUnmount(){
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onChoose = (index: number)=>{
|
|
51
|
+
this.setState({
|
|
52
|
+
choosedTabIndex: index
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
render(){
|
|
57
|
+
return (
|
|
58
|
+
<div style={rootStyle} className={videoLess.column_start_center}>
|
|
59
|
+
<Tabs tabBarStyle={tabBarStyle} onChoose={this.onChoose}>
|
|
60
|
+
{tabsData.map((v, index) =>{
|
|
61
|
+
return <Tab realTab = {<TopTab title={v} isChoosed={index == this.state.choosedTabIndex}/>} />
|
|
62
|
+
})}
|
|
63
|
+
</Tabs>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, createRef, CSSProperties } from "preact";
|
|
2
|
+
import { Images } from "../Images";
|
|
3
|
+
|
|
4
|
+
import videoLess from "./../less/video.less"
|
|
5
|
+
|
|
6
|
+
const rootStyle: CSSProperties = {
|
|
7
|
+
height: '48px', // 100%
|
|
8
|
+
width: '100%',
|
|
9
|
+
fontSize: '20px',
|
|
10
|
+
color: '#F0E6D2',
|
|
11
|
+
// backgroundColor: '#FF000066'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const imgShowStyle: CSSProperties = {
|
|
15
|
+
width: '20px',
|
|
16
|
+
height: '10px',
|
|
17
|
+
marginBottom: '2px',
|
|
18
|
+
visibility: 'visible'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const imgHideStyle: CSSProperties = {
|
|
22
|
+
width:'20px',
|
|
23
|
+
height: '10px',
|
|
24
|
+
marginBottom: '2px',
|
|
25
|
+
visibility: 'hidden'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const reddotStyle: CSSProperties = {
|
|
29
|
+
width: '32px',
|
|
30
|
+
height: '32px',
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: '-20px',
|
|
33
|
+
right: '-20px'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class TopTab extends Component<
|
|
37
|
+
{
|
|
38
|
+
title: string,
|
|
39
|
+
isChoosed: boolean,
|
|
40
|
+
},
|
|
41
|
+
any> {
|
|
42
|
+
private refRoot = createRef()
|
|
43
|
+
private hasYelloDot: boolean = false //是否可能有黄点
|
|
44
|
+
|
|
45
|
+
constructor(props){
|
|
46
|
+
super(props)
|
|
47
|
+
|
|
48
|
+
this.state = {
|
|
49
|
+
showYelloDot: false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.checkYellowDot()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidMount(){
|
|
56
|
+
this.refRoot.current.parentNode.style.flexGrow = 1 //处理掉react自动生成的空div
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
checkYellowDot = ()=>{
|
|
60
|
+
if(this.props.title == "福利") this.hasYelloDot = true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render(){
|
|
64
|
+
return (
|
|
65
|
+
<div ref={this.refRoot} style={rootStyle} className={videoLess.column_end_center}>
|
|
66
|
+
<div>
|
|
67
|
+
{this.hasYelloDot ? <img src={Images.item_reddot} style={reddotStyle}/> : null}
|
|
68
|
+
<text>{this.props.title}</text>
|
|
69
|
+
</div>
|
|
70
|
+
<img src={Images.tab_choosed} style={this.props.isChoosed ? imgShowStyle : imgHideStyle}/>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component, CSSProperties } from "preact"
|
|
2
|
+
import { VideoPlayer, VideoPlayerProps } from "../../components/videoplayer/VideoPlayer"
|
|
3
|
+
|
|
4
|
+
const rootStyle: CSSProperties = {
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: '100%',
|
|
8
|
+
|
|
9
|
+
// backgroundColor: '#000000'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class VideoPlayerDemo extends Component<any,any>{
|
|
13
|
+
constructor(props){
|
|
14
|
+
super(props)
|
|
15
|
+
|
|
16
|
+
this.addNetEvents()
|
|
17
|
+
this.addLogicEvents()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
componentWillUnmount(){
|
|
21
|
+
this.removeLogicEvents()
|
|
22
|
+
this.removeNetEvents()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
addNetEvents = ()=>{
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeNetEvents = ()=>{
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
addLogicEvents = ()=>{
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
removeLogicEvents = ()=>{
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
render(){
|
|
43
|
+
const videoProps: VideoPlayerProps ={
|
|
44
|
+
playUrl: "http://image.smoba.qq.com/Video/playonline/Nobe_Video.mp4",
|
|
45
|
+
onPlaying: null,
|
|
46
|
+
onEnded: null,
|
|
47
|
+
onError: null,
|
|
48
|
+
onNetworkFailed: null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div style={rootStyle}>
|
|
53
|
+
<VideoPlayer config={videoProps}/>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
class EventDispatcherCls { //变量在对象实例上,方法在原型上
|
|
2
|
+
listeners = {};
|
|
3
|
+
|
|
4
|
+
AddEventListener(eventName:string, listener:any, ...args)
|
|
5
|
+
{
|
|
6
|
+
if (listener == undefined){
|
|
7
|
+
console.warn("listener为空, eventName: "+ eventName);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let listeners = this.listeners;
|
|
12
|
+
if (listeners[eventName] == undefined) {
|
|
13
|
+
listeners[eventName] = [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let eventList:Array<Object> = listeners[eventName];
|
|
17
|
+
eventList.forEach(function (v:any) {
|
|
18
|
+
if (v.eventName == eventName && v.listener == listener){
|
|
19
|
+
console.warn("重复添加的事件监听, eventName: " + eventName);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
eventList.push({"eventName":eventName,"listener":listener,"args":args,});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
HasEventListener(eventName:string){
|
|
28
|
+
if (this.listeners[eventName] == undefined || this.listeners[eventName].length == 0){
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
RemoveEventListener(eventName:string, listener){
|
|
36
|
+
if (this.HasEventListener(eventName) == false){
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let eventList:Array<Object> = this.listeners[eventName];
|
|
41
|
+
for (let i = eventList.length - 1; i >=0; --i) {
|
|
42
|
+
let event:any = eventList[i];
|
|
43
|
+
if (event.eventName == eventName && event.listener == listener) {
|
|
44
|
+
eventList.splice(i, 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (eventList.length == 0){
|
|
49
|
+
this.listeners[eventName] = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RemoveEventAllListener(eventName:string){
|
|
54
|
+
if (this.HasEventListener(eventName)){
|
|
55
|
+
this.listeners[eventName] = null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
DispatchEvent(eventName:string, ...args){
|
|
60
|
+
if (eventName == undefined || this.HasEventListener(eventName) == false){
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let eventList:Array<Object> = this.listeners[eventName].slice(0);
|
|
65
|
+
for (let i = 0; i < eventList.length; ++i) {
|
|
66
|
+
let obj:any = eventList[i];
|
|
67
|
+
let listener:any = obj.listener;
|
|
68
|
+
// listener.apply(this, obj.args.concat(args));
|
|
69
|
+
listener(...obj.args.concat(args))
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export let EventDispatcherJs = Object.freeze(new EventDispatcherCls());
|