Jelajahi Sumber

提交代码

Limengbo 5 tahun lalu
induk
melakukan
66bd13e6d0

File diff ditekan karena terlalu besar
+ 138 - 0
android/app/src/main/assets/index.android.bundle


TEMPAT SAMPAH
android/app/src/main/res/drawable-mdpi/pages_images_common_nodata.png


TEMPAT SAMPAH
android/app/src/main/res/drawable-mdpi/pages_images_userinfo_back_white.png


TEMPAT SAMPAH
android/app/src/main/res/drawable-xhdpi/pages_images_common_nodata.png


TEMPAT SAMPAH
android/app/src/main/res/drawable-xhdpi/pages_images_userinfo_back_white.png


TEMPAT SAMPAH
android/app/src/main/res/drawable-xxhdpi/pages_images_common_nodata.png


TEMPAT SAMPAH
android/app/src/main/res/drawable-xxhdpi/pages_images_userinfo_back_white.png


+ 1 - 1
pages/Login.js

@@ -195,7 +195,7 @@ export default class Login extends BasePage {
 					school: '',
 					sex: '',
 					status: result.data.visitor.status,
-					uid: '',
+					uid: result.data.visitor.id,
 					isVisitor: result.data.isVisitor.toUpperCase() === 'TRUE' ? true : false
 				};
 				global.userInfo = info;

+ 123 - 91
pages/buy/order.js

@@ -1,102 +1,134 @@
 /* 
  * 
 */
-import React, { Component } from "react";
+import React, { Component } from 'react';
 import {
-    Platform,
-    StyleSheet,
-    Text,
-    View,
-    Image,
-    TouchableOpacity,
-    FlatList,
-    TouchableHighlight,
-    DeviceEventEmitter,
-    ScrollView
-} from "react-native";
-import BasePage from "../BasePage";
+	Platform,
+	StyleSheet,
+	Text,
+	View,
+	Image,
+	TouchableOpacity,
+	StatusBar,
+	FlatList,
+	BackHandler,
+	TouchableHighlight,
+	DeviceEventEmitter,
+	ScrollView
+} from 'react-native';
+import BasePage from '../BasePage';
 import Dimensions from '../utils/dimensions';
 import TopicTitle from '../components/TopicTitle';
+import CourseTitle from '../components/CourseTitle';
+import NoDataView from '../components/NoDataView';
 
 export default class Order extends BasePage {
-    state = {
-        data: {
-            title: '学前课程', list: [
-                { title: '生活好榜样', time: '2019-10-01' },
-                { title: '生活好榜样2', time: '2019-10-01' },
-                { title: '生活好榜样3', time: '2019-10-01' },
-                { title: '生活好榜样第二期', time: '2019-10-01' },
-            ]
-        }
-
-    };
-    renderItem = (item, index) => {
-        return (
-            <View>
-                {
-                    index === 0
-                        ?
-                        <TopicTitle title={this.state.data.title} ifTubeShow={true} />
-                        :
-                        null
-                }
-                <View style={styles.item}>
-                    <View style={styles.left}>
-                        <Text style={styles.title}>{item.title}</Text>
-                        <Text style={styles.time}>有效期:{item.time}</Text>
-                    </View>
-                    <View style={styles.right}>
-                        <Text style={styles.study}>去学习</Text>
-                    </View>
-                </View>
-            </View>
-        )
-    }
-    render() {
-        return (
-            <FlatList
-
-                data={this.state.data.list}
-                horizontal={false}
-                renderItem={({ item, index }) => this.renderItem(item, index)}
-                keyExtractor={(item, index) => index.toString()}
-            />
-        )
-    }
+	state = {
+		data: [
+			// { title: '生活好榜样', time: '2019-10-01' },
+			// { title: '生活好榜样2', time: '2019-10-01' },
+			// { title: '生活好榜样3', time: '2019-10-01' },
+			// { title: '生活好榜样第二期', time: '2019-10-01' }
+		]
+	};
+	renderItem = (item, index) => {
+		return (
+			<View>
+				{/* {index === 0 ? <TopicTitle title={this.state.data.title} ifTubeShow={true} /> : null} */}
+				<View style={styles.item}>
+					<View style={styles.left}>
+						<Text style={styles.title}>{item.title}</Text>
+						<Text style={styles.time}>购买日期:{item.time}</Text>
+					</View>
+					<View style={styles.right}>
+						<Text style={styles.study}>去学习</Text>
+					</View>
+				</View>
+			</View>
+		);
+	};
+	render() {
+		return (
+			<View style={{ flex: 1 }}>
+				<StatusBar barStyle={'dark-content'} backgroundColor={'white'} translucent={true} />
+				<View
+					style={{
+						height: 50,
+						backgroundColor: 'white',
+						marginTop: 30
+					}}
+				>
+					<CourseTitle
+						width={this.getWindowWidth()}
+						title="我的订单"
+						lefttype={1}
+						textcolor={'#231F20'}
+						backPress={() => this.goBack()}
+						// backPress={() => alert("左侧按钮")}
+					/>
+				</View>
+				<View style={{ flex: 0.1, backgroundColor: 'rgba(242, 242, 242, 1)' }} />
+				<View style={{ flex: 5, backgroundColor: 'rgba(242, 242, 242, 1)' }}>
+					{this.state.data.length > 0 ? (
+						<FlatList
+							data={this.state.data}
+							horizontal={false}
+							renderItem={({ item, index }) => this.renderItem(item, index)}
+							keyExtractor={(item, index) => index.toString()}
+						/>
+					) : (
+						<NoDataView style={{ width: '100%', height: '100%' }} text={'你还没有相关订单哦'} />
+					)}
+				</View>
+			</View>
+		);
+	}
+	componentWillMount() {
+		BackHandler.addEventListener('hardwareBackPress', this.onBackAndroid);
+	}
+	componentWillUnmount() {
+		BackHandler.removeEventListener('hardwareBackPress', this.onBackAndroid);
+	}
+	onBackAndroid = () => {
+		this.goBack();
+		return true;
+	};
 }
 
 const styles = StyleSheet.create({
-    item: {
-        width: Dimensions.width,
-        height: Dimensions.getHeight(79),
-        flexDirection: 'row',
-        justifyContent: 'space-between',
-        alignItems: 'center',
-        paddingHorizontal: 14,
-        borderTopWidth: 1,
-        borderColor: '#f0f1f5'
-    },
-    left: {
-        flexDirection: 'column'
-    },
-    title: {
-        fontSize: 18,
-        color: '#151515'
-    },
-    time: {
-        fontSize: 14,
-        color: '#555'
-    },
-    right: {
-        width: Dimensions.getWidth(83),
-        height: Dimensions.getHeight(27),
-        borderRadius: 14,
-        backgroundColor: '#ffae59',
-        justifyContent: 'center',
-        alignItems: 'center'
-    },
-    study: {
-        color: '#fff',
-        fontSize: 16
-    }
-})
+	item: {
+		width: Dimensions.width,
+		height: Dimensions.getHeight(79),
+		flexDirection: 'row',
+		justifyContent: 'space-between',
+		marginBottom: 6,
+		alignItems: 'center',
+		paddingHorizontal: 14,
+		// borderTopWidth: 1,
+		backgroundColor: 'rgba(255, 255, 255, 1)'
+		// borderColor: '#f0f1f5'
+	},
+	left: {
+		flexDirection: 'column'
+	},
+	title: {
+		fontSize: 18,
+		color: '#151515'
+	},
+	time: {
+		fontSize: 14,
+		color: '#555'
+	},
+	right: {
+		width: Dimensions.getWidth(83),
+		height: Dimensions.getHeight(27),
+		borderRadius: 14,
+		backgroundColor: '#ffae59',
+		justifyContent: 'center',
+		alignItems: 'center'
+	},
+	study: {
+		color: '#fff',
+		fontSize: 16
+	}
+});

