Commit ffe64e2f4b0a561e834168a7154988ae09e64a68
1 parent
856b277c
Exists in
yxb_dev
and in
2 other branches
no message
Showing
9 changed files
with
90 additions
and
10 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/api/LoginRegisterApi.java
1 | package com.shunzhi.parent.api; | 1 | package com.shunzhi.parent.api; |
2 | 2 | ||
3 | import com.google.gson.JsonObject; | 3 | import com.google.gson.JsonObject; |
4 | +import com.shunzhi.parent.bean.CurrentBean; | ||
4 | 5 | ||
5 | import io.reactivex.Observable; | 6 | import io.reactivex.Observable; |
6 | import retrofit2.http.Field; | 7 | import retrofit2.http.Field; |
7 | import retrofit2.http.FormUrlEncoded; | 8 | import retrofit2.http.FormUrlEncoded; |
8 | import retrofit2.http.GET; | 9 | import retrofit2.http.GET; |
9 | import retrofit2.http.POST; | 10 | import retrofit2.http.POST; |
11 | +import retrofit2.http.Query; | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * Created by Administrator on 2018/3/7 0007. | 14 | * Created by Administrator on 2018/3/7 0007. |
@@ -32,10 +34,10 @@ public interface LoginRegisterApi { | @@ -32,10 +34,10 @@ public interface LoginRegisterApi { | ||
32 | 34 | ||
33 | @GET("api/Account/ChangePhoneCaptcha") | 35 | @GET("api/Account/ChangePhoneCaptcha") |
34 | Observable<JsonObject> getidCodeResult( | 36 | Observable<JsonObject> getidCodeResult( |
35 | - @Field("mobile") String username); | 37 | + @Query("mobile") String username); |
36 | 38 | ||
37 | @FormUrlEncoded | 39 | @FormUrlEncoded |
38 | - @POST("api/Account/CurrentInfo") | ||
39 | - Observable<JsonObject> getUserInfo(@Field("grant_type") String grant_type); | 40 | + @POST("/api/ParentHelper/GetParentInfo") |
41 | + Observable<CurrentBean> getUserInfo(); | ||
40 | 42 | ||
41 | } | 43 | } |
app/src/main/java/com/shunzhi/parent/bean/CurrentBean.java
app/src/main/java/com/shunzhi/parent/contract/loginandregister/LoginAndRegisterContract.java
@@ -4,6 +4,7 @@ import com.google.gson.JsonObject; | @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; | ||
4 | import com.share.mvpsdk.base.BasePresenter; | 4 | import com.share.mvpsdk.base.BasePresenter; |
5 | import com.share.mvpsdk.base.IBaseFragment; | 5 | import com.share.mvpsdk.base.IBaseFragment; |
6 | import com.share.mvpsdk.base.IBaseModel; | 6 | import com.share.mvpsdk.base.IBaseModel; |
7 | +import com.shunzhi.parent.bean.CurrentBean; | ||
7 | 8 | ||
8 | import io.reactivex.Observable; | 9 | import io.reactivex.Observable; |
9 | 10 | ||
@@ -31,7 +32,7 @@ public interface LoginAndRegisterContract { | @@ -31,7 +32,7 @@ public interface LoginAndRegisterContract { | ||
31 | Observable<JsonObject> getidCodeResult(String phoneNumber); | 32 | Observable<JsonObject> getidCodeResult(String phoneNumber); |
32 | 33 | ||
33 | //获取登录用户信息 | 34 | //获取登录用户信息 |
34 | -// Observable<CurrentBean> getUserInfo(); | 35 | + Observable<CurrentBean> getUserInfo(); |
35 | } | 36 | } |
36 | interface ILoginView extends IBaseFragment { | 37 | interface ILoginView extends IBaseFragment { |
37 | 38 |
app/src/main/java/com/shunzhi/parent/model/loginandregister/LoginAndRegisterModel.java
@@ -5,6 +5,7 @@ import com.share.mvpsdk.base.BaseModel; | @@ -5,6 +5,7 @@ import com.share.mvpsdk.base.BaseModel; | ||
5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; | 5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; |
6 | import com.share.mvpsdk.helper.RxHelper; | 6 | import com.share.mvpsdk.helper.RxHelper; |
7 | import com.shunzhi.parent.api.LoginRegisterApi; | 7 | import com.shunzhi.parent.api.LoginRegisterApi; |
8 | +import com.shunzhi.parent.bean.CurrentBean; | ||
8 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; | 9 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
9 | 10 | ||
10 | import io.reactivex.Observable; | 11 | import io.reactivex.Observable; |
@@ -40,4 +41,10 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste | @@ -40,4 +41,10 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste | ||
40 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 41 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
41 | } | 42 | } |
42 | 43 | ||
44 | + @Override | ||
45 | + public Observable<CurrentBean> getUserInfo() { | ||
46 | + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).getUserInfo() | ||
47 | + .compose(RxHelper.<CurrentBean>rxSchedulerHelper()); | ||
48 | + } | ||
49 | + | ||
43 | } | 50 | } |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
@@ -105,7 +105,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -105,7 +105,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
105 | @Override | 105 | @Override |
106 | public void accept(JsonObject jsonObject) throws Exception { | 106 | public void accept(JsonObject jsonObject) throws Exception { |
107 | //TODO 获取验证码返回 | 107 | //TODO 获取验证码返回 |
108 | - Log.e("111", jsonObject.toString()); | 108 | + ToastUtils.showToast("已发送短信,请注意查收"); |
109 | } | 109 | } |
110 | }, new Consumer<Throwable>() { | 110 | }, new Consumer<Throwable>() { |
111 | @Override | 111 | @Override |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -3,10 +3,7 @@ package com.shunzhi.parent.ui.fragment; | @@ -3,10 +3,7 @@ package com.shunzhi.parent.ui.fragment; | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.annotation.NonNull; | 4 | import android.support.annotation.NonNull; |
5 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
6 | -import android.support.v4.app.Fragment; | ||
7 | -import android.view.LayoutInflater; | ||
8 | import android.view.View; | 6 | import android.view.View; |
9 | -import android.view.ViewGroup; | ||
10 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
11 | 8 | ||
12 | import com.bumptech.glide.Glide; | 9 | import com.bumptech.glide.Glide; |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
@@ -150,14 +150,18 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -150,14 +150,18 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
150 | if (loginAndRegister.getText().toString().trim().equals("登录")) { | 150 | if (loginAndRegister.getText().toString().trim().equals("登录")) { |
151 | if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(password.getText().toString())) { | 151 | if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(password.getText().toString())) { |
152 | loginAndRegister.setEnabled(true); | 152 | loginAndRegister.setEnabled(true); |
153 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn); | ||
153 | } else { | 154 | } else { |
154 | loginAndRegister.setEnabled(false); | 155 | loginAndRegister.setEnabled(false); |
156 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick); | ||
155 | } | 157 | } |
156 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { | 158 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { |
157 | if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(idCode.getText().toString()) && !TextUtils.isEmpty(password.getText().toString())) { | 159 | if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(idCode.getText().toString()) && !TextUtils.isEmpty(password.getText().toString())) { |
158 | loginAndRegister.setEnabled(true); | 160 | loginAndRegister.setEnabled(true); |
161 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn); | ||
159 | } else { | 162 | } else { |
160 | loginAndRegister.setEnabled(false); | 163 | loginAndRegister.setEnabled(false); |
164 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick); | ||
161 | } | 165 | } |
162 | } | 166 | } |
163 | } | 167 | } |
app/src/main/res/drawable/rudiobtn_unclick.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> |
3 | <stroke android:color="#00000000" android:width="1dp"/> | 3 | <stroke android:color="#00000000" android:width="1dp"/> |
4 | - <solid android:color="#b3cfff" /> | 4 | + <solid android:color="#D2D2D2" /> |
5 | <corners android:radius="5dp"/> | 5 | <corners android:radius="5dp"/> |
6 | </shape> | 6 | </shape> |
7 | \ No newline at end of file | 7 | \ No newline at end of file |
app/src/main/res/layout/fragment_login_and_regist.xml
@@ -137,13 +137,52 @@ | @@ -137,13 +137,52 @@ | ||
137 | android:background="@color/bottomline" /> | 137 | android:background="@color/bottomline" /> |
138 | 138 | ||
139 | </LinearLayout> | 139 | </LinearLayout> |
140 | + <LinearLayout | ||
141 | + android:id="@+id/passwordLayout_new" | ||
142 | + android:layout_width="match_parent" | ||
143 | + android:layout_height="wrap_content" | ||
144 | + android:visibility="gone" | ||
145 | + android:orientation="vertical"> | ||
146 | + | ||
147 | + <LinearLayout | ||
148 | + android:layout_width="match_parent" | ||
149 | + android:layout_height="wrap_content"> | ||
150 | + | ||
151 | + <EditText | ||
152 | + android:id="@+id/et_password_new" | ||
153 | + android:layout_width="wrap_content" | ||
154 | + android:layout_height="50dp" | ||
155 | + android:layout_weight="1" | ||
156 | + android:background="@null" | ||
157 | + android:hint="请设置密码:6~16个字符" | ||
158 | + android:maxLength="16" | ||
159 | + android:inputType="textPassword" | ||
160 | + android:textColorHint="@color/hintTextColor" | ||
161 | + android:textSize="@dimen/sp_16" /> | ||
162 | + | ||
163 | + <ImageView | ||
164 | + android:id="@+id/img_eye_new" | ||
165 | + android:layout_width="wrap_content" | ||
166 | + android:layout_height="match_parent" | ||
167 | + android:layout_gravity="center" | ||
168 | + android:layout_marginRight="10dp" | ||
169 | + android:src="@drawable/eye_close" /> | ||
170 | + | ||
171 | + </LinearLayout> | ||
172 | + | ||
173 | + <TextView | ||
174 | + android:layout_width="match_parent" | ||
175 | + android:layout_height="1dp" | ||
176 | + android:background="@color/bottomline" /> | ||
177 | + | ||
178 | + </LinearLayout> | ||
140 | 179 | ||
141 | <TextView | 180 | <TextView |
142 | android:id="@+id/loginAndRegister" | 181 | android:id="@+id/loginAndRegister" |
143 | android:layout_width="match_parent" | 182 | android:layout_width="match_parent" |
144 | android:layout_height="wrap_content" | 183 | android:layout_height="wrap_content" |
145 | android:layout_marginTop="40dp" | 184 | android:layout_marginTop="40dp" |
146 | - android:background="@drawable/rudiobtn" | 185 | + android:background="@drawable/rudiobtn_unclick" |
147 | android:gravity="center" | 186 | android:gravity="center" |
148 | android:paddingBottom="10dp" | 187 | android:paddingBottom="10dp" |
149 | android:paddingTop="10dp" | 188 | android:paddingTop="10dp" |
@@ -153,10 +192,12 @@ | @@ -153,10 +192,12 @@ | ||
153 | android:textSize="@dimen/sp_16" /> | 192 | android:textSize="@dimen/sp_16" /> |
154 | 193 | ||
155 | <LinearLayout | 194 | <LinearLayout |
195 | + android:id="@+id/zhuce" | ||
156 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
157 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
158 | android:layout_marginTop="30dp" | 198 | android:layout_marginTop="30dp" |
159 | android:gravity="center" | 199 | android:gravity="center" |
200 | + android:visibility="gone" | ||
160 | android:orientation="horizontal"> | 201 | android:orientation="horizontal"> |
161 | 202 | ||
162 | <TextView | 203 | <TextView |
@@ -177,6 +218,31 @@ | @@ -177,6 +218,31 @@ | ||
177 | android:textSize="@dimen/sp_16" /> | 218 | android:textSize="@dimen/sp_16" /> |
178 | 219 | ||
179 | </LinearLayout> | 220 | </LinearLayout> |
221 | + <LinearLayout | ||
222 | + android:id="@+id/denglu" | ||
223 | + android:layout_width="match_parent" | ||
224 | + android:layout_height="wrap_content" | ||
225 | + android:layout_marginTop="30dp" | ||
226 | + android:orientation="horizontal"> | ||
227 | + | ||
228 | + <TextView | ||
229 | + android:id="@+id/tv_info_login" | ||
230 | + android:layout_width="wrap_content" | ||
231 | + android:layout_height="wrap_content" | ||
232 | + android:text="还没有账号,快速" | ||
233 | + android:textColor="@color/hintTextColor" | ||
234 | + android:textSize="@dimen/sp_16" /> | ||
235 | + | ||
236 | + <TextView | ||
237 | + android:id="@+id/tv_goto_login" | ||
238 | + android:layout_width="wrap_content" | ||
239 | + android:layout_height="wrap_content" | ||
240 | + android:text="注册" | ||
241 | + android:textColor="#acc9fc" | ||
242 | + android:textSize="@dimen/sp_16" /> | ||
243 | + | ||
244 | + | ||
245 | + </LinearLayout> | ||
180 | 246 | ||
181 | 247 | ||
182 | </LinearLayout> | 248 | </LinearLayout> |