From 2b249ff5e4ddf5d621486045da854c03f642d9db Mon Sep 17 00:00:00 2001 From: fyf Date: Thu, 9 Nov 2023 17:26:11 +0800 Subject: [PATCH] 3 --- .../bonait/bnframework/business/MainInit.java | 2 +- .../mine/fragment/from/UserActivity.java | 25 +++--- app/src/main/res/layout/activity_user.xml | 78 +++++++++++-------- .../res/layout/datatab/layout/user_item.xml | 54 +++++++------ 4 files changed, 88 insertions(+), 71 deletions(-) diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java index 8bc6e4af..f8634aad 100644 --- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java +++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java @@ -190,7 +190,7 @@ public class MainInit { user.account = "admin"; user.pass = "123456"; user.deviceID = ConfigName.getInstance().DeviceId; - user.userID = "20230415-fyf"; + user.userID = "超级管理员"; user.exp = "管理员"; QueryDB.AddUser(user); diff --git a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/from/UserActivity.java b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/from/UserActivity.java index c1b280d9..f9e2229d 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/from/UserActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/from/UserActivity.java @@ -43,6 +43,7 @@ public class UserActivity extends BaseActivity implements MyClickListener { * 用户数据 */ ArrayList bpa_users = new ArrayList<>(); + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -55,7 +56,7 @@ public class UserActivity extends BaseActivity implements MyClickListener { private void initTopBar() { mTopBar.setTitle("账户管理"); - mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { + mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); @@ -89,8 +90,7 @@ public class UserActivity extends BaseActivity implements MyClickListener { public void onClick(QMUIDialog dialog, int index) { CharSequence text = builder_add.getEditText().getText(); if (text != null && text.length() > 0) { - if(text.toString().equals("admin")) - { + if (text.toString().equals("admin")) { ToastUtils.warning("不能设置账号为admin!"); return; } @@ -99,7 +99,7 @@ public class UserActivity extends BaseActivity implements MyClickListener { bpa_user.account = text.toString(); bpa_user.pass = "123456"; bpa_user.deviceID = ConfigName.getInstance().DeviceId; - bpa_user.userID = ConfigName.getInstance().user.userID; + bpa_user.userID = ConfigName.getInstance().user.userID;//更改为,用户权限 // 一般用户 研发用户 超级管理员 QueryDB.AddUser(bpa_user); ToastUtils.info("新增成功"); Initdata(); @@ -131,10 +131,9 @@ public class UserActivity extends BaseActivity implements MyClickListener { @Override public void clickListener(View v, Object data) { - String name= ((BPA_USER) data).name; - String ac= ((BPA_USER) data).account; - if(name.equals("admin") || ac.equals("admin")) - { + String name = ((BPA_USER) data).name; + String ac = ((BPA_USER) data).account; + if (name.equals("admin") || ac.equals("admin")) { ToastUtils.warning("对不起,admin账户禁止操作!"); return; } @@ -155,11 +154,8 @@ public class UserActivity extends BaseActivity implements MyClickListener { @Override public void onClick(QMUIDialog dialog, int index) { CharSequence text = builder.getEditText().getText(); - - - if (text != null && text.length() > 0 ) { - if(text.toString().equals("admin")) - { + if (text != null && text.length() > 0) { + if (text.toString().equals("admin")) { ToastUtils.warning("不能设置账号为admin!"); return; } @@ -192,8 +188,7 @@ public class UserActivity extends BaseActivity implements MyClickListener { public void onClick(QMUIDialog dialog, int index) { CharSequence text = builder1.getEditText().getText(); if (text != null && text.length() > 0) { - if(text.toString().equals("admin")) - { + if (text.toString().equals("admin")) { ToastUtils.warning("不能设置账号为admin!"); return; } diff --git a/app/src/main/res/layout/activity_user.xml b/app/src/main/res/layout/activity_user.xml index 0d14b1e4..03193a64 100644 --- a/app/src/main/res/layout/activity_user.xml +++ b/app/src/main/res/layout/activity_user.xml @@ -8,11 +8,12 @@ android:fitsSystemWindows="true" android:orientation="vertical" tools:context=".modules.mine.fragment.from.UserActivity"> + + android:layout_marginTop="?attr/qmui_topbar_height" + android:background="@color/qmui_config_color_white"> + + + +