feat: add user manager
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Button, Input, message, Modal, Space, Table } from 'antd';
|
||||
import { Button, Input, Modal, Space, Table } from 'antd';
|
||||
import { Fragment, useEffect, useMemo, useState } from 'react';
|
||||
import { useUserStore } from '../store';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
@@ -8,7 +8,7 @@ import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlin
|
||||
import clsx from 'clsx';
|
||||
import { isObjectNull } from '@/utils/is-null';
|
||||
import { CardBlank } from '@/components/card/CardBlank';
|
||||
|
||||
import { message } from '@/modules/message';
|
||||
const FormModal = () => {
|
||||
const [form] = Form.useForm();
|
||||
const userStore = useUserStore(
|
||||
|
||||
@@ -32,7 +32,7 @@ export const Login = () => {
|
||||
<div className='w-full h-full absolute top-[10%] xl:top-[15%] 2xl:top-[18%] 3xl:top-[20%] '>
|
||||
<div className='w-[400px] mx-auto'>
|
||||
<h1 className='mb-4 tracking-widest text-center'>Login</h1>
|
||||
<div className='card border-t-2 pt-8 px-8'>
|
||||
<div className='card border-t-2 border-gray-200 pt-8 px-8'>
|
||||
<Form
|
||||
className='mt-2'
|
||||
form={form}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { Flex, message, Upload } from 'antd';
|
||||
import { Flex, Upload } from 'antd';
|
||||
import { message } from '@/modules/message';
|
||||
import type { GetProp, UploadProps } from 'antd';
|
||||
|
||||
type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
|
||||
@@ -53,7 +54,7 @@ export const AvatarUpload = () => {
|
||||
};
|
||||
const customAction = (file) => {
|
||||
console.log('file', file);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Flex gap='middle' wrap>
|
||||
<Upload
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { message } from 'antd';
|
||||
import { message } from '@/modules/message';
|
||||
import { useImperativeHandle, useRef, forwardRef } from 'react';
|
||||
import type { GetProp, UploadProps } from 'antd';
|
||||
type FileTypeOrg = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { create } from 'zustand';
|
||||
import { query } from '@/modules';
|
||||
import { message } from 'antd';
|
||||
import { message } from '@/modules/message';
|
||||
type UserStore = {
|
||||
showEdit: boolean;
|
||||
setShowEdit: (showEdit: boolean) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { query } from '@/modules';
|
||||
import { basename } from '@/modules/basename';
|
||||
import { message } from 'antd';
|
||||
import { message } from '@/modules/message';
|
||||
import { create } from 'zustand';
|
||||
// 如果自己是在iframe中登录,需要调用这个方法
|
||||
export const postLoginInIframe = (token: string) => {
|
||||
@@ -55,7 +55,7 @@ export const useLoginStore = create<LoginStore>((set, get) => {
|
||||
set({ loading: true });
|
||||
const loaded = message.loading('loading...', 0);
|
||||
const res = await query.post({ path: 'user', key: 'login', username, password });
|
||||
loaded();
|
||||
setTimeout(loaded, 200);
|
||||
if (res.code === 200) {
|
||||
const { token } = res.data;
|
||||
message.success('Success');
|
||||
@@ -81,7 +81,7 @@ export const useLoginStore = create<LoginStore>((set, get) => {
|
||||
set({ loading: true });
|
||||
const loaded = message.loading('loading...', 0);
|
||||
const res = await query.post({ path: 'user', key: 'register' });
|
||||
loaded();
|
||||
setTimeout(loaded, 200);
|
||||
if (res.code === 200) {
|
||||
message.success('Success');
|
||||
// 跳到某一个页面
|
||||
|
||||
Reference in New Issue
Block a user