Commit 91d4262102c69d0c070bfc0895a51c51b717175b

Authored by 姚旭斌
1 parent 4512e826

no message

app/src/main/AndroidManifest.xml
... ... @@ -45,7 +45,7 @@
45 45 android:supportsRtl="true"
46 46 android:theme="@style/AppTheme">
47 47  
48   - <activity android:name=".ui.MainActivity">
  48 + <activity android:name=".ui.activity.LoginAndRegistActivity">
49 49 <intent-filter>
50 50 <action android:name="android.intent.action.MAIN" />
51 51  
... ... @@ -60,9 +60,9 @@
60 60 android:screenOrientation="portrait"
61 61 android:windowSoftInputMode="adjustPan|stateHidden"
62 62 ></activity>
63   - <activity android:name=".ui.activity.LoginAndRegistActivity"
64   - android:screenOrientation="portrait"
65   - />
  63 + <!--<activity android:name=".ui.activity.LoginAndRegistActivity"-->
  64 + <!--android:screenOrientation="portrait"-->
  65 + <!--/>-->
66 66 <activity android:name=".ui.activity.MyChildActivity"
67 67 android:screenOrientation="portrait"
68 68 />
... ... @@ -71,6 +71,11 @@
71 71  
72 72 android:windowSoftInputMode="adjustPan|stateHidden"
73 73 />
  74 + <activity android:name=".ui.activity.binding.CheckInfoActivity"
  75 + android:screenOrientation="portrait"
  76 +
  77 + android:windowSoftInputMode="adjustPan|stateHidden"
  78 + />
74 79 </application>
75 80  
76 81 </manifest>
77 82 \ No newline at end of file
... ...
app/src/main/java/com/shunzhi/parent/api/LoginRegisterApi.java
... ... @@ -5,6 +5,7 @@ import com.google.gson.JsonObject;
5 5 import io.reactivex.Observable;
6 6 import retrofit2.http.Field;
7 7 import retrofit2.http.FormUrlEncoded;
  8 +import retrofit2.http.GET;
8 9 import retrofit2.http.POST;
9 10  
10 11 /**
... ... @@ -12,7 +13,8 @@ import retrofit2.http.POST;
12 13 */
13 14  
14 15 public interface LoginRegisterApi {
15   - String url="http://campus.myjxt.com/";
  16 +// String url="http://campus.myjxt.com/";
  17 + String url="http://60.190.202.57:1000/";
16 18  
17 19  
18 20 @FormUrlEncoded
... ... @@ -22,10 +24,15 @@ public interface LoginRegisterApi {
22 24 , @Field("password") String password);
23 25  
24 26 @FormUrlEncoded
25   - @POST("api/Account/CurrentInfo")
  27 + @POST("/api/ParentHelper/ParentRegister")
26 28 Observable<JsonObject> registerResult(
27   - @Field("grant_type") String grant_type, @Field("username") String username
28   - , @Field("idcode") String idCode,@Field("password") String password);
  29 + @Field("mobile") String username, @Field("captcha") String idCode,@Field("password") String password);
  30 +
  31 +
  32 +
  33 + @GET("api/Account/ChangePhoneCaptcha")
  34 + Observable<JsonObject> getidCodeResult(
  35 + @Field("mobile") String username);
