Kaynağa Gözat

解决冲突

Limengbo 5 yıl önce
ebeveyn
işleme
480b1d08b6

+ 5 - 1
README.md

@@ -39,4 +39,8 @@ https://www.jianshu.com/p/72c3d3af094f
 
 
 ##react-native-device-fino github地址
-1.https://github.com/zqHero/deviceInfoDemo#getuniqueid
+https://github.com/zqHero/deviceInfoDemo#getuniqueid
+
+##使用react-native-yunpeng-alipay 支付宝支付demo
+https://github.com/dai1254473705/react-native-alipay
+1.修改node_modules/react-native-yupeng-alipay/android/src/main/java/com/yunpeng/alipay/AlipayPackage,注释createJSModules方法体

+ 1 - 0
android/app/build.gradle

@@ -151,6 +151,7 @@ android {
 }
 
 dependencies {
+    implementation project(':react-native-yunpeng-alipay')
     implementation project(':react-native-splash-screen')
     implementation project(':react-native-device-info')
     implementation project(':react-native-wechat')

Dosya farkı çok büyük olduğundan ihmal edildi
+ 107 - 1
android/app/src/main/assets/index.android.bundle


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

@@ -15,6 +15,7 @@ import com.imagepicker.ImagePickerPackage;
 import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
 import com.theweflex.react.WeChatPackage;
 import com.learnium.RNDeviceInfo.RNDeviceInfo;
+import com.yunpeng.alipay.AlipayPackage;
 
 import org.devio.rn.splashscreen.SplashScreenReactPackage;
 
@@ -41,7 +42,8 @@ public class MainApplication extends Application implements ReactApplication {
                     new ImagePickerPackage(),
                     new WeChatPackage(),
                     new RNDeviceInfo(),
-                    new SplashScreenReactPackage()
+                    new SplashScreenReactPackage(),
+                    new AlipayPackage()
             );
         }
 

+ 2 - 0
android/settings.gradle

@@ -1,4 +1,6 @@
 rootProject.name = 'efunbox_mobile_8'
+include ':react-native-yunpeng-alipay'
+project(':react-native-yunpeng-alipay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-yunpeng-alipay/android')
 include ':react-native-splash-screen'
 project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
 include ':react-native-device-info'

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

@@ -49,6 +49,7 @@
 		12BDF20DBE4141F8A990F8D7 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FCB46EDB7F456AB88EF68C /* libRNDeviceInfo.a */; };
 		5C6A0716F9C849D2B67AE09E /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 505D2A7DD9E64E7B82EC655D /* libRNDeviceInfo-tvOS.a */; };
 		5ABEAAADCD024F01B438B689 /* libSplashScreen.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D337E77E80D430CB4D8DF4B /* libSplashScreen.a */; };
