Quellcode durchsuchen

增加注册绑定昵称时提示

Pq vor 3 Jahren
Ursprung
Commit
5c20b05c95

+ 19 - 0
usercenter/src/main/java/com/cooleshow/usercenter/data/api/UserApi.kt

@@ -1,6 +1,7 @@
 package com.cooleshow.usercenter.data.api
 
 
+import com.cooleshow.base.bean.QueryParamsConfigBean
 import com.cooleshow.base.common.BaseConstant
 import com.cooleshow.base.data.net.BaseResponse
 import com.cooleshow.usercenter.bean.UserLoginInfo
@@ -101,4 +102,22 @@ interface UserApi {
 //     */
 //    @POST("userCenter/editUser")
 //    fun editUser(@Body req:EditUserReq):Observable<BaseResp<UserInfo>>
+
+    /**
+     * 获取修改名称限制时间
+     *
+     * @param
+     * @return
+     */
+    @GET(BaseConstant.TEACHER_GROUP + "sysConfig/queryByParamName")
+    fun queryModifyNickConfigForTeacher(@Query("paramName") last_username_month: String?): Observable<BaseResponse<QueryParamsConfigBean?>?>?
+
+    /**
+     * 获取修改名称限制时间
+     *
+     * @param
+     * @return
+     */
+    @GET(BaseConstant.STUDENT_GROUP + "sysConfig/queryByParamName")
+    fun queryModifyNickConfigForStu(@Query("paramName") last_username_month: String?): Observable<BaseResponse<QueryParamsConfigBean?>?>?
 }

+ 37 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/BindPasswordPresenter.java

@@ -1,5 +1,7 @@
 package com.cooleshow.usercenter.presenter;
 
+import com.cooleshow.base.bean.QueryParamsConfigBean;
+import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.data.net.ApiException;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
@@ -39,4 +41,39 @@ public class BindPasswordPresenter extends BasePresenter<BindPasswordContract.Bi
             }
         });
     }
+
+    public void queryModifyConfig() {
+        getView().showLoading();
+        String params = "last_username_month";
+        if(BaseApplication.Companion.isTeacherClient()){
+            addSubscribe(create(UserApi.class).queryModifyNickConfigForTeacher(params), new BaseObserver<QueryParamsConfigBean>(getView()) {
+                @Override
+                protected void onSuccess(QueryParamsConfigBean data) {
+                    if (getView() != null) {
+                        getView().queryModifyConfigSuccess(data);
+                    }
+                }
+
+                @Override
+                public void onError(Throwable e) {
+                    super.onError(e);
+
+                }
+            });
+        }else{
+            addSubscribe(create(UserApi.class).queryModifyNickConfigForStu(params), new BaseObserver<QueryParamsConfigBean>(getView()) {
+                @Override
+                protected void onSuccess(QueryParamsConfigBean data) {
+                    if (getView() != null) {
+                        getView().queryModifyConfigSuccess(data);
+                    }
+                }
+
+                @Override
+                public void onError(Throwable e) {
+                    super.onError(e);
+                }
+            });
+        }
+    }
 }

+ 2 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/BindPasswordContract.java

@@ -1,5 +1,6 @@
 package com.cooleshow.usercenter.presenter.contract;
 
+import com.cooleshow.base.bean.QueryParamsConfigBean;
 import com.cooleshow.base.presenter.view.BaseView;
 
 /**
@@ -9,6 +10,7 @@ public interface BindPasswordContract {
 
     interface BindPwdView extends BaseView {
         void onBindSuccess();
+        void queryModifyConfigSuccess(QueryParamsConfigBean bean);
     }
 
     interface Presenter {

+ 17 - 0
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/BindPasswordActivity.java

@@ -7,6 +7,7 @@ import android.view.View;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.bean.QueryParamsConfigBean;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
@@ -48,6 +49,11 @@ public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutB
 
     }
 
+    @Override
+    public void initData() {
+        super.initData();
+        presenter.queryModifyConfig();
+    }
 
     @Override
     public void onBindSuccess() {
@@ -56,6 +62,17 @@ public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutB
     }
 
     @Override
+    public void queryModifyConfigSuccess(QueryParamsConfigBean bean) {
+        if (!checkActivityExist()) {
+            return;
+        }
+        if (bean == null) {
+            return;
+        }
+        viewBinding.tvModifyConfig.setText(String.format("每隔%s个月可修改一次", bean.paramValue));
+    }
+
+    @Override
     public void onClick(View v) {
         if (v.getId() == R.id.tv_confirm) {
             String pwd = viewBinding.etPwd.getText().toString();

+ 16 - 2
usercenter/src/main/res/layout/activity_bind_pwd_layout.xml

@@ -67,8 +67,22 @@
         app:layout_constraintLeft_toLeftOf="@+id/et_nickname"
         app:layout_constraintRight_toRightOf="@+id/et_nickname"
         app:layout_constraintTop_toBottomOf="@+id/et_nickname" />
+
     <TextView
-        android:layout_marginTop="16dp"
+        android:layout_marginStart="35dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/view_nickname_divide"
+        android:id="@+id/tv_modify_config"
+        android:textColor="@color/color_999999"
+        android:textSize="@dimen/sp_12"
+        android:layout_marginTop="10dp"
+        android:text="每隔3个月可修改一次"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+
+    <TextView
+        android:layout_marginTop="10dp"
         android:id="@+id/tv_phone_num"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -79,7 +93,7 @@
         android:textSize="@dimen/sp_18"
         android:textStyle="bold"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/et_nickname" />
+        app:layout_constraintTop_toBottomOf="@+id/tv_modify_config" />
 
 
     <EditText