Browse Source

调用详情页接口

Limengbo 5 years ago
parent
commit
859378a2ac

File diff suppressed because it is too large
+ 97 - 87
android/app/src/main/assets/index.android.bundle


BIN
android/app/src/main/res/drawable-mdpi/pages_images_common_arrowright.png


BIN
android/app/src/main/res/drawable-mdpi/pages_images_common_setting.png


BIN
android/app/src/main/res/drawable-mdpi/pages_images_common_wechat.png


BIN
android/app/src/main/res/drawable-mdpi/pages_images_share_circle.png


BIN
android/app/src/main/res/drawable-mdpi/pages_images_share_wechat.png


BIN
android/app/src/main/res/drawable-xhdpi/pages_images_common_setting.png


BIN
android/app/src/main/res/drawable-xhdpi/pages_images_common_wechat.png


BIN
android/app/src/main/res/drawable-xhdpi/pages_images_share_circle.png


BIN
android/app/src/main/res/drawable-xhdpi/pages_images_share_wechat.png


BIN
android/app/src/main/res/drawable-xxhdpi/pages_images_common_setting.png


BIN
android/app/src/main/res/drawable-xxhdpi/pages_images_common_wechat.png


BIN
android/app/src/main/res/drawable-xxhdpi/pages_images_share_circle.png


BIN
android/app/src/main/res/drawable-xxhdpi/pages_images_share_wechat.png


+ 18 - 1
pages/CourseDetails.js

@@ -21,11 +21,23 @@ import CourseListRow from './components/CourseListRow'
 import CourseListLine from './components/CourseListLine'
 import Comment from './components/Comment'
 import Order from './components/Order'
+import courseDetails from './services/courseDetails'
 
 export default class CourseDetails extends Component {
+  componentDidMount() {
+    const { courseId } = this.props.navigation.state.params;
+    console.log(courseId)
+    courseDetails.getCourseDetails(courseId).success(res => {
+      console.log('列表',res.data)
+      this.setState({
+        courseList: 222
+      })
+    });
+  }
   state = {
     fullStyle: {},
-    lefts: 0
+    lefts: 0,
+    courseList: 111
   }
   render() {
     return (
@@ -37,6 +49,8 @@ export default class CourseDetails extends Component {
             title={'同步辅导语文一年级下册'}
             details={'汉字,作为象形文字,是中华文化的载体,本课程从甲骨文开始,让孩子爱上识字爱上文字的美。了解文字…'}
             uri={'http://chimee.org/vod/1.mp4'}
+            dataList={ this.state.courseList }
+            videoback={this.back.bind(this) } 
             />
           </View>
           <View style={ this.state.fullStyle }>
@@ -49,6 +63,9 @@ export default class CourseDetails extends Component {
       </View>
     );
   }
+  back(){
+    this.props.navigation.goBack()
+  }
   full(isFull){
     if(isFull) {
       // 全屏时隐藏多余的view

+ 2 - 1
pages/components/ScrollRow.js

@@ -34,6 +34,7 @@ export default class ScrollRow extends Component {
 
     renderItem(item, separators) {
         console.log(this.toNextPage)
+        const courseId = item.course ? item.course.id : item.operationContent;
         return (
             <TouchableOpacity
                 style={{
@@ -44,7 +45,7 @@ export default class ScrollRow extends Component {
                     alignItems: 'center',
                     marginLeft: 9,
                 }}
-                onPress={() => this.props.nav('CourseDetails')}
+                onPress={() => this.props.nav('CourseDetails', {courseId})}
                 activeOpacity={1}
             >
                 <View style={{

+ 16 - 9
pages/components/VideoExplain.js

@@ -57,7 +57,7 @@ export default class VideoExplain extends Component {
           uri={this.props.uri} //播放路径
           ref={view => (this.video = view)} //设置ID
           needback={true}
-          videoback={() => alert("videoback")}
+          videoback={this.back.bind(this)}
           videofullScreenPlayer={this.fullScreenPlayer.bind(this)}
           onError={this.onError.bind(this)}
           onEnd={this.onEnd.bind(this)}
@@ -68,7 +68,7 @@ export default class VideoExplain extends Component {
         />
         <View style={styles.videoExplain}>
           <View style={styles.title}>
-            <Text style={styles.font}>{this.props.title}</Text>
+            <Text style={styles.font}>{this.props.dataList}</Text>
             <View style={styles.icon}>
               <TouchableOpacity onPress={this.collection.bind(this)}>
                 <Image source={this.state.collectImage} style={styles.iconSize} />
@@ -122,20 +122,27 @@ export default class VideoExplain extends Component {
     alert("播放结束");
     this.video.refreshVideo();
   }
+  back(){
+    this.props.videoback();
+  }
   componentWillMount() {
-    BackHandler.addEventListener(
+    this.backlistener=BackHandler.addEventListener(
       "hardwareBackPress",
-      this.onBackAndroid.bind(this)
+      this.onBackAndroid
     );
   }
   componentWillUnmount() {
-    BackHandler.removeEventListener(
-      "hardwareBackPress",
-      this.onBackAndroid.bind(this)
-    );
+    console.log("componentWillUnmount")
+    if( this.backlistener){
+      BackHandler.removeEventListener(
+        "hardwareBackPress",
+        this.onBackAndroid
+      );
+    }
+ 
   }
   // 播放器返回
-  onBackAndroid() {
+  onBackAndroid=() => {
     if (this.state.isFull) {
       return true;
     } else {

+ 8 - 0
pages/services/courseDetails.js

@@ -0,0 +1,8 @@
+import APIConfig from './api.js';
+import efunRequest from '../utils/efunRequest'
+
+export default class CourseDetails {
+    static getCourseDetails(courseId) {
+      return efunRequest.getHttpRequest().url(`http://ott80testlibrary.yifangjiaoyu.cn/mobile/course/${courseId}`).get();
+    }
+}