@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == 0) {
      requestAllState();

    } else if (requestCode == FLAG_CHOOSE_IMG && resultCode == RESULT_OK) { // 选择图片
      if (data != null) {
        Uri uri = data.getData();
        if (!TextUtils.isEmpty(uri.getAuthority())) {
          Cursor cursor =
              getContentResolver()
                  .query(uri, new String[] {MediaStore.Images.Media.DATA}, null, null, null);
          if (null == cursor) {
            Toast.makeText(this, "图片没找到", Toast.LENGTH_SHORT).show();
            return;
          }
          cursor.moveToFirst();
          String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
          cursor.close();
          Log.i("===", "path=" + path);
          Intent intent = new Intent(this, CropImageActivity.class);
          intent.putExtra("path", path);
          startActivityForResult(intent, FLAG_MODIFY_FINISH);

        } else {
          Log.i("===", "path=" + uri.getPath());
          Intent intent = new Intent(this, CropImageActivity.class);
          intent.putExtra("path", uri.getPath());
          startActivityForResult(intent, FLAG_MODIFY_FINISH);
        }
      }
    } else if (requestCode == FLAG_CHOOSE_PHONE && resultCode == RESULT_OK) { // 拍照
      File f = new File(FILE_PIC_SCREENSHOT, localTempImageFileName);
      Intent intent = new Intent(this, CropImageActivity.class);
      intent.putExtra("path", f.getAbsolutePath());
      startActivityForResult(intent, FLAG_MODIFY_FINISH);

    } else if (requestCode == FLAG_MODIFY_FINISH && resultCode == RESULT_OK) {
      if (data != null) {
        final String path = data.getStringExtra("path");
        Log.i("===", "截取到的图片路径是 = " + path);

        Bitmap b = BitmapFactory.decodeFile(path);

        headImageView.setImageBitmap(b);

        headerImageStr = bitmap2Base64(b);

        requestSetUserLogo();
      }
    }
  }
  private void initView() {
    ((TextView) this.findViewById(R.id.titleTextView)).setText("个人认证");
    this.findViewById(R.id.backBtn).setOnClickListener(this);

    headLogoView = (DavinciView) this.findViewById(R.id.headLogoView);
    headLogoView.getLogoImageView().setVisibility(View.GONE);
    headLogoView.getTitleTextView().setText("设置头像");
    headLogoView.getImportantTextView().setVisibility(View.VISIBLE);
    headLogoView.getTipTextView().setText("");
    headLogoView.setOnClickListener(this);

    headImageView = (CustomNetworkImageView) this.findViewById(R.id.headImageView);
    headImageView.setErrorImageResId(R.drawable.head_keeper_default);
    headImageView.setDefaultImageResId(R.drawable.head_keeper_default);
    if (agentDto != null) {
      headImageView.setImageUrl(
          Constants.HOST_IP
              + agentDto.getLogoUrl()
              + "?random="
              + ActivityUtil.getSharedPreferences().getString(Constants.HEAD_RANDOM, "0"),
          ImageCacheManager.getInstance().getImageLoader());
    }

    transferPwdView = (DavinciView) this.findViewById(R.id.transferPwdView);
    transferPwdView.getLogoImageView().setVisibility(View.GONE);
    transferPwdView.getTitleTextView().setText("交易密码");
    transferPwdView.getImportantTextView().setVisibility(View.VISIBLE);
    transferPwdView.getTipTextView().setText("");
    transferPwdView.setOnClickListener(this);

    modifyLoginPwdView = (DavinciView) this.findViewById(R.id.modifyLoginPwdView);
    modifyLoginPwdView.getLogoImageView().setVisibility(View.GONE);
    modifyLoginPwdView.getTitleTextView().setText("修改登录密码");
    modifyLoginPwdView.getTipTextView().setText("");
    modifyLoginPwdView.setOnClickListener(this);

    modifyGestureLockView = (DavinciView) this.findViewById(R.id.modifyGestureLockView);
    modifyGestureLockView.getLogoImageView().setVisibility(View.GONE);
    modifyGestureLockView.getTitleTextView().setText("管理手势密码");
    modifyGestureLockView.getTipTextView().setText("");
    modifyGestureLockView.setOnClickListener(this);

    bankCardView = (DavinciView) this.findViewById(R.id.bankCardView);
    bankCardView.getLogoImageView().setVisibility(View.GONE);
    bankCardView.getTitleTextView().setText("银行卡");
    bankCardView.getImportantTextView().setVisibility(View.VISIBLE);
    bankCardView.getTipTextView().setText("");
    bankCardView.setOnClickListener(this);

    cardIdView = (DavinciView) this.findViewById(R.id.cardIdView);
    cardIdView.getLogoImageView().setVisibility(View.GONE);
    cardIdView.getTitleTextView().setText("身份证照片");
    cardIdView.getImportantTextView().setVisibility(View.VISIBLE);
    cardIdView.getTipTextView().setText("");
    cardIdView.setOnClickListener(this);

    jobPhotoView = (DavinciView) this.findViewById(R.id.jobPhotoView);
    jobPhotoView.getLogoImageView().setVisibility(View.GONE);
    jobPhotoView.getTitleTextView().setText("工作证照片");
    jobPhotoView.getImportantTextView().setVisibility(View.VISIBLE);
    jobPhotoView.getTipTextView().setText("");
    jobPhotoView.setOnClickListener(this);
  }