页面跳转前对ToKen判断
来源:互联网 发布:丹爷辣椒酱淘宝 编辑:程序博客网 时间:2024/05/18 01:35
public class GetMyWalletInfo {private Context context;private String action;public GetMyWalletInfo(Context context, String action) {this.context = context;this.action = action;}/*public GetMyWalletInfo(Context context) {this.context = context;}*/public void getMyWallet() {if (new GetSharePerfence(context).getToken().equals("")) {Toast.makeText(context, "请先登录", Toast.LENGTH_LONG).show();Intent intent = new Intent(context, LoginActivity.class);intent.putExtra("action",action);context.startActivity(intent);} else {RequestParams parmas = new RequestParams(Config.WALLETURL);parmas.addHeader("token", new GetSharePerfence(context).getToken());x.http().get(parmas, new MyCallBack<String>() {@Overridepublic void onSuccess(String result) {Gson gson = new Gson();ErrorMsg errorMsg = gson.fromJson(result, ErrorMsg.class);if (errorMsg.getErrorCode() == 300) {//错误码未300表示token过期Toast.makeText(context, "已过期,请重新登录", Toast.LENGTH_LONG).show();Intent intent = new Intent(context, LoginActivity.class);intent.putExtra("action",action);context.startActivity(intent);} else {Intent intent =new Intent();intent.setAction(action);context.startActivity(intent);}super.onSuccess(result);}});}}}--------------------------------------------点击前的token判断@Overridepublic void onClick(View view) {switch (view.getId()) {case R.id.helper:new GetMyWalletInfo(getContext(), "com.carinsurance").getMyWallet();// getUserInfo(); //实名认证break;case R.id.rl_wallet:new GetMyWalletInfo(getContext(), "com.home").getMyWallet();break;case R.id.rl_task:new GetMyWalletInfo(getContext(), "com.insurance").getMyWallet();break;case R.id.rl_baojai:new GetMyWalletInfo(getContext(), "com.home.baojia").getMyWallet();break;}}
阅读全文
0 0
- 页面跳转前对ToKen判断
- axios 拦截 , 页面跳转, token 验证(经常用于判断用户是否登录)
- 页面提交前判断
- ionic ionic2进入App前判断是否登录,进入页面之前作判断,实现未登录跳转
- 判断页面跳转的平台
- Vue-resource拦截器判断token失效跳转
- Page.IsValid 判断页面是否有效前需要先对验证控件进行验证
- 实现页面跳转到前一页!
- Laravel5自动跳转到登陆前页面
- 登录后跳转到登录前页面
- Android页面跳转结束前一个activity
- Swift 登录页面跳转,条件判断 ,页面跳转
- Swift 登录页面跳转,条件判断 ,页面跳转
- Swift 登录页面跳转,条件判断 ,页面跳转
- 先在JSP页面判断然后再跳转
- ASP根据IP来判断跳转页面
- 判断登录与否,确定跳转页面
- js判断移动,平板跳转页面
- AFNetworking 的详细使用
- 各类研究数据集合
- javascript Date format(js日期格式化)
- 京东轮播图
- Java file方法的路径特性
- 页面跳转前对ToKen判断
- 【maven】单元测试
- Cocos2dx三种定时器的使用
- 两个页面传值时提取url后面的参数
- Hibernate原理及框架结构以增删改查语句
- Jetson Tx2下ORBSLAM2的安装
- centos 7 安装卸载apache(httpd)服务
- JSP学习笔记(四)------JSTL外链标签库
- Rails 发送邮件配置