fix(entry): add entry
This commit is contained in:
35
app/entry/page.tsx
Normal file
35
app/entry/page.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
"use client"
|
||||
|
||||
import { useUserStore } from "@/app/store/user"
|
||||
import { usePermissionStore } from "@/components/label/store/auth"
|
||||
import { getUserPermission } from "@/components/login/api"
|
||||
import { useCallback, useEffect } from "react"
|
||||
|
||||
export default function EntryCheck() {
|
||||
const user_info = useUserStore.getState().user_info
|
||||
const { setUserPermissionInfo } = usePermissionStore()
|
||||
|
||||
const asyncGetUserPermission = useCallback(async () => {
|
||||
const { message: permissionRes } = await getUserPermission()
|
||||
const { uid, name } = permissionRes
|
||||
setUserPermissionInfo({
|
||||
user_id: uid,
|
||||
user_name: name,
|
||||
detailInfo: permissionRes,
|
||||
})
|
||||
}, [setUserPermissionInfo])
|
||||
|
||||
useEffect(() => {
|
||||
if (!user_info.account) {
|
||||
window.location.href = "/login"
|
||||
} else {
|
||||
try {
|
||||
asyncGetUserPermission()
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/management`
|
||||
} catch {
|
||||
window.location.href = "/login"
|
||||
}
|
||||
}
|
||||
}, [asyncGetUserPermission, user_info.account])
|
||||
return <></>
|
||||
}
|
||||
@@ -1,20 +1,10 @@
|
||||
"use client"
|
||||
|
||||
import { getUserList, userEditById } from "@/components/label/api/user"
|
||||
import { getUserList } from "@/components/label/api/user"
|
||||
import { User } from "@/components/label/api/user/typing"
|
||||
import useAuth from "@/components/label/hooks/useAuth"
|
||||
import { useAllUserStore } from "@/components/label/store/auth"
|
||||
import {
|
||||
ActionIcon,
|
||||
Badge,
|
||||
Button,
|
||||
Group,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
} from "@mantine/core"
|
||||
import { modals } from "@mantine/modals"
|
||||
import { Badge, Button, Group, Paper, Stack, TextInput } from "@mantine/core"
|
||||
import { notifications } from "@mantine/notifications"
|
||||
import { IconEdit, IconRefresh, IconSearch } from "@tabler/icons-react"
|
||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
||||
@@ -107,7 +97,7 @@ export default function TeamEmployeePage() {
|
||||
textAlign: "center",
|
||||
render: (record) => (
|
||||
<Group justify="center" gap={4} wrap="nowrap">
|
||||
{isShow("edit") ? (
|
||||
{/* {isShow("edit") ? (
|
||||
<Button
|
||||
variant="subtle"
|
||||
size="compact-xs"
|
||||
@@ -131,17 +121,18 @@ export default function TeamEmployeePage() {
|
||||
}}>
|
||||
重置密码
|
||||
</Button>
|
||||
) : null}
|
||||
) : null} */}
|
||||
{isShow("edit") ? (
|
||||
<ActionIcon
|
||||
variant="subtle"
|
||||
<Button
|
||||
variant="transparent"
|
||||
leftSection={<IconEdit size={16} />}
|
||||
color="blue"
|
||||
onClick={() => {
|
||||
setSelectedUser(record)
|
||||
setEditOpened(true)
|
||||
}}>
|
||||
<IconEdit size={16} />
|
||||
</ActionIcon>
|
||||
编辑
|
||||
</Button>
|
||||
) : null}
|
||||
</Group>
|
||||
),
|
||||
@@ -234,6 +225,7 @@ export default function TeamEmployeePage() {
|
||||
fetching={loading}
|
||||
records={records}
|
||||
columns={columns}
|
||||
idAccessor="uid"
|
||||
noRecordsText="暂无数据"
|
||||
totalRecords={totalItems}
|
||||
recordsPerPage={pageSize}
|
||||
|
||||
@@ -107,7 +107,12 @@ export default function CreateModal({ opened, onCloseAction }: ComponentProps) {
|
||||
radius="xs"
|
||||
withAsterisk
|
||||
searchable
|
||||
data={finalUserOpts}
|
||||
data={finalUserOpts.map((item) => {
|
||||
return {
|
||||
label: item.label.toString(),
|
||||
value: item.value.toString(),
|
||||
}
|
||||
})}
|
||||
{...form.getInputProps("leader_uid")}
|
||||
/>
|
||||
<Select
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useEffect } from "react"
|
||||
export default function Home() {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
router.push("/management")
|
||||
router.push("/entry")
|
||||
}, [router])
|
||||
return <></>
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import { useUserStore } from "@/app/store/user"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useEffect } from "react"
|
||||
import { useUserStore } from "@/app/store/user"
|
||||
|
||||
export function InfoCheck() {
|
||||
const pathname = usePathname()
|
||||
|
||||
Reference in New Issue
Block a user