+		3E1226E51D6749DF98D970B7 /* libAlipayModule.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE3397F6B4284B5086A4BAFF /* libAlipayModule.a */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -373,6 +374,8 @@
 		505D2A7DD9E64E7B82EC655D /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
 		2CB189F11F9C4B5B8D057FFC /* SplashScreen.xcodeproj */ = {isa = PBXFileReference; name = "SplashScreen.xcodeproj"; path = "../node_modules/react-native-splash-screen/ios/SplashScreen.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
 		1D337E77E80D430CB4D8DF4B /* libSplashScreen.a */ = {isa = PBXFileReference; name = "libSplashScreen.a"; path = "libSplashScreen.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
+		9E7028B3CD414C43AF6ABADC /* AlipayModule.xcodeproj */ = {isa = PBXFileReference; name = "AlipayModule.xcodeproj"; path = "../node_modules/react-native-yunpeng-alipay/ios/AlipayModule.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
+		CE3397F6B4284B5086A4BAFF /* libAlipayModule.a */ = {isa = PBXFileReference; name = "libAlipayModule.a"; path = "libAlipayModule.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -409,6 +412,7 @@
 				D3F60855D8FF4C4A9C5D4ACA /* RCTWeChatTests.xctest in Resources */,
 				12BDF20DBE4141F8A990F8D7 /* libRNDeviceInfo.a in Frameworks */,
 				5ABEAAADCD024F01B438B689 /* libSplashScreen.a in Frameworks */,
+				3E1226E51D6749DF98D970B7 /* libAlipayModule.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -607,6 +611,7 @@
 				593F0F0596BC4EB7996A9D21 /* RCTWeChat.xcodeproj */,
 				18F4C7BFE3EB4947A8A72EB4 /* RNDeviceInfo.xcodeproj */,
 				2CB189F11F9C4B5B8D057FFC /* SplashScreen.xcodeproj */,
+				9E7028B3CD414C43AF6ABADC /* AlipayModule.xcodeproj */,
 			);
 			name = Libraries;
 			sourceTree = "<group>";
@@ -1244,6 +1249,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1254,6 +1260,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Debug;
@@ -1285,6 +1292,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1295,6 +1303,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Release;
@@ -1324,6 +1333,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Debug;
@@ -1352,6 +1362,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Release;
@@ -1391,6 +1402,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1401,6 +1413,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Debug;
@@ -1440,6 +1453,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1450,6 +1464,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Release;
@@ -1488,6 +1503,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1498,6 +1514,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Debug;
@@ -1536,6 +1553,7 @@
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 					"\"$(SRCROOT)/$(TARGET_NAME)\"",
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1546,6 +1564,7 @@
 					"$(SRCROOT)\..\node_modules\react-native-wechat\ios",
 					"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo",
 					"$(SRCROOT)\..\node_modules\react-native-splash-screen\ios",
+					"$(SRCROOT)\..\node_modules\react-native-yunpeng-alipay\ios\AlipayModule/**",
 				);
 			};
 			name = Release;

+ 9 - 4
package-lock.json

@@ -6281,7 +6281,7 @@
     },
     "opencollective": {
       "version": "1.0.3",
-      "resolved": "https://registry.npm.taobao.org/opencollective/download/opencollective-1.0.3.tgz",
+      "resolved": "https://registry.npm.taobao.org/opencollective/download/opencollective-1.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fopencollective%2Fdownload%2Fopencollective-1.0.3.tgz",
       "integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=",
       "requires": {
         "babel-polyfill": "6.23.0",
@@ -6299,12 +6299,12 @@
         },
         "ansi-styles": {
           "version": "2.2.1",
-          "resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-2.2.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-styles%2Fdownload%2Fansi-styles-2.2.1.tgz",
+          "resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-2.2.1.tgz",
           "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
         },
         "chalk": {
           "version": "1.1.3",
-          "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-1.1.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-1.1.3.tgz",
+          "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-1.1.3.tgz",
           "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
           "requires": {
             "ansi-styles": "^2.2.1",
@@ -6316,7 +6316,7 @@
         },
         "inquirer": {
           "version": "3.0.6",
-          "resolved": "https://registry.npm.taobao.org/inquirer/download/inquirer-3.0.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finquirer%2Fdownload%2Finquirer-3.0.6.tgz",
+          "resolved": "https://registry.npm.taobao.org/inquirer/download/inquirer-3.0.6.tgz",
           "integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=",
           "requires": {
             "ansi-escapes": "^1.1.0",
@@ -7175,6 +7175,11 @@
         "events": "1.0.2"
       }
     },
+    "react-native-yunpeng-alipay": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npm.taobao.org/react-native-yunpeng-alipay/download/react-native-yunpeng-alipay-2.0.0.tgz",
+      "integrity": "sha1-qdPWil7vLlx1u2bEYDhOEojZqq0="
+    },
     "react-navigation": {
       "version": "3.9.1",
       "resolved": "https://registry.npm.taobao.org/react-navigation/download/react-navigation-3.9.1.tgz",

+ 1 - 0
package.json

@@ -24,6 +24,7 @@
     "react-native-video": "^4.4.1",
     "react-native-web": "^0.11.2",
     "react-native-wechat": "^1.9.10",
+    "react-native-yunpeng-alipay": "^2.0.0",
     "react-navigation": "^3.9.1"
   },
   "devDependencies": {

+ 3 - 1
pages/Login.js

@@ -157,6 +157,7 @@ export default class Login extends BasePage {
 					usermap.set('status', result.data.user.status);
 					usermap.set('uid', result.data.user.uid);
 					usermap.set('ageGroup', result.data.user.ageGroup);
+					map.set('avatar', res.data.avatar);
 					//登陆成功了,可以存储用户数据到本地
 					console.log('===============手机号登录成功=====================');
 					console.log(commonutil.mapToJson(usermap));
@@ -182,7 +183,7 @@ export default class Login extends BasePage {
 					deviceCode: this.state.deviceCode,
 					openId: user['openid'],
 					unionId: user['unionid'],
-					avatar: user['province'] + user['city'],
+					avatar: user['headimgurl'],
 					sex: +user['sex'],
 					nickName: user['nickname']
 				}
@@ -208,6 +209,7 @@ export default class Login extends BasePage {
 					usermap.set('status', result.data.user.status);
 					usermap.set('uid', result.data.user.uid);
 					usermap.set('ageGroup', result.data.user.ageGroup);
+					usermap.set('avatar', result.data.user.avatar);
 					console.log('===============微信登录成功=====================');
 					console.log(commonutil.mapToJson(usermap));
 					console.log('===============微信登录成功=====================');

Dosya farkı çok büyük olduğundan ihmal edildi
+ 929 - 918
pages/PersonalInfo.js


+ 400 - 319
pages/buy/buy.js

@@ -1,176 +1,258 @@
 /* 
  * 
 */
-import React, { Component } from "react";
+import React, { Component } from 'react';
 import {
-    Platform,
-    StyleSheet,
-    Text,
-    View,
-    Image,
-    TouchableOpacity,
-    FlatList,
-    TouchableHighlight,
-    DeviceEventEmitter,
-    ScrollView,
-    Modal,
-    Animated,
-    TextInput
-} from "react-native";
-import BasePage from "../BasePage";
+	Platform,
+	StyleSheet,
+	Text,
+	View,
+	Image,
+	TouchableOpacity,
+	FlatList,
+	TouchableHighlight,
+	DeviceEventEmitter,
+	ScrollView,
+	Modal,
+	Animated,
+	TextInput
+} from 'react-native';
+import BasePage from '../BasePage';
 import Dimensions from '../utils/dimensions';
 import TopicTitle from '../components/TopicTitle';
-import CourseTitle from "../components/CourseTitle";
+import CourseTitle from '../components/CourseTitle';
+import wechat from '../utils/wechat';
+import aliPay from '../utils/aliPay';
 
 export default class Buy extends BasePage {
-    state = {
-        shopData: [
-            { title: '1个月', originPrice: '199', price: '49', },
-            { title: '12个月', originPrice: '499', price: '199' }
-        ],
-        currentTapindex: 0,
-        slideAnim: new Animated.Value(-150),
-        ifDialogShow: false,
-        payType: 1
-    };
-    itemTap = (index) => {
-        this.setState({
-            currentTapindex: index
-        })
-    }
-    renderItem = (item, index) => {
-        return (
-            <TouchableOpacity style={this.state.currentTapindex === index ? styles.itemWrapperTap : styles.itemWrapperNormal} onPress={() => { this.itemTap(index) }} key={index}>
-                <Text style={this.state.currentTapindex === index ? styles.timeLengthTap : styles.timeLength}>{item.title}</Text>
-                <Text style={this.state.currentTapindex === index ? styles.priceTap : styles.price}>¥{item.price}元</Text>
-                <Text style={this.state.currentTapindex === index ? styles.originPriceTap : styles.originPrice}>原价:¥{item.originPrice}</Text>
-            </TouchableOpacity>
-        )
-    }
-    dialogComeout = (index) => {
-        if (index) {
-            this.setState({
-                ifDialogShow: true
-            }, () => {
-                Animated.timing(
-                    this.state.slideAnim,
-                    {
-                        toValue: 0,
-                        duration: 300,
-                    }
-                ).start();
-            })
-        } else {
-            Animated.timing(
-                this.state.slideAnim,
-                {
-                    toValue: -150,
-                    duration: 200,
-                }
-            ).start();
-            setTimeout(() => {
-                this.setState({
-                    ifDialogShow: false
-                })
-            }, 210)
-        }
+	state = {
+		shopData: [
+			{ title: '1个月', originPrice: '199', price: '49' },
+			{ title: '12个月', originPrice: '499', price: '199' }
+		],
+		currentTapindex: 0,
+		slideAnim: new Animated.Value(-150),
+		ifDialogShow: false,
+		payType: 1,
+		ticketPrice: 0
+	};
+	itemTap = (index) => {
+		this.setState({
+			currentTapindex: index
+		});
+	};
+	renderItem = (item, index) => {
+		return (
+			<TouchableOpacity
+				style={this.state.currentTapindex === index ? styles.itemWrapperTap : styles.itemWrapperNormal}
+				onPress={() => {
+					this.itemTap(index);
+				}}
+				key={index}
+			>
+				<Text style={this.state.currentTapindex === index ? styles.timeLengthTap : styles.timeLength}>
+					{item.title}
+				</Text>
+				<Text style={this.state.currentTapindex === index ? styles.priceTap : styles.price}>
+					¥{item.price}元
+				</Text>
+				<Text style={this.state.currentTapindex === index ? styles.originPriceTap : styles.originPrice}>
+					原价:¥{item.originPrice}
+				</Text>
+			</TouchableOpacity>
+		);
+	};
+	dialogComeout = (index) => {
+		if (index) {
+			this.setState(
+				{
+					ifDialogShow: true
+				},
+				() => {
+					Animated.timing(this.state.slideAnim, {
+						toValue: 0,
+						duration: 300
+					}).start();
+				}
+			);
+		} else {
+			Animated.timing(this.state.slideAnim, {
+				toValue: -150,
+				duration: 200
+			}).start();
+			setTimeout(() => {
+				this.setState({
+					ifDialogShow: false
+				});
+			}, 210);
+		}
+	};
+	setPayMethod = (type) => {
+		this.setState(
+			{
+				payType: type
+			},
+			() => {
+				setTimeout(() => {
+					this.dialogComeout(false);
+				}, 100);
+			}
+		);
+	};
+	choseTicket = () => {
+		this.toNextPage('Ticket', { choseTicketCallBack: this.choseTicketCallBack.bind(this) });
+	};
+	choseTicketCallBack(item) {
+		/**
+         * 	type: 1,
+			price: 12,
+			num: 6,
+			time: '2019-12-12'
+         * 
+         */
+		this.setState({
+			ticketPrice: item.price
+		});
+	}
+	pay = () => {
+		switch (this.state.payType) {
+			case 1:
+				//微信支付
+				wechat.pay();
+				break;
+			case 2:
+				//阿里支付
+				let params = {
+					partner: 'asdfasdf', //app_id
+					seller_id: '115681592@qq.com', //下单账号,用的芮总QQ邮箱,人家说没有可不填,但为了代表下单身份才用芮总QQ邮箱的
+					out_trade_no: 'ALIPAY15307684880120000000001', //第三方订单号
+					subject: '描述',
+					body: '',
+					total_fee: '0.01', //价格
+					notify_url: 'http://xx.xx.xx.xx/api/0/alipay/alipayCallback', //回调地址
+					service: 'm.pay',
+					payment_type: '1',
+					_input_charset: 'utf-8',
+					it_b_pay: '30m',
+					sign: 'sdfasdf', //签名
+					sign_type: 'RSA'
+				};
+				aliPay.pay(params);
+				break;
+		}
+	};
+	render() {
+		return (
+			<View style={{ flex: 1 }}>
+				<View
+					style={{
+						height: 30,
+						marginTop: 30
+					}}
+				>
+					<CourseTitle
+						width={this.getWindowWidth()}
+						title="VIP购买"
+						lefttype={1}
+						textcolor={'#231F20'}
+						backPress={() => this.goBack()}
+						// backPress={() => alert("左侧按钮")}
+					/>
+				</View>
+				<View style={{ flex: 0.02, backgroundColor: 'rgba(242, 242, 242, 1)' }} />
+				<View style={styles.top}>
+					<Text style={styles.title}>套餐选择</Text>
+					<View>{this.state.shopData.map((item, index) => this.renderItem(item, index))}</View>
+				</View>
+				<View style={{ flex: 0.01, backgroundColor: 'rgba(242, 242, 242, 1)' }} />
+				<TouchableOpacity style={styles.payment} activeOpacity={1} onPress={() => this.dialogComeout(true)}>
+					<Text style={styles.left}>支付方式</Text>
+					<View style={styles.right}>
+						{this.state.payType === 1 ? (
+							<Text style={styles.method}>微信支付</Text>
+						) : (
+							<Text style={styles.method}>支付宝支付</Text>
+						)}
 
-    }
-    setPayMethod = (type) => {
-        this.setState({
-            payType: type
-        },()=>{
-            setTimeout(() => {
-                this.dialogComeout(false)
-            }, 100)
-            
-        })
-    }
-    render() {
-        return (
-            <View style={{ flex: 1 }}>
-                <View
-                    style={{
-                        height: 30,
-                        marginTop: 30
-                    }}
-                >
-                    <CourseTitle
-                        width={this.getWindowWidth()}
-                        title="VIP购买"
-                        lefttype={1}
-                        textcolor={"#231F20"}
-                        backPress={() => this.goBack()}
-                    // backPress={() => alert("左侧按钮")}
-                    />
-                </View>
-                <View style={styles.top}>
-                    <Text style={styles.title}>套餐选择</Text>
-                    <View>
-                        {this.state.shopData.map((item, index) => this.renderItem(item, index))}
-                    </View>
-                </View>
-                <TouchableOpacity style={styles.payment} onPress={() => this.dialogComeout(true)}>
-                    <Text style={styles.left}>支付方式</Text>
-                    <View style={styles.right}>
-                        <Text style={styles.method}>微信支付</Text>
-                        <Image source={require('../images/common/arrowRight.png')} />
-                    </View>
-                </TouchableOpacity>
-                <View style={styles.bottom}>
-                    <Text style={styles.bottomLeft}>¥{this.state.shopData[this.state.currentTapindex].price}元</Text>
-                    <TouchableOpacity style={styles.bottomRight}>
-                        <Text style={styles.bottomRightText}>支付</Text>
-                    </TouchableOpacity>
-                </View>
-                {
-                    this.state.ifDialogShow
-                        ?
-                        <TouchableHighlight
-                            onPress={() => { this.dialogComeout(false) }}
-                            style={{ ...styles.dialog }}
-                            underlayColor={0.1}
-                        >
-                            <Animated.View
-                                style={{ ...styles.payMethod, bottom: this.state.slideAnim }}
-                                onPress={() => { alert(12311) }}
-                            >
-                                <Text style={styles.payText}>选择支付方式</Text>
-                                <TouchableOpacity activeOpacity={0.9} style={styles.payDialog} onPress={() => this.setPayMethod(1)}>
-                                    <View style={styles.dialogRow}>
-                                        <Image style={styles.payIcon} source={require('../images/common/wxPay.png')} />
-                                        <Text>微信支付</Text>
-                                    </View>
-                                    {
-                                        this.state.payType === 1
-                                            ?
-                                            <Image source={require('../images/common/check.png')} />
-                                            :
-                                            null
-                                    }
+						<Image source={require('../images/common/arrowRight.png')} />
+					</View>
+				</TouchableOpacity>
+				<TouchableOpacity style={styles.payment} activeOpacity={1} onPress={this.choseTicket.bind(this)}>
+					<Text style={styles.left}>使用抵用券</Text>
+					<View style={styles.right}>
+						<Text style={styles.method}>-¥{this.state.ticketPrice}元</Text>
+						<Image source={require('../images/common/arrowRight.png')} />
+					</View>
+				</TouchableOpacity>
+				<View style={{ flex: 0.01, backgroundColor: 'rgba(242, 242, 242, 1)' }} />
+				<View>
+					<Text style={{ fontSize: 14, width: '100%', textAlignVertical: 'center', textAlign: 'center' }}>
+						开通会员即时生效,有任何问题请联系我们。
+					</Text>
+				</View>
+				<View style={styles.bottom}>
+					{this.state.ticketPrice > 0 ? (
+						(price = (
+							<Text style={styles.bottomLeft}>
+								¥{parseInt(this.state.shopData[this.state.currentTapindex].price) -
+									parseInt(this.state.ticketPrice)}元
+							</Text>
+						))
+					) : (
+						<Text style={styles.bottomLeft}>¥{this.state.shopData[this.state.currentTapindex].price}元</Text>
+					)}
 
-                                </TouchableOpacity>
-                                {/* <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>
-                                    </View>
-                                    {
-                                        this.state.payType === 2
-                                            ?
-                                            <Image source={require('../images/common/check.png')} />
-                                            :
-                                            null
-                                    }
-                                </TouchableOpacity> */}
-                                <TextInput style={styles.payDialog} />
-                            </Animated.View>
-                        </TouchableHighlight>
-                        :
-                        null
-                }
+					<TouchableOpacity style={styles.bottomRight} onPress={this.pay.bind(this)}>
+						<Text style={styles.bottomRightText}>支付</Text>
+					</TouchableOpacity>
+				</View>
+				{this.state.ifDialogShow ? (
+					<TouchableHighlight
+						onPress={() => {
+							this.dialogComeout(false);
+						}}
+						style={{ ...styles.dialog }}
+						underlayColor={0.1}
+					>
+						<Animated.View
+							style={{ ...styles.payMethod, bottom: this.state.slideAnim }}
+							onPress={() => {
+								alert(12311);
+							}}
+						>
+							<Text style={styles.payText}>选择支付方式</Text>
+							<TouchableOpacity
+								activeOpacity={0.9}
+								style={styles.payDialog}
+								onPress={() => this.setPayMethod(1)}
+							>
+								<View style={styles.dialogRow}>
+									<Image style={styles.payIcon} source={require('../images/common/wxPay.png')} />
+									<Text>微信支付</Text>
+								</View>
+								{this.state.payType === 1 ? (
+									<Image source={require('../images/common/check.png')} />
+								) : null}
+							</TouchableOpacity>
+							<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>
+								</View>
+								{this.state.payType === 2 ? (
+									<Image source={require('../images/common/check.png')} />
+								) : null}
+							</TouchableOpacity>
+							{/* <TextInput style={styles.payDialog} /> */}
+						</Animated.View>
+					</TouchableHighlight>
+				) : null}
 
-                {/* <Modal
+				{/* <Modal
                     animationType="none "
                     transparent={true}
                     visible={true}
@@ -179,163 +261,162 @@ export default class Buy extends BasePage {
                     }}
                     
                 ></Modal> */}
-            </View>
-
-        )
-    }
+			</View>
+		);
+	}
 }
 
 const styles = StyleSheet.create({
-    top: {
-        width: Dimensions.width,
-        flexDirection: 'column',
-        alignItems: 'center',
-        paddingBottom: 20
-    },
-    title: {
-        fontSize: 20,
-        color: '#a8674d',
-        marginTop: 22,
-    },
-    itemWrapperNormal: {
-        borderWidth: 1,
-        borderColor: '#a8674d',
-        borderRadius: 27,
-        backgroundColor: '#fff',
-        flexDirection: 'row',
-        alignItems: 'center',
-        justifyContent: 'space-around',
-        width: '86%',
-        height: Dimensions.getHeight(53),
-        marginTop: 20,
-    },
-    itemWrapperTap: {
-        // borderWidth: 1,
-        // borderColor: '#a8674d',
-        borderRadius: 27,
-        backgroundColor: '#ff7525',
-        flexDirection: 'row',
-        alignItems: 'center',
-        justifyContent: 'space-around',
-        width: '86%',
-        height: Dimensions.getHeight(53),
-        marginTop: 20,
-    },
-    originPriceTap: {
-        fontSize: 14,
-        color: '#fff',
-        textDecorationLine: 'line-through'
-    },
-    originPrice: {
-        fontSize: 14,
-        color: '#a8674d',
-        textDecorationLine: 'line-through'
-    },
-    priceTap: {
-        fontSize: 20,
-        color: '#fff',
-    },
-    price: {
-        fontSize: 20,
-        color: '#a8674d',
-    },
-    timeLengthTap: {
-        fontSize: 18,
-        color: '#fff',
-    },
-    timeLength: {
-        fontSize: 18,
-        color: '#a8674d',
-    },
-    payment: {
-        flexDirection: 'row',
-        alignItems: 'center',
-        width: Dimensions.width,
-        height: 60,
-        justifyContent: 'space-between',
-        alignItems: 'center',
-        borderColor: '#f3f2f7',
-        borderTopWidth: 6,
-        borderBottomWidth: 6,
-        paddingHorizontal: 33
-    },
-    left: {
-        fontSize: 16
-    },
-    right: {
-        flexDirection: 'row',
-        alignItems: 'center'
-    },
-    method: {
-        color: '#a8674d',
-        fontSize: 16,
-        marginRight: 7
-    },
-    bottom: {
-        width: Dimensions.width,
-        height: 60,
-        flexDirection: 'row',
-        position: 'absolute',
-        bottom: 0,
-    },
-    bottomLeft: {
-        width: '58%',
-        textAlign: 'center',
-        lineHeight: 60,
-        color: '#a8674d',
-        fontSize: 20
-    },
-    bottomRight: {
-        width: '42%',
-        fontSize: 16,
-        color: '#fff',
-        backgroundColor: '#f5880d',
-        alignItems: 'center'
-    },
-    bottomRightText: {
-        fontSize: 20,
-        color: '#fff',
-        textAlign: 'center',
-        lineHeight: 60,
-    },
-    dialog: {
-        width: Dimensions.width,
-        height: Dimensions.height,
-        position: 'absolute',
-        backgroundColor: 'rgba(0,0,0,0.4)',
-
-    },
-    payMethod: {
-        width: Dimensions.width,
-        height: 150,
-        position: 'absolute',
-        // bottom: 0,
-        backgroundColor: '#fff',
-        flexDirection: 'column',
-        alignItems: 'center',
-        justifyContent: 'flex-start'
-    },
-    payDialog: {
-        width: '90%',
-        borderTopWidth: 1,
-        borderColor: '#e4e4e4',
-        flexDirection: 'row',
-        alignItems: 'center',
-        justifyContent: 'space-between',
-        flex: 1
-    },
-    dialogRow: {
-        flexDirection: 'row',
-        alignItems: 'center',
-    },
-    payIcon: {
-        marginRight: 17
-    },
-    payText: {
-        fontSize: 16,
-        color: '#191919',
-        alignContent: 'center',
-        flex: 1,
-        lineHeight: 50
-    }
-})
+	top: {
+		width: Dimensions.width,
+		flexDirection: 'column',
+		alignItems: 'center',
+		paddingBottom: 20
+	},
+	title: {
+		fontSize: 20,
+		color: '#a8674d',
+		marginTop: 22
+	},
+	itemWrapperNormal: {
+		borderWidth: 1,
+		borderColor: '#a8674d',
+		borderRadius: 27,
+		backgroundColor: '#fff',
+		flexDirection: 'row',
+		alignItems: 'center',
+		justifyContent: 'space-around',
+		width: '86%',
+		height: Dimensions.getHeight(53),
+		marginTop: 20
+	},
+	itemWrapperTap: {
+		// borderWidth: 1,
+		// borderColor: '#a8674d',
+		borderRadius: 27,
+		backgroundColor: '#ff7525',
+		flexDirection: 'row',
+		alignItems: 'center',
+		justifyContent: 'space-around',
+		width: '86%',
+		height: Dimensions.getHeight(53),
+		marginTop: 20
+	},
+	originPriceTap: {
+		fontSize: 14,
+		color: '#fff',
+		textDecorationLine: 'line-through'
+	},
+	originPrice: {
+		fontSize: 14,
+		color: '#a8674d',
+		textDecorationLine: 'line-through'
+	},
+	priceTap: {
+		fontSize: 20,
+		color: '#fff'
+	},
+	price: {
+		fontSize: 20,
+		color: '#a8674d'
+	},
+	timeLengthTap: {
+		fontSize: 18,
+		color: '#fff'
+	},
+	timeLength: {
+		fontSize: 18,
+		color: '#a8674d'
+	},
+	payment: {
+		flexDirection: 'row',
+		alignItems: 'center',
+		width: Dimensions.width,
+		height: 60,
+		justifyContent: 'space-between',
+		alignItems: 'center',
+		borderColor: '#f3f2f7',
+		borderTopWidth: 6,
+		borderBottomWidth: 6,
+		paddingHorizontal: 33
+	},
+	left: {
+		fontSize: 16
+	},
+	right: {
+		flexDirection: 'row',
+		alignItems: 'center'
+	},
+	method: {
+		color: '#a8674d',
+		fontSize: 16,
+		marginRight: 7
+	},
+	bottom: {
+		width: Dimensions.width,
+		height: 60,
+		flexDirection: 'row',
+		position: 'absolute',
+		bottom: 0
+	},
+	bottomLeft: {
+		width: '58%',
+		textAlign: 'center',
+		lineHeight: 60,
+		color: '#a8674d',
+		fontSize: 20
+	},
+	bottomRight: {
+		width: '42%',
+		fontSize: 16,
+		color: '#fff',
+		backgroundColor: '#f5880d',
+		alignItems: 'center'
+	},
+	bottomRightText: {
+		fontSize: 20,
+		color: '#fff',
+		textAlign: 'center',
+		lineHeight: 60
+	},
+	dialog: {
+		width: Dimensions.width,
+		height: Dimensions.height,
+		position: 'absolute',
+		backgroundColor: 'rgba(0,0,0,0.4)'
+	},
+	payMethod: {
+		width: Dimensions.width,
+		height: 150,
+		position: 'absolute',
+		// bottom: 0,
+		backgroundColor: '#fff',
+		flexDirection: 'column',
+		alignItems: 'center',
+		justifyContent: 'flex-start'
+	},
+	payDialog: {
+		width: '90%',
+		borderTopWidth: 1,
+		borderColor: '#e4e4e4',
+		flexDirection: 'row',
+		alignItems: 'center',
+		justifyContent: 'space-between',
+		flex: 1
+	},
+	dialogRow: {
+		flex: 1,
+		flexDirection: 'row',
+		alignItems: 'center'
+	},
+	payIcon: {
+		marginRight: 17
+	},
+	payText: {
+		fontSize: 16,
+		color: '#191919',
+		alignContent: 'center',
+		flex: 1,
+		lineHeight: 50
+	}
+});

+ 144 - 145
pages/buy/ticket.js

@@ -1,158 +1,157 @@
 /* 
  * 
 */
-import React, { Component } from "react";
+import React, { Component } from 'react';
 import {
-    Platform,
-    StyleSheet,
-    Text,
-    View,
-    Image,
-    TouchableOpacity,
-    FlatList,
-    TouchableHighlight,
-    DeviceEventEmitter,
-    ScrollView,
-    ImageBackground
-} from "react-native";
-import BasePage from "../BasePage";
+	Platform,
+	StyleSheet,
+	Text,
+	View,
+	Image,
+	TouchableOpacity,
+	FlatList,
+	TouchableHighlight,
+	DeviceEventEmitter,
+	ScrollView,
+	ImageBackground
+} from 'react-native';
+import BasePage from '../BasePage';
 import Dimensions from '../utils/dimensions';
 
 export default class Ticket extends BasePage {
-    state = {
-        data: [
-            {
-                type: 1,
-                price: 12,
-                num: 6,
-                time: '2019-12-12'
-            },
-            {
-                type: 2,
-                price: 50,
-                limit: '199',
-                time: '2019-12-12'
-            }
-        ]
-    };
-    renderItem = (item, index) => {
+	state = {
+		data: [
+			{
+				type: 1,
+				price: 12,
+				num: 6,
+				time: '2019-12-12'
+			},
+			{
+				type: 1,
+				price: 33,
+				num: 9,
+				time: '2019-12-12'
+			},
+			{
+				type: 2,
+				price: 50,
+				limit: '199',
+				time: '2019-12-12'
+			}
+		]
+	};
+	renderItem = (item, index) => {
+		return (
+			<View>
+				{item.type === 1 ? (
+					// 抵用券
+					<TouchableOpacity onPress={() => this.userdiscount(item)} activeOpacity={1}>
+						<ImageBackground source={require('../images/ticket/discount-bg.png')} style={styles.type1}>
+							<View style={styles.topInfo}>
+								<View style={styles.left2}>
+									<Text style={styles.price}>¥{item.price}</Text>
+									<Text style={styles.type}>抵用券</Text>
+								</View>
 
-        return (
-            <View>
-                {
-                    item.type === 1
-                        ? // 抵用券
-                        <ImageBackground
-                            source={require('../images/ticket/discount-bg.png')}
-                            style={styles.type1}
-                        >
-                            <View style={styles.topInfo}>
-                                <View style={styles.left2}>
-                                    <Text style={styles.price}>
-                                        ¥{item.price}
-                                    </Text>
-                                    <Text style={styles.type}>抵用券</Text>
-                                </View>
+								<View style={styles.right2}>
+									<Text style={styles.greyText}>购买{item.num}个单课程的奖励</Text>
+									<Text style={styles.greyText}>有效期:{item.time}</Text>
+								</View>
+							</View>
+							<View style={styles.bottomInfo}>
+								<Text style={styles.greyText}>注:开通会员时方可使用</Text>
+								<Text style={styles.blueText}>查看订单</Text>
+							</View>
+						</ImageBackground>
+					</TouchableOpacity>
+				) : (
+					// 优惠券
+					<ImageBackground source={require('../images/ticket/coupon-bg.png')} style={styles.type2}>
+						<View style={styles.left2}>
+							<Text style={styles.price}>¥{item.price}</Text>
+							<Text style={styles.type}>优惠券</Text>
+						</View>
 
-                                <View style={styles.right2}>
-                                    <Text style={styles.greyText}>购买{item.num}个单课程的奖励</Text>
-                                    <Text style={styles.greyText}>有效期:{item.time}</Text>
-                                </View>
+						<View style={styles.right2}>
+							<Text style={styles.greyText}>满{item.limit}可用</Text>
+							<Text style={styles.greyText}>有效期:{item.time}</Text>
+						</View>
+					</ImageBackground>
+				)}
+			</View>
+		);
+	};
+	render() {
+		return (
+			<FlatList
+				data={this.state.data}
+				horizontal={false}
+				renderItem={({ item, index }) => this.renderItem(item, index)}
+				keyExtractor={(item, index) => index.toString()}
+			/>
+		);
+	}
 
-                            </View>
-                            <View style={styles.bottomInfo}>
-                                <Text style={styles.greyText}>注:开通会员时方可使用</Text>
-                                <Text style={styles.blueText}>查看订单</Text>
-                            </View>
-                        </ImageBackground>
-                        : // 优惠券
-                        <ImageBackground
-                            source={require('../images/ticket/coupon-bg.png')}
-                            style={styles.type2}
-                        >
-                            <View style={styles.left2}>
-                                <Text style={styles.price}>
-                                    ¥{item.price}
-                                </Text>
-                                <Text style={styles.type}>优惠券</Text>
-                            </View>
-
-                            <View style={styles.right2}>
-                                <Text style={styles.greyText}>满{item.limit}可用</Text>
-                                <Text style={styles.greyText}>有效期:{item.time}</Text>
-                            </View>
-                        </ImageBackground>
-                }
-            </View>
-
-        )
-    }
-    render() {
-        return (
-            <FlatList
-
-                data={this.state.data}
-                horizontal={false}
-                renderItem={({ item, index }) => this.renderItem(item, index)}
-                keyExtractor={(item, index) => index.toString()}
-            />
-        )
-    }
+	userdiscount = (item) => {
+		if (this.props.navigation.state.params != undefined) {
+			this.props.navigation.state.params.choseTicketCallBack(item);
+			this.props.navigation.goBack();
+		}
+	};
 }
 
 const styles = StyleSheet.create({
-    type1: {
-        width: 343,
-        height: 144,
-        flexDirection: 'column',
-        justifyContent: 'space-between',
-        alignItems: 'center',
-        paddingTop: 12,
-        paddingBottom: 14
-    },
-    type2: {
-        width: 343,
-        height: 100,
-        flexDirection: 'row',
-        justifyContent: 'flex-start',
-        alignItems: 'center',
-        paddingLeft: 27
-    },
-    left2: {
-        flexDirection: 'column',
-
-    },
-    price: {
-        color: '#ff6d2f',
-        fontSize: 19,
-        fontWeight: '500'
-    },
-    type: {
-        color: '#ff6d2f',
-        fontSize: 18,
-        fontWeight: '500'
-    },
-    right2: {
-        flexDirection: 'column'
-
-    },
-    topInfo: {
-        flexDirection: 'row',
-        alignItems: 'center'
-    },
-    bottomInfo: {
-        width: '100%',
-        paddingHorizontal: 12,
-        flexDirection: 'row',
-        alignItems: 'center',
-        justifyContent: 'space-between'
-    },
-    greyText: {
-        fontSize: 14,
-        color: '#888'
-    },
-    blueText: {
-        color: '#4a90e2',
-        fontSize: 14
-    }
-})
+	type1: {
+		width: 343,
+		height: 144,
+		flexDirection: 'column',
+		justifyContent: 'space-between',
+		alignItems: 'center',
+		paddingTop: 12,
+		paddingBottom: 14
+	},
+	type2: {
+		width: 343,
+		height: 100,
+		flexDirection: 'row',
+		justifyContent: 'flex-start',
+		alignItems: 'center',
+		paddingLeft: 27
+	},
+	left2: {
+		flexDirection: 'column'
+	},
+	price: {
+		color: '#ff6d2f',
+		fontSize: 19,
+		fontWeight: '500'
+	},
+	type: {
+		color: '#ff6d2f',
+		fontSize: 18,
+		fontWeight: '500'
+	},
+	right2: {
+		flexDirection: 'column'
+	},
+	topInfo: {
+		flexDirection: 'row',
+		alignItems: 'center'
+	},
+	bottomInfo: {
+		width: '100%',
+		paddingHorizontal: 12,
+		flexDirection: 'row',
+		alignItems: 'center',
+		justifyContent: 'space-between'
+	},
+	greyText: {
+		fontSize: 14,
+		color: '#888'
+	},
+	blueText: {
+		color: '#4a90e2',
+		fontSize: 14
+	}
+});

