瀏覽代碼

Merge branch 'master' of http://gogs.efunbox.cn/Rorschach/efunbox-mobile-8

Limengbo 5 年之前
父節點
當前提交
8b065f318f
共有 8 個文件被更改,包括 169 次插入146 次删除
  1. 7 2
      pages/PersonalInfo.js
  2. 23 15
      pages/Splash.js
  3. 0 2
      pages/components/MainPage.js
  4. 92 120
      pages/components/ShopBox.js
  5. 6 2
      pages/services/api.js
  6. 20 0
      pages/services/showcase.js
  7. 5 4
      pages/services/user.js
  8. 16 1
      pages/userCenter.js

+ 7 - 2
pages/PersonalInfo.js

@@ -885,8 +885,13 @@ export default class PersonalInfo extends BasePage {
 
 	logout() {
 		//清空存储的用户信息
-		global.storage.remove({ key: 'userInfo' });
-		this.clearPageToNext('Login');
+		http_user.LoginOut().then((res) => {
+			console.log('====================================');
+			console.log('res', res);
+			console.log('====================================');
+			global.storage.remove({ key: 'userInfo' });
+			this.clearPageToNext('Login');
+		});
 	}
 
 	updateState(input_text, type) {

+ 23 - 15
pages/Splash.js

@@ -3,19 +3,18 @@ import { StyleSheet, Text, View, Image, TouchableOpacity, StatusBar, ToastAndroi
 import BasePage from './BasePage';
 import SplashScreen from 'react-native-splash-screen';
 import commonutil from './utils/commonutil';
+import http_showcase from '../pages/services/showcase';
 export default class Splash extends BasePage {
 	state = {
 		exist: false,
-		MainPageParams: ''
+		MainPageParams: '',
+		boothContent: { uri: '' }
 	};
 	render() {
 		return (
 			<View style={{ flex: 1 }}>
 				<StatusBar backgroundColor={'transparent'} translucent={true} />
-				<View style={{ flex: 1 }} />
-				<View style={{ flex: 5 }}>
-					<Text style={{ fontSize: 30 }}>模拟活动广告。。。。</Text>
-				</View>
+				<Image source={this.state.boothContent} style={{ width: '100%', height: '100%' }} />
 			</View>
 		);
 	}
@@ -39,20 +38,16 @@ export default class Splash extends BasePage {
 					exist: true,
 					MainPageParams: usermap.get('ageGroup')
 				});
-				SplashScreen.hide();
-				this.Advertisement();
+				this.getShowCase();
 			})
 			.catch((err) => {
 				console.log(err.message);
+				this.getShowCase();
+				this.setState({
+					exist: false
+				});
 				switch (err.name) {
 					case 'NotFoundError':
-						// TODO;
-						// alert('NotFoundError');
-						this.setState({
-							exist: false
-						});
-						SplashScreen.hide();
-						this.Advertisement();
 						break;
 					case 'ExpiredError':
 						// TODO
@@ -62,6 +57,19 @@ export default class Splash extends BasePage {
 			});
 	}
 
+	getShowCase() {
+		http_showcase.getSTARTING_UP_RECOMMEND().then((res) => {
+			console.log('====================================');
+			console.log('res', res.data[0].boothContent);
+			console.log('====================================');
+			this.setState({
+				boothContent: { uri: res.data[0].boothContent }
+			});
+			SplashScreen.hide();
+			this.Advertisement();
+		});
+	}
+
 	//获取用户之后的操作,或者是别的操作。
 	Advertisement() {
 		//假装3秒广告
@@ -71,6 +79,6 @@ export default class Splash extends BasePage {
 			} else {
 				this.clearPageToNext('Login');
 			}
-		}, 3000);
+		}, 5000);
 	}
 }

+ 0 - 2
pages/components/MainPage.js

