Browse Source

解决冲突

Limengbo 5 years ago
parent
commit
07b6a27d6d

+ 2 - 0
android/app/build.gradle

@@ -148,9 +148,11 @@ android {
 }
 
 dependencies {
+    implementation project(':react-native-image-picker')
     implementation project(':react-native-orientation')
     implementation project(':react-native-video')
     implementation project(':react-native-gesture-handler')
+    implementation project(':react-native-image-picker')
     implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
     implementation "com.facebook.react:react-native:+"  // From node_modules

+ 2 - 3
android/app/src/main/AndroidManifest.xml

@@ -2,13 +2,10 @@
     package="com.edufound.mobile">
 
     <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
     <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
@@ -18,6 +15,8 @@
     <!--Android6.0需要动态申请一下权限-->
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="com.xiaomi.permission.AUTH_THIRDPAY" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 
     <application
         android:name="com.edufound.MainApplication"

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


+ 3 - 1
android/app/src/main/java/com/edufound/MainApplication.java

@@ -11,6 +11,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
 import com.facebook.react.shell.MainReactPackage;
 import com.facebook.soloader.SoLoader;
 import com.github.yamill.orientation.OrientationPackage;
+import com.imagepicker.ImagePickerPackage;
 import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
 
 import java.util.Arrays;
@@ -32,7 +33,8 @@ public class MainApplication extends Application implements ReactApplication {
                     new RNGestureHandlerPackage(),
                     new CustomPackage(),
                     new ReactVideoPackage(),
-                    new OrientationPackage()
+                    new OrientationPackage(),
+                    new ImagePickerPackage()
             );
         }
 

+ 2 - 0
android/settings.gradle

@@ -1,4 +1,6 @@
 rootProject.name = 'efunbox_mobile_8'
+include ':react-native-image-picker'
+project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
 include ':react-native-orientation'
 project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
 include ':react-native-video'

+ 19 - 0
ios/efunbox_mobile_8.xcodeproj/project.pbxproj

@@ -43,6 +43,7 @@
 		40B60160FAE8416EABF8F455 /* libRNGestureHandler-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63E89BCAA43940789F6CD17E /* libRNGestureHandler-tvOS.a */; };
 		9CB969D57DBB44968F57230A /* libRCTVideo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D361E312399E41ABA1C9CF77 /* libRCTVideo.a */; };
 		BE43474A85F54112A6EA6E37 /* libRCTOrientation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 977DC2E26A1E45688924C43C /* libRCTOrientation.a */; };
