@Override
    public View getViewForRow(View convertView, ViewGroup parent, int section, int row) {
      View view = null;
      if (section == 0) {
        if (AccountService.instance().isLogin()) {
          MineHeaderView headerView = MineHeaderView.create(getActivity());
          Account account = AccountService.instance().account();
          headerView.getAvartaIv().setImageUrl(account.getAvatar());
          headerView.getNameTv().setText(account.getNickName());
          headerView.getAgeTv().setText(account.getMobile());
          view = headerView;

        } else {
          view =
              LayoutInflater.from(getActivity())
                  .inflate(R.layout.layout_mine_header_not_login, null);
          view.findViewById(R.id.login_btn)
              .setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      Intent intent =
                          new Intent(Intent.ACTION_VIEW, Uri.parse("sgteacher://login"));
                      startActivity(intent);
                    }
                  });
        }

      } else {
        SimpleListItem simpleListItem = SimpleListItem.create(getActivity());
        simpleListItem.setShowArrow(true);
        if (section == 1) {
          if (row == 0) {
            simpleListItem.setTitle("成为助教");
            simpleListItem.setIcon(R.drawable.ic_mine_order);
          }
        } else if (section == 2) {
          if (row == 0) {
            simpleListItem.setTitle("系统消息");
            simpleListItem.setIcon(R.drawable.ic_mine_feedback);
            int unreadSys =
                RongIM.getInstance()
                    .getRongIMClient()
                    .getUnreadCount(Conversation.ConversationType.SYSTEM);
            if (unreadSys > 0) {
              simpleListItem.getDotView().setVisibility(View.VISIBLE);
            } else {
              simpleListItem.getDotView().setVisibility(View.GONE);
            }

          } else {
            simpleListItem.setTitle("关于我们");
            simpleListItem.setIcon(R.drawable.ic_mine_setting);
          }
        }
        view = simpleListItem;
      }
      return view;
    }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    titleBar.getTitleTv().setText("我的");

    AccountService.instance().addListener(this);
  }
  private void doRCIMConnect(final int tryTime) {
    if (!AccountService.instance().isLogin()) {
      return;
    }
    String imToken = AccountService.instance().account().getImToken();
    if (imToken == null) {
      return;
    }

    RongIM.connect(
        AccountService.instance().account().getImToken(),
        new RongIMClient.ConnectCallback() {
          @Override
          public void onTokenIncorrect() {
            // Connect Token 失效的状态处理,需要重新获取 Token

            if (tryTime > 0) {
              HttpService.post(
                  Constants.domain() + "/im/token",
                  null,
                  IMTokenModel.class,
                  new RequestHandler() {
                    @Override
                    public void onRequestFinish(Object response) {
                      IMTokenModel model = (IMTokenModel) response;
                      AccountService.instance().account().setImToken(model.getData());
                      doRCIMConnect(tryTime - 1);
                    }

                    @Override
                    public void onRequestFailed(BaseModel error) {}
                  });
            }
          }

          @Override
          public void onSuccess(String userId) {}

          @Override
          public void onError(RongIMClient.ErrorCode errorCode) {}
        });
  }
 @Override
 public void onDestroy() {
   AccountService.instance().removeListener(this);
   super.onDestroy();
 }