添加‘我的’页面的实名认证接口 完善能力测评的提交功能接口

This commit is contained in:
md 2021-06-28 18:25:02 +08:00
parent ffa24988c3
commit af5d7da58c
17 changed files with 347 additions and 128 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
//ndkVersion '23.0.7123448' ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" applicationId "com.navinfo.outdoor"

View File

@ -109,13 +109,13 @@ public class CapacityMeasureAdapter extends RecyclerView.Adapter<CapacityMeasure
} }
}); });
ImageView ivOption = optionLayer.findViewById(R.id.iv_option_img); // ImageView ivOption = optionLayer.findViewById(R.id.iv_option_img);
TextView tvOptionContent = optionLayer.findViewById(R.id.tv_option_content); TextView tvOptionContent = optionLayer.findViewById(R.id.tv_option_content);
if (option != null) { if (option != null) {
if (option.startsWith("http")) { if (option.startsWith("http")) {
Glide.with(context).load(option).into(ivOption); // Glide.with(context).load(option).into(ivOption);
} else { } else {
tvOptionContent.setText(option); tvOptionContent.setText(option);
} }

View File

@ -1,27 +1,24 @@
package com.navinfo.outdoor.bean; package com.navinfo.outdoor.bean;
import java.util.List;
public class ExamBean { public class ExamBean {
private String examId; private String id;
private String answer; private List<String> answer;
public ExamBean(String examId, String answer) { public String getId() {
this.examId = examId; return id;
this.answer = answer;
} }
public String getExamId() { public void setId(String id) {
return examId; this.id = id;
} }
public void setExamId(String examId) { public List<String> getAnswer() {
this.examId = examId;
}
public String getAnswer() {
return answer; return answer;
} }
public void setAnswer(String answer) { public void setAnswer(List<String> answer) {
this.answer = answer; this.answer = answer;
} }
} }

View File

@ -83,6 +83,15 @@ public class MeasureBean {
private String id; private String id;
private String question; private String question;
private List<?> option; private List<?> option;
private String examId;
public String getExamId() {
return examId;
}
public void setExamId(String examId) {
this.examId = examId;
}
public String getId() { public String getId() {
return id; return id;
@ -111,9 +120,10 @@ public class MeasureBean {
@Override @Override
public String toString() { public String toString() {
return "SingleChoiceBean{" + return "SingleChoiceBean{" +
"id=" + id + "id='" + id + '\'' +
", question='" + question + '\'' + ", question='" + question + '\'' +
", option=" + option + ", option=" + option +
", examId='" + examId + '\'' +
'}'; '}';
} }
} }
@ -128,6 +138,26 @@ public class MeasureBean {
private String id; private String id;
private String question; private String question;
private List<?> option; private List<?> option;
private String examId;
public String getExamId() {
return examId;
}
public void setExamId(String examId) {
this.examId = examId;
}
@Override
public String toString() {
return "MultiChoiceBean{" +
"id='" + id + '\'' +
", question='" + question + '\'' +
", option=" + option +
", examId='" + examId + '\'' +
'}';
}
public String getId() { public String getId() {
return id; return id;
@ -153,14 +183,7 @@ public class MeasureBean {
this.option = option; this.option = option;
} }
@Override
public String toString() {
return "MultiChoiceBean{" +
"id=" + id +
", question='" + question + '\'' +
", option=" + option +
'}';
}
} }
@Override @Override

View File

@ -0,0 +1,32 @@
package com.navinfo.outdoor.bean;
public class NameAuthenticationBean {
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;
}
}

View File

@ -89,7 +89,6 @@ public class CapacityEvaluationFragment2 extends BaseFragment implements View.On
.url(HttpInterface.MSG_LISt) .url(HttpInterface.MSG_LISt)
.method(OkGoBuilder.GET) .method(OkGoBuilder.GET)
.cls(TaskPrefectureBean.class) .cls(TaskPrefectureBean.class)
.json(new JSONObject())
.callback(new Callback<TaskPrefectureBean>() { .callback(new Callback<TaskPrefectureBean>() {
@Override @Override
public void onSuccess(TaskPrefectureBean response, int id) { public void onSuccess(TaskPrefectureBean response, int id) {

View File

@ -11,7 +11,10 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.CapacityMeasureAdapter; import com.navinfo.outdoor.adapter.CapacityMeasureAdapter;
import com.navinfo.outdoor.base.BaseFragment; import com.navinfo.outdoor.base.BaseFragment;
@ -20,21 +23,22 @@ import com.navinfo.outdoor.bean.ExamBean;
import com.navinfo.outdoor.bean.ExamSubmitBean; import com.navinfo.outdoor.bean.ExamSubmitBean;
import com.navinfo.outdoor.bean.MeasureBean; import com.navinfo.outdoor.bean.MeasureBean;
import com.navinfo.outdoor.http.Callback; import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface; import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.http.OkGoBuilder;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener; import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog; import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.v3.MessageDialog; import com.kongzue.dialog.v3.MessageDialog;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import okhttp3.MediaType;
/** /**
* 发现-能力测评条目点击进入测试页面 * 发现-能力测评条目点击进入测试页面
*/ */
@ -46,6 +50,9 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
private Button btn; private Button btn;
private ArrayList<ExamBean> examBeans; private ArrayList<ExamBean> examBeans;
private String examId;
private Gson gson;
public static CapacityMeasurementFragment newInstance(Bundle bundle) { public static CapacityMeasurementFragment newInstance(Bundle bundle) {
CapacityMeasurementFragment fragment = new CapacityMeasurementFragment(); CapacityMeasurementFragment fragment = new CapacityMeasurementFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
@ -68,7 +75,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
capacityMeasurementRel.setAdapter(capacityMeasureAdapter); capacityMeasurementRel.setAdapter(capacityMeasureAdapter);
btn = findViewById(R.id.btn); btn = findViewById(R.id.btn);
btn.setOnClickListener(this::onClick); btn.setOnClickListener(this::onClick);
gson = new Gson();
} }
@Override @Override
@ -76,6 +83,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
super.initData(); super.initData();
bolbean = new ArrayList<>(); bolbean = new ArrayList<>();
examBeans = new ArrayList<>(); examBeans = new ArrayList<>();
initNetWorks(true); initNetWorks(true);
} }
@ -96,14 +104,18 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
List<MeasureBean.BodyBean.MultiChoiceBean> multiChoice = response.getBody().getMultiChoice(); List<MeasureBean.BodyBean.MultiChoiceBean> multiChoice = response.getBody().getMultiChoice();
//多选 //多选
List<MeasureBean.BodyBean.SingleChoiceBean> singleChoice1 = response.getBody().getSingleChoice(); List<MeasureBean.BodyBean.SingleChoiceBean> singleChoice1 = response.getBody().getSingleChoice();
if (multiChoice != null) { if (multiChoice != null) {
for (int i = 0; i < multiChoice.size(); i++) { for (int i = 0; i < multiChoice.size(); i++) {
bolbean.add(new BolBean(multiChoice.get(i).getId(), multiChoice.get(i).getQuestion(), multiChoice.get(i).getOption(), true)); bolbean.add(new BolBean(multiChoice.get(i).getId(), multiChoice.get(i).getQuestion(), multiChoice.get(i).getOption(), true));
examId = multiChoice.get(i).getExamId();
} }
} }
if (singleChoice1 != null) { if (singleChoice1 != null) {
for (int i = 0; i < singleChoice1.size(); i++) { for (int i = 0; i < singleChoice1.size(); i++) {
bolbean.add(new BolBean(singleChoice1.get(i).getId(), singleChoice1.get(i).getQuestion(), singleChoice1.get(i).getOption(), false)); bolbean.add(new BolBean(singleChoice1.get(i).getId(), singleChoice1.get(i).getQuestion(), singleChoice1.get(i).getOption(), false));
examId = singleChoice1.get(i).getExamId();
} }
} }
@ -142,7 +154,21 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
} }
} }
for (Map.Entry<String, String> entry : checkedMap.entrySet()) { for (Map.Entry<String, String> entry : checkedMap.entrySet()) {
examBeans.add(new ExamBean(entry.getKey(), entry.getValue())); ExamBean examBean = new ExamBean();
examBean.setId(entry.getKey());
String value = entry.getValue();
String[] valus = value.split(",");
List<String> answerList = new ArrayList<>();
if (valus!=null) {
for (int i = 0; i < valus.length; i++) {
if (valus[i]!=null&&!valus[i].equals("")) {
answerList.add(valus[i]);
}
}
}
examBean.setAnswer(answerList);
examBeans.add(examBean);
} }
initExamSubmit(); initExamSubmit();
} }
@ -154,27 +180,25 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
} }
private void initExamSubmit() throws JSONException { private void initExamSubmit() throws JSONException {
JSONArray jsonArray = new JSONArray(); Map<String, Object> map = new HashMap<>();
for (int i = 0; i < examBeans.size(); i++) { map.put("examId",examId);
JSONObject json = new JSONObject(); map.put("answerList",examBeans);
json.put("examId", examBeans.get(i).getExamId());
json.put("answer", examBeans.get(i).getAnswer()); String json = gson.toJson(map);
jsonArray.put(json);
}
examBeans.clear(); examBeans.clear();
Log.d("TAG", "initExamSubmit: " + jsonArray.toString()); // Log.d("TAG", "initExamSubmit: " + jsonArray.toString());
OkGoBuilder.getInstance() OkGo
.Builder(getActivity()) // 请求方式和请求url
.url(HttpInterface.EXAM_SUBMIT) .<ExamSubmitBean>post(HttpInterface.EXAM_SUBMIT)
.method(OkGoBuilder.POST) .upString(json, MediaType.parse("application/json"))
.cls(ExamSubmitBean.class) // 请求的 tag, 主要用于取消对应的请求
.jsonArray(jsonArray) .tag(this)
.callback(new Callback<ExamSubmitBean>() { .execute(new DialogCallback<ExamSubmitBean>(ExamSubmitBean.class) {
@Override @Override
public void onSuccess(ExamSubmitBean response, int id) { public void onSuccess(Response<ExamSubmitBean> response) {
dismissLoadingDialog(); dismissLoadingDialog();
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss"); Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
if (response.getBody().equals("0")) { if (response.body().equals("0")) {
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
@ -191,16 +215,55 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
} }
}); });
} }
//Toast.makeText(getActivity(), response.getMsg() + "", Toast.LENGTH_SHORT).show();
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Response<ExamSubmitBean> response) {
super.onError(response);
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage()); Log.d("TAG", "onError: " + response.message());
} }
}).build(); });
// OkGoBuilder.getInstance()
// .Builder(getActivity())
// .url(HttpInterface.EXAM_SUBMIT)
// .method(OkGoBuilder.POST)
// .cls(ExamSubmitBean.class)
// .json(json)
// .callback(new Callback<ExamSubmitBean>() {
// @Override
// public void onSuccess(ExamSubmitBean response, int id) {
// dismissLoadingDialog();
// Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
// if (response.getBody().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;
// }
// });
// }
//
// //Toast.makeText(getActivity(), response.getMsg() + "", Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onError(Throwable e, int id) {
// dismissLoadingDialog();
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onError: " + e.getMessage());
// }
// }).build();
} }
} }

