|
|
@@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.common.LogUtil;
|
|
|
import com.core.app.MyApplication;
|
|
|
import com.core.base.BaseActivity;
|
|
|
+import com.core.utils.CommonUtil;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
@@ -39,7 +40,7 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
webView.getSettings().setDatabaseEnabled(true);
|
|
|
webView.getSettings().setAppCacheEnabled(true);
|
|
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
|
|
- //initBusinessToken();
|
|
|
+ initBusinessToken();
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
String url = intent.getStringExtra("url");
|
|
|
@@ -68,17 +69,19 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
super.onPageFinished(view, url);
|
|
|
}
|
|
|
});
|
|
|
- // webView.loadUrl(url);
|
|
|
+ // webView.loadUrl(url);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ //企业uu为空,则取附近账套和子帐套的
|
|
|
public void initBusinessToken(){
|
|
|
+ LogUtil.d(TAG, CommonUtil.getSharedPreferences(this,"erp_uu"));
|
|
|
+
|
|
|
HttpClient httpClient=new HttpClient.Builder("https://account.ubtob.com/").build();
|
|
|
httpClient.Api().send(new HttpClient.Builder()
|
|
|
.url("api/user/getToken")
|
|
|
.add("appId","b2b")
|
|
|
- .add("spaceDialectUID","0")
|
|
|
+ .add("spaceDialectUID",CommonUtil.getSharedPreferences(this,"erp_uu"))
|
|
|
.add("uid", MyApplication.getInstance().mLoginUser.getTelephone())
|
|
|
.method(Method.GET)
|
|
|
.build(),new ResultSubscriber<Object>(new ResultListener<Object>() {
|
|
|
@@ -86,10 +89,6 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
try {
|
|
|
-// {
|
|
|
-// "success": true,
|
|
|
-// "content": "fe7120a70d3c40c59830dbb5c0efb7f7"
|
|
|
-// }
|
|
|
LogUtil.d(TAG,o.toString());
|
|
|
String token= JSON.parseObject(o.toString()).getString("content");
|
|
|
String url="https://account.ubtob.com/sso/login/proxy?appId=b2b&returnURL=https://www.usoftmall.com&token="+token+"&baseURL=https://www.usoftmall.com/login/other&isLoginAll=false";
|
|
|
@@ -121,6 +120,8 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
public void setThirdPartyCookiesEnabled(final boolean enabled) {
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, enabled);
|
|
|
+ }else {
|
|
|
+ CookieManager.getInstance().setAcceptCookie(true);
|
|
|
}
|
|
|
}
|
|
|
|