|
|
@@ -13,8 +13,14 @@ import android.webkit.WebSettings;
|
|
|
import android.webkit.WebView;
|
|
|
import android.webkit.WebViewClient;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.common.LogUtil;
|
|
|
+import com.core.app.MyApplication;
|
|
|
import com.core.base.BaseActivity;
|
|
|
+import com.me.network.app.http.HttpClient;
|
|
|
+import com.me.network.app.http.Method;
|
|
|
+import com.me.network.app.http.rx.ResultListener;
|
|
|
+import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
import com.modular.apputils.R;
|
|
|
|
|
|
public class SimpleWebActivity extends BaseActivity {
|
|
|
@@ -33,7 +39,7 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
webView.getSettings().setDatabaseEnabled(true);
|
|
|
webView.getSettings().setAppCacheEnabled(true);
|
|
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
|
|
-
|
|
|
+ //initBusinessToken();
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
String url = intent.getStringExtra("url");
|
|
|
@@ -62,10 +68,38 @@ private static final String TAG = "SimpleWebActivity";
|
|
|
super.onPageFinished(view, url);
|
|
|
}
|
|
|
});
|
|
|
- webView.loadUrl(url);
|
|
|
+ // webView.loadUrl(url);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ public void initBusinessToken(){
|
|
|
+ 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("uid", MyApplication.getInstance().mLoginUser.getTelephone())
|
|
|
+ .method(Method.GET)
|
|
|
+ .build(),new ResultSubscriber<Object>(new ResultListener<Object>() {
|
|
|
+
|
|
|
+ @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";
|
|
|
+ webView.loadUrl(url);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
|
|
|
public static void synCookies(Context context, String url,String cookies) {
|
|
|
CookieSyncManager.createInstance(context);
|