+ 3 - 6
pages/components/MainPage.js

@@ -17,12 +17,8 @@ import {
 	TouchableOpacity,
 	ImageBackground,
 	TextInput,
-	Button,
-	ViewPagerAndroid,
-	DeviceEventEmitter,
-	SectionList,
 	Animated,
-	TouchableHighlight
+	StatusBar
 } from 'react-native';
 import BasePage from '../BasePage';
 import Header from './Header';
@@ -156,7 +152,8 @@ export default class MainPage extends BasePage {
           ListHeaderComponent={() => this.headerorfooterComponent()}
           renderSectionHeader={this.sectionTitle}
           onScroll={this.hideGradeMenu}
-        /> */}
+		/> */}
+				<StatusBar barStyle={'dark-content'} backgroundColor={'white'} translucent={false} />
 				<ScrollView
 					style={{ height: Dimensions.height }}
 					showsVerticalScrollIndicator={false}

+ 18 - 13
pages/services/api.js

@@ -1,18 +1,23 @@
 const url = {
-  library_url: "http://ott80testlibrary.yifangjiaoyu.cn/mobile/page",
-  schedule_url: "http://ott80test-schedule.yifangjiaoyu.cn/mobile/schedule/",
-  user_url: "http://ott80test-base.yifangjiaoyu.cn/mobile/user"
+	library_url: 'http://ott80testlibrary.yifangjiaoyu.cn/mobile/page',
+	schedule_url: 'http://ott80test-schedule.yifangjiaoyu.cn/mobile/schedule/',
+	user_url: 'http://ott80test-base.yifangjiaoyu.cn/mobile/user',
+	upload_img: 'http://ott80test-base.yifangjiaoyu.cn/file/upload'
 };
 
 export default class APIConfig {
-  static getLibraryUrl(path) {
-    return url.library_url + path;
-  }
-  static getScheduleUrl(path) {
-    console.log(33333, url.schedule_url + path);
-    return url.schedule_url + path;
-  }
-  static getUserUrl(path) {
-    return url.user_url + path;
-  }
+	static getLibraryUrl(path) {
+		return url.library_url + path;
+	}
+	static getScheduleUrl(path) {
+		console.log(33333, url.schedule_url + path);
+		return url.schedule_url + path;
+	}
+	static getUserUrl(path) {
+		return url.user_url + path;
+	}
+
+	static getUploadImg() {
+		return url.upload_img;
+	}
 }

