|
|
@@ -308,7 +308,7 @@ public class ViewUtil {
|
|
|
Bundle bundle = new Bundle();
|
|
|
Message message = new Message();
|
|
|
bundle.putString("result", "{\n" +
|
|
|
- "\"exception\":\"网络未连接!\"\n" +
|
|
|
+ "\"exception\":\""+MyApplication.getInstance().getString(R.string.common_notlinknet)+"!\"\n" +
|
|
|
"}");
|
|
|
message.setData(bundle);
|
|
|
message.what = Constants.APP_SOCKETIMEOUTEXCEPTION;
|
|
|
@@ -351,7 +351,7 @@ public class ViewUtil {
|
|
|
} else {
|
|
|
Bundle bundle = new Bundle();
|
|
|
Message message = new Message();
|
|
|
- bundle.putString("result", "{\"exception\":\"网络未连接\"}");
|
|
|
+ bundle.putString("result", "{\"exception\":\""+MyApplication.getInstance().getString(R.string.common_notlinknet)+"\"}");
|
|
|
message.setData(bundle);
|
|
|
message.what = what;
|
|
|
handler.sendMessage(message);
|
|
|
@@ -367,7 +367,7 @@ public class ViewUtil {
|
|
|
ViewUtil.ct = ct;
|
|
|
mdProcessDialog = new MaterialDialog.Builder(ct).title(
|
|
|
MyApplication.getInstance().getString(R.string.app_dialog_title))
|
|
|
- .content("登录验证中,请稍等...")
|
|
|
+ .content(MyApplication.getInstance().getString(R.string.login_progress_erp))
|
|
|
.progress(true, 0)
|
|
|
.progressIndeterminateStyle(false)
|
|
|
.build();
|
|
|
@@ -394,20 +394,6 @@ public class ViewUtil {
|
|
|
|
|
|
}
|
|
|
|
|
|
-/* public static void LoginTaskERP(String user_phone, String user_password, Context ct) {
|
|
|
- ViewUtil.ct = ct;
|
|
|
- String url = Constants.BASE_URL_LOGIN;
|
|
|
- Map<String, String> params = new HashMap<String, String>();
|
|
|
- params.put("user", user_phone);
|
|
|
- params.put("password", user_password);
|
|
|
- Message message = new Message();
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- bundle.putString("phone", user_phone);
|
|
|
- bundle.putString("password", user_password);
|
|
|
- startNetThread(url, params, handler, Constants.SUCCESS_LOGIN, message,
|
|
|
- bundle, "get");
|
|
|
- }*/
|
|
|
-
|
|
|
public static void showDialogB2B(final String phone, final String password, final List<LoginEntity.Spaces> models) {
|
|
|
String[] items = new String[models.size()];
|
|
|
// int select = 0;
|
|
|
@@ -418,7 +404,7 @@ public class ViewUtil {
|
|
|
// return;
|
|
|
// } else {
|
|
|
new MaterialDialog.Builder(ct)
|
|
|
- .title("选择公司")
|
|
|
+ .title(MyApplication.getInstance().getString(R.string.login_company_select))
|
|
|
.items(items)
|
|
|
.itemsCallbackSingleChoice(0,
|
|
|
new MaterialDialog.ListCallbackSingleChoice() {
|
|
|
@@ -435,14 +421,14 @@ public class ViewUtil {
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
- }).positiveText("确定").show();
|
|
|
+ }).positiveText(MyApplication.getInstance().getString(R.string.common_sure)).show();
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
// 登录B2B
|
|
|
public static void LoginB2BTask(String phone, String password, Integer spaceId) {
|
|
|
- mdProcessDialog.setContent("正在验证B2B...");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_progress_b2b));
|
|
|
String url = ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().login;
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
params.put("appId", "b2b");
|
|
|
@@ -484,7 +470,7 @@ public class ViewUtil {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- ToastMessage(ct, "登录失败,请重新登录!", Style.holoRedLight, 3000);
|
|
|
+ ToastMessage(ct, MyApplication.getInstance().getString(R.string.login_error_erp), Style.holoRedLight, 3000);
|
|
|
}
|
|
|
break;
|
|
|
case Constants.SUCCESS_B2B:
|
|
|
@@ -523,12 +509,11 @@ public class ViewUtil {
|
|
|
|
|
|
public static void ChangeStatusERP(String result, boolean isBrodcast) {
|
|
|
if (mdProcessDialog != null) {
|
|
|
- mdProcessDialog.setContent("UAS验证成功!");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_success_erp));
|
|
|
}
|
|
|
if (ct == null) ct = MyApplication.getInstance();
|
|
|
Map<String, Object> dataMap = FlexJsonUtil.fromJson(result);
|
|
|
try {
|
|
|
- Log.i("Arison", "ChangeStatusERP:" + dataMap.get("sessionId").toString());
|
|
|
CommonUtil.setSharedPreferences(ct, "sessionId",
|
|
|
dataMap.get("sessionId").toString());
|
|
|
CommonUtil.setSharedPreferences(ct, "erp_username",
|
|
|
@@ -547,8 +532,6 @@ public class ViewUtil {
|
|
|
CommonUtil.setSharedPreferences(ct, "erp_emname", String.valueOf(dataMap.get("emname")));
|
|
|
}
|
|
|
if (erp_phone != null) {
|
|
|
- Log.i("login_status", "ChangeStatusERP:" + erp_phone);
|
|
|
- Log.i("login_status", "ChangeStatusERP:" + erp_password);
|
|
|
CommonUtil.setSharedPreferences(ct, "user_phone", erp_phone);
|
|
|
CommonUtil.setSharedPreferences(ct, "user_password", erp_password);
|
|
|
}
|
|
|
@@ -574,7 +557,7 @@ public class ViewUtil {
|
|
|
if (!new JsonValidator().validate(result)) return;
|
|
|
if (JSON.parseObject(result).getBoolean("success") == null) {
|
|
|
if (mdProcessDialog == null) return;
|
|
|
- mdProcessDialog.setContent("平台登录失败!");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_error_b2b));
|
|
|
mdProcessDialog.show();
|
|
|
handler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
@@ -584,17 +567,14 @@ public class ViewUtil {
|
|
|
}, 1500);
|
|
|
return;
|
|
|
}
|
|
|
- LogUtil.d("b2b login:" + result);
|
|
|
if (erp_phone != null) {
|
|
|
- Log.i("login_status", "ChangeStatusB2B:" + erp_phone);
|
|
|
- Log.i("login_status", "ChangeStatusB2B:" + erp_password);
|
|
|
CommonUtil.setSharedPreferences(ct, "user_phone", erp_phone);
|
|
|
CommonUtil.setSharedPreferences(ct, "user_password", erp_password);
|
|
|
}
|
|
|
if (ct == null) ct = MyApplication.getInstance();
|
|
|
CommonUtil.setSharedPreferences(ct, "b2b_login", true);
|
|
|
CommonUtil.setSharedPreferences(ct, "b2b_uu", b2b_uu);
|
|
|
- mdProcessDialog.setContent("验证B2B成功!");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_success_b2b));
|
|
|
handler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -777,7 +757,7 @@ public class ViewUtil {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- mdProcessDialog.setContent("手机号或者密码失败!");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_error_info));
|
|
|
handler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -1021,7 +1001,7 @@ public class ViewUtil {
|
|
|
Bundle bundle = new Bundle();
|
|
|
Message message = new Message();
|
|
|
bundle.putString("result", "{\n" +
|
|
|
- "\"exception\":\"网络未连接!\"\n" +
|
|
|
+ "\"exception\":\""+MyApplication.getInstance().getString(R.string.common_notlinknet)+"\"\n" +
|
|
|
"}");
|
|
|
message.setData(bundle);
|
|
|
message.what = Constants.APP_SOCKETIMEOUTEXCEPTION;
|
|
|
@@ -1035,7 +1015,7 @@ public class ViewUtil {
|
|
|
// 登录ERP
|
|
|
public static void LoginERPTask(String url, String master, String username,
|
|
|
String password) {
|
|
|
- mdProcessDialog.setContent("正在验证ERP...");
|
|
|
+ mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_progress_erp));
|
|
|
url = url + "mobile/login.action";
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
params.put("username", username);
|
|
|
@@ -1058,18 +1038,6 @@ public class ViewUtil {
|
|
|
ct.startActivity(intent_web);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @注释:跳转嵌入网页页面
|
|
|
- * @param: url 经过登录验证之后的URL路径跳转
|
|
|
- * text 客户端嵌入网页页面动态显示文字
|
|
|
- */
|
|
|
-// public static void webLinks(Context ct, String url, String text, boolean isCookie) {
|
|
|
-// Intent intent_web = new Intent(ct, WebViewCommActivity.class);
|
|
|
-// intent_web.putExtra("url", url);
|
|
|
-// intent_web.putExtra("p", text);
|
|
|
-// intent_web.putExtra("cookie", isCookie);
|
|
|
-// ct.startActivity(intent_web);
|
|
|
-// }
|
|
|
|
|
|
/**
|
|
|
* @desc:清楚登录信息
|