+ 2 - 5
pages/buy/ticket.js

@@ -21,6 +21,7 @@ import BasePage from '../BasePage';
 import Dimensions from '../utils/dimensions';
 import CourseTitle from '../components/CourseTitle';
 import PayServer from '../services/Pay';
+import NoDataView from '../components/NoDataView';
 
 export default class Ticket extends BasePage {
 	state = {
@@ -59,11 +60,7 @@ export default class Ticket extends BasePage {
 							keyExtractor={(item, index) => index.toString()}
 						/>
 					) : (
-						<Text
-							style={{ height: '100%', width: '100%', textAlign: 'center', textAlignVertical: 'center' }}
-						>
-							还没有获取到抵用券
-						</Text>
+						<NoDataView style={{ width: '100%', height: '100%' }} text={'很遗憾,您还没有抵用券 \n 购买单课程可获得哦'} />
 					)}
 				</View>
 			</View>

+ 2 - 2
pages/components/CourseTitle.js

@@ -141,8 +141,8 @@ export default class CourseTitle extends Component<Props> {
       <Image
         source={right}
         style={{
-          width: 20,
-          height: 20
+          width: 30,
+          height: 30
         }}
       />
     );

+ 51 - 0
pages/components/NoDataView.js

@@ -0,0 +1,51 @@
+/**
+ * Sample React Native App
+ * https://github.com/facebook/react-native
+ *
+ * @format
+ * @flow
+ */
+
+import React, { Component } from 'react';
+import {
+	Platform,
+	StyleSheet,
+	Text,
+	View,
+	Image,
+	TouchableOpacity,
+	ImageBackground,
+	TextInput,
+	Button,
+	StatusBar,
+	Modal,
+	TouchableHighlight,
+	DeviceEventEmitter
+} from 'react-native';
+import ImagePicker from 'react-native-image-picker';
+
+export default class NoDataView extends Component {
+	render() {
+		return (
+			<View style={{ flex: 1 }}>
+				<View
+					style={{
+						height: '100%',
+						width: '100%',
+						alignItems: 'center',
+						backgroundColor: 'rgba(246, 247, 248, 1)',
+						justifyContent: 'center'
+					}}
+				>
+					<Image
+						source={require('../images/common/nodata.png')}
+						style={{ alignItems: 'center', justifyContent: 'center' }}
+					/>
+					<Text style={{ textAlign: 'center', textAlignVertical: 'center', marginTop: 18, fontSize: 16 }}>
+						{this.props.text}
+					</Text>
+				</View>
+			</View>
+		);
+	}
+}

TEMPAT SAMPAH
pages/images/common/nodata.png


TEMPAT SAMPAH
pages/images/common/nodata@2x.png


TEMPAT SAMPAH
pages/images/common/nodata@3x.png


TEMPAT SAMPAH
pages/images/userInfo/back_white.png


TEMPAT SAMPAH
pages/images/userInfo/back_white@2x.png


TEMPAT SAMPAH
pages/images/userInfo/back_white@3x.png