@@ -11,6 +11,8 @@ import {
11
11
import VideoPlayer from './../../components/VideoPlayer' ;
12
12
import Orientation from 'react-native-orientation'
13
13
14
+ const { width : screenWidth , height :screenHeight } = Dimensions . get ( 'window' )
15
+
14
16
export default class VideoDetail extends PureComponent {
15
17
16
18
constructor ( props ) {
@@ -66,17 +68,125 @@ export default class VideoDetail extends PureComponent {
66
68
this . setState ( {
67
69
isFullScreen : false
68
70
} )
69
- this . videoPlayer . uodateLayout ( width , width * 9 / 16 , false )
71
+ this . videoPlayer . updateLayout ( width , width * 9 / 16 , false )
70
72
}
71
73
}
72
74
73
-
75
+ _clickVote = ( ) => {
76
+ this . setState ( {
77
+ isVote : true ,
78
+ voteCount : this . state . voteCount + 1
79
+ } )
80
+ }
74
81
75
82
render ( ) {
76
83
return (
77
- < View >
84
+ < View style = { styles . container } onLayout = { this . _onLayoutChange } >
85
+ < VideoPlayer
86
+ ref = { ( ref ) => this . videoPlayer = ref }
87
+ videoURL = { this . uri }
88
+ videoTitle = { this . params . title }
89
+ videoCover = { this . cover }
90
+ onChangeOrientation = { this . _onOrinentationChange }
91
+ onTapBackButton = { this . _onClickBackButton }
92
+ enableSwitchScreen = { true }
93
+ />
94
+ < View style = { { flex : 1 , backgroundColor : 'red' } } >
95
+ < ScrollView style = { { backgroundColor : '#f8f8f8' } } >
96
+ < View style = { styles . videoInfoContainer } >
97
+ < View style = { styles . infoTopContainer } >
98
+ < Text style = { styles . infoTitle } > { this . params . title } </ Text >
99
+ < TouchableOpacity activeOpacity = { 1 } style = { styles . infoRight } onPress = { ( ) => { ! this . state . isVote && this . _clickVote ( ) } } >
100
+ < Image style = { styles . infoZoveImg } source = { this . state . isVote ? require ( './../../../assets/images/i_vote_red.png' ) : require ( './../../../assets/images/i_vote_black.png' ) } resizeMode = { 'contain' } />
101
+ < Text style = { [ styles . infoZoveText , { color :this . state . isVote ? '#d81e06' : '#000' } ] } > { this . state . voteCount } </ Text >
102
+ </ TouchableOpacity >
103
+ </ View >
78
104
105
+ < View style = { styles . vedioPlayContainer } >
106
+ < Image resizeMode = { 'contain' } source = { require ( './../../../assets/images/i_right_arrows.png' ) } style = { { width :15 , height :15 } } />
107
+ < Text style = { { fontSize :12 , color :'#515151' } } > { this . playCount } 次播放</ Text >
108
+ </ View >
109
+
110
+ < View style = { styles . vedioUserContainer } >
111
+ < View style = { { flexDirection :'row' , alignItems : 'center' } } >
112
+ < Image resizeMode = { 'contain' } source = { { uri :this . topicImg } } style = { styles . vedioUserImg } />
113
+ < Text style = { { fontSize :12 , color :'#000' } } > { this . topicName } </ Text >
114
+ </ View >
115
+
116
+ < TouchableOpacity activeOpacity = { 0.9 } style = { styles . subscriptionBtn } >
117
+ < Text style = { { fontSize :12 , color :'#000' } } > +订阅</ Text >
118
+ </ TouchableOpacity >
119
+ </ View >
120
+ </ View >
121
+ </ ScrollView >
122
+
123
+ < View style = { { height : 50 , backgroundColor :'#f8f8f8' , flexDirection :'row' } } > </ View >
124
+ </ View >
79
125
</ View >
80
126
)
81
127
}
82
- }
128
+ }
129
+
130
+ const styles = StyleSheet . create ( {
131
+ container : {
132
+ flex : 1 ,
133
+ } ,
134
+ videoInfoContainer :{
135
+ paddingHorizontal : 10 ,
136
+ paddingVertical : 12 ,
137
+ } ,
138
+ infoTopContainer :{
139
+ flexDirection : 'row' ,
140
+ minHeight : 60 ,
141
+ justifyContent : 'space-around' ,
142
+ alignItems : 'flex-start' ,
143
+ } ,
144
+ infoTitle :{
145
+ color : '#000' ,
146
+ fontSize : 16 ,
147
+ maxWidth : screenWidth * 0.8 ,
148
+ lineHeight : 28 ,
149
+ } ,
150
+ infoRight : {
151
+ alignItems : 'center' ,
152
+ justifyContent : 'center' ,
153
+ alignSelf : 'center' ,
154
+ width : 60 ,
155
+ height : 40 ,
156
+ marginLeft : 20 ,
157
+ borderLeftColor : '#bfbfbf' ,
158
+ borderLeftWidth : 1 ,
159
+ } ,
160
+ infoZoveImg : {
161
+ width : 20 ,
162
+ height : 20 ,
163
+ } ,
164
+ infoZoveText : {
165
+ fontSize : 12 ,
166
+ } ,
167
+ vedioPlayContainer : {
168
+ flexDirection : 'row' ,
169
+ alignItems : 'center' ,
170
+ marginVertical : 12 ,
171
+ } ,
172
+ vedioUserContainer : {
173
+ flexDirection : 'row' ,
174
+ alignItems : 'center' ,
175
+ justifyContent : 'space-between'
176
+ } ,
177
+ vedioUserImg : {
178
+ width : 26 ,
179
+ height : 26 ,
180
+ borderRadius : 26 ,
181
+ marginRight : 5
182
+ } ,
183
+ subscriptionBtn : {
184
+ width : 70 ,
185
+ height : 30 ,
186
+ borderWidth : 1 ,
187
+ borderColor : '#000' ,
188
+ borderRadius : 20 ,
189
+ justifyContent : 'center' ,
190
+ alignItems : 'center' ,
191
+ }
192
+ } )
0 commit comments