|
|
@@ -33,6 +33,9 @@ import com.uas.baigang_workshop_workstation.util.CommonUtil;
|
|
|
import com.uas.baigang_workshop_workstation.util.Constants;
|
|
|
import com.uas.baigang_workshop_workstation.util.LogUtil;
|
|
|
|
|
|
+import org.json.JSONException;
|
|
|
+import org.json.JSONObject;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -65,6 +68,7 @@ public class LoginFragment extends BaseFragment implements AdapterView.OnItemSel
|
|
|
public void handleMessage(Message msg) {
|
|
|
progressDialog.dismiss();
|
|
|
String tip = (String) msg.obj;
|
|
|
+ Log.e("aaa", "登录数据为:" + tip);
|
|
|
switch (msg.what) {
|
|
|
case VolleyUtil.SUCCESS_SUCCESS:
|
|
|
String userName = userEditText.getText().toString().trim();
|
|
|
@@ -80,12 +84,25 @@ public class LoginFragment extends BaseFragment implements AdapterView.OnItemSel
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.ACCOUNT_NAME_CACHE, maName);
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.ACCOUNT_FUNNAME_CACHE, maFunName);
|
|
|
|
|
|
-// String em_name = jsonObject.optString("em_name");
|
|
|
-// String em_code = jsonObject.optString("em_code");
|
|
|
-
|
|
|
-
|
|
|
- SharedPreUtil.saveString(mActivity, Constants.FLAG.CACHE_USER_EMNAME, userName);
|
|
|
- SharedPreUtil.saveString(mActivity,Constants.FLAG.CACHE_USER_EMCODE,maName);
|
|
|
+ // String em_name = jsonObject.optString("em_name");
|
|
|
+ // String em_code = jsonObject.optString("em_code");
|
|
|
+
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = null;
|
|
|
+ try {
|
|
|
+ jsonObject = new JSONObject(tip);
|
|
|
+ boolean isSuccess = jsonObject.getBoolean("success");
|
|
|
+ String em_name = jsonObject.getString("em_name");
|
|
|
+ if (isSuccess) {
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.FLAG.CACHE_USER_EMNAME, em_name);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.FLAG.CACHE_USER_EMCODE, userName);
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
|
|
|
//保存登录数据,用于应用内切换登录
|
|
|
if (mCyCheckBox.isChecked()) {
|
|
|
@@ -198,8 +215,8 @@ public class LoginFragment extends BaseFragment implements AdapterView.OnItemSel
|
|
|
|
|
|
@Override
|
|
|
protected void initEvents() {
|
|
|
-// btnLogin.setFocusable(true);
|
|
|
-// btnLogin.setFocusableInTouchMode(true);
|
|
|
+ // btnLogin.setFocusable(true);
|
|
|
+ // btnLogin.setFocusableInTouchMode(true);
|
|
|
masterSpinner.setOnItemSelectedListener(this);
|
|
|
userEditText.setOnFocusChangeListener(this);
|
|
|
pwdEditText.setOnFocusChangeListener(this);
|