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

1.新用戶注册

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