Skip to content

Commit c49c2a6

Browse files
author
weimeng
committed
个人中心-修改密码联调完成
1 parent f49cece commit c49c2a6

10 files changed

Lines changed: 162 additions & 38 deletions

File tree

app/domain/api/apidoc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ orderId : 订单编号
232232
**成功返回**
233233
```
234234
{
235-
code : 0
235+
code : 0,
236+
data : {
237+
name : '张三'
238+
}
236239
}
237240
```
238241

app/domain/api/apis.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export const login = (data) => {
116116

117117
console.log("@login")
118118
return http_get("/user/identity", data)
119+
119120
}
120121

121122
/**

app/domain/page/Login.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ export class Login extends Component {
8080
this.setState({busy : true})
8181
const {mobile,password} = data
8282
const result = await login({mobile, password})
83-
this.setState({busy : false})
8483

84+
this.setState({busy : false})
85+
86+
store.dispatch({
87+
type : "LOGIN_SUCCESS",
88+
name : result.name
89+
})
8590
if(this.props.route.from) {
8691
this.props.navigator.pop()
8792
}
@@ -125,11 +130,18 @@ const LoginForm = ({form, fields, submit, busy, navigator}) => {
125130
<View>
126131
<ZInput placeholder="手机号" keyboardType="phone-pad" {...mobile} />
127132
<ZInput placeholder="密码" {...password} secureTextEntry={true} />
128-
<TouchableOpacity
129-
onPress={() => navigator.push({...Routes.Register})}
130-
style={{paddingLeft : 20}}>
131-
<Text style={{color : COLOR_PRIMARY, marginTop : 10}}>没有账号?马上注册</Text>
132-
</TouchableOpacity>
133+
<View style={{justifyContent : "space-between", flexDirection : 'row'}}>
134+
<TouchableOpacity
135+
onPress={() => navigator.push({...Routes.Register})}
136+
style={{paddingLeft : 20}}>
137+
<Text style={{color : COLOR_PRIMARY, marginTop : 10}}>没有账号?马上注册</Text>
138+
</TouchableOpacity>
139+
<TouchableOpacity
140+
onPress={() => navigator.push({...Routes.ResetPassword})}
141+
style={{paddingRight : 20}}>
142+
<Text style={{color : COLOR_PRIMARY, marginTop : 10}}>忘记密码</Text>
143+
</TouchableOpacity>
144+
</View>
133145
<View style={{...flexCenter, marginTop : 20}}>
134146
<ZButton onPress={submit} loading={busy}>登录</ZButton>
135147
</View>

app/domain/page/Tabs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ export class Tabs extends Component{
4444
<Tabbar.Item
4545
name="mycourse"
4646
title="我的课程" activeIcon={require("./images/my-course.png")} icon={require("./images/my-course-gray.png")}>
47-
<MyCourse />
47+
<MyCourse navigator={this.props.navigator} route={this.props.route} />
4848
</Tabbar.Item>
4949
<Tabbar.Item
5050
name="usercenter"
5151
title="个人中心" activeIcon={require("./images/user-center.png")} icon={require("./images/user-center-gray.png")}>
52-
<UserCenter />
52+
<UserCenter navigator={this.props.navigator} route={this.props.route} />
5353
</Tabbar.Item>
5454
</Tabbar>
5555
)

app/domain/page/UserCenter.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,42 @@ const {width, height} = Dimensions.get('window')
3939
const sliderItemStyle = {width, height : width * 0.6}
4040

4141
import {Routes} from "domain/page"
42-
export class UserCenter extends Component{
42+
import {connect} from 'react-redux'
43+
class _UserCenter extends Component{
4344

4445
_about(){
4546
this.props.navigator.push({...Routes.About})
4647
}
4748

49+
_reset(){
50+
this.props.navigator.push({...Routes.ResetPassword})
51+
}
52+
53+
_logout(){
54+
55+
store.dispatch({type : "LOGOUT"})
56+
57+
this.props.switch_to("home")
58+
}
59+
60+
61+
4862
render(){
4963
return (
5064
<ScrollView style={{backgroundColor : "white"}}>
5165
<View>
5266
<Image source={require("./images/usercenter.png")} style={sliderItemStyle} >
5367
</Image>
68+
<View style={{position : "absolute", top : sliderItemStyle.height * 0.7, backgroundColor: "rgba(0,0,0,0)", width : Dimensions.get("window").width, alignItems : 'center'}}>
69+
<Text style={{color : 'white', fontSize : 16}}>{this.props.name}</Text>
70+
</View>
5471
</View>
5572

5673
<View style={{marginTop : 10}}>
5774
{/*<StripedButton icon={require("./images/uc/question.png")}>常见问题</StripedButton>*/}
5875
<StripedButton onPress={this._about.bind(this)} icon={require("./images/uc/user.png")}>关于《珠峰课堂》</StripedButton>
59-
<StripedButton icon={require("./images/uc/password.png")}>修改密码</StripedButton>
60-
<StripedButton icon={require("./images/uc/password.png")}>登出</StripedButton>
76+
<StripedButton onPress={this._reset.bind(this)} icon={require("./images/uc/password.png")}>修改密码</StripedButton>
77+
<StripedButton onPress={this._logout.bind(this)} icon={require("./images/uc/password.png")}>登出</StripedButton>
6178
</View>
6279
</ScrollView>
6380
)
@@ -97,4 +114,14 @@ const styles = StyleSheet.create({
97114
marginRight : 20
98115
}
99116

100-
})
117+
})
118+
119+
const map = (state) => {
120+
121+
return {
122+
name : state.user.name
123+
}
124+
125+
}
126+
127+
export let UserCenter = connect(map)(_UserCenter)

