提交 8de260c2 authored 作者: lgd's avatar lgd

1.新用戶注册

上级 6263b182
...@@ -6,6 +6,7 @@ import org.json.JSONObject; ...@@ -6,6 +6,7 @@ import org.json.JSONObject;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
...@@ -124,7 +125,7 @@ public interface ApiService { ...@@ -124,7 +125,7 @@ public interface ApiService {
* @return * @return
*/ */
@POST("/open/sys/user/register") @POST("/open/sys/user/register")
Observable<BaseBean> register(@QueryMap Map<String, Object> param); Observable<BaseBean> register(@Body RequestBody requestBody);
/** /**
...@@ -178,6 +179,6 @@ public interface ApiService { ...@@ -178,6 +179,6 @@ public interface ApiService {
* *
* @return * @return
*/ */
@POST("/open/sys/dept/list") @GET("/open/sys/dept/list")
Observable<BaseBean> depList(); Observable<BaseBean> depList();
} }
...@@ -8,10 +8,10 @@ package com.wd.workoffice.app; ...@@ -8,10 +8,10 @@ package com.wd.workoffice.app;
public class BaseBean { public class BaseBean {
public Integer code; public Integer code;
public Object data; public Object data;
private String message; public String message;
private int httpStatus; public int httpStatus;
private String path; public String path;
private String ext; public String ext;
public Integer getCode() { public Integer getCode() {
return code; return code;
...@@ -21,6 +21,10 @@ public class BaseBean { ...@@ -21,6 +21,10 @@ public class BaseBean {
return data; return data;
} }
public String getMessage() {
return message;
}
public int getHttpStatus() { public int getHttpStatus() {
return httpStatus; return httpStatus;
} }
...@@ -32,13 +36,4 @@ public class BaseBean { ...@@ -32,13 +36,4 @@ public class BaseBean {
public String getExt() { public String getExt() {
return ext; return ext;
} }
public String getMessage() {
return message;
}
public Integer getStatus() {
return code;
}
} }
...@@ -3,6 +3,7 @@ package com.wd.workoffice.model; ...@@ -3,6 +3,7 @@ package com.wd.workoffice.model;
import com.wd.workoffice.app.ApiService; import com.wd.workoffice.app.ApiService;
import com.wd.workoffice.app.BaseBean; import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.contract.UserRegisterThreeContract; import com.wd.workoffice.contract.UserRegisterThreeContract;
import com.wd.workoffice.util.WorkUtils;
import java.util.Map; import java.util.Map;
...@@ -17,7 +18,8 @@ import io.reactivex.Observable; ...@@ -17,7 +18,8 @@ import io.reactivex.Observable;
public class UserRegisterThreeModel implements UserRegisterThreeContract.Model { public class UserRegisterThreeModel implements UserRegisterThreeContract.Model {
@Override @Override
public Observable<BaseBean> register(Map<String, Object> param) { public Observable<BaseBean> register(Map<String, Object> param) {
return RtfHelper.getInstance().getApiService(ApiService.class).register(param);
return RtfHelper.getInstance().getApiService(ApiService.class).register( WorkUtils.convertMapToBody(param));
} }
@Override @Override
......
...@@ -41,7 +41,7 @@ public class UserRegisterOnePresenter extends BasePresenter<UserRegisterOneContr ...@@ -41,7 +41,7 @@ public class UserRegisterOnePresenter extends BasePresenter<UserRegisterOneContr
public void onSuccess(BaseBean data) { public void onSuccess(BaseBean data) {
mView.hideLoading(); mView.hideLoading();
if (data.getStatus() != 0) { if (data.getStatus() != 0) {
mView.onError(data.getMsg()); mView.onError(data.getMessage());
return; return;
} }
mView.codeSuccess(); mView.codeSuccess();
...@@ -68,7 +68,7 @@ public class UserRegisterOnePresenter extends BasePresenter<UserRegisterOneContr ...@@ -68,7 +68,7 @@ public class UserRegisterOnePresenter extends BasePresenter<UserRegisterOneContr
public void onSuccess(BaseBean data) { public void onSuccess(BaseBean data) {
mView.hideLoading(); mView.hideLoading();
if (data.getStatus() != 0) { if (data.getStatus() != 0) {
mView.onError(data.getMsg()); mView.onError(data.getMessage());
return; return;
} }
mView.verifySuccess(); mView.verifySuccess();
......
package com.wd.workoffice.presenter; package com.wd.workoffice.presenter;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.app.BaseBean; import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.bean.DepBean; import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.contract.UserRegisterThreeContract; import com.wd.workoffice.contract.UserRegisterThreeContract;
...@@ -69,7 +70,7 @@ public class UserRegisterThreePresenter extends BasePresenter<UserRegisterThreeC ...@@ -69,7 +70,7 @@ public class UserRegisterThreePresenter extends BasePresenter<UserRegisterThreeC
mView.onError(data.getMessage()); mView.onError(data.getMessage());
return; return;
} }
mView.depSuccess((List<DepBean>) data.getData()); mView.depSuccess(JSON.parseArray(data.getData().toString(),DepBean.class));
} }
}); });
} }
......
package com.wd.workoffice.ui.login; package com.wd.workoffice.ui.login;
import android.content.Intent;
import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity; import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.util.SearchUtils; import com.wd.workoffice.util.WorkUtils;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -64,7 +61,7 @@ public class ErpActivationOneActivity extends WorkToolBarActivity { ...@@ -64,7 +61,7 @@ public class ErpActivationOneActivity extends WorkToolBarActivity {
case R.id.tv_discover: case R.id.tv_discover:
break; break;
case R.id.tv_code: case R.id.tv_code:
SearchUtils.timerSeckill(tvCode, 60 * 1000, 1000, 0); WorkUtils.timerSeckill(tvCode, 60 * 1000, 1000, 0);
ToastUtil.showLong("验证码发送成功,请注意查收!"); ToastUtil.showLong("验证码发送成功,请注意查收!");
break; break;
case R.id.btn_next: case R.id.btn_next:
......
...@@ -12,7 +12,7 @@ import com.wd.workoffice.R; ...@@ -12,7 +12,7 @@ import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity; import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.contract.UserRegisterOneContract; import com.wd.workoffice.contract.UserRegisterOneContract;
import com.wd.workoffice.presenter.UserRegisterOnePresenter; import com.wd.workoffice.presenter.UserRegisterOnePresenter;
import com.wd.workoffice.util.SearchUtils; import com.wd.workoffice.util.WorkUtils;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -132,7 +132,7 @@ public class UserRegisterOneActivity extends WorkToolBarActivity implements User ...@@ -132,7 +132,7 @@ public class UserRegisterOneActivity extends WorkToolBarActivity implements User
@Override @Override
public void codeSuccess() { public void codeSuccess() {
SearchUtils.timerSeckill(tvCode, 60 * 1000, 1000, 0); WorkUtils.timerSeckill(tvCode, 60 * 1000, 1000, 0);
ToastUtil.showLong("验证码发送成功,请注意查收!"); ToastUtil.showLong("验证码发送成功,请注意查收!");
} }
......
...@@ -17,8 +17,11 @@ import com.wd.workoffice.bean.DepBean; ...@@ -17,8 +17,11 @@ import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.contract.UserRegisterThreeContract; import com.wd.workoffice.contract.UserRegisterThreeContract;
import com.wd.workoffice.presenter.UserRegisterThreePresenter; import com.wd.workoffice.presenter.UserRegisterThreePresenter;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import butterknife.BindView; import butterknife.BindView;
...@@ -45,8 +48,10 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -45,8 +48,10 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
Button btnSubmit; Button btnSubmit;
private UserRegisterThreePresenter userRegisterThreePresenter; private UserRegisterThreePresenter userRegisterThreePresenter;
private List<DepBean> depList; private List<DepBean> depList;
private List<String> depNameList; private List<String> depNameList = new ArrayList<>();
private int chooseDep =-1; private int chooseDep = -1;
private AlertDialog.Builder builder;
@Override @Override
protected void initView() { protected void initView() {
ButterKnife.bind(this); ButterKnife.bind(this);
...@@ -111,18 +116,37 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -111,18 +116,37 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
public void onViewClicked(View view) { public void onViewClicked(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.ll_product: case R.id.ll_product:
if (builder == null) {
toast("正在加载部门,请稍等");
return;
}
builder.show();
break; break;
case R.id.btn_submit: case R.id.btn_submit:
if (chooseDep == -1) {
toast("请选择部门");
return;
}
Map<String, Object> param = new HashMap<>();
param.put("userName", etName.getText().toString());
param.put("password", getIntent().getStringExtra("pwd"));
param.put("nickName", getIntent().getStringExtra("name"));
param.put("email", etEmail.getText().toString());
param.put("phone", getIntent().getStringExtra("phone"));
// param.put("erpId", "");
param.put("deptId", depList.get(chooseDep).getId());
param.put("verifyCode", getIntent().getStringExtra("code"));
userRegisterThreePresenter.register(param);
break; break;
} }
} }
private void initDialog() { private void initDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder = new AlertDialog.Builder(this);
String[] stringArray = new String[depNameList.size()]; String[] stringArray = new String[depNameList.size()];
builder.setItems(depNameList.toArray(stringArray), (dialog, which) -> { builder.setItems(depNameList.toArray(stringArray), (dialog, which) -> {
tvProductContent.setText(depNameList.get(which)); tvProductContent.setText(depNameList.get(which));
chooseDep=which; chooseDep = which;
}); });
// normalDialog = builder.setView(dialogView).setPositiveButton("确定", (dialog, which) -> clientPresenter.changeClient(id, status + "")) // normalDialog = builder.setView(dialogView).setPositiveButton("确定", (dialog, which) -> clientPresenter.changeClient(id, status + ""))
// .setNegativeButton("取消", (dialog, which) -> dialog.dismiss()).create(); // .setNegativeButton("取消", (dialog, which) -> dialog.dismiss()).create();
...@@ -141,5 +165,6 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -141,5 +165,6 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
for (DepBean dep : dataList) { for (DepBean dep : dataList) {
depNameList.add(dep.getName()); depNameList.add(dep.getName());
} }
initDialog();
} }
} }
...@@ -127,7 +127,7 @@ public class UserRegisterTwoActivity extends WorkToolBarActivity { ...@@ -127,7 +127,7 @@ public class UserRegisterTwoActivity extends WorkToolBarActivity {
toast("账号名称数字和字母4-16位"); toast("账号名称数字和字母4-16位");
return; return;
} }
if(!RegexUtils.isMatch(Config.REGEX_USERNAME,name)){ if(!RegexUtils.isMatch(Config.REGEX_PASSWORD,name)){
toast("设置密码数字或字母6-16位"); toast("设置密码数字或字母6-16位");
return; return;
} }
......
...@@ -8,17 +8,32 @@ import android.os.CountDownTimer; ...@@ -8,17 +8,32 @@ import android.os.CountDownTimer;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkApp; import com.wd.workoffice.app.WorkApp;
import java.io.File; import java.io.File;
import java.util.Map;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
* author : flexible * author : flexible
* email : lgd19940421@163.com * email : lgd19940421@163.com
* github: https://github.com/FlexibleXd * github: https://github.com/FlexibleXd
**/ **/
public class SearchUtils { public class WorkUtils {
/**
* 将map数据转换为 普通的 json RequestBody
* @param map 以前的请求参数
* @return
*/
public static RequestBody convertMapToBody(Map<?,?> map) {
return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), JSON.toJSONString(map));
}
// public static Map<String, Object> pageKey() { // public static Map<String, Object> pageKey() {
// Map<String, Object> param = new HashMap<>(); // Map<String, Object> param = new HashMap<>();
// param.put("size", Config.SIZE); // param.put("size", Config.SIZE);
......
...@@ -27,13 +27,14 @@ ...@@ -27,13 +27,14 @@
<EditText <EditText
android:id="@+id/et_code" android:id="@+id/et_code"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="10mm" android:layout_marginRight="10mm"
android:background="@null" android:background="@null"
android:text="YG22015444" android:gravity="right"
android:paddingVertical="8mm"
android:textColor="@color/flexible_text_sup" android:textColor="@color/flexible_text_sup"
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </RelativeLayout>
...@@ -55,13 +56,14 @@ ...@@ -55,13 +56,14 @@
<EditText <EditText
android:id="@+id/et_name" android:id="@+id/et_name"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="10mm" android:layout_marginRight="10mm"
android:background="@null" android:background="@null"
android:text="YG22015444" android:gravity="right"
android:paddingVertical="8mm"
android:textColor="@color/flexible_text_sup" android:textColor="@color/flexible_text_sup"
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </RelativeLayout>
...@@ -88,7 +90,6 @@ ...@@ -88,7 +90,6 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="10mm" android:layout_marginRight="10mm"
android:text="YG22015444"
android:textColor="@color/flexible_text_sup" android:textColor="@color/flexible_text_sup"
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </RelativeLayout>
...@@ -117,7 +118,6 @@ ...@@ -117,7 +118,6 @@
android:layout_marginLeft="10mm" android:layout_marginLeft="10mm"
android:layout_weight="1" android:layout_weight="1"
android:gravity="right" android:gravity="right"
android:text="YG22015444"
android:textSize="16sp" /> android:textSize="16sp" />
<ImageView <ImageView
...@@ -144,13 +144,15 @@ ...@@ -144,13 +144,15 @@
<EditText <EditText
android:id="@+id/et_email" android:id="@+id/et_email"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="10mm" android:layout_marginRight="10mm"
android:background="@null" android:background="@null"
android:text="YG22015444" android:gravity="right"
android:inputType="textEmailAddress"
android:paddingVertical="8mm"
android:textColor="@color/flexible_text_sup" android:textColor="@color/flexible_text_sup"
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </RelativeLayout>
...@@ -168,10 +170,10 @@ ...@@ -168,10 +170,10 @@
android:layout_width="256mm" android:layout_width="256mm"
android:layout_height="53mm" android:layout_height="53mm"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="@mipmap/btn_main_bg"
android:text="提交"
android:layout_marginTop="30mm"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="30mm"
android:background="@drawable/selector_btn"
android:text="提交"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="24sp" /> android:textSize="24sp" />
</LinearLayout> </LinearLayout>
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="@null" android:background="@null"
android:hint="账号名称数字和字母4-16位" android:hint="账号名称数字和字母4-16位"
android:inputType="textVisiblePassword"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
...@@ -79,6 +80,7 @@ ...@@ -79,6 +80,7 @@
android:layout_marginLeft="10mm" android:layout_marginLeft="10mm"
android:layout_weight="1" android:layout_weight="1"
android:background="@null" android:background="@null"
android:inputType="textPassword"
android:hint="设置密码数字或字母6- 16位" android:hint="设置密码数字或字母6- 16位"
android:textSize="12sp" /> android:textSize="12sp" />
...@@ -105,6 +107,7 @@ ...@@ -105,6 +107,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="10mm" android:layout_marginLeft="10mm"
android:layout_weight="1" android:layout_weight="1"
android:inputType="textPassword"
android:background="@null" android:background="@null"
android:hint="再次确认密码" android:hint="再次确认密码"
android:textSize="12sp" /> android:textSize="12sp" />
...@@ -119,7 +122,7 @@ ...@@ -119,7 +122,7 @@
android:layout_height="50mm" android:layout_height="50mm"
android:layout_marginHorizontal="58mm" android:layout_marginHorizontal="58mm"
android:layout_marginTop="40mm" android:layout_marginTop="40mm"
android:background="@mipmap/btn_main_bg" android:background="@drawable/selector_btn"
android:text="激活" android:text="激活"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" /> android:textSize="20sp" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论