Skip to content

Commit 78f456e

Browse files
committed
[feat]add whitelist
1 parent 2f90f24 commit 78f456e

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

src/constants/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
export const BOOL = {
2-
TRUE: '1',
3-
FALSE: '0',
4-
};
5-
61
export const LOCKED_OPTIONS = [
7-
{ value: BOOL.FALSE, label: '正常' },
8-
{ value: BOOL.TRUE, label: '已锁定' },
2+
{ value: false, label: '正常' },
3+
{ value: true, label: '已锁定' },
94
];
105

116
// 通用请求头
@@ -19,3 +14,9 @@ export const PAGE = {
1914
NUM: '1',
2015
SIZE: '20',
2116
};
17+
18+
export const WHITELIST_OPTIONS = [
19+
{ value: 0, label: 'permission' },
20+
{ value: 1, label: 'jwt' },
21+
{ value: 2, label: 'idempotent' },
22+
];

src/modules/store.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import systemUser from './system/user';
1111
import systemUserGroup from './system/userGroup';
1212
import systemRole from './system/role';
1313
import systemAction from './system/action';
14+
import systemWhitelist from './system/whitelist';
1415

1516
const reducer = combineReducers({
1617
global,
@@ -23,6 +24,7 @@ const reducer = combineReducers({
2324
systemUserGroup,
2425
systemRole,
2526
systemAction,
27+
systemWhitelist,
2628
});
2729

2830
export const store = configureStore({

src/pages/System/User/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export const SelectTable = () => {
260260
async function handleRowLockConfirm() {
261261
const params = {
262262
id: lockDialogRow.id,
263-
locked: 1,
263+
locked: true,
264264
lockExpireTime: '',
265265
};
266266
if (!lockDialogForever) {
@@ -300,7 +300,7 @@ export const SelectTable = () => {
300300
async function handleRowUnlockConfirm() {
301301
const params = {
302302
id: unlockDialogRow.id,
303-
locked: 0,
303+
locked: false,
304304
};
305305
try {
306306
setEditLoading(true);
@@ -511,7 +511,7 @@ export const SelectTable = () => {
511511
let lock = false;
512512
let unlock = false;
513513
if (props.edit) {
514-
if (props.row.locked === BOOL.FALSE) {
514+
if (!props.row.locked) {
515515
lock = true;
516516
unlock = false;
517517
} else {
@@ -677,7 +677,7 @@ export const SelectTable = () => {
677677
ellipsis: true,
678678
colKey: 'locked',
679679
cell(record) {
680-
if (record.row.locked === BOOL.FALSE) {
680+
if (!record.row.locked) {
681681
return (
682682
<Tag theme='success' variant='light'>
683683
正常

src/router/modules/system.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ const system: IRouter[] = [
3838
title: '行为',
3939
},
4040
},
41+
{
42+
path: 'whitelist',
43+
Component: lazy(() => import('pages/System/Whitelist')),
44+
meta: {
45+
title: '白名单',
46+
},
47+
},
4148
],
4249
},
4350
];

src/services/model/userModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface UserStatusReply {
1717
id: string;
1818
img: string;
1919
};
20-
locked: string;
20+
locked: bool;
2121
lockExpire: string;
2222
}
2323

@@ -39,7 +39,7 @@ export interface User {
3939
username: string;
4040
code: string;
4141
status: string;
42-
locked: string;
42+
locked: bool;
4343
lockMsg: string;
4444
platform: string;
4545
lastLogin: string;

0 commit comments

Comments
 (0)