@@ -482,8 +482,6 @@ export default class MainPage extends BasePage {
 			})
 			.then((result) => {
 				this.state.file_user_data = commonutil.jsonToMap(result);
-				console.log('=====MainPage获取本地用户信息============');
-				console.log(commonutil.mapToJson(this.state.file_user_data));
 				var ageGroup = this.state.file_user_data.get('ageGroup');
 				const username = this.state.file_user_data.get('nickName');
 				const avatar = this.state.file_user_data.get('avatar');

+ 92 - 120
pages/components/ShopBox.js

@@ -4,129 +4,101 @@
  *      discount: 优惠信息
  */
 
-import React, { Component } from "react";
-import {
-    StyleSheet,
-    Text,
-    View,
-    Image,
-    TouchableOpacity,
-    ImageBackground,
-} from "react-native";
-import Dimensions from '../utils/dimensions'
+import React, { Component } from 'react';
+import { StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground } from 'react-native';
+import Dimensions from '../utils/dimensions';
 
 const styles = StyleSheet.create({
-    bigWrapper: {
-        flexDirection: 'column',
-    },
-    wrapper: {
-        // width: Dimensions.width,
-        // height: 45,
-        justifyContent: "center",
-        flexDirection: 'row',
-        justifyContent: 'space-around',
-        paddingHorizontal: 7
-    },
-    item: {
-        width: Dimensions.width * 168 / 375,
-        height: Dimensions.width * 168 / 375 * 120 / 168,
-        paddingLeft: 10
-    },
-    title: {
-        fontSize: 20,
-        color: '#fff',
-        marginTop: 15,
-    },
-    line2: {
-        flexDirection: 'row',
-        alignItems: 'center',
-        // marginTop: 3
-    },
-    price: {
-        fontSize: 24,
-        color: '#fff',
-        fontWeight: 'bold',
-        marginRight: 5
-    },
-    originPrice: {
-        fontSize: 11,
-        color: '#fff',
-        textDecorationLine: 'line-through'
-    },
-    line3: {
-        alignItems: 'center',
-        flexDirection: 'row',
-        marginTop: 8
-    },
-    buy: {
-        fontSize: 18,
-        color: '#fff'
-    },
-    discount: {
-        width: Dimensions.width,
-        alignItems: 'center',
-        justifyContent: 'center',
-        height: 100
-    },
-    discountIcon: {
-        width: Dimensions.width * 343 / 375,
-        height: Dimensions.width * 343 / 375 * 80 / 343
-    }
-
-})
+	bigWrapper: {
+		flexDirection: 'column'
+	},
+	wrapper: {
+		// width: Dimensions.width,
+		// height: 45,
+		justifyContent: 'center',
+		flexDirection: 'row',
+		justifyContent: 'space-around',
+		paddingHorizontal: 7
+	},
+	item: {
+		width: Dimensions.width * 168 / 375,
+		height: Dimensions.width * 168 / 375 * 120 / 168,
+		paddingLeft: 10
+	},
+	title: {
+		fontSize: 20,
+		color: '#fff',
+		marginTop: 15
+	},
+	line2: {
+		flexDirection: 'row',
+		alignItems: 'center'
+		// marginTop: 3
+	},
+	price: {
+		fontSize: 24,
+		color: '#fff',
+		fontWeight: 'bold',
+		marginRight: 5
+	},
+	originPrice: {
+		fontSize: 11,
+		color: '#fff',
+		textDecorationLine: 'line-through'
+	},
+	line3: {
+		alignItems: 'center',
+		flexDirection: 'row',
+		marginTop: 8
+	},
+	buy: {
+		fontSize: 18,
+		color: '#fff'
+	},
+	discount: {
+		width: Dimensions.width,
+		alignItems: 'center',
+		justifyContent: 'center',
+		height: 100
+	},
+	discountIcon: {
+		width: Dimensions.width * 343 / 375,
+		height: Dimensions.width * 343 / 375 * 80 / 343
+	}
+});
 
 export default class ShopBox extends Component {
+	renderGoods = (item, index) => {
+		return (
+			<ImageBackground source={item.background} style={styles.item} key={index}>
+				<TouchableOpacity onPress={() => this.props.nav('Buy')}>
+					<Text style={styles.title}>{item.title}</Text>
+					<View style={styles.line2}>
+						<Text style={styles.price}>¥{item.price}</Text>
+						<Text style={styles.originPrice}>原价: {item.originPrice}</Text>
+					</View>
+					<View style={styles.line3}>
+						<Text style={styles.buy}>立即购买</Text>
+						<Image source={require('../images/shopBox/arrow.png')} style={styles.arrow} />
+					</View>
+				</TouchableOpacity>
+			</ImageBackground>
+		);
+	};
 
-    renderGoods = (item, index) => {
-        return (
-            <ImageBackground
-                source={item.background}
-                style={styles.item}
-                key={index}
-
-            >
-                <TouchableOpacity onPress={() => this.props.nav('Buy')}>
-                    <Text
-                        style={styles.title}
-                    >{item.title}</Text>
-                    <View
-                        style={styles.line2}
-                    >
-                        <Text style={styles.price}>¥{item.price}</Text>
-                        <Text style={styles.originPrice}>原价: {item.originPrice}</Text>
-                    </View>
-                    <View
-                        style={styles.line3}
-                    >
-                        <Text style={styles.buy}>立即购买</Text>
-                        <Image
-                            source={require('../images/shopBox/arrow.png')}
-                            style={styles.arrow}
-                        />
-
-                    </View>
-                </TouchableOpacity>
-
-            </ImageBackground>
-        )
-    }
-
-    render() {
-
-        return (
-            <View style={styles.bigWrapper}>
-                <View style={styles.wrapper}>
-                    {this.props.data.map((item, index) => this.renderGoods(item, index))}
-                </View>
-                <View style={styles.discount}>
-                    <Image
-                        source={this.props.discount.icon}
-                        stytle={styles.discountIcon}
-                    />
-                </View>
-
-            </View>
-
-        );
-    }
+	render() {
+		return (
+			<View style={styles.bigWrapper}>
+				<View style={styles.wrapper}>
+					{this.props.data.map((item, index) => this.renderGoods(item, index))}
+				</View>
+				<View style={styles.discount}>
+					<Image
+						source={this.props.discount.icon}
+						style={{ height: '80%', width: '95%', borderRadius: 10 }}
+					/>
+				</View>
+			</View>
+		);
+	}
 }

