添加‘我的’页面的银行卡绑定接口和用户资料接口
This commit is contained in:
@@ -3,6 +3,7 @@ package com.navinfo.outdoor.activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
@@ -11,14 +12,25 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
import com.google.gson.Gson;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||
import com.navinfo.outdoor.bean.CityBean;
|
||||
import com.navinfo.outdoor.bean.JsonBean;
|
||||
import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.RegexUtil;
|
||||
import org.json.JSONArray;
|
||||
@@ -42,6 +54,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
public static Pattern compile = Pattern.compile("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,})$/");
|
||||
private Button userSave;
|
||||
private LinearLayout llRegion;
|
||||
private String userqq;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@@ -97,21 +110,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
case R.id.ll_region:
|
||||
showPickerView();
|
||||
break;
|
||||
case R.id.et_phone:
|
||||
String phoneEt = etPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneEt)) {
|
||||
Toast.makeText(this, "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!RegexUtil.isPhone(phoneEt)) {
|
||||
Toast.makeText(this, "手机格式有误", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case R.id.edit_qq:
|
||||
qq();
|
||||
break;
|
||||
case R.id.edit_mailbox:
|
||||
if (isEmail(etMailbox.getText().toString().trim()) && etMailbox.getText().toString().trim().length() <= 31) {
|
||||
if (isEmail(etMailbox.getText().toString().trim()) && etMailbox.getText().toString().trim().length() > 31) {
|
||||
Toast.makeText(this, "邮箱验证成功", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(this, "邮箱格式错误", Toast.LENGTH_SHORT).show();
|
||||
@@ -119,7 +122,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
break;
|
||||
case R.id.btn_save:
|
||||
final String userphone = etPhone.getText().toString().trim();
|
||||
final String userqq = etQq.getText().toString().trim();
|
||||
userqq = etQq.getText().toString().trim();
|
||||
final String usermailbox = etMailbox.getText().toString().trim();
|
||||
if (!RegexUtil.isPhone(userphone)) {
|
||||
Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show();
|
||||
@@ -132,10 +135,55 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
if (usermailbox.length() > 31) {
|
||||
Toast.makeText(this, "邮箱输入错误", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
netWork();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void netWork() {
|
||||
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<UserBean>post(HttpInterface.USER_UPDATE)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("pid", "1")
|
||||
.params("regionId", "530902")//省市区id
|
||||
.params("qq", userqq)//qq号
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<UserBean>(UserBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<UserBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show(UserActivity.this, "是否保存", "取消", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageDialog.show(UserActivity.this, "是否保存", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<UserBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(UserActivity.this, response.message(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String qq() {
|
||||
String qq = "23412312";
|
||||
String regex = "[1-9][0-9]{4,11}";
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.navinfo.outdoor.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.bean.BankPathBean;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> {
|
||||
private List<BankPathBean> bankPathBeans ;
|
||||
private Context context;
|
||||
|
||||
public BankAdapter(List<BankPathBean> bankPathBeans, Context context) {
|
||||
this.bankPathBeans = bankPathBeans;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.bankadapteritem, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
holder.tvitem.setText(bankPathBeans.get(position).getLabel());
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onBankClick.onClick(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return bankPathBeans.size();
|
||||
}
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvitem;
|
||||
|
||||
public ViewHolder(@NonNull @NotNull View itemView) {
|
||||
super(itemView);
|
||||
tvitem = itemView.findViewById(R.id.tv_bank);
|
||||
}
|
||||
}
|
||||
public interface OnBankClick {
|
||||
void onClick(int pos);
|
||||
}
|
||||
|
||||
private OnBankClick onBankClick;
|
||||
|
||||
public void setOnBankClick(OnBankClick onBankClick) {
|
||||
this.onBankClick = onBankClick;
|
||||
}
|
||||
}
|
||||
23
app/src/main/java/com/navinfo/outdoor/bean/BankPathBean.java
Normal file
23
app/src/main/java/com/navinfo/outdoor/bean/BankPathBean.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class BankPathBean {
|
||||
|
||||
private String label;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class BankPhoneBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer body;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(Integer body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
32
app/src/main/java/com/navinfo/outdoor/bean/UserBean.java
Normal file
32
app/src/main/java/com/navinfo/outdoor/bean/UserBean.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class UserBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer body;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(Integer body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,42 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.gson.Gson;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.BankAdapter;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.BankPathBean;
|
||||
import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import org.json.JSONArray;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
/**
|
||||
* 收款信息
|
||||
@@ -17,14 +46,23 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
private ImageView ivGathering, imageBank;
|
||||
private Button btnBank;
|
||||
private TextView tvBank;
|
||||
private TextView tvName;
|
||||
private EditText etBankNum;
|
||||
private ImageView gatheringCamera;
|
||||
private String gatheringPath;
|
||||
private ArrayList<File> gatheringList;
|
||||
|
||||
|
||||
public static GatheringFragment newInstance(Bundle bundle) {
|
||||
GatheringFragment fragment = new GatheringFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.gathering_fragment;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,8 +71,15 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
ivGathering = findViewById(R.id.iv_gathering);
|
||||
ivGathering.setOnClickListener(this::onClick);
|
||||
imageBank = findViewById(R.id.iv_bank);
|
||||
imageBank.setOnClickListener(this::onClick);
|
||||
tvBank = findViewById(R.id.tv_bank);
|
||||
tvBank.setOnClickListener(this::onClick);
|
||||
btnBank = findViewById(R.id.btn_bank);
|
||||
btnBank.setOnClickListener(this::onClick);
|
||||
tvName = (TextView) findViewById(R.id.tv_name);
|
||||
etBankNum = (EditText) findViewById(R.id.et_bank_num);
|
||||
gatheringCamera = (ImageView) findViewById(R.id.gathering_camera);
|
||||
gatheringCamera.setOnClickListener(this::onClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,13 +89,134 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_gathering:
|
||||
getActivity().finish();
|
||||
break;
|
||||
case R.id.et_bank_num:
|
||||
|
||||
break;
|
||||
case R.id.iv_bank:
|
||||
String bankJson = new GetJsonDataUtil().getJson(getContext(), "bank.json");//获取assets目录下的json文件数据
|
||||
ArrayList<BankPathBean> jsonBean = parseData(bankJson);//用Gson 转成实体
|
||||
Dialog dialog = new Dialog(getContext());
|
||||
//弹窗点击周围空白处弹出层自动消失弹窗消失(false时为点击周围空白处弹出层不自动消失)
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
//将布局设置给Dialog
|
||||
dialog.setContentView(R.layout.bank_item);
|
||||
RecyclerView rlvBank = dialog.findViewById(R.id.rlv_bank);
|
||||
rlvBank.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||
rlvBank.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
BankAdapter bankAdapter = new BankAdapter(jsonBean, getContext());
|
||||
rlvBank.setAdapter(bankAdapter);
|
||||
bankAdapter.setOnBankClick(new BankAdapter.OnBankClick() {
|
||||
@Override
|
||||
public void onClick(int pos) {
|
||||
|
||||
tvBank.setText(jsonBean.get(pos).getLabel());
|
||||
|
||||
bankAdapter.notifyDataSetChanged();
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
Window window = dialog.getWindow();
|
||||
WindowManager.LayoutParams wlp = window.getAttributes();
|
||||
wlp.gravity = Gravity.BOTTOM;
|
||||
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
wlp.height = 1000;
|
||||
window.setAttributes(wlp);
|
||||
dialog.show();
|
||||
break;
|
||||
case R.id.btn_bank:
|
||||
gatheringNetWork();
|
||||
break;
|
||||
case R.id.gathering_camera:
|
||||
Intent gatheringNumber = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(gatheringNumber, 400);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void gatheringNetWork() {
|
||||
gatheringList = new ArrayList<>();
|
||||
File gatheringFile = new File(gatheringPath);
|
||||
if (!gatheringFile.exists()) {
|
||||
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
gatheringList.add(gatheringFile);
|
||||
String etBankAccount = etBankNum.getText().toString().trim();
|
||||
if (etBankAccount == null || etBankAccount.equals("")) {
|
||||
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<BankPhoneBean>post(HttpInterface.USER_BANKCARD_UP_DATA)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("userid", "1")
|
||||
.params("bankAccount", "123456")//银行id
|
||||
.params("idNumber", etBankAccount)//银行卡号
|
||||
.addFileParams("file", gatheringList)//银行卡拍照
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<BankPhoneBean>(BankPhoneBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<BankPhoneBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "取消", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<BankPhoneBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 400 && resultCode == RESULT_OK) {
|
||||
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "e");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//所属银行解析
|
||||
public ArrayList<BankPathBean> parseData(String result) {//Gson 解析
|
||||
ArrayList<BankPathBean> detail = new ArrayList<>();
|
||||
try {
|
||||
JSONArray data = new JSONArray(result);
|
||||
Gson gson = new Gson();
|
||||
for (int i = 0; i < data.length(); i++) {
|
||||
BankPathBean bankPath = gson.fromJson(data.optJSONObject(i).toString(), BankPathBean.class);
|
||||
detail.add(bankPath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
private EditText etNamePhone;
|
||||
private String takePhotoPath1;//身份证正面照片路径
|
||||
private String takePhotoPath2;//身份证反面照片路径
|
||||
private ImageView ivAttestation3;
|
||||
private String takePhotoPath3;
|
||||
private ArrayList<File> takePhoneList;
|
||||
|
||||
|
||||
public static UserAttestationFragment newInstance(Bundle bundle) {
|
||||
@@ -74,6 +77,8 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
ivAttestation1.setOnClickListener(this);
|
||||
ivAttestation2 = findViewById(R.id.iv_attestation2);
|
||||
ivAttestation2.setOnClickListener(this);
|
||||
ivAttestation3 = findViewById(R.id.iv_attestation3);
|
||||
ivAttestation3.setOnClickListener(this);
|
||||
btnAttestation = (Button) findViewById(R.id.btn_attestation);
|
||||
btnAttestation.setOnClickListener(this::onClick);
|
||||
etAttestationName = (EditText) findViewById(R.id.et_attestationName);
|
||||
@@ -94,41 +99,51 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
Intent ivAttestation2 = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(ivAttestation2, 200);
|
||||
break;
|
||||
case R.id.iv_attestation3:
|
||||
Intent ivAttestation3 = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(ivAttestation3, 300);
|
||||
break;
|
||||
case R.id.btn_attestation:
|
||||
|
||||
if (etAttestationName == null || etAttestationName.equals("")) {
|
||||
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (etNamePhone == null || etNamePhone.equals("")) {
|
||||
if (etNamePhone.getText().toString() == null || etNamePhone.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "身份证号不能为空,请输入身份证号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
// if (takePhoneList.size()<=0) {
|
||||
// Toast.makeText(getContext(), "身份证照不能为空", Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
nameAuthentication();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void nameAuthentication() {
|
||||
ArrayList<File> takePhoneList = new ArrayList<>();
|
||||
takePhoneList = new ArrayList<>();
|
||||
|
||||
File takePhotoFile1 = new File(takePhotoPath1);
|
||||
File takePhotoFile2 = new File(takePhotoPath2);
|
||||
if (!takePhotoFile1.exists() || !takePhotoFile2.exists()) {
|
||||
File takePhotoFile3 = new File(takePhotoPath3);
|
||||
if (!takePhotoFile1.exists() || !takePhotoFile2.exists() ||!takePhotoFile3.exists()){
|
||||
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
takePhoneList.add(takePhotoFile1);
|
||||
takePhoneList.add(takePhotoFile2);
|
||||
takePhoneList.add(takePhotoFile2);
|
||||
takePhoneList.add(takePhotoFile3);
|
||||
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("userid", "1")
|
||||
.params("name", "李心榕")
|
||||
.params("idnum", "123456")
|
||||
.addFileParams("file",takePhoneList)
|
||||
.params("name", etAttestationName.getFreezesText())
|
||||
.params("idnum", etNamePhone.getFreezesText())
|
||||
.addFileParams("file", takePhoneList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||
@Override
|
||||
@@ -168,13 +183,19 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data,"a");
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a");
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
||||
} else if (requestCode == 200 && resultCode == RESULT_OK) {
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data,"b");
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
ivAttestation2.setImageBitmap(bitmap);//显示图像
|
||||
}else if (requestCode == 300 && resultCode == RESULT_OK) {
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
|
||||
@@ -21,10 +21,15 @@ public class HttpInterface {
|
||||
|
||||
|
||||
public static final String IPm4 = "http://172.23.139.4:8001/m4";
|
||||
|
||||
public static final String MSG_CONTENT = IPm4 + "/1/msg_content";//发现 -富文本详情页请求
|
||||
|
||||
//172.23.139.4:8001/m4/userAuth/add
|
||||
public static final String USER_AUTH_ADD = IPm4 + "/userAuth/add"; //实名认证
|
||||
|
||||
//172.23.139.4:8001/m4/user/update
|
||||
public static final String USER_UPDATE = IPm4+"/user/update";//用户资料
|
||||
|
||||
//172.23.139.4:8001/m4/userBankcard/update
|
||||
public static final String USER_BANKCARD_UP_DATA = IPm4 + "/userBankcard/update"; //绑定银行卡
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user