+ 58 - 0
pages/services/user.js

@@ -19,6 +19,50 @@ export default class user {
 		return request(APIConfig.getUserUrl(``), opts);
 	}
 
+	/** 
+	* //上传头像
+	* @return 返回Promise 
+	*/
+	static async uploadImage(photo_url) {
+		const file_uid = await getuid();
+		let formData = new FormData();
+		formData.append('file', {
+			uri: photo_url,
+			name: file_uid + '.jpg',
+			type: 'image/jpeg'
+		});
+		let options = {};
+		options.body = formData;
+		options.headers = { 'Content-Type': 'multipart/form-data', uid: file_uid };
+		options.method = 'POST';
+		return fetch(APIConfig.getUploadImg(), options)
+			.then((response) => {
+				console.log('res1', response);
+				if (response.status >= 200 && response.status < 300) {
+					return response;
+				}
+				const error = new Error(response.statusText);
+				error.response = response;
+				throw error;
+			})
+			.then((response) => {
+				return response.json();
+			})
+			.then((data) => {
+				console.log('data', data);
+				if (!data.success) {
+					const code = data;
+				}
+				return data;
+			})
+			.catch((err) => {
+				console.log('err', err);
+				return {
+					err
+				};
+			});
+	}
+
 	//绑定微信
 	static bind_wechat(opts) {
 		return request(APIConfig.getUserUrl(`/wechatBind`), opts);
@@ -43,3 +87,17 @@ export default class user {
 		return request(APIConfig.getUserUrl(``), opts);
 	}
 }