+ 6 - 2
pages/services/api.js

@@ -6,7 +6,8 @@ const url = {
 	get_member: 'http://ott80test-trade.yifangjiaoyu.cn/customer/order/member',
 	pay_url: 'http://ott80test-trade.yifangjiaoyu.cn/mobile',
 	get_voucher: 'http://ott80test-trade.yifangjiaoyu.cn/mobile/voucher',
-	get_isLogin: 'http://ott80test-base.yifangjiaoyu.cn/mobile/user/isLogin'
+	get_isLogin: 'http://ott80test-base.yifangjiaoyu.cn/mobile/user/isLogin',
+	get_showcase: 'http://ott80testlibrary.yifangjiaoyu.cn/mobile/page/showcase'
 };
 
 export default class APIConfig {
@@ -14,7 +15,6 @@ export default class APIConfig {
 		return url.library_url + path;
 	}
 	static getScheduleUrl(path) {
-		console.log(33333, url.schedule_url + path);
 		return url.schedule_url + path;
 	}
 	static getUserUrl(path) {
@@ -36,4 +36,8 @@ export default class APIConfig {
 	static getIsLogin() {
 		return url.get_isLogin;
 	}
+	static getShowCase(params) {
+		console.log('url.get_showcase + params', url.get_showcase + params);
+		return url.get_showcase + params;
+	}
 }

+ 20 - 0
pages/services/showcase.js

@@ -0,0 +1,20 @@
+import APIConfig from './api.js';
+import request from '../utils/request';
+
+export default class showcase {
+	/**
+     * 开机页推荐 code STARTING_UP_RECOMMEND
+     */
+	static getSTARTING_UP_RECOMMEND() {
+		return request(APIConfig.getShowCase('?code=STARTING_UP_RECOMMEND'), {
+			method: 'get'
+		});
+	}
+
+	/**
+     * 开机页推荐 code UCENTER_RECOMMEND
+     */
+	static getUCENTER_RECOMMEND() {
+		return request(APIConfig.getShowCase('?code=UCENTER_RECOMMEND'), { method: 'GET' });
+	}
+}

+ 5 - 4
pages/services/user.js

@@ -90,12 +90,13 @@ export default class user {
 	}
 	//跳过
 	static jumpLogin(deviceCode, channel) {
-		console.log('====================================');
-		console.log('deviceCode', deviceCode);
-		console.log('channel', channel);
-		console.log('====================================');
 		return request(APIConfig.getIsLogin() + `?deviceCode=` + deviceCode + '&channel=' + channel, { method: 'GET' });
 	}
+
+	//登出
+	static LoginOut() {
+		return request(APIConfig.getUserUrl('/signOut'), { method: 'GET' });
+	}
 }
 
 async function getuid() {

+ 16 - 1
pages/userCenter.js

@@ -25,9 +25,11 @@ import ScrollRow from './components/ScrollRow';
 import CourseTitle from './components/CourseTitle';
 import user from './services/user';
 import commonUtil from './utils/commonutil';
+import http_showcase from '../pages/services/showcase';
 
 export default class userCenter extends BasePage {
 	componentDidMount() {
+		this.getUCENTER_RECOMMEND();
 		//触发更新
 		this.refreshSubScription = DeviceEventEmitter.addListener('infoback', () => {
 			user.userMember().then((res) => {
@@ -91,7 +93,7 @@ export default class userCenter extends BasePage {
 		],
 		discount: {
 			title: '限时秒杀',
-			icon: require('./images/shopBox/discount.png')
+			icon: { uri: '' }
 		},
 		favoritesList: [],
 		playLogList: [],
@@ -116,6 +118,19 @@ export default class userCenter extends BasePage {
 		//返回上一页
 		this.props.navigation.goBack();
 	}
+	getUCENTER_RECOMMEND() {
+		http_showcase.getUCENTER_RECOMMEND().then((res) => {
+			console.log('====================================');
+			console.log('res', res.data[0].boothContent);
+			console.log('====================================');
+			this.setState({
+				discount: {
+					title: res.data[0].title,
+					icon: { uri: res.data[0].boothContent }
+				}
+			});
+		});
+	}
 	render() {
 		return (
 			<ScrollView style={{ height: 1100, overflow: 'scroll', backgroundColor: '#fff' }}>