提交 4a46cea3 authored 作者: lgd's avatar lgd

1.刷新token

2.//TODO erp用户是否选择新部门为空,质检接口数据无对应问题,内部交易订单审核,审核规则,领用申请列表/退件列表/参数,坩埚下单,mes,编辑任务担当无法修改.
上级 a275e057
package com.wd.workoffice.bean.event;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class RefreshTokenEvent {
public RefreshTokenEvent() {
}
}
...@@ -15,6 +15,7 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem; ...@@ -15,6 +15,7 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkBaseActivity; import com.wd.workoffice.app.WorkBaseActivity;
import com.wd.workoffice.bean.event.RefreshTokenEvent;
import com.wd.workoffice.ui.activity.login.LoginActivity; import com.wd.workoffice.ui.activity.login.LoginActivity;
import com.wd.workoffice.ui.adapter.VpMainAdapter; import com.wd.workoffice.ui.adapter.VpMainAdapter;
import com.wd.workoffice.ui.fg.MainFragment; import com.wd.workoffice.ui.fg.MainFragment;
...@@ -78,11 +79,7 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa ...@@ -78,11 +79,7 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
.addItem(new BottomNavigationItem(R.mipmap.main_my, "我的").setActiveColorResource(R.color.main_icon_select).setInActiveColorResource(R.color.main_icon)) .addItem(new BottomNavigationItem(R.mipmap.main_my, "我的").setActiveColorResource(R.color.main_icon_select).setInActiveColorResource(R.color.main_icon))
.initialise(); .initialise();
fm = getSupportFragmentManager(); fm = getSupportFragmentManager();
fragments = getFragments(); WorkUtils.refreshToken();
bnbMainBottomBar.setTabSelectedListener(this);
mainContent.setOffscreenPageLimit(3);
VpMainAdapter vpFgAdapter = new VpMainAdapter(fm, fragments);
mainContent.setAdapter(vpFgAdapter);
} }
@Override @Override
...@@ -162,10 +159,19 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa ...@@ -162,10 +159,19 @@ public class MainActivity extends WorkBaseActivity implements BottomNavigationBa
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void Login(LoginEvent lg) { public void login(LoginEvent lg) {
Intent intent = new Intent(MainActivity.this, LoginActivity.class); Intent intent = new Intent(MainActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
UserKeeper.getInstance().clearAll(); UserKeeper.getInstance().clearAll();
startActivity(intent); startActivity(intent);
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeView(RefreshTokenEvent refreshTokenEvent) {
fragments = getFragments();
bnbMainBottomBar.setTabSelectedListener(this);
mainContent.setOffscreenPageLimit(3);
VpMainAdapter vpFgAdapter = new VpMainAdapter(fm, fragments);
mainContent.setAdapter(vpFgAdapter);
}
} }
...@@ -18,12 +18,17 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -18,12 +18,17 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.Config; import com.wd.workoffice.app.Config;
import com.wd.workoffice.app.WorkApp; import com.wd.workoffice.app.WorkApp;
import com.wd.workoffice.bean.event.RefreshTokenEvent;
import com.wd.workoffice.bean.workEnum.OrderType; import com.wd.workoffice.bean.workEnum.OrderType;
import com.wd.workoffice.bean.workEnum.PermissionType; import com.wd.workoffice.bean.workEnum.PermissionType;
import com.wd.workoffice.retrofit.ApiService;
import com.wd.workoffice.retrofit.RtfUtils; import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.ui.adapter.StarAdapter; import com.wd.workoffice.ui.adapter.StarAdapter;
import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
...@@ -32,6 +37,7 @@ import java.util.Map; ...@@ -32,6 +37,7 @@ import java.util.Map;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import flexible.xd.android_base.network.rtfhttp.RtfHelper;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.Call; import retrofit2.Call;
...@@ -290,13 +296,13 @@ public class WorkUtils { ...@@ -290,13 +296,13 @@ public class WorkUtils {
if (response.isSuccessful()) { if (response.isSuccessful()) {
JSONObject data = response.body(); JSONObject data = response.body();
UserKeeper.getInstance().keepLoginInfo(data.toJSONString()); UserKeeper.getInstance().keepLoginInfo(data.toJSONString());
} else {
} }
EventBus.getDefault().post(new RefreshTokenEvent());
} }
@Override @Override
public void onFailure(Call<JSONObject> call, Throwable t) { public void onFailure(Call<JSONObject> call, Throwable t) {
EventBus.getDefault().post(new RefreshTokenEvent());
} }
}); });
} }
...@@ -352,10 +358,11 @@ public class WorkUtils { ...@@ -352,10 +358,11 @@ public class WorkUtils {
* @return * @return
*/ */
public static boolean isImg(String type) { public static boolean isImg(String type) {
return TextUtils.equals("jpeg",type)|| TextUtils.equals("gif",type)|| TextUtils.equals("webp",type)|| return TextUtils.equals("jpeg", type) || TextUtils.equals("gif", type) || TextUtils.equals("webp", type) ||
TextUtils.equals("png",type)|| TextUtils.equals("bmp",type)||TextUtils.equals("JPEG",type)|| TextUtils.equals("GIF",type)|| TextUtils.equals("WEBP",type)|| TextUtils.equals("png", type) || TextUtils.equals("bmp", type) || TextUtils.equals("JPEG", type) || TextUtils.equals("GIF", type) || TextUtils.equals("WEBP", type) ||
TextUtils.equals("PNG",type)|| TextUtils.equals("BMP",type); TextUtils.equals("PNG", type) || TextUtils.equals("BMP", type);
} }
/** /**
* 小星星布局 * 小星星布局
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论