提交 410c0ed2 authored 作者: lgd's avatar lgd

1.setting 退出登录

2.//TODO erp用户激活,忘记密码测试,产品下单还差附件,bat,mes,消息,我的,刷新token
上级 3e4dde66
...@@ -544,6 +544,22 @@ ...@@ -544,6 +544,22 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Work.Base" android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.user.UserInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:label="个人资料"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.user.UserSettingActivity"
android:configChanges="keyboardHidden|orientation"
android:label="系统设置"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
......
...@@ -65,7 +65,7 @@ public class UserInfoBean { ...@@ -65,7 +65,7 @@ public class UserInfoBean {
private String access; private String access;
private String ofDeptRuler; private String ofDeptRuler;
private Object roleNames; private Object roleNames;
private Object deptName; private String deptName;
private Object roleId; private Object roleId;
private Object deptId; private Object deptId;
private List<RolesBean> roles; private List<RolesBean> roles;
...@@ -223,11 +223,11 @@ public class UserInfoBean { ...@@ -223,11 +223,11 @@ public class UserInfoBean {
this.roleNames = roleNames; this.roleNames = roleNames;
} }
public Object getDeptName() { public String getDeptName() {
return deptName; return deptName;
} }
public void setDeptName(Object deptName) { public void setDeptName(String deptName) {
this.deptName = deptName; this.deptName = deptName;
} }
......
package com.wd.workoffice.ui.activity.user;
import android.text.TextUtils;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.PermissionBean;
import com.wd.workoffice.bean.UserInfoBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.util.UserKeeper;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* 我的 - 信息
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class UserInfoActivity extends WorkToolBarActivity {
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.tv_phone)
TextView tvPhone;
@BindView(R.id.tv_no)
TextView tvNo;
@BindView(R.id.tv_dep)
TextView tvDep;
@Override
protected void initView() {
ButterKnife.bind(this);
String userInfo = UserKeeper.getInstance().getUserInfo();
if (!TextUtils.isEmpty(userInfo)) {
UserInfoBean userInfoBean = JSON.parseObject(userInfo, UserInfoBean.class);
tvName.setText(userInfoBean.getUserName());
tvPhone.setText(userInfoBean.getPhone());
tvNo.setText(userInfoBean.getOfDept().getName());
tvDep.setText(userInfoBean.getDeptName());
}
}
@Override
protected void initData() {
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_user_info;
}
}
package com.wd.workoffice.ui.activity.user;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.PermissionBean;
import com.wd.workoffice.bean.UserInfoBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.MainActivity;
import com.wd.workoffice.ui.activity.login.LoginActivity;
import com.wd.workoffice.util.UserKeeper;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* 我的 - 设置
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class UserSettingActivity extends WorkToolBarActivity {
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.rl_account)
RelativeLayout rlAccount;
@BindView(R.id.tv_phone)
TextView tvPhone;
@BindView(R.id.rl_phone)
RelativeLayout rlPhone;
@BindView(R.id.rl_pwd)
RelativeLayout rlPwd;
@BindView(R.id.rl_about)
RelativeLayout rlAbout;
@BindView(R.id.btn_logout)
Button btnLogout;
@Override
protected void initView() {
ButterKnife.bind(this);
String userInfo = UserKeeper.getInstance().getUserInfo();
if (!TextUtils.isEmpty(userInfo)) {
UserInfoBean userInfoBean = JSON.parseObject(userInfo, UserInfoBean.class);
tvName.setText(userInfoBean.getUserName());
tvPhone.setText(userInfoBean.getPhone());
}
}
@Override
protected void initData() {
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_user_setting;
}
@OnClick({R.id.rl_account, R.id.rl_phone, R.id.rl_pwd, R.id.rl_about, R.id.btn_logout})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.rl_account:
break;
case R.id.rl_phone:
break;
case R.id.rl_pwd:
break;
case R.id.rl_about:
break;
case R.id.btn_logout:
logout();
break;
}
}
private void logout() {
RtfUtils.getRtf().logout().compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
toast("退出成功");
Intent intent = new Intent(UserSettingActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
UserKeeper.getInstance().clearAll();
startActivity(intent);
}
});
}
}
...@@ -6,6 +6,9 @@ import android.widget.TextView; ...@@ -6,6 +6,9 @@ import android.widget.TextView;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkBaseFg; import com.wd.workoffice.app.WorkBaseFg;
import com.wd.workoffice.ui.activity.user.UserInfoActivity;
import com.wd.workoffice.ui.activity.user.UserPermissionActivity;
import com.wd.workoffice.ui.activity.user.UserSettingActivity;
import com.wd.workoffice.util.UserKeeper; import com.wd.workoffice.util.UserKeeper;
import butterknife.BindView; import butterknife.BindView;
...@@ -58,10 +61,13 @@ public class MyFragment extends WorkBaseFg { ...@@ -58,10 +61,13 @@ public class MyFragment extends WorkBaseFg {
public void onViewClicked(View view) { public void onViewClicked(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.ll_role: case R.id.ll_role:
startActivity(UserPermissionActivity.class);
break; break;
case R.id.ll_info: case R.id.ll_info:
startActivity(UserInfoActivity.class);
break; break;
case R.id.ll_setting: case R.id.ll_setting:
startActivity(UserSettingActivity.class);
break; break;
} }
} }
......
...@@ -18,7 +18,6 @@ public class UserKeeper { ...@@ -18,7 +18,6 @@ public class UserKeeper {
private SPUtils sp = SPUtils.getInstance("UserKeeper"); private SPUtils sp = SPUtils.getInstance("UserKeeper");
private final String LOGIN_INFO = "_LOGIN_INFO"; private final String LOGIN_INFO = "_LOGIN_INFO";
private final String USER_INFO = "_USER_INFO"; private final String USER_INFO = "_USER_INFO";
private final String ACCOUNT = "_ACCOUNT";
private UserKeeper() { private UserKeeper() {
} }
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="头像"
android:textSize="16sp" />
<ImageView
android:layout_width="40mm"
android:layout_height="40mm"
android:layout_alignParentRight="true"
android:src="@mipmap/my_head"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户姓名"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="联系电话"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="员工编号"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="所属部门"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_dep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:id="@+id/rl_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="手机号"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="销售二公司"
android:textColor="@color/flexible_text_gray"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:id="@+id/rl_pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="修改密码"
android:textSize="16sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@mipmap/arrow_right_my" />
</RelativeLayout>
<View style="@style/dividerX" />
<RelativeLayout
android:id="@+id/rl_about"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="关于软件"
android:textSize="16sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@mipmap/arrow_right_my" />
</RelativeLayout>
<Button
android:id="@+id/btn_logout"
android:text="退出登录"
android:background="@color/input_background"
android:layout_width="match_parent"
android:layout_height="50mm"
android:layout_marginHorizontal="40mm"
android:layout_marginTop="20mm" />
</LinearLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论