+		E7126B830D54449191E5A4A3 /* libRNImagePicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D4C934671D884A4AAA31603D /* libRNImagePicker.a */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -357,6 +358,8 @@
 		D361E312399E41ABA1C9CF77 /* libRCTVideo.a */ = {isa = PBXFileReference; name = "libRCTVideo.a"; path = "libRCTVideo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
 		13F318D169DD4BA79CB54ED5 /* RCTOrientation.xcodeproj */ = {isa = PBXFileReference; name = "RCTOrientation.xcodeproj"; path = "../node_modules/react-native-orientation/iOS/RCTOrientation.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
 		977DC2E26A1E45688924C43C /* libRCTOrientation.a */ = {isa = PBXFileReference; name = "libRCTOrientation.a"; path = "libRCTOrientation.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
+		B11B05F3205C483583EB7421 /* RNImagePicker.xcodeproj */ = {isa = PBXFileReference; name = "RNImagePicker.xcodeproj"; path = "../node_modules/react-native-image-picker/ios/RNImagePicker.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
+		D4C934671D884A4AAA31603D /* libRNImagePicker.a */ = {isa = PBXFileReference; name = "libRNImagePicker.a"; path = "libRNImagePicker.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -388,6 +391,7 @@
 				E4A0D76E036246C0B94364AD /* libRNGestureHandler.a in Frameworks */,
 				9CB969D57DBB44968F57230A /* libRCTVideo.a in Frameworks */,
 				BE43474A85F54112A6EA6E37 /* libRCTOrientation.a in Frameworks */,
+				E7126B830D54449191E5A4A3 /* libRNImagePicker.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -581,6 +585,7 @@
 				CB9C1A0696FE4DC596B9C15D /* RNGestureHandler.xcodeproj */,
 				C6CF52A56D1E43279554ACA6 /* RCTVideo.xcodeproj */,
 				13F318D169DD4BA79CB54ED5 /* RCTOrientation.xcodeproj */,
+				B11B05F3205C483583EB7421 /* RNImagePicker.xcodeproj */,
 			);
 			name = Libraries;
 			sourceTree = "<group>";
@@ -1212,12 +1217,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Debug;
@@ -1243,12 +1250,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Release;
@@ -1274,6 +1283,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Debug;
@@ -1298,6 +1308,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Release;
@@ -1331,12 +1342,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Debug;
@@ -1370,12 +1383,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Release;
@@ -1408,12 +1423,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Debug;
@@ -1446,12 +1463,14 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(SRCROOT)\..\node_modules\react-native-gesture-handler\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-video\ios/**",
 					"$(SRCROOT)\..\node_modules\react-native-orientation\iOS\RCTOrientation/**",
+					"$(SRCROOT)\..\node_modules\react-native-image-picker\ios",
 				);
 			};
 			name = Release;

+ 5 - 0
package-lock.json

@@ -6953,6 +6953,11 @@
         "prop-types": "^15.5.10"
       }
     },
+    "react-native-image-picker": {
+      "version": "0.28.1",
+      "resolved": "https://registry.npm.taobao.org/react-native-image-picker/download/react-native-image-picker-0.28.1.tgz",
+      "integrity": "sha1-ESdGBSLgyXQfxi89BAJx0pj7am4="
+    },
     "react-native-orientation": {
       "version": "3.1.3",
       "resolved": "https://registry.npm.taobao.org/react-native-orientation/download/react-native-orientation-3.1.3.tgz",

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "react-dom": "^16.8.6",
     "react-native": "0.59.4",
     "react-native-gesture-handler": "^1.1.0",
+    "react-native-image-picker": "^0.28.1",
     "react-native-orientation": "^3.1.3",
     "react-native-swiper": "^1.5.14",
     "react-native-video": "^4.4.1",

+ 2 - 4
pages/BasePage.js

@@ -45,12 +45,10 @@ export default class BasePage extends Component<Props> {
     return width;
   }
 
-  toNextPage= (params) => {
+  toNextPage= (params,obj) => {
     //跳转之前移除当前界面的监听
     this.removeListener();
-    console.log('跳转参数',params)
-    console.log(this.props)
-    this.props.navigation.navigate(params);
+    this.props.navigation.navigate(params,obj);
   }
   Toast(params) {
     AndroidUtil.showToast(params, AndroidUtil.SHORT);

+ 4 - 2
pages/buy/buy.js

@@ -15,6 +15,7 @@ import {
     ScrollView,
     Modal,
     Animated,
+    TextInput
 } from "react-native";
 import BasePage from "../BasePage";
 import Dimensions from '../utils/dimensions';
@@ -149,7 +150,7 @@ export default class Buy extends BasePage {
                                     }
 
                                 </TouchableOpacity>
-                                <TouchableOpacity activeOpacity={0.9} style={styles.payDialog} onPress={() => this.setPayMethod(2)}>
+                                {/* <TouchableOpacity activeOpacity={0.9} style={styles.payDialog} onPress={() => this.setPayMethod(2)}>
                                     <View style={styles.dialogRow}>
                                         <Image style={styles.payIcon} source={require('../images/common/aliPay.png')} />
                                         <Text>支付宝支付</Text>
@@ -161,7 +162,8 @@ export default class Buy extends BasePage {
                                             :
                                             null
                                     }
-                                </TouchableOpacity>
+                                </TouchableOpacity> */}
+                                <TextInput style={styles.payDialog} />
                             </Animated.View>
                         </TouchableHighlight>
                         :

+ 2 - 2
pages/components/BirthdayModal.js

@@ -506,7 +506,7 @@ export default class BirthdayModal extends Component<Props> {
 const styles = StyleSheet.create({
   item_text: {
     color: "rgba(77, 77, 77, 1)",
-    fontSize: 20,
+    fontSize: 18,
     justifyContent: "center",
     alignItems: "center",
     marginTop: 20,
@@ -516,7 +516,7 @@ const styles = StyleSheet.create({
   },
   item_text_click: {
     color: "rgba(59, 149, 243, 1)",
-    fontSize: 20,
+    fontSize: 18,
     justifyContent: "center",
     alignItems: "center",
     marginTop: 20,

+ 16 - 3
pages/components/ChosePhoto.js

@@ -22,8 +22,9 @@ import {
   TouchableHighlight,
   DeviceEventEmitter
 } from "react-native";
-
+import ImagePicker from "react-native-image-picker";
 type Props = {};
+const options = {};
 export default class ChosePhoto extends Component<Props> {
   state = {
     modalVisible: false
@@ -191,10 +192,22 @@ export default class ChosePhoto extends Component<Props> {
     );
   }
   photograph() {
-    alert("拍照");
+    //拍照
+    ImagePicker.launchCamera(options, response => {
+      if (response.error) {
+        alert("ImagePicker Error: " + response.error);
+      }
+      this.props.photoback(response.uri);
+    });
   }
 
   album_selection() {
-    alert("相册选择");
+    //打开系统相册
+    ImagePicker.launchImageLibrary(options, response => {
+      if (response.error) {
+        alert("ImagePicker Error: " + response.error);
+      }
+      this.props.photoback(response.uri);
+    });
   }
 }

+ 88 - 43
pages/components/MainPage.js

@@ -41,7 +41,11 @@ export default class MainPage extends BasePage {
   }
 
   componentDidMount() {
-    LibraryUrl.getIndex('PRESCHOOL').success(res => {
+    this.updateRender('PRIMARY_SCHOOL')
+  }
+
+  updateRender(index) {
+    LibraryUrl.getIndex(index).success(res => {
       console.log(res)
       const monthTopicTitle = res.data.monthTopic.zone.title;
       const monthTopicScroll = res.data.monthTopic.zoneCourseVOList;
@@ -57,6 +61,7 @@ export default class MainPage extends BasePage {
       // console.log(typeof listData)
       // console.log(listData)
       // console.log(listData.length)
+      let scheduleWeek = schedule[0].featureMap ? schedule[0].featureMap.weekSeq : '1'
       this.setState({
         // listData: listData.length? listData : [],
         hotCourse,
@@ -64,9 +69,12 @@ export default class MainPage extends BasePage {
         monthTopicScroll,
         schedule,
         recommend,
-        banner
+        banner,
+        scheduleWeek
       })
       console.log(this.state.banner)
+    }).fail(() => {
+      alert(1111)
     })
   }
 
@@ -79,33 +87,39 @@ export default class MainPage extends BasePage {
     recommend: [],
     listData: [],
     banner: [],
-    currentSwitch: { title: '学前', param: 'PRESCHOOL' },
+    currentSwitch: { title: '小学', param: 'PRIMARY_SCHOOL' },
     switchList: [
-      { title: '幼儿园', param: 'KINDERGARTEN' },
+      // { title: '幼儿园', param: 'KINDERGARTEN' },
       { title: '学前', param: 'PRESCHOOL' },
       { title: '小学', param: 'PRIMARY_SCHOOL' },
       { title: '中学', param: 'MIDDLE_SCHOOL' },
-    ]
+    ],
+    scheduleWeek: '1'
   }
 
   renderBtn = (item, index) => {
     return (
-      this.state.currentSwitch.param === item.param
-        ?
-        null
-        :
-        <TouchableOpacity onPress={()=>this.switchGrade(index)} key={index} style={index === 1 ? styles.gradeItemMid : styles.gradeItem}>
-          <Text style={styles.gradeText}>{item.title}</Text>
-        </TouchableOpacity>
+      // this.state.currentSwitch.param === item.param
+      //   ?
+      //   null
+      //   :
+      //   <TouchableOpacity onPress={() => this.switchGrade(index)} key={index} style={index === 1 ? styles.gradeItemMid : styles.gradeItem}>
+      //     <Text style={styles.gradeText}>{item.title}</Text>
+      //   </TouchableOpacity>
+      <TouchableOpacity onPress={() => this.switchGrade(index)} key={index} style={index === 1 ? styles.gradeItemMid : styles.gradeItem}>
+        <Text style={styles.gradeText}>{item.title}</Text>
+      </TouchableOpacity>
     )
   }
 
-  switchGrade=(index)=>{
+  switchGrade = (index) => {
     const obj = this.state.switchList[index]
     this.setState({
       currentSwitch: obj
     })
     this.hideGradeMenu()
+    // if (obj.param === this.state.currentSwitch.param) return
+    this.updateRender(obj.param)
   }
 
   render() {
@@ -122,7 +136,7 @@ export default class MainPage extends BasePage {
           renderSectionHeader={this.sectionTitle}
           onScroll={this.hideGradeMenu}
         /> */}
-        <ScrollView style={{ height: Dimensions.height }} onScroll={this.hideGradeMenu} >
+        <ScrollView style={{ height: Dimensions.height }} showsVerticalScrollIndicator={false} onScroll={this.hideGradeMenu} >
           {this.headerorfooterComponent()}
           {this.getSwiperElement()}
           {this.getScheduleElement()}
@@ -138,15 +152,6 @@ export default class MainPage extends BasePage {
                 ...styles.callUpGrade,
                 opacity: this.state.fadeAnim
               }}>
-              {/* <TouchableOpacity style={styles.gradeItem}>
-                <Text style={styles.gradeText}>小学</Text>
-              </TouchableOpacity>
-              <TouchableOpacity style={styles.gradeItemMid}>
-                <Text style={styles.gradeText}>学前</Text>
-              </TouchableOpacity>
-              <TouchableOpacity style={styles.gradeItem}>
-                <Text style={styles.gradeText}>中学</Text>
-              </TouchableOpacity> */}
               {this.state.switchList.map((item, index) => this.renderBtn(item, index))}
             </Animated.View>
           ) : (
@@ -203,7 +208,7 @@ export default class MainPage extends BasePage {
     return (
       <View
         style={{
-          height: Dimensions.getDp(163),
+          height: Dimensions.getHeight(163),
           flex: 1,
           justifyContent: "center",
           alignItems: "center",
@@ -213,7 +218,7 @@ export default class MainPage extends BasePage {
         <View
           style={{
             width: Dimensions.getWidth(358),
-            height: Dimensions.getDp(153),
+            height: Dimensions.getHeight(153),
             justifyContent: "center",
             overflow: 'hidden'
           }}
@@ -231,26 +236,58 @@ export default class MainPage extends BasePage {
   // 渲染课程表
   getScheduleElement() {
     let renderScheduleItem = (item, index) => {
+      const id = item.boothId
       return (
         <TouchableOpacity
-          style={{ width: 172, height: 86, marginRight: 12 }}
-          onPress={() => this.toNextPage('SchedulePage')}
+          style={{
+            width: Dimensions.getWidth(172),
+            height: Dimensions.getHeight(86),
+            marginRight: 12
+          }}
+          onPress={() => this.toNextPage('SchedulePage',{id})}
           key={index}
           activeOpacity={1}
         >
-          <Image
+          <ImageBackground
             source={{
               uri: item.boothContent
             }}
             key={index}
             style={{
               flex: 1,
-              justifyContent: "center",
-              alignItems: "center",
+              // justifyContent: "center",
+              // alignItems: "center",
               borderRadius: 10
-
             }}
-          />
+          >
+            {
+              item.operationContent === 'KINDERGARTE'
+                ?
+                null
+                :
+                <View style={{
+                  width: Dimensions.getWidth(90),
+                  height: Dimensions.getHeight(45),
+                  marginLeft: Dimensions.getWidth(15),
+                  marginTop: Dimensions.getHeight(15),
+
+                  justifyContent: 'center',
+                  alignItems: 'center'
+                }}>
+                  <Text style={{
+                    color: '#fff',
+                    fontSize: 18,
+                  }}>{item.title}</Text>
+                  <Text
+                    style={{
+                      color: '#fff',
+                      fontSize: 18,
+                    }}
+                  >{item.summary}</Text>
+                </View>
+            }
+
+          </ImageBackground>
         </TouchableOpacity>
       )
     }
@@ -259,11 +296,11 @@ export default class MainPage extends BasePage {
         style={{
           flex: 1,
           flexDirection: "column",
-          height: 160,
+          height: Dimensions.getHeight(160),
         }}
       >
-        <TopicTitle title={'课程表:第一周'} ifTubeShow={true} />
-        <View
+        <TopicTitle title={`课程表:第${this.state.scheduleWeek}周`} ifTubeShow={true} />
+        {/* <View
           style={{
             flex: 2,
             flexDirection: "row",
@@ -272,7 +309,15 @@ export default class MainPage extends BasePage {
           }}
         >
           {this.state.schedule.map((item, index) => renderScheduleItem(item, index))}
-        </View>
+        </View> */}
+        <FlatList
+          data={this.state.schedule}
+          horizontal={true}
+          style={{ paddingLeft: '3.2%' }}
+          renderItem={({ item, index }) => renderScheduleItem(item, index)}
+          keyExtractor={(item, index) => index.toString()}
+          showsHorizontalScrollIndicator={false}
+        />
       </View>
     );
   }
@@ -419,7 +464,7 @@ const styles = StyleSheet.create({
   searchSection: {
     flex: 1,
     width: Dimensions.width,
-    height: 60,
+    height: Dimensions.getHeight(60),
     flexDirection: 'row',
     alignItems: 'center',
     backgroundColor: '#f0f1f5',
@@ -427,14 +472,14 @@ const styles = StyleSheet.create({
     position: 'relative',
   },
   searchBox: {
-    width: 232,
-    height: 40,
+    width: Dimensions.getWidth(232),
+    height: Dimensions.getHeight(40),
     backgroundColor: '#fff',
     borderRadius: 20
   },
   rightBtn: {
-    width: 113,
-    height: 40,
+    width: Dimensions.getWidth(113),
+    height: Dimensions.getHeight(40),
     backgroundColor: '#fff',
     borderRadius: 20,
     alignItems: 'center',
@@ -445,8 +490,8 @@ const styles = StyleSheet.create({
     paddingRight: 10,
   },
   rightBtnIcon: {
-    width: 14,
-    height: 14
+    width: Dimensions.getWidth(23),
+    height: Dimensions.getHeight(23),
   },
   rightBtnText: {
     color: '#151515',

+ 395 - 387
pages/components/PersonalInfo.js

@@ -34,494 +34,500 @@ import PersonalInfoDialog from "./PersonalInfoDialog";
 type Props = {};
 export default class PersonalInfo extends BasePage {
   state = {
-    updateNS_show: false,
     nickName: "初始昵称",
     schoolName: "未设置",
-    cisys: "北京市",
+    provinceName: "广东省",
+    citys: "深圳市",
     grade_text: "七年级",
     grade_index: 6,
     birthday_year: 0,
     birthday_month: 0,
     birthday_day: 0,
-    birthday_time: 0
+    birthday_time: 0,
+    photo_uri: require("../images/userInfo/default_photo.png")
   };
-
+  updateState(data) {
+    this.setState(data);
+  }
   render() {
     return (
-      <View style={{ flex: 1 }}>
-        <ChosePhoto ref={view => (this.chosephoto = view)} />
-        <RegionModal
-          ref={view => (this.regionmodal = view)}
-          cityscommit={this.cityscommit.bind(this)}
-        />
-        <GradeSelectionModal
-          ref={view => (this.gradeselectionModal = view)}
-          commitGrade={this.commitGrade.bind(this)}
-          grade_index={this.state.grade_index}
-        />
-        <BirthdayModal
-          ref={view => (this.birthdaymodal = view)}
-          birthdaycommit={this.birthdaycommit.bind(this)}
-          year={this.state.birthday_year}
-          month={this.state.birthday_month}
-          day={this.state.birthday_day}
-        />
-        <StatusBar backgroundColor={"transparent"} translucent={true} />
+      <View style={{ backgroundColor: "#F0F1F5", flex: 1 }}>
+        <View style={{ width: "100%", height: this.getWindowHeight() }}>
+          <PersonalInfoDialog
+            ref={view => (this.dialog = view)}
+            updateParentState={this.updateState.bind(this)}
+          />
+          <ChosePhoto
+            ref={view => (this.chosephoto = view)}
+            photoback={this.photoback.bind(this)}
+          />
+          <RegionModal
+            ref={view => (this.regionmodal = view)}
+            cityscommit={this.cityscommit.bind(this)}
+            provinceName={this.state.provinceName}
+            citys={this.state.citys}
+          />
+          <GradeSelectionModal
+            ref={view => (this.gradeselectionModal = view)}
+            commitGrade={this.commitGrade.bind(this)}
+            grade_index={this.state.grade_index}
+          />
+          <BirthdayModal
+            ref={view => (this.birthdaymodal = view)}
+            birthdaycommit={this.birthdaycommit.bind(this)}
+            year={this.state.birthday_year}
+            month={this.state.birthday_month}
+            day={this.state.birthday_day}
+          />
+          <StatusBar backgroundColor={"transparent"} translucent={true} />
 
-        <View
-          style={{
-            flex: 1,
-            flexDirection: "column"
-          }}
-        >
-          <ImageBackground
-            source={require("../images/userInfo/top.png")}
+          <View
             style={{
-              flex: 2.8,
-              width: "100%",
-              backgroundColor: "#F0F1F5",
-              height: "75%"
+              flex: 1,
+              flexDirection: "column"
             }}
-            imageStyle={{ resizeMode: "cover" }}
           >
-            <View
+            <ImageBackground
+              source={require("../images/userInfo/top.png")}
               style={{
-                flex: 1,
-                alignItems: "center",
-                justifyContent: "center",
-                flexDirection: "column"
+                flex: 2.8,
+                width: "100%",
+                backgroundColor: "#F0F1F5",
+                height: "75%"
               }}
+              imageStyle={{ resizeMode: "cover" }}
             >
-              <CourseTitle
-                style={{ flex: 4 }}
-                width={this.getWindowWidth()}
-                title="个人信息"
-                backPress={() => this.goBack()}
-                lefttype={2}
-                righttype={0}
-                textcolor={"white"}
-                backPress={() => this.goBack()}
-              />
-
-              <TouchableOpacity
+              <View
                 style={{
                   flex: 1,
-                  backgroundColor: "white",
-                  width: "90%",
-                  bottom: 0,
                   alignItems: "center",
                   justifyContent: "center",
-                  borderRadius: 20,
-                  overflow: "hidden"
+                  flexDirection: "column"
                 }}
-                activeOpacity={1}
-                onPress={() => this.arrowpress(0)}
               >
-                <View
+                <CourseTitle
+                  style={{ flex: 4 }}
+                  width={this.getWindowWidth()}
+                  title="个人信息"
+                  backPress={() => this.goBack()}
+                  lefttype={2}
+                  righttype={0}
+                  textcolor={"white"}
+                  backPress={() => this.goBack()}
+                />
+
+                <TouchableOpacity
                   style={{
                     flex: 1,
-                    borderRadius: 20,
-                    overflow: "hidden",
+                    backgroundColor: "white",
+                    width: "90%",
+                    bottom: 0,
                     alignItems: "center",
                     justifyContent: "center",
-                    flexDirection: "row"
+                    borderRadius: 20,
+                    overflow: "hidden"
                   }}
+                  activeOpacity={1}
+                  onPress={() => this.arrowpress(0)}
                 >
-                  <View style={{ flex: 0.5 }} />
-
                   <View
                     style={{
-                      flex: 3,
-                      height: "100%",
+                      flex: 1,
+                      borderRadius: 20,
+                      overflow: "hidden",
                       alignItems: "center",
-                      justifyContent: "center"
+                      justifyContent: "center",
+                      flexDirection: "row"
                     }}
                   >
-                    <Image
+                    <View style={{ flex: 0.5 }} />
+
+                    <View
                       style={{
-                        borderRadius: 50,
-                        width: "80%",
-                        height: "70%"
-                        // borderWidth: 3
-                        // borderColor: "red"
+                        flex: 3,
+                        height: "100%",
+                        alignItems: "center",
+                        justifyContent: "center"
                       }}
-                      source={{
-                        uri:
-                          "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1556277324856&di=dc1548a0c5ba10481af922e174912937&imgtype=0&src=http%3A%2F%2Fwww.51pptmoban.com%2Fd%2Ffile%2F2012%2F05%2F12%2F82c4568a90055adcf8fbb896f0841c69.jpg"
+                    >
+                      <Image
+                        style={{
+                          borderRadius: 50,
+                          width: "80%",
+                          height: "70%"
+                          // borderWidth: 3
+                          // borderColor: "red"
+                        }}
+                        source={this.state.photo_uri}
+                      />
+                    </View>
+                    <View
+                      style={{
+                        flex: 9,
+                        backgroundColor: "white",
+                        height: "100%",
+                        justifyContent: "center"
                       }}
-                    />
-                  </View>
-                  <View
-                    style={{
-                      flex: 9,
-                      backgroundColor: "white",
-                      height: "100%",
-                      justifyContent: "center"
-                    }}
-                  >
-                    <Text style={{ left: 10, color: "black", fontSize: 20 }}>
-                      修改头像
-                    </Text>
-                  </View>
-                  <View
-                    style={{
-                      flex: 1.5,
-                      height: "65%",
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.getArraowImg(0)}
+                    >
+                      <Text style={{ left: 10, color: "black", fontSize: 20 }}>
+                        修改头像
+                      </Text>
+                    </View>
+                    <View
+                      style={{
+                        flex: 1.5,
+                        height: "65%",
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.getArraowImg(0)}
+                    </View>
                   </View>
-                </View>
-              </TouchableOpacity>
-            </View>
-          </ImageBackground>
-          <View style={{ flex: 0.5, backgroundColor: "#F0F1F5" }} />
-          <View
-            style={{
-              width: "100%",
-              flex: 4.3,
-              alignItems: "center",
-              backgroundColor: "#F0F1F5"
-            }}
-          >
+                </TouchableOpacity>
+              </View>
+            </ImageBackground>
+            <View style={{ flex: 0.5, backgroundColor: "#F0F1F5" }} />
             <View
               style={{
-                backgroundColor: "rgb(242, 242, 242)",
-                width: "90%",
+                width: "100%",
+                flex: 4.3,
                 alignItems: "center",
-                justifyContent: "center",
-                height: "100%",
-                overflow: "hidden",
-                borderRadius: 10
+                backgroundColor: "#F0F1F5"
               }}
             >
               <View
                 style={{
-                  width: "100%",
+                  backgroundColor: "rgb(242, 242, 242)",
+                  width: "90%",
                   alignItems: "center",
                   justifyContent: "center",
-                  height: "100%"
+                  height: "100%",
+                  overflow: "hidden",
+                  borderRadius: 10
                 }}
               >
-                <TouchableOpacity
+                <View
                   style={{
-                    flex: 1,
-                    marginVertical: 1,
                     width: "100%",
-                    flexDirection: "row",
-                    backgroundColor: "white"
+                    alignItems: "center",
+                    justifyContent: "center",
+                    height: "100%"
                   }}
-                  activeOpacity={1}
-                  onPress={() => this.arrowpress(1)}
                 >
-                  <View
+                  <TouchableOpacity
                     style={{
-                      flex: 2,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.choseheadericon(1)}
-                  </View>
-                  <Text style={styles.item_text}>昵称</Text>
-                  <View
-                    style={{
-                      flex: 5,
-                      alignItems: "flex-end"
+                      flex: 1,
+                      marginVertical: 1,
+                      width: "100%",
+                      flexDirection: "row",
+                      backgroundColor: "white"
                     }}
+                    activeOpacity={1}
+                    onPress={() => this.arrowpress(1)}
                   >
-                    <Text
+                    <View
                       style={{
-                        flex: 1,
-                        fontSize: 15,
-                        textAlignVertical: "center"
+                        flex: 2,
+                        alignItems: "center",
+                        justifyContent: "center"
                       }}
-                      numberOfLines={1}
-                      ellipsizeMode={"tail"}
                     >
-                      {this.state.nickName}
-                    </Text>
-                  </View>
-                  <View
-                    style={{
-                      flex: 1.1,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.getArraowImg(1)}
-                  </View>
-                </TouchableOpacity>
-                <TouchableOpacity
-                  style={{
-                    flex: 1,
-                    width: "100%",
-                    flexDirection: "row",
-                    backgroundColor: "white",
-                    marginVertical: 1
-                  }}
-                  activeOpacity={1}
-                  onPress={() => this.arrowpress(2)}
-                >
-                  <View
-                    style={{
-                      flex: 2,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.choseheadericon(2)}
-                  </View>
-                  <Text style={styles.item_text}>生日</Text>
-                  <View
-                    style={{
-                      flex: 5,
-                      alignItems: "flex-end"
-                    }}
-                  >
-                    <Text
+                      {this.choseheadericon(1)}
+                    </View>
+                    <Text style={styles.item_text}>昵称</Text>
+                    <View
                       style={{
-                        flex: 1,
-                        fontSize: 15,
-                        textAlignVertical: "center"
+                        flex: 5,
+                        alignItems: "flex-end"
                       }}
-                      numberOfLines={1}
-                      ellipsizeMode={"tail"}
                     >
-                      {this.state.birthday_time}
-                    </Text>
-                  </View>
-                  <View
+                      <Text
+                        style={{
+                          flex: 1,
+                          fontSize: 15,
+                          textAlignVertical: "center"
+                        }}
+                        numberOfLines={1}
+                        ellipsizeMode={"tail"}
+                      >
+                        {this.state.nickName}
+                      </Text>
+                    </View>
+                    <View
+                      style={{
+                        flex: 1.1,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.getArraowImg(1)}
+                    </View>
+                  </TouchableOpacity>
+                  <TouchableOpacity
                     style={{
-                      flex: 1.1,
-                      alignItems: "center",
-                      justifyContent: "center"
+                      flex: 1,
+                      width: "100%",
+                      flexDirection: "row",
+                      backgroundColor: "white",
+                      marginVertical: 1
                     }}
+                    activeOpacity={1}
+                    onPress={() => this.arrowpress(2)}
                   >
-                    {this.getArraowImg(2)}
-                  </View>
-                </TouchableOpacity>
-                <TouchableOpacity
-                  style={{
-                    flex: 1,
-                    width: "100%",
-                    flexDirection: "row",
-                    backgroundColor: "white",
-                    marginVertical: 1
-                  }}
-                  activeOpacity={1}
-                  onPress={() => this.arrowpress(3)}
-                >
-                  <View
+                    <View
+                      style={{
+                        flex: 2,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.choseheadericon(2)}
+                    </View>
+                    <Text style={styles.item_text}>生日</Text>
+                    <View
+                      style={{
+                        flex: 5,
+                        alignItems: "flex-end"
+                      }}
+                    >
+                      <Text
+                        style={{
+                          flex: 1,
+                          fontSize: 15,
+                          textAlignVertical: "center"
+                        }}
+                        numberOfLines={1}
+                        ellipsizeMode={"tail"}
+                      >
+                        {this.state.birthday_time}
+                      </Text>
+                    </View>
+                    <View
+                      style={{
+                        flex: 1.1,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.getArraowImg(2)}
+                    </View>
+                  </TouchableOpacity>
+                  <TouchableOpacity
                     style={{
-                      flex: 2,
-                      alignItems: "center",
-                      justifyContent: "center"
+                      flex: 1,
+                      width: "100%",
+                      flexDirection: "row",
+                      backgroundColor: "white",
+                      marginVertical: 1
                     }}
+                    activeOpacity={1}
+                    onPress={() => this.arrowpress(3)}
                   >
-                    {this.choseheadericon(3)}
-                  </View>
+                    <View
+                      style={{
+                        flex: 2,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.choseheadericon(3)}
+                    </View>
 
-                  <Text style={styles.item_text}>所在地区</Text>
-                  <View
-                    style={{
-                      flex: 5,
-                      alignItems: "flex-end"
-                    }}
-                  >
-                    <Text
+                    <Text style={styles.item_text}>所在地区</Text>
+                    <View
                       style={{
-                        flex: 1,
-                        fontSize: 15,
-                        textAlignVertical: "center"
+                        flex: 5,
+                        alignItems: "flex-end"
                       }}
-                      numberOfLines={1}
-                      ellipsizeMode={"tail"}
                     >
-                      {this.state.cisys}
-                    </Text>
-                  </View>
-                  <View
-                    style={{
-                      flex: 1.1,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.getArraowImg(3)}
-                  </View>
-                </TouchableOpacity>
-                <TouchableOpacity
-                  style={{
-                    flex: 1,
-                    width: "100%",
-                    flexDirection: "row",
-                    backgroundColor: "white",
-                    marginVertical: 1
-                  }}
-                  activeOpacity={1}
-                  onPress={() => this.arrowpress(4)}
-                >
-                  <View
+                      <Text
+                        style={{
+                          flex: 1,
+                          fontSize: 15,
+                          textAlignVertical: "center"
+                        }}
+                        numberOfLines={1}
+                        ellipsizeMode={"tail"}
+                      >
+                        {this.state.provinceName}-{this.state.citys}
+                      </Text>
+                    </View>
+                    <View
+                      style={{
+                        flex: 1.1,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.getArraowImg(3)}
+                    </View>
+                  </TouchableOpacity>
+                  <TouchableOpacity
                     style={{
-                      flex: 2,
-                      alignItems: "center",
-                      justifyContent: "center"
+                      flex: 1,
+                      width: "100%",
+                      flexDirection: "row",
+                      backgroundColor: "white",
+                      marginVertical: 1
                     }}
+                    activeOpacity={1}
+                    onPress={() => this.arrowpress(4)}
                   >
-                    {this.choseheadericon(4)}
-                  </View>
+                    <View
+                      style={{
+                        flex: 2,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.choseheadericon(4)}
+                    </View>
 
-                  <Text style={styles.item_text}>我的学校</Text>
-                  <View
-                    style={{
-                      flex: 5,
-                      alignItems: "flex-end"
-                    }}
-                  >
-                    <Text
+                    <Text style={styles.item_text}>我的学校</Text>
+                    <View
                       style={{
-                        flex: 1,
-                        fontSize: 15,
-                        textAlignVertical: "center"
+                        flex: 5,
+                        alignItems: "flex-end"
                       }}
-                      numberOfLines={1}
-                      ellipsizeMode={"tail"}
                     >
-                      {this.state.schoolName}
-                    </Text>
-                  </View>
-                  <View
-                    style={{
-                      flex: 1.1,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.getArraowImg(4)}
-                  </View>
-                </TouchableOpacity>
-                <TouchableOpacity
-                  style={{
-                    flex: 1,
-                    marginTop: 1,
-                    width: "100%",
-                    flexDirection: "row",
-                    backgroundColor: "white",
-                    marginVertical: 1
-                  }}
-                  activeOpacity={1}
-                  onPress={() => this.arrowpress(5)}
-                >
-                  <View
+                      <Text
+                        style={{
+                          flex: 1,
+                          fontSize: 15,
+                          textAlignVertical: "center"
+                        }}
+                        numberOfLines={1}
+                        ellipsizeMode={"tail"}
+                      >
+                        {this.state.schoolName}
+                      </Text>
+                    </View>
+                    <View
+                      style={{
+                        flex: 1.1,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.getArraowImg(4)}
+                    </View>
+                  </TouchableOpacity>
+                  <TouchableOpacity
                     style={{
-                      flex: 2,
-                      alignItems: "center",
-                      justifyContent: "center"
+                      flex: 1,
+                      marginTop: 1,
+                      width: "100%",
+                      flexDirection: "row",
+                      backgroundColor: "white",
+                      marginVertical: 1
                     }}
+                    activeOpacity={1}
+                    onPress={() => this.arrowpress(5)}
                   >
-                    {this.choseheadericon(5)}
-                  </View>
+                    <View
+                      style={{
+                        flex: 2,
+                        alignItems: "center",
+                        justifyContent: "center"
+                      }}
+                    >
+                      {this.choseheadericon(5)}
+                    </View>
 
-                  <Text style={styles.item_text}>我的年级</Text>
-                  <View
-                    style={{
-                      flex: 5,
-                      alignItems: "flex-end"
-                    }}
-                  >
-                    <Text
+                    <Text style={styles.item_text}>我的年级</Text>
+                    <View
+                      style={{
+                        flex: 5,
+                        alignItems: "flex-end"
+                      }}
+                    >
+                      <Text
+                        style={{
+                          flex: 1.1,
+                          fontSize: 15,
+                          textAlignVertical: "center"
+                        }}
+                        numberOfLines={1}
+                        ellipsizeMode={"tail"}
+                      >
+                        {this.state.grade_text}
+                      </Text>
+                    </View>
+                    <View
                       style={{
                         flex: 1.1,
-                        fontSize: 15,
-                        textAlignVertical: "center"
+                        alignItems: "center",
+                        justifyContent: "center"
                       }}
-                      numberOfLines={1}
-                      ellipsizeMode={"tail"}
                     >
-                      {this.state.grade_text}
-                    </Text>
-                  </View>
-                  <View
-                    style={{
-                      flex: 1.1,
-                      alignItems: "center",
-                      justifyContent: "center"
-                    }}
-                  >
-                    {this.getArraowImg(5)}
-                  </View>
-                </TouchableOpacity>
+                      {this.getArraowImg(5)}
+                    </View>
+                  </TouchableOpacity>
+                </View>
               </View>
             </View>
-          </View>
 
-          <View
-            style={{
-              width: "100%",
-              flex: 4,
-              backgroundColor: "#F0F1F5",
-              flexDirection: "column"
-            }}
-          >
-            <View style={{ flex: 2.5 }} />
-            <View style={{ flex: 2, flexDirection: "row" }}>
-              <View style={{ flex: 1 }} />
-              <View
-                style={{
-                  flex: 7,
-                  width: "100%",
-                  height: "100%"
-                }}
-              >
-                <TouchableOpacity
-                  activeOpacity={1}
+            <View
+              style={{
+                width: "100%",
+                flex: 4,
+                backgroundColor: "#F0F1F5",
+                flexDirection: "column"
+              }}
+            >
+              <View style={{ flex: 2.5 }} />
+              <View style={{ flex: 2, flexDirection: "row" }}>
+                <View style={{ flex: 1 }} />
+                <View
                   style={{
-                    flex: 2,
+                    flex: 7,
                     width: "100%",
-                    alignItems: "center",
-                    justifyContent: "center",
                     height: "100%"
                   }}
-                  onPress={() => this.logout()}
                 >
-                  <ImageBackground
-                    source={require("../images/userInfo/logoutbg1.png")}
+                  <TouchableOpacity
+                    activeOpacity={1}
                     style={{
-                      flex: 1,
+                      flex: 2,
                       width: "100%",
                       alignItems: "center",
                       justifyContent: "center",
                       height: "100%"
                     }}
-                    imageStyle={{ resizeMode: "contain" }}
+                    onPress={() => this.logout()}
                   >
-                    <Text
+                    <ImageBackground
+                      source={require("../images/userInfo/logoutbg1.png")}
                       style={{
-                        fontSize: 30,
-                        color: "white",
+                        flex: 1,
                         width: "100%",
-                        textAlign: "center"
+                        alignItems: "center",
+                        justifyContent: "center",
+                        height: "100%"
                       }}
+                      imageStyle={{ resizeMode: "contain" }}
                     >
-                      退出登录
-                    </Text>
-                  </ImageBackground>
-                </TouchableOpacity>
+                      <Text
+                        style={{
+                          fontSize: 30,
+                          color: "white",
+                          width: "100%",
+                          textAlign: "center"
+                        }}
+                      >
+                        退出登录
+                      </Text>
+                    </ImageBackground>
+                  </TouchableOpacity>
+                  <View style={{ flex: 1 }} />
+                </View>
                 <View style={{ flex: 1 }} />
               </View>
-              <View style={{ flex: 1 }} />
+              <View style={{ flex: 0.8 }} />
             </View>
-            <View style={{ flex: 0.8 }} />
           </View>
         </View>
-        <PersonalInfoDialog
-          ref={view => (this.dialog = view)}
-          updateNS_show={this.state.updateNS_show}
-          updateParentState={this.updateState.bind(this)}
-        />
       </View>
     );
   }
@@ -605,9 +611,6 @@ export default class PersonalInfo extends BasePage {
         this.chosephoto.setModalVisible(true);
         break;
       case 1:
-        this.setState({
-          updateNS_show: true
-        });
         this.dialog.setInfo("修改昵称", "昵称");
         this.dialog.setModalVisible(true, 1);
         break;
@@ -619,9 +622,6 @@ export default class PersonalInfo extends BasePage {
         this.regionmodal.setModalVisible(true);
         break;
       case 4:
-        this.setState({
-          updateNS_show: true
-        });
         this.dialog.setInfo("我的学校", "学校名称");
         this.dialog.setModalVisible(true, 2);
         break;
@@ -634,13 +634,11 @@ export default class PersonalInfo extends BasePage {
   logout() {
     alert("点击退出了");
   }
-  updateState(data) {
-    this.setState(data);
-  }
 
   cityscommit(provinces_name, citys_name) {
     this.setState({
-      cisys: provinces_name + "-" + citys_name
+      provinceName: provinces_name,
+      citys: citys_name
     });
   }
   commitGrade(text, index) {
@@ -654,6 +652,16 @@ export default class PersonalInfo extends BasePage {
       birthday_time: year + "年" + month + "月" + day + "日"
     });
   }
+
+  photoback(photo_uri) {
+    this.chosephoto.setModalVisible(false);
+    if (photo_uri == undefined || photo_uri === "" || photo_uri == null) {
+      return;
+    }
+    this.setState({
+      photo_uri: { uri: photo_uri }
+    });
+  }
 }
 
 const styles = StyleSheet.create({

+ 74 - 35
pages/components/PersonalInfoDialog.js

@@ -16,6 +16,7 @@ import {
   TouchableOpacity,
   ImageBackground,
   TextInput,
+  Keyboard,
   Button,
   StatusBar,
   Modal,
@@ -34,7 +35,8 @@ export default class PersonalInfoDialog extends Component<Props> {
     touch_cancel_color: "white",
     touch_cancel_textcolor: "#58A8FA",
     input_text: "",
-    updateType: 0 //1修改昵称,2修改学校名称
+    updateType: 0, //1修改昵称,2修改学校名称,
+    keyBoardHeight: 0
   };
 
   setModalVisible(visible, type) {
@@ -50,10 +52,6 @@ export default class PersonalInfoDialog extends Component<Props> {
       placeholder: holder
     });
   }
-  cancel() {
-    let data = { updateNS_show: false };
-    this.props.updateParentState(data);
-  }
 
   touchDown() {
     this.setState({
@@ -79,44 +77,76 @@ export default class PersonalInfoDialog extends Component<Props> {
       touch_cancel_textcolor: "#58A8FA"
     });
   }
-  setParentState(bool) {
+  setParentState() {
     let data;
     if (this.state.updateType == 1) {
-      data = { nickName: this.state.input_text, updateNS_show: bool };
+      data = { nickName: this.state.input_text };
     } else if (this.state.updateType == 2) {
-      data = { schoolName: this.state.input_text, updateNS_show: bool };
+      data = {
+        schoolName: this.state.input_text
+      };
     }
     this.props.updateParentState(data);
+    this.setModalVisible(false);
+  }
+  componentWillMount() {
+    this.keyboardDidShowListener = Keyboard.addListener(
+      "keyboardDidShow",
+      this._keyboardDidShow
+    );
+    this.keyboardDidHideListener = Keyboard.addListener(
+      "keyboardDidHide",
+      this._keyboardDidHide
+    );
+  }
+
+  componentWillUnmount() {
+    this.keyboardDidShowListener.remove();
+    this.keyboardDidHideListener.remove();
   }
 
+  _keyboardDidShow = e => {
+    this.setState({
+      keyBoardHeight: 0
+    });
+  };
+  _keyboardDidHide = () => {
+    this.setState({
+      keyBoardHeight: 0
+    });
+  };
   render() {
-    if (this.props.updateNS_show) {
-      return (
+    return (
+      <Modal
+        animationType="fade"
+        transparent={true}
+        visible={this.state.modalVisible}
+        onRequestClose={() => {
+          this.setState({ modalVisible: false });
+        }}
+      >
         <View
           style={{
             flex: 1,
             width: "100%",
             height: "100%",
-            alignItems: "center",
-            justifyContent: "center",
             backgroundColor: "rgba(0, 0, 0, 0.3)",
-            flexDirection: "row",
-            position: "absolute"
+            flexDirection: "column",
+            justifyContent: "flex-end"
           }}
         >
           <View
             style={{
-              flex: 111,
-              alignItems: "center",
-              justifyContent: "center",
-              backgroundColor: "white"
+              width: "100%",
+              height: 150,
+              backgroundColor: "white",
+              bottom: this.state.keyBoardHeight
             }}
           >
             <View
               style={{
-                height: 150,
+                height: "100%",
                 width: "100%",
-
                 backgroundColor: "white"
               }}
             >
@@ -131,7 +161,7 @@ export default class PersonalInfoDialog extends Component<Props> {
                   style={{
                     flex: 1,
                     textAlignVertical: "center",
-                    fontSize: 25,
+                    fontSize: 16,
                     color: "black"
                   }}
                 >
@@ -148,15 +178,20 @@ export default class PersonalInfoDialog extends Component<Props> {
                 <TextInput
                   placeholder={this.state.placeholder}
                   editable={true} //是否可编辑
+                  autoFocus={true}
                   style={{
                     width: "90%",
                     height: "90%",
                     borderColor: "black",
                     borderWidth: 0,
                     marginLeft: 5,
-                    fontSize: 20
+                    fontSize: 16
                   }}
-                  onChangeText={text => this.setState({ input_text: text })}
+                  onChangeText={text =>
+                    this.setState({
+                      input_text: text
+                    })
+                  }
                 />
               </View>
               <View
@@ -168,15 +203,16 @@ export default class PersonalInfoDialog extends Component<Props> {
               >
                 <View
                   style={{
-                    flex: 4
+                    flex: 5
                   }}
                 />
                 <View
                   style={{
                     flex: 2,
-                    backgroundColor: this.state.touchcolor,
                     height: "100%",
-                    borderRadius: 30
+                    borderRadius: 30,
+                    backgroundColor: this.state.touchcolor,
+                    alignItems: "center"
                   }}
                 >
                   <TouchableOpacity
@@ -184,14 +220,16 @@ export default class PersonalInfoDialog extends Component<Props> {
                     onPressIn={() => this.touchDown()}
                     onPressOut={() => this.touchUp()}
                     onPress={() => {
-                      this.setParentState(false);
+                      this.setParentState();
                     }}
                   >
                     <Text
                       style={{
+                        height: "100%",
+                        width: "100%",
                         textAlignVertical: "center",
                         textAlign: "center",
-                        fontSize: 25,
+                        fontSize: 18,
                         borderRadius: 30,
                         color: this.state.touchtextcolor
                       }}
@@ -204,8 +242,9 @@ export default class PersonalInfoDialog extends Component<Props> {
                 <View
                   style={{
                     flex: 2,
-                    backgroundColor: this.state.touch_cancel_color,
                     height: "100%",
+                    backgroundColor: this.state.touch_cancel_color,
+                    alignItems: "center",
                     borderRadius: 30
                   }}
                 >
@@ -213,13 +252,15 @@ export default class PersonalInfoDialog extends Component<Props> {
                     activeOpacity={1}
                     onPressIn={() => this.touchCancelDown()}
                     onPressOut={() => this.touchCancelUp()}
-                    onPress={() => this.cancel()}
+                    onPress={() => this.setModalVisible(false)}
                   >
                     <Text
                       style={{
                         textAlignVertical: "center",
                         textAlign: "center",
-                        fontSize: 25,
+                        height: "100%",
+                        width: "100%",
+                        fontSize: 18,
                         color: this.state.touch_cancel_textcolor
                       }}
                     >
@@ -233,9 +274,7 @@ export default class PersonalInfoDialog extends Component<Props> {
             </View>
           </View>
         </View>
-      );
-    } else {
-      return null;
-    }
+      </Modal>
+    );
   }
 }

+ 18 - 3
pages/components/RegionModal.js

@@ -195,7 +195,21 @@ export default class RegionModal extends Component<Props> {
       </Modal>
     );
   }
-
+  componentWillMount() {
+    for (var i = 0; i < this.state.cityjson.length; i++) {
+      if (this.props.provinceName === CitysData.provinces[i].provinceName) {
+        this.state.provinces_views_index = i;
+        this.state.click_provinces_name = this.props.provinceName;
+        this.state.city_data = CitysData.provinces[i].citys;
+        for (var j = 0; j < this.state.city_data.length; j++) {
+          if (this.props.citys === this.state.city_data[j].citysName) {
+            this.state.city_views_index = j;
+            this.state.click_city_name = this.props.citys;
+          }
+        }
+      }
+    }
+  }
   provinces_onlayout() {
     if (this.state.provinces_views_index != -1) {
       this.provinces_scroll.scrollTo({
@@ -294,6 +308,7 @@ export default class RegionModal extends Component<Props> {
     this.state.city_views = [];
     for (var i = 0; i < citys.length; i++) {
       let index = i;
+      console.log("this.state.city_views_index:" + this.state.city_views_index);
       if (this.state.city_views_index == i) {
         textstyle = styles.item_text_click;
       } else {
@@ -318,7 +333,7 @@ export default class RegionModal extends Component<Props> {
 const styles = StyleSheet.create({
   item_text: {
     color: "rgba(77, 77, 77, 1)",
-    fontSize: 20,
+    fontSize: 18,
     justifyContent: "center",
     alignItems: "center",
     marginTop: 20,
@@ -328,7 +343,7 @@ const styles = StyleSheet.create({
   },
   item_text_click: {
     color: "rgba(59, 149, 243, 1)",
-    fontSize: 20,
+    fontSize: 18,
     justifyContent: "center",
     alignItems: "center",
     marginTop: 20,

+ 5 - 12
pages/components/ScheduleFlatItem.js

@@ -12,18 +12,11 @@ import {
   DeviceEventEmitter
 } from "react-native";
 
-/** 因没有图,所以Image先用颜色代替,有图可替换 */
-const instructions = Platform.select({
-  ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
-  android:
-    "Double tap R on your keyboard to reload,\n" +
-    "Shake or press menu button for dev menu"
-});
 
-type Props = {};
 var width = Dimensions.get("window").width;
 var height = Dimensions.get("window").height;
-export default class ScheduleFlatItem extends Component<Props> {
+
+export default class ScheduleFlatItem extends Component {
   render() {
     return (
       <TouchableOpacity activeOpacity={1} onPress={this.props.onPress}>
@@ -49,7 +42,7 @@ export default class ScheduleFlatItem extends Component<Props> {
             <View
               style={{
                 flex: 2.5,
-                backgroundColor: this.props.data.typecolor,
+                backgroundColor: this.props.data.subColor,
                 width: "100%",
                 height: "70%",
                 alignItems: "center",
@@ -57,7 +50,7 @@ export default class ScheduleFlatItem extends Component<Props> {
                 borderRadius: 20
               }}
             >
-              <Text style={{ color: "white" }}>{this.props.data.typename}</Text>
+              <Text style={{ color: "white",fontSize: 12, }}>{this.props.data.subTitle}</Text>
             </View>
             <View style={{ flex: 0.2 }} />
             <View
@@ -69,7 +62,7 @@ export default class ScheduleFlatItem extends Component<Props> {
               }}
             >
               <Text style={{ textAlign: "left" }}>
-                {this.props.data.videoname}
+                {this.props.data.title}
               </Text>
             </View>
             <View

+ 47 - 87
pages/components/SchedulePage.js

@@ -30,14 +30,9 @@ import CourseTitle from "./CourseTitle";
 import SharedDialog from "./SharedDialog";
 import ScheduleFlatItem from "./ScheduleFlatItem";
 import CusVideo from "./CusVideo";
-const instructions = Platform.select({
-  ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
-  android:
-    "Double tap R on your keyboard to reload,\n" +
-    "Shake or press menu button for dev menu"
-});
+import ScheduleUrl from '../services/schedule'
+
 
-type Props = {};
 export default class SchedulePage extends BasePage {
   constructor(props) {
     super(props);
@@ -58,7 +53,16 @@ export default class SchedulePage extends BasePage {
       seat_height: "2%",
       flatlist_height: "60%",
       isFull: false,
-      playing_key: 0
+      playing_key: 0,
+      scheduleTitle: '',
+      wareList: [],
+      colorList: [
+        '#FFBC3D',
+        '#FB5B76',
+        '#EC48E1',
+        '#39D6B9',
+        '#3397F0'
+      ]
     };
   }
 
@@ -93,7 +97,7 @@ export default class SchedulePage extends BasePage {
           >
             <CourseTitle
               width={this.getWindowWidth()}
-              title="第12周 爱上幼儿园"
+              title={this.state.scheduleTitle}
               lefttype={1}
               righttype={1}
               textcolor={"#231F20"}
@@ -153,81 +157,9 @@ export default class SchedulePage extends BasePage {
               renderItem={({ item }) => {
                 return this.loadFlatItem(item);
               }}
-              keyExtractor={(item, index) => item.key.toString()}
+              keyExtractor={(item, index) => item.id.toString()}
               horizontal={false}
-              data={[
-                {
-                  key: 1,
-                  typecolor: "#74E0FF",
-                  typename: "习惯养成",
-                  videoname: "碗里不剩一粒米",
-                  videourl: "碗里不剩一粒米xxxx"
-                },
-                {
-                  key: 2,
-                  typecolor: "#FB5B76",
-                  typename: "品格礼仪",
-                  videoname: "我有很多朋友",
-                  videourl: "我有很多朋友xxxx"
-                },
-                {
-                  key: 3,
-                  typecolor: "#EC48E1",
-                  typename: "自我保护",
-                  videoname: "小猫喵喵叫",
-                  videourl: "小猫喵喵叫xxxx"
-                },
-                {
-                  key: 4,
-                  typecolor: "#39D6B9",
-                  typename: "亲子游戏",
-                  videoname: "安静的睡前游戏-全家人都睡了",
-                  videourl: "安静的睡前游戏xxxx"
-                },
-                {
-                  key: 5,
-                  typecolor: "#3397F0",
-                  typename: "欢乐音乐",
-                  videoname: "小鸡捉虫子",
-                  videourl: "小鸡捉虫子xxxx"
-                },
-                {
-                  key: 11,
-                  typecolor: "#74E0FF",
-                  typename: "习惯养成",
-                  videoname: "碗里不剩一粒米",
-                  videourl: "碗里不剩一粒米xxxx"
-                },
-                {
-                  key: 12,
-                  typecolor: "#FB5B76",
-                  typename: "品格礼仪",
-                  videoname: "我有很多朋友",
-                  videourl: "我有很多朋友xxxx"
-                },
-                {
-                  key: 13,
-                  typecolor: "#EC48E1",
-                  typename: "自我保护",
-                  videoname: "小猫喵喵叫",
-                  videourl: "小猫喵喵叫xxxx"
-                },
-                {
-                  key: 14,
-                  typecolor: "#39D6B9",
-                  typename: "亲子游戏",
-                  videoname: "安静的睡前游戏-全家人都睡了",
-                  videourl:
-                    "https://www.apple.com/105/media/cn/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-cn-20170912_1280x720h.mp4"
-                },
-                {
-                  key: 15,
-                  typecolor: "#3397F0",
-                  typename: "欢乐音乐",
-                  videoname: "小鸡捉虫子",
-                  videourl: "http://chimee.org/vod/1.mp4"
-                }
-              ]}
+              data={this.state.wareList}
             />
           </View>
         </View>
@@ -269,6 +201,34 @@ export default class SchedulePage extends BasePage {
   componentWillUnmount() {
     BackHandler.removeEventListener("hardwareBackPress", this.onBackAndroid);
   }
+  componentDidMount() {
+    const { id } = this.props.navigation.state.params;
+    alert(id)
+    let colorTemp = '';
+    let colorIndexTemp = 0;
+    const colorList = this.state.colorList;
+    ScheduleUrl.getSchedule('KINDERGARTEN').success(res => {
+      res.data.wareList.forEach((item, index) => {
+        if (index === 0) {
+          colorTemp = item.subTitle;
+        }
+        if (item.subTitle === colorTemp) {
+          item.subColor = colorList[colorIndexTemp];
+        } else {
+          colorIndexTemp++;
+          if (colorIndexTemp > colorList.length - 1) {
+            colorIndexTemp = 0
+          }
+          colorTemp = item.subTitle;
+          item.subColor = colorList[colorIndexTemp];
+        }
+      })
+      this.setState({
+        scheduleTitle: res.data.category.title,
+        wareList: res.data.wareList
+      })
+    })
+  }
   showSharedDialog() {
     this.video.pause();
     this.shareddialog.setModalVisible(true);
@@ -320,9 +280,9 @@ export default class SchedulePage extends BasePage {
   changeUrl(data) {
     //切换视频并且播放
     // alert(url);
-    if (this.state.playing_key == data.key) {
-      return;
-    }
+    // if (this.state.playing_key == data.key) {
+    //   return;
+    // }
     const handle = findNodeHandle(this.video_image);
     setTimeout(() => {
       UIManager.measure(handle, (x, y, width, height, pageX, pageY) => {
@@ -336,7 +296,7 @@ export default class SchedulePage extends BasePage {
           videoImage_x: pageX,
           videoImage_y: pageY,
           video_show: true,
-          video_uri: data.videourl,
+          video_uri: data.playUrl,
           playing_key: data.key
         });
       });

+ 2 - 0
pages/components/ScrollRow.js

@@ -27,6 +27,8 @@ export default class ScrollRow extends Component {
                 data={this.props.data}
                 horizontal={true}
                 renderItem={({ item, separators }) => this.renderItem(item, separators)}
+                keyExtractor={(item, index) => index.toString()}
+                showsHorizontalScrollIndicator = {false}
             />
         )
     }

+ 6 - 5
pages/components/Swiper.js

@@ -28,7 +28,8 @@ export default class Swipers extends Component {
         horizontal={true}
         autoplayTimeout={5}
         autoplay={this.props.autoplay}
-        loop={this.props.loop}
+        // loop={this.props.loop}
+        loop={true}
         index={this.props.ifShowMiddle ? 1 : 0}
         activeDotColor="#fff"
         showsPagination={true}
@@ -59,14 +60,14 @@ const styles = StyleSheet.create({
     // flex: 1,
   },
   slide: {
-    width: Dimensions.getDp(352),
-    height: Dimensions.getDp(153),
+    width: Dimensions.getWidth(352),
+    height: Dimensions.getHeight(153),
     marginHorizontal: Dimensions.getDp(3),
     zIndex: 1
   },
   img: {
-    width: Dimensions.getDp(352),
-    height: Dimensions.getDp(153),
+    width: Dimensions.getWidth(352),
+    height: Dimensions.getHeight(153),
     borderRadius: Dimensions.getDp(10),
     zIndex: 1
   }

BIN
pages/images/userInfo/default_photo.png


+ 8 - 5
pages/services/api.js

@@ -1,14 +1,17 @@
+
 const url = {
-    library_url: 'http://ott80testlibrary.yifangjiaoyu.cn/mobile/page'
+    library_url: 'http://ott80testlibrary.yifangjiaoyu.cn/mobile/page',
+    schedule_url: 'http://ott80test-schedule.yifangjiaoyu.cn/mobile/schedule/'
 }
 
 
 export default class APIConfig {
-    constructor(props){
-        this.library_url = 'http://ott80testlibrary.yifangjiaoyu.cn/mobile/page'
-    }
+    
     static getLibraryUrl(path){
-        console.log(url.library_url + path)
         return url.library_url + path
     }
+    static getScheduleUrl(path){
+        console.log(33333,url.schedule_url + path)
+        return url.schedule_url + path
+    }
 } 

+ 1 - 4
pages/services/library.js

@@ -3,13 +3,10 @@ import efunRequest from '../utils/efunRequest'
 
 export default class LibraryUrl {
     
-    static aabbcc(){
-        alert(123)
-    }
     static getIndex(ageGroup) {
-        console.log(ageGroup)
         return efunRequest.getHttpRequest().url(APIConfig.getLibraryUrl(`/category`)).params({
             ageGroup
         }).get();
     }
+    
 }

+ 16 - 0
pages/services/schedule.js

@@ -0,0 +1,16 @@
+import APIConfig from './api.js';
+import efunRequest from '../utils/efunRequest'
+
+export default class ScheduleUrl {
+    
+    static getSchedule(code) {
+        console.log(22222,efunRequest.getHttpRequest().url(APIConfig.getScheduleUrl(`/ware`)).params({
+            code
+        }))
+        return efunRequest.getHttpRequest().url(APIConfig.getScheduleUrl(`/ware`)).params({
+            code
+        }).get();
+    }
+    
+
+}