app/domain/redux/reducers/user.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@
2424
*/
2525

2626
const initialState = {
27-
token : null
27+
token : null ,
28+
name : ""
2829
}
2930
export const user = (state = initialState, action) => {
3031

3132
switch(action.type) {
3233
case "SET_TOKEN" :
3334
return {token : action.token}
35+
case "LOGOUT" :
36+
37+
return {token : null, name : ""}
38+
case "LOGIN_SUCCESS" : {
39+
return {...state, name : action.name}
40+
}
3441
}
3542
return state
3643

ios/zhufengketang.xcodeproj/project.pbxproj

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
2424
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
2525
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
26+
6B6646481E2E76E200CB6CD8 /* RCTPay.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6646461E2E76E200CB6CD8 /* RCTPay.m */; };
2627
6F61E8CE0416407B96FEFC61 /* libRCTToast.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 08257537934F4384882B25DF /* libRCTToast.a */; };
2728
7789623E084B469C9E6D73D4 /* libSplashScreen.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 83E3A57583A0469FB30CDFDB /* libSplashScreen.a */; };
2829
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
@@ -212,6 +213,13 @@
212213
remoteGlobalIDString = 3D7682761D8E76B80014119E;
213214
remoteInfo = SplashScreen;
214215
};
216+
6B6646421E2E750B00CB6CD8 /* PBXContainerItemProxy */ = {
217+
isa = PBXContainerItemProxy;
218+
containerPortal = 310D1F0F14C844BCBA898994 /* RNFetchBlob.xcodeproj */;
219+
proxyType = 2;
220+
remoteGlobalIDString = A15C300E1CD25C330074CB35;
221+
remoteInfo = RNFetchBlob;
222+
};
215223
78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
216224
isa = PBXContainerItemProxy;
217225
containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
@@ -252,6 +260,8 @@
252260
310D1F0F14C844BCBA898994 /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = "<group>"; };
253261
3C87663139074CC9842435A8 /* libRNFetchBlob.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFetchBlob.a; sourceTree = "<group>"; };
254262
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
263+
6B6646451E2E76E200CB6CD8 /* RCTPay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTPay.h; path = zhufengketang/RCTPay.h; sourceTree = "<group>"; };
264+
6B6646461E2E76E200CB6CD8 /* RCTPay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTPay.m; path = zhufengketang/RCTPay.m; sourceTree = "<group>"; };
255265
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
256266
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
257267
83E3A57583A0469FB30CDFDB /* libSplashScreen.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libSplashScreen.a; sourceTree = "<group>"; };
@@ -372,6 +382,8 @@
372382
13B07FAE1A68108700A75B9A /* zhufengketang */ = {
373383
isa = PBXGroup;
374384
children = (
385+
6B6646451E2E76E200CB6CD8 /* RCTPay.h */,
386+
6B6646461E2E76E200CB6CD8 /* RCTPay.m */,
375387
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
376388
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
377389
13B07FB01A68108700A75B9A /* AppDelegate.m */,
@@ -423,6 +435,14 @@
423435
name = Products;
424436
sourceTree = "<group>";
425437
};
438+
6B6646251E2E750B00CB6CD8 /* Products */ = {
439+
isa = PBXGroup;
440+
children = (
441+
6B6646431E2E750B00CB6CD8 /* libRNFetchBlob.a */,
442+
);
443+
name = Products;
444+
sourceTree = "<group>";
445+
};
426446
78C398B11ACF4ADC00677621 /* Products */ = {
427447
isa = PBXGroup;
428448
children = (
@@ -535,6 +555,9 @@
535555
CreatedOnToolsVersion = 6.2;
536556
TestTargetID = 13B07F861A680F5B00A75B9A;
537557
};
558+
13B07F861A680F5B00A75B9A = {
559+
DevelopmentTeam = D9D59BE76S;
560+
};
538561
};
539562
};
540563
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "zhufengketang" */;
@@ -597,6 +620,10 @@
597620
ProductGroup = 146834001AC3E56700842450 /* Products */;
598621
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
599622
},
623+
{
624+
ProductGroup = 6B6646251E2E750B00CB6CD8 /* Products */;
625+
ProjectRef = 310D1F0F14C844BCBA898994 /* RNFetchBlob.xcodeproj */;
626+
},
600627
{
601628
ProductGroup = 6B6645F91E2E3D6B00CB6CD8 /* Products */;
602629
ProjectRef = B3FF7D3FE9994B4097F1D3B2 /* SplashScreen.xcodeproj */;
@@ -786,6 +813,13 @@
786813
remoteRef = 6B6646161E2E3D6B00CB6CD8 /* PBXContainerItemProxy */;
787814
sourceTree = BUILT_PRODUCTS_DIR;
788815
};
816+
6B6646431E2E750B00CB6CD8 /* libRNFetchBlob.a */ = {
817+
isa = PBXReferenceProxy;
818+
fileType = archive.ar;
819+
path = libRNFetchBlob.a;
820+
remoteRef = 6B6646421E2E750B00CB6CD8 /* PBXContainerItemProxy */;
821+
sourceTree = BUILT_PRODUCTS_DIR;
822+
};
789823
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
790824
isa = PBXReferenceProxy;
791825
fileType = archive.ar;
@@ -853,6 +887,7 @@
853887
files = (
854888
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
855889
13B07FC11A68108700A75B9A /* main.m in Sources */,
890+
6B6646481E2E76E200CB6CD8 /* RCTPay.m in Sources */,
856891
);
857892
runOnlyForDeploymentPostprocessing = 0;
858893
};
@@ -924,15 +959,24 @@
924959
isa = XCBuildConfiguration;
925960
buildSettings = {
926961
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
962+
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = splash;
927963
CURRENT_PROJECT_VERSION = 1;
928964
DEAD_CODE_STRIPPING = NO;
965+
DEVELOPMENT_TEAM = D9D59BE76S;
966+
FRAMEWORK_SEARCH_PATHS = "";
967+
HEADER_SEARCH_PATHS = (
968+
"$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
969+
"$(SRCROOT)/../node_modules/react-native/React/**",
970+
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
971+
);
929972
INFOPLIST_FILE = zhufengketang/Info.plist;
930973
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
931974
OTHER_LDFLAGS = (
932975
"$(inherited)",
933976
"-ObjC",
934977
"-lc++",
935978
);
979+
PRODUCT_BUNDLE_IDENTIFIER = com.zhufengketang.app;
936980
PRODUCT_NAME = zhufengketang;
937981
VERSIONING_SYSTEM = "apple-generic";
938982
};
@@ -942,14 +986,23 @@
942986
isa = XCBuildConfiguration;
943987
buildSettings = {
944988
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
989+
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = splash;
945990
CURRENT_PROJECT_VERSION = 1;
991+
DEVELOPMENT_TEAM = D9D59BE76S;
992+
FRAMEWORK_SEARCH_PATHS = "";
993+
HEADER_SEARCH_PATHS = (
994+
"$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
995+
"$(SRCROOT)/../node_modules/react-native/React/**",
996+
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
997+
);
946998
INFOPLIST_FILE = zhufengketang/Info.plist;
947999
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
9481000
OTHER_LDFLAGS = (
9491001
"$(inherited)",
9501002
"-ObjC",
9511003
"-lc++",
9521004
);
1005+
PRODUCT_BUNDLE_IDENTIFIER = com.zhufengketang.app;
9531006
PRODUCT_NAME = zhufengketang;
9541007
VERSIONING_SYSTEM = "apple-generic";
9551008
};
@@ -958,7 +1011,7 @@
9581011
83CBBA201A601CBA00E9B192 /* Debug */ = {
9591012
isa = XCBuildConfiguration;
9601013
buildSettings = {
961-
ALWAYS_SEARCH_USER_PATHS = NO;
1014+
ALWAYS_SEARCH_USER_PATHS = YES;
9621015
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
9631016
CLANG_CXX_LIBRARY = "libc++";
9641017
CLANG_ENABLE_MODULES = YES;
@@ -999,7 +1052,7 @@
9991052
83CBBA211A601CBA00E9B192 /* Release */ = {
10001053
isa = XCBuildConfiguration;
10011054
buildSettings = {
1002-
ALWAYS_SEARCH_USER_PATHS = NO;
1055+
ALWAYS_SEARCH_USER_PATHS = YES;
10031056
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
10041057
CLANG_CXX_LIBRARY = "libc++";
10051058
CLANG_ENABLE_MODULES = YES;

ios/zhufengketang/AppDelegate.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#import <React/RCTBundleURLProvider.h>
1313
#import <React/RCTRootView.h>
14+
#import "SplashScreen.h"
15+
1416

1517
@implementation AppDelegate
1618

@@ -31,6 +33,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3133
rootViewController.view = rootView;
3234
self.window.rootViewController = rootViewController;
3335
[self.window makeKeyAndVisible];
36+
[SplashScreen show];
3437
return YES;
3538
}
3639

ios/zhufengketang/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
{
22
"images" : [
33
{
4+
"size" : "20x20",
45
"idiom" : "iphone",
5-
"size" : "29x29",
6+
"filename" : "40*40.png",
67
"scale" : "2x"
78
},
89
{
10+
"size" : "20x20",
911
"idiom" : "iphone",
10-
"size" : "29x29",
12+
"filename" : "60*60.png",
1113
"scale" : "3x"
1214
},
1315
{
16+
"size" : "29x29",
1417
"idiom" : "iphone",
15-
"size" : "40x40",
18+
"filename" : "58*58.png",
1619
"scale" : "2x"
1720
},
1821
{
22+
"size" : "29x29",
1923
"idiom" : "iphone",
20-
"size" : "40x40",
24+
"filename" : "87*87.png",
2125
"scale" : "3x"
2226
},
2327
{
28+
"size" : "40x40",
2429
"idiom" : "iphone",
25-
"size" : "60x60",
30+
"filename" : "80*80.png",
2631
"scale" : "2x"
2732
},
2833
{
34+
"size" : "40x40",
35+
"idiom" : "iphone",
36+
"filename" : "120*120-1.png",
37+
"scale" : "3x"
38+
},
39+
{
40+
"size" : "60x60",
2941
"idiom" : "iphone",
42+
"filename" : "120*120.png",
43+
"scale" : "2x"
44+
},
45+
{
3046
"size" : "60x60",
47+
"idiom" : "iphone",
48+
"filename" : "180*180.png",
3149
"scale" : "3x"
3250
}
3351
],

0 commit comments

Comments
 (0)