/** * 获取登录信息 * * @param context * @return */ public static User getLoginInfo(Context context) { if (mSPreferences == null) { mSPreferences = context.getSharedPreferences(USER_INFO, 0); } if (!TextUtils.isEmpty(mSPreferences.getString(USER_INFO_PHONE, ""))) { User u = new User(); u.setPhone(mSPreferences.getString(USER_INFO_PHONE, "")); u.setPassWord(mSPreferences.getString(USER_INFO_PASS, "")); return u; } else { return null; } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setTitleText("首页"); // initImageView(R.id.left_icon).setImageResource(R.drawable.ic_message); mUser = SharePreferencesUtil.getShopInfo(getActivity()); if (mUser.getQ_verifi() != 1) { mOnSelectTab.onSelect(4); } // 昨日营收 mTvSRY = (TextView) view.findViewById(R.id.sr_y); // 累计收入 mTvSRT = (TextView) view.findViewById(R.id.sr_t); // 余额 mTvSRE = (TextView) view.findViewById(R.id.sr_e); // 新的订单 mTvOrderNew = (TextView) view.findViewById(R.id.o_new); // 代收货订单 mTvOrderDai = (TextView) view.findViewById(R.id.o_dai); // 抢单订单 mTvOrderQiang = (TextView) view.findViewById(R.id.o_qiang); // 新增用户 mTvPNew = (TextView) view.findViewById(R.id.p_new); // 活跃用户 mTvPHou = (TextView) view.findViewById(R.id.p_huo); // 累计用户 mTvAll = (TextView) view.findViewById(R.id.p_all); mView1 = (LinearLayout) view.findViewById(R.id.view1); mView1.setOnClickListener(this); mView2 = (TextView) view.findViewById(R.id.view2); mView2.setOnClickListener(this); mView21 = (LinearLayout) view.findViewById(R.id.view2_1); mView21.setOnClickListener(this); mView22 = (LinearLayout) view.findViewById(R.id.view2_2); mView22.setOnClickListener(this); mView3 = (LinearLayout) view.findViewById(R.id.view3); mView3.setOnClickListener(this); mView4 = (LinearLayout) view.findViewById(R.id.view4); mView4.setOnClickListener(this); mTvName = (TextView) view.findViewById(R.id.name); mTvName.setText(mUser.getName()); mTvName.setOnClickListener(this); JSONObject jb = new JSONObject(); mAppHttpClient.postData1( HOME, new AppAjaxParam(jb), new onResultListener() { @Override public void onResult(String data, String msg) { try { JSONObject jb = new JSONObject(data); JSONObject jb1 = new JSONObject(jb.getString("custormer")); mTvPNew.setText(jb1.getString("new_add")); mTvPHou.setText(jb1.getString("hyl")); mTvAll.setText(jb1.getString("allU")); JSONObject jb2 = new JSONObject(jb.getString("order")); mTvOrderDai.setText(jb2.getString("shouHuo")); mTvOrderNew.setText(jb2.getString("newOrder")); mTvOrderQiang.setText(jb2.getString("robOrder")); JSONObject jb3 = new JSONObject(jb.getString("account")); mTvSRE.setText(PriceUtil.floatToString(jb3.getInt("balance"))); mTvSRT.setText(PriceUtil.floatToString(jb3.getInt("LJYS"))); mTvSRY.setText(PriceUtil.floatToString(jb3.getInt("YS"))); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onError(String error) {} }); }