View File

@ -61,7 +61,6 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
.url(HttpInterface.listTaskExplain) .url(HttpInterface.listTaskExplain)
.method(OkGoBuilder.GET) .method(OkGoBuilder.GET)
.cls(TaskExplainInfo.class) .cls(TaskExplainInfo.class)
.json(new JSONObject())
.callback(new Callback<TaskExplainInfo>() { .callback(new Callback<TaskExplainInfo>() {
@Override @Override
public void onSuccess(TaskExplainInfo taskExplainInfo, int id) { public void onSuccess(TaskExplainInfo taskExplainInfo, int id) {

View File

@ -98,7 +98,6 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
.url(HttpInterface.listTaskExplain) .url(HttpInterface.listTaskExplain)
.method(OkGoBuilder.GET) .method(OkGoBuilder.GET)
.cls(TaskExplainInfo.class) .cls(TaskExplainInfo.class)
.json(new JSONObject())
.callback(new Callback<TaskExplainInfo>() { .callback(new Callback<TaskExplainInfo>() {
@Override @Override
public void onSuccess(TaskExplainInfo response, int id) { public void onSuccess(TaskExplainInfo response, int id) {

View File

@ -1,16 +1,32 @@
package com.navinfo.outdoor.fragment; package com.navinfo.outdoor.fragment;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
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.R;
import com.navinfo.outdoor.base.BaseFragment; import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.NameAuthenticationBean;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.util.PhotoPathUtil;
import java.io.File;
import java.util.ArrayList;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
@ -22,12 +38,20 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
private ImageView ivAttestation2; private ImageView ivAttestation2;
private ImageView ivAttestation1; private ImageView ivAttestation1;
private ImageView ivAttestation; private ImageView ivAttestation;
private Button btnAttestation;
private ArrayList<NameAuthenticationBean> authenticationBeans;
private EditText etAttestationName;
private EditText etNamePhone;
private String takePhotoPath1;//身份证正面照片路径
private String takePhotoPath2;//身份证反面照片路径
public static UserAttestationFragment newInstance(Bundle bundle) { public static UserAttestationFragment newInstance(Bundle bundle) {
UserAttestationFragment fragment = new UserAttestationFragment(); UserAttestationFragment fragment = new UserAttestationFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
@Override @Override
protected int getLayout() { protected int getLayout() {
return R.layout.user_attestation_fragment; return R.layout.user_attestation_fragment;
@ -36,6 +60,9 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override @Override
protected void initData() { protected void initData() {
super.initData(); super.initData();
authenticationBeans = new ArrayList<>();
} }
@Override @Override
@ -47,6 +74,10 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
ivAttestation1.setOnClickListener(this); ivAttestation1.setOnClickListener(this);
ivAttestation2 = findViewById(R.id.iv_attestation2); ivAttestation2 = findViewById(R.id.iv_attestation2);
ivAttestation2.setOnClickListener(this); ivAttestation2.setOnClickListener(this);
btnAttestation = (Button) findViewById(R.id.btn_attestation);
btnAttestation.setOnClickListener(this::onClick);
etAttestationName = (EditText) findViewById(R.id.et_attestationName);
etNamePhone = (EditText) findViewById(R.id.et_namePhone);
} }
@Override @Override
@ -63,19 +94,90 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Intent ivAttestation2 = new Intent("android.media.action.IMAGE_CAPTURE"); Intent ivAttestation2 = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(ivAttestation2, 200); startActivityForResult(ivAttestation2, 200);
break; break;
case R.id.btn_attestation:
if (etAttestationName == null || etAttestationName.equals("")) {
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
return;
}
if (etNamePhone == null || etNamePhone.equals("")) {
Toast.makeText(getContext(), "身份证号不能为空,请输入身份证号", Toast.LENGTH_SHORT).show();
return;
}
nameAuthentication();
break;
} }
} }
private void nameAuthentication() {
ArrayList<File> takePhoneList = new ArrayList<>();
File takePhotoFile1 = new File(takePhotoPath1);
File takePhotoFile2 = new File(takePhotoPath2);
if (!takePhotoFile1.exists() || !takePhotoFile2.exists()) {
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
return;
}
takePhoneList.add(takePhotoFile1);
takePhoneList.add(takePhotoFile2);
takePhoneList.add(takePhotoFile2);
OkGo
// 请求方式和请求url
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
// 请求的 tag, 主要用于取消对应的请求
.params("userid", "1")
.params("name", "李心榕")
.params("idnum", "123456")
.addFileParams("file",takePhoneList)
.tag(this)
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
@Override
public void onSuccess(Response<NameAuthenticationBean> 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<NameAuthenticationBean> response) {
super.onError(response);
dismissLoadingDialog();
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + response.message());
}
});
}
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100 && resultCode == RESULT_OK) { if (requestCode == 100 && resultCode == RESULT_OK) {
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data);
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 //从附加值中获取返回的图像
Bitmap bitmap = (Bitmap) extras.get("data");
ivAttestation1.setImageBitmap(bitmap);//显示图像 ivAttestation1.setImageBitmap(bitmap);//显示图像
} else if (requestCode == 200 && resultCode == RESULT_OK) { } else if (requestCode == 200 && resultCode == RESULT_OK) {
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data);
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 //从附加值中获取返回的图像
Bitmap bitmap = (Bitmap) extras.get("data");
ivAttestation2.setImageBitmap(bitmap);//显示图像 ivAttestation2.setImageBitmap(bitmap);//显示图像
} }
} }

View File

@ -1,23 +1,30 @@
package com.navinfo.outdoor.http; package com.navinfo.outdoor.http;
public class HttpInterface { public class HttpInterface {
//http://172.21.91.160:8000/api/user/list //http://172.21.91.160:8000/api/user/list
//发现接口 //发现接口
//http://172.23.139.4:8002/m4/findAndMessage/1/msg_list?fid=1&pageNum=1&pageSize=2 //http://172.23.139.4:8002/m4/findAndMessage/1/msg_list?fid=1&pageNum=1&pageSize=2
//能力测评接口 //能力测评接口
//http://172.23.139.4:8002/m4/findAndMessage/1/exam_content?id=11 //http://172.23.139.4:8002/m4/findAndMessage/1/exam_content?id=11
//http://172.23.139.4:8002/m4/findAndMessage/1/submitExam //http://172.23.139.4:8002/m4/findAndMessage/1/submitExam
public static final String IP1 = "http://172.23.139.4:8002/m4/findAndMessage/1/"; public static final String IP1 = "http://172.23.139.4:8002/m4/findAndMessage/1/";
public static final String IPm4 = "https://mockapi.eolinker.com/m5LxPbRb58eec57f4943420b1eb3b4e95b93968619a2973/m4/1/";
//发现测试接口 //发现测试接口
public static final String listTask = IP1 + "msg_list";//任务专区 public static final String listTask = IP1 + "msg_list";//任务专区
public static final String listEvent = IP1 + "msg_list";//活动专区 public static final String listEvent = IP1 + "msg_list";//活动专区
public static final String listTaskExplain = IP1 + "msg_list";//任务说明 public static final String listTaskExplain = IP1 + "msg_list";//任务说明
public static final String MSG_LISt = IP1 + "msg_list";//发现查询接口 public static final String MSG_LISt = IP1 + "msg_list";//发现查询接口
public static final String MSG_CONTENT = IPm4 + "msg_content";//发现 -富文本详情页请求
public static final String EXAM_CONTENT = IP1 + "exam_content";//发现 -能力测评获取试题接口 public static final String EXAM_CONTENT = IP1 + "exam_content";//发现 -能力测评获取试题接口
public static final String EXAM_SUBMIT = IP1 + "submitExam";//发现 -能力测评提交试卷 post public static final String EXAM_SUBMIT = IP1 + "submitExam";//发现 -能力测评提交试卷 post
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"; //实名认证
} }

View File

@ -26,8 +26,7 @@ public class OkGoBuilder<T> {
/** /**
* post请求 * post请求
*/ */
public static final int PSOT = 2; public static final int POST = 2;
public static final int POST = 5;
/** /**
* post请求 * post请求
*/ */
@ -46,9 +45,7 @@ public class OkGoBuilder<T> {
* 参数 * 参数
*/ */
private HttpParams params; private HttpParams params;
private String jsonstr; private String json;
private JSONObject json;
private JSONArray jsonArray;
/** /**
* 实体类 * 实体类
*/ */
@ -122,19 +119,11 @@ public class OkGoBuilder<T> {
} }
public OkGoBuilder jsonstr(String jsonstr) {
this.jsonstr = jsonstr;
return this;
}
public OkGoBuilder json(JSONObject json) { public OkGoBuilder json(String json) {
this.json = json; this.json = json;
return this; return this;
} }
public OkGoBuilder jsonArray(JSONArray json) {
this.jsonArray = json;
return this;
}
public OkGoBuilder cls(Class<T> clazz) { public OkGoBuilder cls(Class<T> clazz) {
this.clazz = clazz; this.clazz = clazz;
return this; return this;
@ -152,7 +141,7 @@ public class OkGoBuilder<T> {
getRequest(); getRequest();
break; break;
case 2: case 2:
postRequest(); postRequest(json);
break; break;
case 3: case 3:
postRequestFile(); postRequestFile();
@ -160,9 +149,6 @@ public class OkGoBuilder<T> {
case 4: case 4:
postRequestAloneFile(); postRequestAloneFile();
break; break;
case 5:
postsRequest();
break;
} }
return this; return this;
} }
@ -170,11 +156,11 @@ public class OkGoBuilder<T> {
/** /**
* post请求 * post请求
*/ */
private void postRequest() { private void postRequest(String json) {
OkGo OkGo
// 请求方式和请求url // 请求方式和请求url
.<T>post(url) .<T>post(url)
.params("param", json.toString()) .params("param", json)
// .upJson(json) // .upJson(json)
// 请求的 tag, 主要用于取消对应的请求 // 请求的 tag, 主要用于取消对应的请求
.tag(this) .tag(this)
@ -204,38 +190,6 @@ public class OkGoBuilder<T> {
} }
}); });
} }
/**
* post请求
*/
private void postsRequest() {
OkGo
// 请求方式和请求url
.<T>post(url)
.params("param", jsonArray.toString())
// .upJson(json)
// 请求的 tag, 主要用于取消对应的请求
.tag(this)
// 设置当前请求的缓存key,建议每个不同功能的请求设置一个
// .cacheKey("cacheKey")
// 缓存模式详细请看缓存介绍
// .cacheMode(CacheMode.DEFAULT)
.execute(new DialogCallback<T>(clazz) {
@Override
public void onSuccess(Response<T> response) {
callback.onSuccess(response.body(), 1);
}
@Override
public void onError(Response<T> response) {
super.onError(response);
Throwable throwable = response.getException();
if (throwable != null) {
throwable.printStackTrace();
callback.onError(throwable, 2);
}
}
});
}
/** /**
* get请求 * get请求

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

View File

@ -3,7 +3,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RadioButton <RadioButton
android:id="@+id/tv_option_layer_index" android:id="@+id/tv_option_layer_index"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -19,12 +22,14 @@
android:id="@+id/tv_option_content" android:id="@+id/tv_option_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</LinearLayout>
<ImageView
android:id="@+id/iv_option_img" <!-- <ImageView-->
android:layout_width="200dp" <!-- android:id="@+id/iv_option_img"-->
android:layout_height="100dp" <!-- android:layout_width="200dp"-->
android:src="@mipmap/top_bg" /> <!-- android:layout_height="100dp"-->
<!-- android:src="@mipmap/top_bg" />-->
</LinearLayout> </LinearLayout>

View File

@ -64,6 +64,7 @@
android:textSize="18sp" /> android:textSize="18sp" />
<EditText <EditText
android:id="@+id/et_attestationName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
@ -91,6 +92,7 @@
android:textSize="18sp" /> android:textSize="18sp" />
<EditText <EditText
android:id="@+id/et_namePhone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
@ -108,20 +110,57 @@
android:layout_height="150dp" android:layout_height="150dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:orientation="horizontal"> android:orientation="horizontal">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/iv_attestation1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="@color/colorPrimaryBlue"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/card_zhengmian"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*身份证人像面"
android:textColor="@color/white"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_attestation1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="@mipmap/checkbox" />
<ImageView <ImageView
android:id="@+id/iv_attestation2" android:id="@+id/iv_attestation2"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="100dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="@mipmap/checkbox" />
<ImageView
android:id="@+id/iv_attestation3"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@mipmap/checkbox" /> android:background="@mipmap/checkbox" />