29 36  
30 37 @FormUrlEncoded
31 38 @POST("api/Account/CurrentInfo")
... ...
app/src/main/java/com/shunzhi/parent/model/loginandregister/LoginAndRegisterModel.java
... ... @@ -8,7 +8,6 @@ import com.shunzhi.parent.api.LoginRegisterApi;
8 8 import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract;
9 9  
10 10 import io.reactivex.Observable;
11   -import okhttp3.RequestBody;
12 11  
13 12 /**
14 13 * Created by Administrator on 2018/3/6 0006.
... ... @@ -31,13 +30,14 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste
31 30  
32 31 @Override
33 32 public Observable<JsonObject> getRegisterResult(String adminName, String idCode, String password) {
34   - return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).registerResult("idcode",adminName,idCode,password)
  33 + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).registerResult(adminName,idCode,password)
35 34 .compose(RxHelper.<JsonObject>rxSchedulerHelper());
36 35 }
37 36  
38 37 @Override
39 38 public Observable<JsonObject> getidCodeResult(String phoneNumber) {
40   - return null;
  39 + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).getidCodeResult(phoneNumber)
  40 + .compose(RxHelper.<JsonObject>rxSchedulerHelper());
41 41 }
42 42  
43 43 }
... ...
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
... ... @@ -42,23 +42,23 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre
42 42 try {
43 43 if (jsonObject != null && !TextUtils.isEmpty(jsonObject.get("access_token").getAsString())) {
44 44 AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString());
45   - AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME,loginName);
  45 + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, loginName);
46 46 AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, loginPwd);
47   - RetrofitCreateHelper.getInstance().setAuthorization("Bearer "+jsonObject.get("access_token").getAsString());
  47 + RetrofitCreateHelper.getInstance().setAuthorization("Bearer " + jsonObject.get("access_token").getAsString());
48 48 getUserInfo();
49 49 } else {
50 50 ToastUtils.showToast(jsonObject.get("error").getAsString());
51 51 }
52   - }catch (Exception e){
  52 + } catch (Exception e) {
53 53 e.printStackTrace();
54   - ToastUtils.showToast("登录失败:"+e.toString());
  54 + ToastUtils.showToast("登录失败:" + e.toString());
55 55 }
56 56 }
57 57 }, new Consumer<Throwable>() {
58 58 @Override
59 59 public void accept(Throwable throwable) throws Exception {
60   - if (null!=throwable)
61   - OkHttpExceptionUtil.handOkHttpException((HttpException) throwable);
  60 + if (null != throwable)
  61 + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable);
62 62 // ToastUtils.showToast(throwable.getMessage());
63 63 }
64 64 }));
... ... @@ -74,18 +74,19 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre
74 74 if (mIModel == null || mIView == null) {
75 75 return;
76 76 }
77   - mIView.getUserInfo();
  77 +
78 78 mRxManager.register(mIModel.getRegisterResult(adminName, idCode, password).subscribe(new Consumer<JsonObject>() {
79 79 @Override
80 80 public void accept(JsonObject jsonObject) throws Exception {
81 81 //TODO 注册成功返回
82   -
83   -
  82 + Log.e("1111", jsonObject.toString());
  83 + mIView.getUserInfo();
84 84 }
85 85 }, new Consumer<Throwable>() {
86 86 @Override
87 87 public void accept(Throwable throwable) throws Exception {
88 88 ToastUtils.showToast(throwable.getMessage());
  89 + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable);
89 90 }
90 91 }));
91 92  
... ... @@ -104,8 +105,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre
104 105 @Override
105 106 public void accept(JsonObject jsonObject) throws Exception {
106 107 //TODO 获取验证码返回
107   -
108   -
  108 + Log.e("111", jsonObject.toString());
109 109 }
110 110 }, new Consumer<Throwable>() {
111 111 @Override
... ... @@ -119,7 +119,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre
119 119  
120 120 @Override
121 121 public void getUserInfo() {
122   - Log.d("77777","getUserInfo=");
  122 + Log.d("77777", "getUserInfo=");
123 123 }
124 124  
125 125  
... ...
app/src/main/res/drawable-xhdpi/arrow_down.png 0 → 100644

481 Bytes

app/src/main/res/drawable/rudio_bord.xml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <stroke android:color="#b8b8b9" android:width="1dp"/>
  4 + <solid android:color="#00000000"/>
  5 + <corners android:radius="5dp"/>
  6 +</shape>
0 7 \ No newline at end of file
... ...
app/src/main/res/drawable/rudiobtn_bord.xml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <stroke android:color="@color/bottomline" android:width="1dp"/>
  4 + <corners android:radius="10dp"/>
  5 +</shape>
0 6 \ No newline at end of file
... ...
app/src/main/res/layout/activity_check_info.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<LinearLayout
3   - xmlns:android="http://schemas.android.com/apk/res/android"
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4 3 xmlns:tools="http://schemas.android.com/tools"
5 4 android:layout_width="match_parent"
6 5 android:layout_height="match_parent"
  6 + android:orientation="vertical"
  7 + android:background="@color/white"
7 8 tools:context="com.shunzhi.parent.ui.activity.binding.CheckInfoActivity">
  9 + <include layout="@layout/top" />
8 10  
  11 + <LinearLayout
  12 + android:layout_width="match_parent"
  13 + android:layout_height="match_parent"
  14 + android:orientation="vertical">
  15 +
  16 + <LinearLayout
  17 + android:id="@+id/iphone_layout"
  18 + android:layout_width="match_parent"
  19 + android:layout_height="wrap_content"
  20 + android:layout_marginTop="30dp"
  21 + android:orientation="vertical">
  22 +
  23 + <TextView
  24 + android:layout_width="match_parent"
  25 + android:layout_height="wrap_content"
  26 + android:gravity="center"
  27 + android:text="绑定手机号码为"
  28 + android:textSize="@dimen/sp_18" />
  29 +
  30 + <TextView
  31 + android:layout_width="match_parent"
  32 + android:layout_height="wrap_content"
  33 + android:layout_marginTop="10dp"
  34 + android:gravity="center_horizontal"
  35 + android:text="15245252542"
  36 + android:textColor="@color/textRed"
  37 + android:textSize="@dimen/sp_18" />
  38 + </LinearLayout>
  39 +
  40 + <LinearLayout
  41 + android:id="@+id/info_layout"
  42 + android:layout_width="match_parent"
  43 + android:layout_height="match_parent"
  44 + android:layout_marginTop="20dp"
  45 + android:orientation="vertical">
  46 +
  47 + <LinearLayout
  48 + android:layout_width="match_parent"
  49 + android:layout_height="30dp"
  50 + android:layout_marginLeft="60dp"
  51 + android:layout_marginRight="60dp"
  52 + android:layout_marginTop="10dp">
  53 +
  54 + <TextView
  55 + android:layout_width="wrap_content"
  56 + android:layout_height="wrap_content"
  57 + android:text="孩子姓名:"
  58 + android:textSize="@dimen/sp_16" />
  59 +
  60 + <EditText
  61 + android:layout_width="wrap_content"
  62 + android:layout_height="match_parent"
  63 + android:layout_weight="1"
  64 + android:background="@drawable/rudio_bord"
  65 + android:gravity="center"
  66 + android:text="李小明"
  67 + android:textColor="@color/textColor" />
  68 +
  69 + </LinearLayout>
  70 +
  71 + <LinearLayout
  72 + android:layout_width="match_parent"
  73 + android:layout_height="30dp"
  74 + android:layout_marginLeft="60dp"
  75 + android:layout_marginRight="60dp"
  76 + android:layout_marginTop="10dp">
  77 +
  78 + <TextView
  79 + android:layout_width="wrap_content"
  80 + android:layout_height="wrap_content"
  81 + android:text="性 别:"
  82 + android:textSize="@dimen/sp_16" />
  83 +
  84 + <EditText
  85 + android:layout_width="wrap_content"
  86 + android:layout_height="match_parent"
  87 + android:layout_weight="1"
  88 + android:background="@drawable/rudio_bord"
  89 + android:gravity="center"
  90 + android:text="男"
  91 + android:textColor="@color/textColor" />
  92 +
  93 + </LinearLayout>
  94 +
  95 + <LinearLayout
  96 + android:layout_width="match_parent"
  97 + android:layout_height="30dp"
  98 + android:layout_marginLeft="60dp"
  99 + android:layout_marginRight="60dp"
  100 + android:layout_marginTop="10dp">
  101 +
  102 + <TextView
  103 + android:layout_width="wrap_content"
  104 + android:layout_height="wrap_content"
  105 + android:text="年 级:"
  106 + android:textSize="@dimen/sp_16" />
  107 +
  108 + <EditText
  109 + android:layout_width="wrap_content"
  110 + android:layout_height="match_parent"
  111 + android:layout_weight="1"
  112 + android:background="@drawable/rudio_bord"
  113 + android:gravity="center"
  114 + android:text="初一"
  115 + android:textColor="@color/textColor" />
  116 +
  117 + </LinearLayout>
  118 +
  119 + <LinearLayout
  120 + android:layout_width="match_parent"
  121 + android:layout_height="30dp"
  122 + android:layout_marginLeft="60dp"
  123 + android:layout_marginRight="60dp"
  124 + android:layout_marginTop="10dp">
  125 +
  126 + <TextView
  127 + android:layout_width="wrap_content"
  128 + android:layout_height="wrap_content"
  129 + android:text="班 级:"
  130 + android:textSize="@dimen/sp_16" />
  131 +
  132 + <EditText
  133 + android:layout_width="wrap_content"
  134 + android:layout_height="match_parent"
  135 + android:layout_weight="1"
  136 + android:background="@drawable/rudio_bord"
  137 + android:gravity="center"
  138 + android:text="初一(3)班"
  139 + android:textColor="@color/textColor" />
  140 +
  141 + </LinearLayout>
  142 +
  143 + <TextView
  144 + android:id="@+id/add_child"
  145 + android:layout_width="220dp"
  146 + android:layout_height="40dp"
  147 + android:layout_gravity="center_horizontal"
  148 + android:layout_marginTop="20dp"
  149 + android:background="@drawable/rudiobtn"
  150 + android:gravity="center"
  151 + android:text="确定"
  152 + android:textColor="@color/white"
  153 + android:textSize="@dimen/txtsize_title" />
  154 + </LinearLayout>
  155 +
  156 +
  157 + </LinearLayout>
9 158  
10 159  
11 160 </LinearLayout>
... ...
app/src/main/res/layout/activity_create_childinfo.xml 0 → 100644
... ... @@ -0,0 +1,148 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:tools="http://schemas.android.com/tools"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:orientation="vertical"
  7 + android:background="@color/white"
  8 + tools:context="com.shunzhi.parent.ui.activity.binding.CheckInfoActivity">
  9 + <include layout="@layout/top" />
  10 +
  11 + <LinearLayout
  12 + android:layout_width="match_parent"
  13 + android:layout_height="match_parent"
  14 + android:orientation="vertical">
  15 +
  16 + <LinearLayout
  17 + android:id="@+id/iphone_layout"
  18 + android:layout_width="match_parent"
  19 + android:layout_height="46dp"
  20 + android:layout_marginTop="30dp"
  21 + android:orientation="vertical">
  22 +
  23 + </LinearLayout>
  24 +
  25 + <LinearLayout
  26 + android:id="@+id/info_layout"
  27 + android:layout_width="match_parent"
  28 + android:layout_height="match_parent"
  29 + android:layout_marginTop="20dp"
  30 + android:orientation="vertical">
  31 +
  32 + <LinearLayout
  33 + android:layout_width="match_parent"
  34 + android:layout_height="30dp"
  35 + android:layout_marginLeft="60dp"
  36 + android:layout_marginRight="60dp"
  37 + android:layout_marginTop="10dp">
  38 +
  39 + <TextView
  40 + android:layout_width="wrap_content"
  41 + android:layout_height="wrap_content"
  42 + android:text="孩子姓名:"
  43 + android:textSize="@dimen/sp_16" />
  44 +
  45 + <EditText
  46 + android:layout_width="wrap_content"
  47 + android:layout_height="match_parent"
  48 + android:layout_weight="1"
  49 + android:background="@drawable/rudio_bord"
  50 + android:gravity="center"
  51 + android:text="李小明"
  52 + android:textColor="@color/textColor" />
  53 +
  54 + </LinearLayout>
  55 +
  56 + <LinearLayout
  57 + android:layout_width="match_parent"
  58 + android:layout_height="30dp"
  59 + android:layout_marginLeft="60dp"
  60 + android:layout_marginRight="60dp"
  61 + android:layout_marginTop="10dp">
  62 +
  63 + <TextView
  64 + android:layout_width="wrap_content"
  65 + android:layout_height="wrap_content"
  66 + android:text="性 别:"
  67 + android:textSize="@dimen/sp_16" />
  68 +
  69 + <EditText
  70 + android:layout_width="wrap_content"
  71 + android:layout_height="match_parent"
  72 + android:layout_weight="1"
  73 + android:background="@drawable/rudio_bord"
  74 + android:gravity="center"
  75 + android:drawableRight="@drawable/arrow_down"
  76 + android:text="男"
  77 + android:textColor="@color/textColor" />
  78 +
  79 + </LinearLayout>
  80 +
  81 + <LinearLayout
  82 + android:layout_width="match_parent"
  83 + android:layout_height="30dp"
  84 + android:layout_marginLeft="60dp"
  85 + android:layout_marginRight="60dp"
  86 + android:layout_marginTop="10dp">
  87 +
  88 + <TextView
  89 + android:layout_width="wrap_content"
  90 + android:layout_height="wrap_content"
  91 + android:text="年 级:"
  92 + android:textSize="@dimen/sp_16" />
  93 +
  94 + <EditText
  95 + android:layout_width="wrap_content"
  96 + android:layout_height="match_parent"
  97 + android:layout_weight="1"
  98 + android:background="@drawable/rudio_bord"
  99 + android:gravity="center"
  100 + android:text="初一"
  101 + android:drawableRight="@drawable/arrow_down"
  102 + android:textColor="@color/textColor" />
  103 +
  104 + </LinearLayout>
  105 +
  106 + <LinearLayout
  107 + android:layout_width="match_parent"
  108 + android:layout_height="30dp"
  109 + android:layout_marginLeft="60dp"
  110 + android:layout_marginRight="60dp"
  111 + android:layout_marginTop="10dp">
  112 +
  113 + <TextView
  114 + android:layout_width="wrap_content"
  115 + android:layout_height="wrap_content"
  116 + android:text="班 级:"
  117 + android:textSize="@dimen/sp_16" />
  118 +
  119 + <EditText
  120 + android:layout_width="wrap_content"
  121 + android:layout_height="match_parent"
  122 + android:layout_weight="1"
  123 + android:background="@drawable/rudio_bord"
  124 + android:gravity="center"
  125 + android:text="初一(3)班"
  126 + android:drawableRight="@drawable/arrow_down"
  127 + android:textColor="@color/textColor" />
  128 +
  129 + </LinearLayout>
  130 +
  131 + <TextView
  132 + android:id="@+id/add_child"
  133 + android:layout_width="220dp"
  134 + android:layout_height="40dp"
  135 + android:layout_gravity="center_horizontal"
  136 + android:layout_marginTop="20dp"
  137 + android:background="@drawable/rudiobtn"
  138 + android:gravity="center"
  139 + android:text="生成孩子账号"
  140 + android:textColor="@color/white"
  141 + android:textSize="@dimen/txtsize_title" />
  142 + </LinearLayout>
  143 +
  144 +
  145 + </LinearLayout>
  146 +
  147 +
  148 +</LinearLayout>
... ...
app/src/main/res/layout/activity_invitecode.xml 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical">
  6 +
  7 + <include layout="@layout/top" />
  8 +
  9 + <TextView
  10 + android:layout_width="match_parent"
  11 + android:layout_height="40dp" />
  12 +
  13 + <EditText
  14 + android:layout_width="match_parent"
  15 + android:layout_height="60dp"
  16 + android:layout_margin="20dp"
  17 + android:hint="填写邀请码" />
  18 +
  19 + <TextView
  20 + android:id="@+id/add_child"
  21 + android:layout_width="220dp"
  22 + android:layout_height="40dp"
  23 + android:layout_gravity="center_horizontal"
  24 + android:layout_marginTop="20dp"
  25 + android:background="@drawable/rudiobtn"
  26 + android:gravity="center"
  27 + android:text="下一步"
  28 + android:textColor="@color/white"
  29 + android:textSize="@dimen/txtsize_title" />
  30 + <TextView
  31 + android:layout_margin="20dp"
  32 + android:layout_width="match_parent"
  33 + android:layout_height="wrap_content"
  34 + android:text="注:填写需要绑定的孩子的邀请码(非合作学校无邀请码,请更换为手机号码验证的方式)
  35 +
  36 +如不知道邀请码请电话拨打:400-123456 进行查询 "
  37 + android:textSize="@dimen/sp_14"
  38 + android:textColor="@color/text_color"
  39 + android:lineSpacingMultiplier="1.5"
  40 + />
  41 +
  42 +</LinearLayout>
... ...
mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java
... ... @@ -22,7 +22,7 @@ public class OkHttpExceptionUtil {
22 22 try {
23 23 JSONObject json = new JSONObject(responseBody.string());
24 24 Log.d("77777",json.toString());
25   - ToastUtils.showToast(json.optString("error"));
  25 + ToastUtils.showToast(json.optString("message"));
26 26 } catch (Exception e1) {
27 27 e1.printStackTrace();
28 28 }
... ...