|
@@ -25,9 +25,9 @@ import Swiper from "react-native-swiper";
|
|
|
import AndroidUtil from "../../util/AndroidUtil";
|
|
|
import BasePage from "../BasePage";
|
|
|
import Header from "./Header";
|
|
|
-import Swipers from "./Swiper";
|
|
|
-import Dimensions from '../utils/dimensions'
|
|
|
-
|
|
|
+import MySwiper from "./Swiper";
|
|
|
+import Dimensions from '../utils/dimensions';
|
|
|
+import TopicTitle from './TopicTitle';
|
|
|
|
|
|
export default class MainPage extends BasePage {
|
|
|
constructor(props) {
|
|
@@ -43,7 +43,7 @@ export default class MainPage extends BasePage {
|
|
|
<View style={{ flex: 1 }}>
|
|
|
|
|
|
<FlatList
|
|
|
- style={{ flex: 1 }}
|
|
|
+ style={{ flex: 1, backgroundColor: 'f0f1f5' }}
|
|
|
ref="_flatlist"
|
|
|
horizontal={false}
|
|
|
removeClippedSubviews={false}
|
|
@@ -267,9 +267,9 @@ export default class MainPage extends BasePage {
|
|
|
/>
|
|
|
<View
|
|
|
style={styles.rightBtn}
|
|
|
- >
|
|
|
- <Image
|
|
|
- source={{uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png'}}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ source={{ uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png' }}
|
|
|
style={styles.rightBtnIcon}
|
|
|
/>
|
|
|
<Text
|
|
@@ -284,180 +284,108 @@ export default class MainPage extends BasePage {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ getSwiperElement() {
|
|
|
+ return (
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ height: 193,
|
|
|
+ flex: 1,
|
|
|
+ justifyContent: "center",
|
|
|
+ alignItems: "center",
|
|
|
+ flexDirection: "row",
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ // width: Dimensions.width,
|
|
|
+ width: Dimensions.getDp(358),
|
|
|
+ height: Dimensions.getDp(150),
|
|
|
+ justifyContent: "center",
|
|
|
+ overflow: 'hidden'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <MySwiper
|
|
|
+ autoplay={true}
|
|
|
+ loop={true}
|
|
|
+ ifShowMiddle={true}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- loadFlatItem(data) {
|
|
|
- switch (data.typea) {
|
|
|
- // case 0:
|
|
|
- // return (
|
|
|
- // <View
|
|
|
- // style={{
|
|
|
- // height: 50,
|
|
|
- // width: "100%",
|
|
|
- // justifyContent: "center",
|
|
|
- // alignItems: "center",
|
|
|
- // backgroundColor: "red"
|
|
|
- // }}
|
|
|
- // >
|
|
|
- // <View
|
|
|
- // style={{
|
|
|
- // height: "60%",
|
|
|
- // justifyContent: "center",
|
|
|
- // alignItems: "center",
|
|
|
- // width: "90%",
|
|
|
- // backgroundColor: "green",
|
|
|
- // borderRadius: 20,
|
|
|
- // flexDirection: "row"
|
|
|
- // }}
|
|
|
- // >
|
|
|
- // <View style={{ flex: 0.2 }} />
|
|
|
- // <Text
|
|
|
- // numberOfLines={1}
|
|
|
- // style={{
|
|
|
- // flex: 12,
|
|
|
- // justifyContent: "center",
|
|
|
- // alignItems: "center",
|
|
|
- // fontSize: 18,
|
|
|
- // fontWeight: "bold",
|
|
|
- // color: "#3E455B"
|
|
|
- // }}
|
|
|
- // >
|
|
|
- // {data.title}
|
|
|
- // </Text>
|
|
|
-
|
|
|
- // <View
|
|
|
- // style={{
|
|
|
- // flex: 1,
|
|
|
- // height: "100%",
|
|
|
- // justifyContent: "center",
|
|
|
- // alignItems: "center"
|
|
|
- // }}
|
|
|
- // >
|
|
|
- // <Image
|
|
|
- // source={{
|
|
|
- // uri:
|
|
|
- // "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1295208965,3056573814&fm=26&gp=0.jpg"
|
|
|
- // }}
|
|
|
- // style={{
|
|
|
- // width: "50%",
|
|
|
- // height: "50%",
|
|
|
- // justifyContent: "center",
|
|
|
- // alignItems: "center",
|
|
|
- // borderRadius: 30
|
|
|
- // }}
|
|
|
- // />
|
|
|
- // </View>
|
|
|
- // </View>
|
|
|
- // </View>
|
|
|
- // );
|
|
|
- // break;
|
|
|
- case 1:
|
|
|
- return (
|
|
|
- <View
|
|
|
+ getScheduleElement(data) {
|
|
|
+ let arr = [];
|
|
|
+ let index = 0;
|
|
|
+ for (let item of data.item.icon_item) {
|
|
|
+ arr.push(
|
|
|
+ <TouchableOpacity
|
|
|
+ style={{ width: 172, height: 86, marginRight: 12, backgroundColor: 'red' }}
|
|
|
+ onPress={() => {
|
|
|
+ alert(item.name);
|
|
|
+ }}
|
|
|
+ key={index}
|
|
|
+ activeOpacity={1}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ source={{
|
|
|
+ uri: item.icon
|
|
|
+ }}
|
|
|
+ key={index}
|
|
|
style={{
|
|
|
- height:193,
|
|
|
flex: 1,
|
|
|
justifyContent: "center",
|
|
|
alignItems: "center",
|
|
|
- flexDirection: "row",
|
|
|
- backgroundColor: 'red'
|
|
|
+ borderRadius: 10
|
|
|
+
|
|
|
}}
|
|
|
- >
|
|
|
- <View
|
|
|
- style={{
|
|
|
- // width: "90%",
|
|
|
- width: Dimensions.width,
|
|
|
- // overflow: "hidden",
|
|
|
- height: 150
|
|
|
- }}
|
|
|
- >
|
|
|
- <Swipers
|
|
|
- autoplay={true}
|
|
|
- loop={true}
|
|
|
- ifShowMiddle={true}
|
|
|
- />
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- );
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- let arr = [];
|
|
|
- let index = 0;
|
|
|
- for (let item of data.item.icon_item) {
|
|
|
- arr.push(
|
|
|
- <TouchableOpacity
|
|
|
- style={{ flex: 2 }}
|
|
|
- onPress={() => {
|
|
|
- alert(item.name);
|
|
|
- }}
|
|
|
- key={index}
|
|
|
- activeOpacity={1}
|
|
|
- >
|
|
|
- <Image
|
|
|
- source={{
|
|
|
- uri: item.icon
|
|
|
- }}
|
|
|
- key={index}
|
|
|
- style={{
|
|
|
- width: "100%",
|
|
|
- height: "100%",
|
|
|
- justifyContent: "center",
|
|
|
- alignItems: "center",
|
|
|
- borderRadius: 10
|
|
|
- }}
|
|
|
- />
|
|
|
- </TouchableOpacity>
|
|
|
- );
|
|
|
- if (index < data.item.icon_item.length - 1) {
|
|
|
- arr.push(
|
|
|
- <View
|
|
|
- key={item.name}
|
|
|
- style={{
|
|
|
- flex: 0.1
|
|
|
- }}
|
|
|
- />
|
|
|
- );
|
|
|
- }
|
|
|
- index++;
|
|
|
- }
|
|
|
- return (
|
|
|
+ />
|
|
|
+ </TouchableOpacity>
|
|
|
+ );
|
|
|
+ if (index < data.item.icon_item.length - 1) {
|
|
|
+ arr.push(
|
|
|
<View
|
|
|
+ key={item.name}
|
|
|
style={{
|
|
|
- marginTop: 20,
|
|
|
- flex: 1,
|
|
|
- justifyContent: "center",
|
|
|
- alignItems: "center"
|
|
|
+ flex: 0.1
|
|
|
}}
|
|
|
- >
|
|
|
- <View
|
|
|
- style={{
|
|
|
- flex: 1,
|
|
|
- flexDirection: "column",
|
|
|
- width: "90%",
|
|
|
- height: 150
|
|
|
- }}
|
|
|
- >
|
|
|
- <Text
|
|
|
- style={{
|
|
|
- flex: 0.5,
|
|
|
- fontSize: 18,
|
|
|
- fontWeight: "bold",
|
|
|
- color: "#3E455B"
|
|
|
- }}
|
|
|
- >
|
|
|
- {data.item.title}
|
|
|
- </Text>
|
|
|
- <View
|
|
|
- style={{
|
|
|
- flex: 2,
|
|
|
- flexDirection: "row",
|
|
|
- justifyContent: "space-between"
|
|
|
- }}
|
|
|
- >
|
|
|
- {arr}
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
+ />
|
|
|
);
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ flex: 1,
|
|
|
+ flexDirection: "column",
|
|
|
+ height: 140,
|
|
|
+ backgroundColor: 'blue'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <TopicTitle title={'课程表:第一周'} ifTubeShow={true} />
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ flex: 2,
|
|
|
+ flexDirection: "row",
|
|
|
+ backgroundColor: 'green',
|
|
|
+ alignItems: 'center',
|
|
|
+ paddingLeft: 10
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {arr}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ loadFlatItem(data) {
|
|
|
+ switch (data.typea) {
|
|
|
+ case 1:
|
|
|
+ return this.getSwiperElement();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ return this.getScheduleElement(data);
|
|
|
break;
|
|
|
case 3:
|
|
|
return (
|
|
@@ -466,7 +394,8 @@ export default class MainPage extends BasePage {
|
|
|
marginTop: 20,
|
|
|
flex: 1,
|
|
|
justifyContent: "center",
|
|
|
- alignItems: "center"
|
|
|
+ alignItems: "center",
|
|
|
+ backgroundColor: 'blue'
|
|
|
}}
|
|
|
>
|
|
|
<View
|
|
@@ -490,7 +419,7 @@ export default class MainPage extends BasePage {
|
|
|
height: 14,
|
|
|
justifyContent: "flex-start",
|
|
|
alignItems: "center",
|
|
|
- backgroundColor: "#01AFFE",
|
|
|
+ backgroundColor: "green",
|
|
|
borderRadius: 20
|
|
|
}}
|
|
|
/>
|
|
@@ -857,9 +786,9 @@ const styles = StyleSheet.create({
|
|
|
paddingLeft: 20,
|
|
|
paddingRight: 10,
|
|
|
},
|
|
|
- rightBtnIcon:{
|
|
|
- width:14,
|
|
|
- height:14
|
|
|
+ rightBtnIcon: {
|
|
|
+ width: 14,
|
|
|
+ height: 14
|
|
|
},
|
|
|
rightBtnText: {
|
|
|
color: '#151515',
|