Browse Source

修改修改密码流程

Pq 1 year ago
parent
commit
9b057b9863

+ 1 - 0
BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt

@@ -58,6 +58,7 @@ object RouterPath {
             const val PATH_BIND_PASSWORD = "/userCenter/bindPwd"
             const val COMMON_EMPTY_ACTIVITY = "/userCenter/CommEmptyActivity"
             const val SIGN_OUT_ACCOUNT = "/userCenter/SignOutAccountActivity"
+            const val UPDATE_PASSWORD = "/userCenter/UpdatePasswordActivity"
         }
     }
 

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/mine/ModifyPasswordActivity.java

@@ -44,7 +44,6 @@ import io.rong.imkit.utils.StatusBarUtil;
  * @author Ryan
  * 类说明:
  */
-@Route(path = RouterPath.MineCenter.MINE_MODIFY_PASSWORD)
 public class ModifyPasswordActivity extends BaseMVPActivity<ActivityModifyPasswordBinding, ModifyPasswordPresenter> implements ModifyPasswordContract.ModifyPasswordView, View.OnClickListener {
 
     private ImgVerifyCodeDialog mImgVerifyCodeDialog;

+ 5 - 0
usercenter/src/main/AndroidManifest.xml

@@ -42,5 +42,10 @@
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:exported="false"
             android:screenOrientation="portrait" />
+
+        <activity
+            android:name=".ui.activity.setting.ModifyPasswordActivity"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:screenOrientation="portrait" />
     </application>
 </manifest>

+ 38 - 4
usercenter/src/main/java/com/cooleshow/usercenter/data/api/UserApi.kt

@@ -6,10 +6,10 @@ import com.cooleshow.base.common.BaseConstant
 import com.cooleshow.base.data.net.BaseResponse
 import com.cooleshow.usercenter.bean.StudentUserInfo
 import com.cooleshow.usercenter.bean.TeacherUserInfo
-import com.cooleshow.usercenter.bean.UserInfo
 import com.cooleshow.usercenter.bean.UserLoginInfo
 import com.cooleshow.usercenter.data.protocol.RegisterReq
 import io.reactivex.rxjava3.core.Observable
+import okhttp3.RequestBody
 import retrofit2.http.*
 
 
@@ -138,7 +138,7 @@ interface UserApi {
 
 
     /**
-<<<<<<< HEAD
+    <<<<<<< HEAD
      * 校验图片验证码
      *
      *
@@ -175,6 +175,40 @@ interface UserApi {
      *
      * @return
      */
-    @GET(BaseConstant.AUTH_GROUP + "checkPassword")
-    fun checkOldPwd(): Observable<BaseResponse<StudentUserInfo?>?>?
+    @POST(BaseConstant.AUTH_GROUP + "checkPassword")
+    fun checkOldPwd(body: RequestBody): Observable<BaseResponse<Object?>?>?
+
+    /**
+     * 手机验证码修改密码
+     *
+     * @return
+     */
+    @FormUrlEncoded
+    @POST(BaseConstant.AUTH_GROUP + "user/updatePassword")
+    fun updatePassword(@FieldMap params: Map<String?, String?>?): Observable<BaseResponse<Any?>?>?
+
+
+    /**
+     * 发送登录短信验证码
+     *
+     * @param body mobile 手机号
+     * type:类型(PASSWD:修改密码,LOGIN:登录,REGISTER:注册,BANK:绑定银行卡PHONE:修改手机号))
+     * @return
+     */
+    @FormUrlEncoded
+    @POST("{group_name}" + "/code/sendSmsCode")
+    fun sendSmsCode(@Path("group_name") group_name: String,@FieldMap params: Map<String?, String?>?): Observable<BaseResponse<Any?>?>?
+
+    /**
+     * 校验图片验证码
+     *
+     *
+     * type:类型(PASSWD:修改密码,LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号)
+     *
+     * @return
+     */
+    @FormUrlEncoded
+    @POST("{group_name}" + "/code/verifyImageCode")
+    fun verifyImgCode(@Path("group_name") group_name: String,@FieldMap map: Map<String?, String?>?): Observable<BaseResponse<Any?>?>?
+
 }

+ 41 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/ForgetPasswordPresenter.java

@@ -0,0 +1,41 @@
+package com.cooleshow.usercenter.presenter;
+
+import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.RequestBodyUtil;
+import com.cooleshow.usercenter.data.api.UserApi;
+import com.cooleshow.usercenter.presenter.contract.ForgetPasswordContract;
+import com.cooleshow.usercenter.presenter.contract.UpdatePasswordContract;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+/**
+ * Author by pq, Date on 2022/4/19.
+ */
+public class ForgetPasswordPresenter extends BasePresenter<ForgetPasswordContract.View> implements ForgetPasswordContract.Presenter {
+
+
+    public void checkOldPwd(String oldPwd) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject =new JSONObject();
+        try {
+            jsonObject.put("password",oldPwd);
+        } catch (JSONException e) {
+            throw new RuntimeException(e);
+        }
+        addSubscribe(create(UserApi.class).checkOldPwd(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<Object>(getView()) {
+            @Override
+            protected void onSuccess(Object data) {
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+}

+ 88 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/ModifyPasswordPresenter.java

@@ -0,0 +1,88 @@
+package com.cooleshow.usercenter.presenter;
+
+import com.cooleshow.base.common.BaseConstant;
+import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.usercenter.bean.SetDetailBean;
+import com.cooleshow.usercenter.data.api.UserApi;
+import com.cooleshow.usercenter.presenter.contract.ModifyPasswordContract;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 创建日期:2022/5/17 13:36
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class ModifyPasswordPresenter extends BasePresenter<ModifyPasswordContract.ModifyPasswordView> implements ModifyPasswordContract.Presenter {
+    public void updatePassword(Map<String, String> requestData) {
+        getView().showLoading();
+        addSubscribe(create(UserApi.class).updatePassword(requestData), new BaseObserver<SetDetailBean>(getView()) {
+            @Override
+            protected void onSuccess(SetDetailBean data) {
+                if (getView() != null) {
+                    getView().updatePasswordSuccess(data);
+                }
+            }
+
+            @Override
+            public void onComplete() {
+                super.onComplete();
+                getView().hideLoading();
+            }
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+
+    }
+    public void sendSmsCode(Map<String,String> map){
+        getView().showLoading();
+        addSubscribe(create(UserApi.class).sendSmsCode(BaseConstant.getClientApiGroup(),map), new BaseObserver<SetDetailBean>(getView()) {
+            @Override
+            protected void onSuccess(SetDetailBean data) {
+                if (getView() != null) {
+                    getView().sendSmsCodeSuccess(data);
+                }
+            }
+        });
+    }
+
+    /**
+     * 图片验证码验证
+     * @param phone
+     * @param imgCode
+     */
+    public void verifyImgCode(String phone, String imgCode) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        Map<String, String> params = new HashMap<>();
+        params.put("code", imgCode);
+        params.put("phone", phone);
+        addSubscribe(create(UserApi.class).verifyImgCode(BaseConstant.CLIENT_API_GROUP_NAME,params), new BaseObserver<Object>(getView()) {
+            @Override
+            protected void onSuccess(Object data) {
+                if (getView() != null) {
+                    getView().verifyImgCodeSuccess(phone);
+                }
+            }
+
+            @Override
+            public void onComplete() {
+                super.onComplete();
+                if (getView() != null) {
+                    getView().hideLoading();
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+}

+ 18 - 3
usercenter/src/main/java/com/cooleshow/usercenter/presenter/UpdatePasswordPresenter.java

@@ -6,10 +6,14 @@ import com.cooleshow.base.bean.QueryParamsConfigBean;
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.RequestBodyUtil;
 import com.cooleshow.usercenter.data.api.UserApi;
 import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
 import com.cooleshow.usercenter.presenter.contract.UpdatePasswordContract;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 
 /**
  * Author by pq, Date on 2022/4/19.
@@ -17,11 +21,22 @@ import com.cooleshow.usercenter.presenter.contract.UpdatePasswordContract;
 public class UpdatePasswordPresenter extends BasePresenter<UpdatePasswordContract.View> implements UpdatePasswordContract.Presenter {
 
 
-    public void checkOldPwd() {
-        getView().showLoading();
-        addSubscribe(create(UserApi.class).checkOldPwd(), new BaseObserver<Object>(getView()) {
+    public void checkOldPwd(String oldPwd) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject =new JSONObject();
+        try {
+            jsonObject.put("password",oldPwd);
+        } catch (JSONException e) {
+            throw new RuntimeException(e);
+        }
+        addSubscribe(create(UserApi.class).checkOldPwd(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<Object>(getView()) {
             @Override
             protected void onSuccess(Object data) {
+                if (getView() != null) {
+                    getView().checkPwdSuccess();
+                }
             }
 
             @Override

+ 16 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/ForgetPasswordContract.java

@@ -0,0 +1,16 @@
+package com.cooleshow.usercenter.presenter.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+
+/**
+ * Author by pq, Date on 2022/4/20.
+ */
+public interface ForgetPasswordContract {
+
+    interface View extends BaseView {
+
+    }
+
+    interface Presenter {
+    }
+}

+ 20 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/ModifyPasswordContract.java

@@ -0,0 +1,20 @@
+package com.cooleshow.usercenter.presenter.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+
+/**
+ * 创建日期:2022/5/17 13:36
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public interface ModifyPasswordContract {
+    interface ModifyPasswordView extends BaseView {
+        void updatePasswordSuccess(Object object);
+        void sendSmsCodeSuccess(Object object);
+        void verifyImgCodeSuccess(String phone);
+    }
+
+    interface Presenter {
+    }
+}

+ 3 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/UpdatePasswordContract.java

@@ -9,6 +9,9 @@ import com.cooleshow.base.presenter.view.BaseView;
 public interface UpdatePasswordContract {
 
     interface View extends BaseView {
+        void checkPwdSuccess();
+
+
     }
 
     interface Presenter {

+ 65 - 0
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/setting/ForgetPasswordActivity.java

@@ -0,0 +1,65 @@
+package com.cooleshow.usercenter.ui.activity.setting;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.cooleshow.base.constanst.StyleConfig;
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.usercenter.databinding.AcForgetPwdLayoutBinding;
+import com.cooleshow.usercenter.helper.UserHelper;
+import com.cooleshow.usercenter.presenter.ForgetPasswordPresenter;
+import com.cooleshow.usercenter.presenter.contract.ForgetPasswordContract;
+
+import androidx.annotation.Nullable;
+
+/**
+ * Author by pq, Date on 2023/9/26.
+ */
+public class ForgetPasswordActivity extends BaseMVPActivity<AcForgetPwdLayoutBinding, ForgetPasswordPresenter> implements ForgetPasswordContract.View, View.OnClickListener {
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        StyleConfig.setTheme(this);
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
+    @Override
+    protected void initView() {
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "修改密码");
+        String phoneNum = UserHelper.getUserPhone();
+        if (!TextUtils.isEmpty(phoneNum)) {
+            String cPhone = phoneNum.substring(0, 3) + "****" + phoneNum.substring(7, phoneNum.length());
+            viewBinding.tvPhone.setText(cPhone);
+        }
+        
+    }
+
+    @Override
+    public void initData() {
+        super.initData();
+        initListener();
+    }
+
+    private void initListener() {
+        viewBinding.tvConfirm.setOnClickListener(this);
+        viewBinding.tvGetAuthCode.setOnClickListener(this);
+    }
+
+    @Override
+    protected AcForgetPwdLayoutBinding getLayoutView() {
+        return AcForgetPwdLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected ForgetPasswordPresenter createPresenter() {
+        return new ForgetPasswordPresenter();
+    }
+
+    @Override
+    public void onClick(View v) {
+
+    }
+}

+ 237 - 0
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/setting/ModifyPasswordActivity.java

@@ -0,0 +1,237 @@
+package com.cooleshow.usercenter.ui.activity.setting;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.alibaba.android.arouter.facade.annotation.Autowired;
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.constanst.StyleConfig;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.ToastUtil;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.base.widgets.dialog.ImgVerifyCodeDialog;
+import com.cooleshow.usercenter.R;
+import com.cooleshow.usercenter.constants.UserConstants;
+import com.cooleshow.usercenter.databinding.ActivityModifyPasswordBinding;
+import com.cooleshow.usercenter.helper.UserHelper;
+import com.cooleshow.usercenter.presenter.ModifyPasswordPresenter;
+import com.cooleshow.usercenter.presenter.contract.ModifyPasswordContract;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import androidx.annotation.Nullable;
+
+/**
+ * 创建日期:2022/5/17 13:33
+ *
+ * @author Ryan
+ * 类说明:
+ */
+@Route(path = RouterPath.MineCenter.MINE_MODIFY_PASSWORD)
+public class ModifyPasswordActivity extends BaseMVPActivity<ActivityModifyPasswordBinding, ModifyPasswordPresenter> implements ModifyPasswordContract.ModifyPasswordView, View.OnClickListener {
+
+    private ImgVerifyCodeDialog mImgVerifyCodeDialog;
+
+    @Override
+    public void onClick(View view) {
+        int id = view.getId();
+        if (id == R.id.tv_confirm) {
+            String password = viewBinding.etPassword.getText().toString().trim();
+            if (TextUtils.isEmpty(password) || password.length() < 6 || password.length() > 20) {
+                ToastUtil.getInstance().showShort("请输入6-20位密码");
+                return;
+            }
+            String authCode = viewBinding.etAuthCode.getText().toString().trim();
+            if (TextUtils.isEmpty(authCode)) {
+                ToastUtil.getInstance().showShort("请输入验证码");
+                return;
+            }
+            Map<String, String> params = new HashMap<>();
+            params.put("mobile", phoneNum);
+            params.put("authCode", authCode);
+            params.put("newPassword", password);
+            presenter.updatePassword(params);
+        } else if (id == R.id.tv_get_auth_code) {
+            showImgVerifyCodeDialog();
+        }
+    }
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        StyleConfig.setTheme(this);
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
+    @Autowired(name = "phoneNum")
+    String phoneNum;
+
+    @Override
+    protected void initView() {
+        ARouter.getInstance().inject(this);
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "修改密码");
+        viewBinding.tvConfirm.setOnClickListener(this);
+        viewBinding.tvGetAuthCode.setOnClickListener(this);
+        String cPhone = phoneNum.substring(0, 3) + "****" + phoneNum.substring(7, phoneNum.length());
+        viewBinding.tvPhone.setText(cPhone);
+
+    }
+
+
+    private void showImgVerifyCodeDialog() {
+        if (mImgVerifyCodeDialog == null) {
+            mImgVerifyCodeDialog = new ImgVerifyCodeDialog(ModifyPasswordActivity.this);
+        }
+        if (!mImgVerifyCodeDialog.isShowing()) {
+            mImgVerifyCodeDialog.show();
+        }
+        mImgVerifyCodeDialog.setPhone(phoneNum);
+        mImgVerifyCodeDialog.setOnEventListener(new ImgVerifyCodeDialog.OnEventListener() {
+            @Override
+            public void onVerifyImgCode(String phone, String imgCode) {
+                if (presenter != null) {
+                    presenter.verifyImgCode(phone, imgCode);
+                }
+            }
+        });
+    }
+
+    @Override
+    protected ActivityModifyPasswordBinding getLayoutView() {
+        return ActivityModifyPasswordBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected ModifyPasswordPresenter createPresenter() {
+        return new ModifyPasswordPresenter();
+    }
+
+    @Override
+    public void updatePasswordSuccess(Object object) {
+        UserHelper.saveUserToken("");
+        ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_LOGIN)
+                .withString(UserConstants.PHONE_NUM_KEY, UserHelper.getUserPhone())
+                .navigation();
+        finish();
+    }
+
+    @Override
+    public void sendSmsCodeSuccess(Object object) {
+        getCodeSuccess();
+    }
+
+    @Override
+    public void verifyImgCodeSuccess(String phone) {
+        if (isFinishing() || isDestroyed()) {
+            return;
+        }
+        if (mImgVerifyCodeDialog != null) {
+            mImgVerifyCodeDialog.dismiss();
+        }
+        Map<String, String> map = new HashMap<>();
+        map.put("mobile", phone);
+        map.put("type", "PASSWD");
+        presenter.sendSmsCode(map);
+    }
+
+
+    public void getCodeSuccess() {
+        ToastUtil.getInstance().showShort("验证码发送成功,请注意查收!");
+        startTimer();
+    }
+
+    /**
+     * 执行完成
+     */
+    public static final int EXECUTE_FINISH = 0X11000;
+    /**
+     * 执行中
+     */
+    public static final int EXECUTE_LOADING = 0X4000;
+    private int mTimerId = 60;
+
+    private TimerTask timerTask;
+
+    private Timer timer;
+
+    /**
+     * 开始倒计时
+     */
+    private void startTimer() {
+
+        if (timerTask == null) {
+            timerTask = new TimerTask() {
+                @Override
+                public void run() {
+                    Message msg = new Message();
+                    msg.what = EXECUTE_LOADING;
+                    msg.arg1 = --mTimerId;
+                    handler.sendMessage(msg);
+                }
+            };
+            timer = new Timer();
+            timer.schedule(timerTask, 100, 1000);
+        }
+    }
+
+    /**
+     * 结束计时
+     */
+    private void closeTimer() {
+        if (timer != null) {
+            timer.cancel();
+            timer = null;
+        }
+        if (timerTask != null) {
+            timerTask = null;
+        }
+        mTimerId = 60;
+        handler.sendEmptyMessage(EXECUTE_FINISH);
+    }
+
+    @SuppressLint("HandlerLeak")
+    private Handler handler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case EXECUTE_LOADING:
+                    viewBinding.tvGetAuthCode.setText(msg.arg1 + "s");
+                    viewBinding.tvGetAuthCode.setClickable(false);
+                    if (msg.arg1 == 0) {
+                        closeTimer();
+                        viewBinding.tvGetAuthCode.setClickable(true);
+                    }
+                    break;
+                case EXECUTE_FINISH:
+                    viewBinding.tvGetAuthCode.setClickable(true);
+                    viewBinding.tvGetAuthCode.setText("获取验证码");
+                    break;
+            }
+            super.handleMessage(msg);
+        }
+    };
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (timer != null) {
+            timer.cancel();
+            timer = null;
+        }
+        if (timerTask != null) {
+            timerTask = null;
+        }
+        if (handler != null) {
+            handler.removeCallbacksAndMessages(null);
+        }
+    }
+}

+ 30 - 13
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/UpdatePasswordActivity.java → usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/setting/UpdatePasswordActivity.java

@@ -1,4 +1,4 @@
-package com.cooleshow.usercenter.ui.activity;
+package com.cooleshow.usercenter.ui.activity.setting;
 
 import android.content.Intent;
 import android.os.Bundle;
@@ -7,6 +7,7 @@ import android.view.View;
 import android.widget.TextView;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
+import com.alibaba.android.arouter.launcher.ARouter;
 import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 import com.bigkoo.pickerview.view.OptionsPickerView;
 import com.cooleshow.base.bean.QueryParamsConfigBean;
@@ -20,8 +21,11 @@ import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.databinding.ActivityBindPwdLayoutBinding;
 import com.cooleshow.usercenter.databinding.ActivityUpdatePwdLayoutBinding;
 import com.cooleshow.usercenter.helper.PhoneCheckHelper;
+import com.cooleshow.usercenter.helper.UserHelper;
 import com.cooleshow.usercenter.presenter.BindPasswordPresenter;
+import com.cooleshow.usercenter.presenter.UpdatePasswordPresenter;
 import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
+import com.cooleshow.usercenter.presenter.contract.UpdatePasswordContract;
 
 import java.util.ArrayList;
 
@@ -31,8 +35,8 @@ import androidx.annotation.Nullable;
 /**
  * Author by pq, Date on 2022/4/19.
  */
-@Route(path = RouterPath.UserCenter.PATH_BIND_PASSWORD)
-public class UpdatePasswordActivity extends BaseMVPActivity<ActivityUpdatePwdLayoutBinding, BindPasswordPresenter> implements BindPasswordContract.BindPwdView, View.OnClickListener {
+@Route(path = RouterPath.UserCenter.UPDATE_PASSWORD)
+public class UpdatePasswordActivity extends BaseMVPActivity<ActivityUpdatePwdLayoutBinding, UpdatePasswordPresenter> implements UpdatePasswordContract.View, View.OnClickListener {
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -47,6 +51,9 @@ public class UpdatePasswordActivity extends BaseMVPActivity<ActivityUpdatePwdLay
 
     @Override
     protected void initView() {
+        String phoneNum = UserHelper.getUserPhone();
+        String cPhone = phoneNum.substring(0, 3) + "****" + phoneNum.substring(7, phoneNum.length());
+        viewBinding.tvPhone.setText(cPhone);
     }
 
     @Override
@@ -61,21 +68,31 @@ public class UpdatePasswordActivity extends BaseMVPActivity<ActivityUpdatePwdLay
     }
 
     @Override
-    public void onBindSuccess() {
-        ToastUtil.getInstance().showShort("设置成功");
-    }
-
-    @Override
-    public void queryModifyConfigSuccess(QueryParamsConfigBean bean) {
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == R.id.tv_confirm) {
+            String text = viewBinding.etPassword.getText().toString().trim();
+            if (TextUtils.isEmpty(text)) {
+                ToastUtil.getInstance().showShort("请输入账号原密码");
+                return;
+            }
+            presenter.checkOldPwd(text);
+            return;
+        }
+        if (id == R.id.tv_forget_pwd) {
+            return;
+        }
     }
 
     @Override
-    public void onClick(View v) {
+    protected UpdatePasswordPresenter createPresenter() {
+        return new UpdatePasswordPresenter();
     }
 
     @Override
-    protected BindPasswordPresenter createPresenter() {
-        return new BindPasswordPresenter();
+    public void checkPwdSuccess() {
+        ARouter.getInstance().build(RouterPath.MineCenter.MINE_MODIFY_PASSWORD)
+                .withString("phoneNum", UserHelper.getUserPhone())
+                .navigation();
     }
-
 }

+ 84 - 0
usercenter/src/main/res/layout/ac_forget_pwd_layout.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    tools:ignore="MissingDefaultResource">
+
+    <include
+        android:id="@+id/toolbar_include"
+        layout="@layout/common_toolbar_layout" />
+
+    <TextView
+        android:id="@+id/tv_phone"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="12dp"
+        android:layout_marginTop="15dp"
+        android:text="--"
+        android:textColor="@color/black"
+        android:textSize="20sp" />
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="15dp"
+        android:layout_marginStart="13dp"
+        android:layout_marginEnd="13dp"
+        android:background="@drawable/bg_white_10dp">
+
+
+        <EditText
+            android:textCursorDrawable="@drawable/shape_sign_out_edit_drawable"
+            android:theme="@style/MyEditText"
+            android:id="@+id/et_auth_code"
+            android:layout_width="0dp"
+            android:layout_height="@dimen/dp_48"
+            android:background="@null"
+            android:gravity="center_vertical"
+            android:hint="请输入验证码"
+            android:inputType="number"
+            android:maxLength="6"
+            android:paddingLeft="14dp"
+            android:paddingRight="14dp"
+            android:textColor="@color/color_1a1a1a"
+            android:textColorHint="@color/color_aaaaaa"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintRight_toLeftOf="@+id/tv_get_auth_code"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/tv_get_auth_code"
+            android:layout_width="wrap_content"
+            android:layout_height="@dimen/dp_48"
+            android:layout_marginRight="12dp"
+            android:gravity="center"
+            android:text="获取验证码"
+            android:textColor="?attr/klx_main_color2"
+            android:textSize="@dimen/sp_14"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintTop_toTopOf="parent"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+    <TextView
+        android:id="@+id/tv_confirm"
+        android:layout_width="match_parent"
+        android:layout_height="44dp"
+        android:layout_marginLeft="25dp"
+        android:layout_marginTop="30dp"
+        android:layout_marginRight="25dp"
+        android:layout_marginBottom="48dp"
+        android:background="?attr/klx_main_bt_background"
+        android:gravity="center"
+        android:text="确定"
+        android:textStyle="bold"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_18" />
+
+</LinearLayout>

+ 107 - 0
usercenter/src/main/res/layout/activity_modify_password.xml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    tools:ignore="MissingDefaultResource">
+
+    <include
+        android:id="@+id/toolbar_include"
+        layout="@layout/common_toolbar_layout" />
+
+    <TextView
+        android:id="@+id/tv_phone"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="12dp"
+        android:layout_marginTop="15dp"
+        android:text="--"
+        android:textColor="@color/black"
+        android:textSize="20sp" />
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="15dp"
+        android:layout_marginStart="13dp"
+        android:layout_marginEnd="13dp"
+        android:background="@drawable/bg_white_10dp">
+
+        <EditText
+            android:theme="@style/MyEditText"
+            android:textCursorDrawable="@drawable/shape_sign_out_edit_drawable"
+            android:id="@+id/et_password"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_48"
+            android:background="@null"
+            android:gravity="center_vertical"
+            android:hint="请输入6-20位密码"
+            android:inputType="textPassword"
+            android:paddingLeft="14dp"
+            android:paddingRight="14dp"
+            android:textColor="@color/color_1a1a1a"
+            android:textColorHint="@color/color_aaaaaa"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <View
+            android:id="@+id/view_line"
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:layout_marginLeft="12dp"
+            android:background="@color/divide_color_f0f0f0"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/et_password" />
+
+        <EditText
+            android:textCursorDrawable="@drawable/shape_sign_out_edit_drawable"
+            android:theme="@style/MyEditText"
+            android:id="@+id/et_auth_code"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_48"
+            android:background="@null"
+            android:gravity="center_vertical"
+            android:hint="请输入验证码"
+            android:inputType="number"
+            android:maxLength="6"
+            android:paddingLeft="14dp"
+            android:paddingRight="14dp"
+            android:textColor="@color/color_1a1a1a"
+            android:textColorHint="@color/color_aaaaaa"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/view_line" />
+
+        <TextView
+            android:id="@+id/tv_get_auth_code"
+            android:layout_width="wrap_content"
+            android:layout_height="@dimen/dp_48"
+            android:layout_marginRight="12dp"
+            android:gravity="center"
+            android:text="获取验证码"
+            android:textColor="?attr/klx_main_color2"
+            android:textSize="@dimen/sp_14"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/view_line" />
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+    <TextView
+        android:id="@+id/tv_confirm"
+        android:layout_width="match_parent"
+        android:layout_height="44dp"
+        android:layout_marginLeft="25dp"
+        android:layout_marginTop="30dp"
+        android:layout_marginRight="25dp"
+        android:layout_marginBottom="48dp"
+        android:background="?attr/klx_main_bt_background"
+        android:gravity="center"
+        android:text="确定"
+        android:textStyle="bold"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_18" />
+
+</LinearLayout>

+ 1 - 1
usercenter/src/main/res/layout/activity_update_pwd_layout.xml

@@ -31,7 +31,7 @@
 
         <com.cooleshow.base.widgets.ClearEditText
             android:theme="@style/MyEditText"
-            android:textCursorDrawable="@drawable/shape_2dc7aa_1dp"
+            android:textCursorDrawable="@drawable/shape_sign_out_edit_drawable"
             android:id="@+id/et_password"
             android:layout_width="match_parent"
             android:layout_height="@dimen/dp_48"