Commit d0f6c4e98d4b9a60272be014ae3b91f4f39187f9
1 parent
0a3dbbab
Exists in
yxb_dev
and in
1 other branch
no message
Showing
6 changed files
with
52 additions
and
18 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/AppConfig.java
@@ -40,18 +40,18 @@ public class AppConfig { | @@ -40,18 +40,18 @@ public class AppConfig { | ||
40 | public static String APP_IS_START = "app_is_start"; | 40 | public static String APP_IS_START = "app_is_start"; |
41 | 41 | ||
42 | //测试 | 42 | //测试 |
43 | -// public static String BASE_URL="http://60.190.202.57:1000/"; | ||
44 | -// public static String BASE_URL_ORDER="http://60.190.202.57:8101/"; | ||
45 | -// public static String BASE_URL_FILE="http://60.190.202.57:8196"; | ||
46 | -// public static String BASE_URL_VOTE = "http://60.190.202.57:8812/"; | 43 | + public static String BASE_URL="http://60.190.202.57:1000/"; |
44 | + public static String BASE_URL_ORDER="http://60.190.202.57:8101/"; | ||
45 | + public static String BASE_URL_FILE="http://60.190.202.57:8196"; | ||
46 | + public static String BASE_URL_VOTE = "http://60.190.202.57:8812/"; | ||
47 | 47 | ||
48 | 48 | ||
49 | //正式 | 49 | //正式 |
50 | - public static String BASE_URL = "http://campus.myjxt.com/"; | ||
51 | - public static String BASE_URL_ORDER = "http://parent.myjxt.com/"; | ||
52 | - public static String BASE_URL_FILE = "http://manage.myjxt.com"; | ||
53 | -// public static String BASE_URL_VOTE = "www.sxspy.net/"; | ||
54 | - public static String BASE_URL_VOTE = "http://www.sxspy.net/"; | 50 | +// public static String BASE_URL = "http://campus.myjxt.com/"; |
51 | +// public static String BASE_URL_ORDER = "http://parent.myjxt.com/"; | ||
52 | +// public static String BASE_URL_FILE = "http://manage.myjxt.com"; | ||
53 | +//// public static String BASE_URL_VOTE = "www.sxspy.net/"; | ||
54 | +// public static String BASE_URL_VOTE = "http://www.sxspy.net/"; | ||
55 | 55 | ||
56 | 56 | ||
57 | //默认日志保存的路径 | 57 | //默认日志保存的路径 |
app/src/main/java/com/shunzhi/parent/api/LoginRegisterApi.java
@@ -47,4 +47,6 @@ public interface LoginRegisterApi { | @@ -47,4 +47,6 @@ public interface LoginRegisterApi { | ||
47 | @POST("/api/ParentHelper/GetParentInfo") | 47 | @POST("/api/ParentHelper/GetParentInfo") |
48 | Observable<UserInfo> getUserInfo(@Field("mobile") String mobile, @Field("school_id") int school_id, @Field("captcha") String captcha); | 48 | Observable<UserInfo> getUserInfo(@Field("mobile") String mobile, @Field("school_id") int school_id, @Field("captcha") String captcha); |
49 | 49 | ||
50 | + @GET("api/ParentHelper/ParentJudge") | ||
51 | + Observable<JsonObject> getParentJudge(String mobile); | ||
50 | } | 52 | } |
app/src/main/java/com/shunzhi/parent/contract/loginandregister/LoginAndRegisterContract.java
@@ -26,6 +26,8 @@ public interface LoginAndRegisterContract { | @@ -26,6 +26,8 @@ public interface LoginAndRegisterContract { | ||
26 | 26 | ||
27 | public abstract void nimLogin(String account,String password); | 27 | public abstract void nimLogin(String account,String password); |
28 | public abstract void reSetpassResult(String adminName,String idCode,String password); | 28 | public abstract void reSetpassResult(String adminName,String idCode,String password); |
29 | + | ||
30 | + public abstract void isParentJudge(String mobile,String pwd); | ||
29 | } | 31 | } |
30 | 32 | ||
31 | interface ILoginModel extends IBaseModel{ | 33 | interface ILoginModel extends IBaseModel{ |
@@ -40,6 +42,8 @@ public interface LoginAndRegisterContract { | @@ -40,6 +42,8 @@ public interface LoginAndRegisterContract { | ||
40 | 42 | ||
41 | Observable<NIMLoginResultBean> nimLoginResult(String account, String token); | 43 | Observable<NIMLoginResultBean> nimLoginResult(String account, String token); |
42 | Observable<JsonObject> reSetpass(String adminName,String idCode,String password); | 44 | Observable<JsonObject> reSetpass(String adminName,String idCode,String password); |
45 | + | ||
46 | + Observable<JsonObject> getParentJudge(String mobile); | ||
43 | } | 47 | } |
44 | interface ILoginView extends IBaseFragment { | 48 | interface ILoginView extends IBaseFragment { |
45 | 49 |
app/src/main/java/com/shunzhi/parent/model/loginandregister/LoginAndRegisterModel.java
@@ -59,4 +59,10 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste | @@ -59,4 +59,10 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste | ||
59 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 59 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
60 | } | 60 | } |
61 | 61 | ||
62 | + @Override | ||
63 | + public Observable<JsonObject> getParentJudge(String mobile) { | ||
64 | + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class, LoginRegisterApi.url).getParentJudge(mobile) | ||
65 | + .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | ||
66 | + } | ||
67 | + | ||
62 | } | 68 | } |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
@@ -75,7 +75,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -75,7 +75,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
75 | if (responseBody == null) return; | 75 | if (responseBody == null) return; |
76 | try { | 76 | try { |
77 | JSONObject json = new JSONObject(responseBody.string()); | 77 | JSONObject json = new JSONObject(responseBody.string()); |
78 | - ToastUtils.showToast(json.optString("message")+"json="+json); | 78 | + ToastUtils.showToast(json.optString("message") + "json=" + json); |
79 | if (TextUtils.isEmpty(json.optString("error"))) { | 79 | if (TextUtils.isEmpty(json.optString("error"))) { |
80 | mIView.showerror(json.optString("message")); | 80 | mIView.showerror(json.optString("message")); |
81 | return; | 81 | return; |
@@ -107,7 +107,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -107,7 +107,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
107 | //TODO 注册成功返回 | 107 | //TODO 注册成功返回 |
108 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); | 108 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); |
109 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, password); | 109 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, password); |
110 | - mIView.getUserInfo(1,""); | 110 | + mIView.getUserInfo(1, ""); |
111 | } | 111 | } |
112 | }, new Consumer<Throwable>() { | 112 | }, new Consumer<Throwable>() { |
113 | @Override | 113 | @Override |
@@ -170,7 +170,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -170,7 +170,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
170 | 170 | ||
171 | if (currentBean.getStudentClass() != null && currentBean.getStudentClass().size() > 0) { | 171 | if (currentBean.getStudentClass() != null && currentBean.getStudentClass().size() > 0) { |
172 | // Log.e("qqqq--==","qqqqq"); | 172 | // Log.e("qqqq--==","qqqqq"); |
173 | - AppConfig.getAppConfig(mIView.getBindActivity()).set(AppConfig.ISBINDING,"1"); | 173 | + AppConfig.getAppConfig(mIView.getBindActivity()).set(AppConfig.ISBINDING, "1"); |
174 | } | 174 | } |
175 | 175 | ||
176 | String account = currentBean.getUserid(); | 176 | String account = currentBean.getUserid(); |
@@ -212,9 +212,9 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -212,9 +212,9 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
212 | // Log.d("77777","NIMLoginResultBean="+bean); | 212 | // Log.d("77777","NIMLoginResultBean="+bean); |
213 | if (bean.isSuccess()) { | 213 | if (bean.isSuccess()) { |
214 | AppConfig.ISLOGIN = true; | 214 | AppConfig.ISLOGIN = true; |
215 | - mIView.getUserInfo(0,""); | ||
216 | - }else { | ||
217 | - mIView.getUserInfo(-1,"通讯登录失败:"+bean.getResultCode()); | 215 | + mIView.getUserInfo(0, ""); |
216 | + } else { | ||
217 | + mIView.getUserInfo(-1, "通讯登录失败:" + bean.getResultCode()); | ||
218 | } | 218 | } |
219 | } | 219 | } |
220 | })); | 220 | })); |
@@ -225,18 +225,39 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -225,18 +225,39 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
225 | @Override | 225 | @Override |
226 | public void accept(JsonObject jsonObject) throws Exception { | 226 | public void accept(JsonObject jsonObject) throws Exception { |
227 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); | 227 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); |
228 | - mIView.getUserInfo(2,""); | 228 | + mIView.getUserInfo(2, ""); |
229 | } | 229 | } |
230 | }, new Consumer<Throwable>() { | 230 | }, new Consumer<Throwable>() { |
231 | @Override | 231 | @Override |
232 | public void accept(Throwable throwable) throws Exception { | 232 | public void accept(Throwable throwable) throws Exception { |
233 | - mIView.getUserInfo(-1,throwable.getMessage()); | 233 | + mIView.getUserInfo(-1, throwable.getMessage()); |
234 | // OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | 234 | // OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
235 | } | 235 | } |
236 | })); | 236 | })); |
237 | 237 | ||
238 | } | 238 | } |
239 | 239 | ||
240 | + @Override | ||
241 | + public void isParentJudge(final String mobile, final String pwd) { | ||
242 | + | ||
243 | + mRxManager.register(mIModel.getParentJudge(mobile).subscribe(new Consumer<JsonObject>() { | ||
244 | + @Override | ||
245 | + public void accept(JsonObject jsonObject) throws Exception { | ||
246 | + if (jsonObject.get("data").getAsBoolean()) { | ||
247 | + loginResult(mobile, pwd); | ||
248 | + } else { | ||
249 | + ToastUtils.showToast("账号不存在,请先注册账号"); | ||
250 | + } | ||
251 | + } | ||
252 | + }, new Consumer<Throwable>() { | ||
253 | + @Override | ||
254 | + public void accept(Throwable throwable) throws Exception { | ||
255 | + | ||
256 | + } | ||
257 | + })); | ||
258 | + | ||
259 | + } | ||
260 | + | ||
240 | 261 | ||
241 | @Override | 262 | @Override |
242 | public LoginAndRegisterContract.ILoginModel getModel() { | 263 | public LoginAndRegisterContract.ILoginModel getModel() { |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
@@ -195,7 +195,8 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -195,7 +195,8 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
195 | progressDialog.show(); | 195 | progressDialog.show(); |
196 | // Log.e("1111--==", l.getTime() + ""); | 196 | // Log.e("1111--==", l.getTime() + ""); |
197 | if (loginAndRegister.getText().toString().trim().equals("登录")) { | 197 | if (loginAndRegister.getText().toString().trim().equals("登录")) { |
198 | - mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString()); | 198 | +// mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString()); |
199 | + mPresenter.isParentJudge(phoneNumber.getText().toString(),password.getText().toString()); | ||
199 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { | 200 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { |
200 | mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); | 201 | mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); |
201 | } else if (loginAndRegister.getText().toString().trim().equals("确定")) { | 202 | } else if (loginAndRegister.getText().toString().trim().equals("确定")) { |