+
+async function getuid() {
+	const uid = await storage
+		.load({
+			key: 'userInfo'
+		})
+		.catch((error) => {
+			return '';
+		});
+	if (uid === '') {
+		return '';
+	}
+	return JSON.parse(uid).uid;
+}

+ 33 - 0
pages/utils/aliPay.js

@@ -0,0 +1,33 @@
+import Alipay from 'react-native-yunpeng-alipay';
+
+export default class aliPay {
+	/**
+   * 支付宝支付
+   * @param  {Object} params_body 参数Object  {partner:"",seller_id:"",out_trade_no:"",subject:"",body:"",total_fee:"",notify_url:"",service:"",payment_type:"",_input_charset:"",it_b_pay:"",sign:"",sign_type:""}
+  
+   */
+
+	static pay(params_body) {
+		let data = 'partner=' + params_body.partner + '&';
+		'seller_id=' + params_body.seller_id + '&';
+		'out_trade_no=' + params_body.out_trade_no + '&';
+		'subject=' + params_body.subject + '&';
+		'body=' + params_body.body + '&';
+		'total_fee=' + params_body.total_fee + '&';
+		'notify_url=' + params_body.notify_url + '&';
+		'service=' + params_body.service + '&';
+		'payment_type=' + params_body.payment_type + '&';
+		'_input_charset=' + params_body._input_charset + '&';
+		'it_b_pay=' + params_body.it_b_pay + '&';
+		'sign=' + params_body.sign + '&';
+		'sign_type=' + params_body.sign_type;
+		Alipay.pay(data).then(
+			function(data) {
+				console.log(data);
+			},
+			function(err) {
+				console.log(err);
+			}
+		);
+	}
+}

+ 1 - 0
pages/utils/request.js

@@ -117,4 +117,5 @@ async function getuid() {
 	}
 	return JSON.parse(uid).uid;
 }
+
 export default request;

+ 3 - 1
pages/utils/wechat.js

@@ -26,8 +26,10 @@ export default class wechat {
 							res['access_token'] +
 							'&openid=' +
 							res['openid'];
-						console.log('getUserUrl:' + getUserUrl);
 						request(getUserUrl).then((user) => {
+							console.log('微信返回信息');
+							console.log('user', user);
+							console.log('====================================');
 							callback(user);
 						});
 					});