Commit f307b0ddde001638aabbdc95ab6fe4fe2c6968ee
1 parent
dec4c9a0
Exists in
yxb_dev
and in
2 other branches
no message
Showing
7 changed files
with
52 additions
and
8 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/api/LoginRegisterApi.java
... | ... | @@ -33,6 +33,12 @@ public interface LoginRegisterApi { |
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | + @GET("/api/Account/ReSetpass") | |
37 | + Observable<JsonObject> reSetpassResult( | |
38 | + @Field("mobile") String username, @Field("captcha") String idCode,@Field("pass") String password); | |
39 | + | |
40 | + | |
41 | + | |
36 | 42 | @GET("api/Account/ChangePhoneCaptcha") |
37 | 43 | Observable<JsonObject> getidCodeResult( |
38 | 44 | @Query("mobile") String username); | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/loginandregister/LoginAndRegisterContract.java
... | ... | @@ -22,6 +22,8 @@ public interface LoginAndRegisterContract { |
22 | 22 | public abstract void idCodeResult(String phoneNumber); |
23 | 23 | |
24 | 24 | public abstract void getUserInfo(String mobile,int school_id,String captcha); |
25 | + | |
26 | + public abstract void reSetpassResult(String adminName,String idCode,String password); | |
25 | 27 | } |
26 | 28 | |
27 | 29 | interface ILoginModel extends IBaseModel{ |
... | ... | @@ -33,6 +35,8 @@ public interface LoginAndRegisterContract { |
33 | 35 | |
34 | 36 | //获取登录用户信息 |
35 | 37 | Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha); |
38 | + | |
39 | + Observable<JsonObject> reSetpass(String adminName,String idCode,String password); | |
36 | 40 | } |
37 | 41 | interface ILoginView extends IBaseFragment { |
38 | 42 | ... | ... |
app/src/main/java/com/shunzhi/parent/model/loginandregister/LoginAndRegisterModel.java
... | ... | @@ -47,4 +47,10 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste |
47 | 47 | .compose(RxHelper.<UserInfo>rxSchedulerHelper()); |
48 | 48 | } |
49 | 49 | |
50 | + @Override | |
51 | + public Observable<JsonObject> reSetpass(String adminName, String idCode, String password) { | |
52 | + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).reSetpassResult(adminName,idCode,password) | |
53 | + .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
54 | + } | |
55 | + | |
50 | 56 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
... | ... | @@ -86,7 +86,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
86 | 86 | //TODO 注册成功返回 |
87 | 87 | Log.e("1111", jsonObject.toString()); |
88 | 88 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); |
89 | - AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, password); | |
89 | +// AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, password); | |
90 | 90 | mIView.getUserInfo(1); |
91 | 91 | } |
92 | 92 | }, new Consumer<Throwable>() { |
... | ... | @@ -130,7 +130,6 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
130 | 130 | mRxManager.register(mIModel.getUserInfo(mobile, school_id, captcha).subscribe(new Consumer<UserInfo>() { |
131 | 131 | @Override |
132 | 132 | public void accept(UserInfo userInfo) throws Exception { |
133 | - Log.d("6666","userInfo="+userInfo.toString()); | |
134 | 133 | if (userInfo != null) { |
135 | 134 | CurrentBean currentBean = userInfo.getData(); |
136 | 135 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, currentBean.getMobile()); |
... | ... | @@ -138,7 +137,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
138 | 137 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, currentBean.getImage()); |
139 | 138 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_SEX, String.valueOf(currentBean.getSex())); |
140 | 139 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.PARENT_ID, String.valueOf(currentBean.getParentId())); |
141 | - AppConfig.getAppConfig(AppContext.getContext()).set(AppConfig.USER_ID,currentBean.getUserid()); | |
140 | + AppConfig.getAppConfig(AppContext.getContext()).set(AppConfig.USER_ID, currentBean.getUserid()); | |
142 | 141 | mIView.getUserInfo(0); |
143 | 142 | |
144 | 143 | } else { |
... | ... | @@ -155,6 +154,23 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
155 | 154 | })); |
156 | 155 | } |
157 | 156 | |
157 | + @Override | |
158 | + public void reSetpassResult(final String adminName, String idCode, String password) { | |
159 | + mRxManager.register(mIModel.reSetpass(adminName, idCode, password).subscribe(new Consumer<JsonObject>() { | |
160 | + @Override | |
161 | + public void accept(JsonObject jsonObject) throws Exception { | |
162 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); | |
163 | + mIView.getUserInfo(2); | |
164 | + } | |
165 | + }, new Consumer<Throwable>() { | |
166 | + @Override | |
167 | + public void accept(Throwable throwable) throws Exception { | |
168 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
169 | + } | |
170 | + })); | |
171 | + | |
172 | + } | |
173 | + | |
158 | 174 | |
159 | 175 | @Override |
160 | 176 | public LoginAndRegisterContract.ILoginModel getModel() { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CheckInfoActivity.java
... | ... | @@ -151,7 +151,7 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC |
151 | 151 | @Override |
152 | 152 | public void addChildSuccess() { |
153 | 153 | // WebViewActivity.start_show(CheckInfoActivity.this,AppConfig.BINDING_SUCCESS_HEZUO); |
154 | - WebViewActivity.getInstance(CheckInfoActivity.this,"http://60.190.202.57:8101/ParentOrderCenter.aspx?userid="+AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_ID),AppConfig.BINDING_SUCCESS_HEZUO); | |
154 | + WebViewActivity.getInstance(CheckInfoActivity.this,AppConfig.WAP_URL+"/ParentOrderCenter.aspx?userid="+AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_ID),AppConfig.BINDING_SUCCESS_HEZUO); | |
155 | 155 | finish(); |
156 | 156 | } |
157 | 157 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
... | ... | @@ -20,6 +20,7 @@ import android.widget.TextView; |
20 | 20 | import com.makeramen.roundedimageview.RoundedImageView; |
21 | 21 | import com.share.mvpsdk.base.BasePresenter; |
22 | 22 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
23 | +import com.share.mvpsdk.utils.ToastUtils; | |
23 | 24 | import com.shunzhi.parent.AppConfig; |
24 | 25 | import com.shunzhi.parent.AppContext; |
25 | 26 | import com.shunzhi.parent.R; |
... | ... | @@ -99,7 +100,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
99 | 100 | passwordLayout_new = view.findViewById(R.id.passwordLayout_new); |
100 | 101 | et_password_new = view.findViewById(R.id.et_password_new); |
101 | 102 | et_password_new.addTextChangedListener(textWatcher); |
102 | - mPresenter.loginResult("18358585335", "123456"); | |
103 | + | |
103 | 104 | if ("登录".equals(typepage)) { |
104 | 105 | idCodeLayout.setVisibility(View.GONE); |
105 | 106 | passwordLayout_new.setVisibility(View.GONE); |
... | ... | @@ -126,7 +127,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
126 | 127 | roundedImageView.setOnClickListener(new View.OnClickListener() { |
127 | 128 | @Override |
128 | 129 | public void onClick(View view) { |
129 | - startNewActivity(MainActivity.class); | |
130 | + mPresenter.loginResult("18358585335", "123456"); | |
130 | 131 | } |
131 | 132 | }); |
132 | 133 | } |
... | ... | @@ -166,6 +167,10 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
166 | 167 | |
167 | 168 | popupWindow.setContentView(view); |
168 | 169 | popupWindow.showAtLocation(main_login, Gravity.CENTER, 0, 0); |
170 | + }else if(type==3){ | |
171 | + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); | |
172 | + phoneNumber.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | |
173 | + password.setFocusable(true); | |
169 | 174 | } |
170 | 175 | |
171 | 176 | |
... | ... | @@ -182,6 +187,13 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
182 | 187 | mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); |
183 | 188 | } else if (loginAndRegister.getText().toString().trim().equals("确定")) { |
184 | 189 | //修改密码 |
190 | + if(TextUtils.isEmpty(password.getText().toString())&&TextUtils.isEmpty(et_password_new.getText().toString())) { | |
191 | + if(password.getText().toString().equals(et_password_new.getText().toString())) { | |
192 | + mPresenter.reSetpassResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); | |
193 | + }else{ | |
194 | + ToastUtils.showToast("两次输入的密码不一致"); | |
195 | + } | |
196 | + } | |
185 | 197 | } |
186 | 198 | |
187 | 199 | } else if (v == tv_goto) { | ... | ... |
app/src/main/res/layout/fragment_login_and_regist.xml
... | ... | @@ -56,7 +56,7 @@ |
56 | 56 | android:layout_height="50dp" |
57 | 57 | android:background="@null" |
58 | 58 | android:hint="请输入手机号码" |
59 | - android:text="18358585335" | |
59 | + android:text="" | |
60 | 60 | android:maxLength="11" |
61 | 61 | android:textColorHint="@color/hintTextColor" |
62 | 62 | android:textSize="@dimen/sp_16" /> |
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | android:layout_weight="1" |
130 | 130 | android:background="@null" |
131 | 131 | android:hint="请设置密码:6~16个字符" |
132 | - android:text="123456" | |
132 | + android:text="" | |
133 | 133 | android:maxLength="16" |
134 | 134 | android:inputType="textPassword" |
135 | 135 | android:textColorHint="@color/hintTextColor" | ... | ... |