大小写

This commit is contained in:
2026-01-27 14:04:37 +08:00
parent 535fb734ea
commit 3540f51429
10 changed files with 85 additions and 15 deletions

View File

@@ -31,7 +31,7 @@ const authMenu: MenuDataItem = {
icon: <BarsOutlined style={iconStyle} />, icon: <BarsOutlined style={iconStyle} />,
children: [ children: [
{ name: '管理员信息', path: '/staff/list', auth: 'SF_ADMIN_ADMIN_VIEW' }, { name: '管理员信息', path: '/staff/list', auth: 'SF_ADMIN_ADMIN_VIEW' },
{ name: '组织架构', path: '/staff/dep', auth: 'SF_ADMIN_DEPART_VIEW' }, { name: '组织架构', path: '/staff/dept', auth: 'SF_ADMIN_DEPART_VIEW' },
{ name: '岗位角色', path: '/staff/group', auth: 'SF_ADMIN_GROUP_VIEW' }, { name: '岗位角色', path: '/staff/group', auth: 'SF_ADMIN_GROUP_VIEW' },
{ name: '我的权限', path: '/staff/auth', auth: 'SF_ADMIN_AUTH_VIEW' }, { name: '我的权限', path: '/staff/auth', auth: 'SF_ADMIN_AUTH_VIEW' },
{ name: '登录日志', path: '/staff/login', auth: 'SF_LOGIN_LOG_VIEW' }, { name: '登录日志', path: '/staff/login', auth: 'SF_LOGIN_LOG_VIEW' },

View File

@@ -7,7 +7,7 @@ import Index from '@/pages/Index';
import Login from '@/pages/Record/Login'; import Login from '@/pages/Record/Login';
import Sys from '@/pages/Record/Sys'; import Sys from '@/pages/Record/Sys';
import Auth from '@/pages/Staff/Auth'; import Auth from '@/pages/Staff/Auth';
import Dep from '@/pages/Staff/Dep'; import Dept from '@/pages/Staff/Dept';
import Grp from '@/pages/Staff/Grp'; import Grp from '@/pages/Staff/Grp';
import StaffList from '@/pages/Staff/List'; import StaffList from '@/pages/Staff/List';
import UserList from '@/pages/User/List'; import UserList from '@/pages/User/List';
@@ -44,7 +44,7 @@ export const routes: IRouteItem[] = [
Layout: AppLayout, Layout: AppLayout,
children: [ children: [
{ path: '/list', Component: StaffList }, { path: '/list', Component: StaffList },
{ path: '/dep', Component: Dep }, { path: '/dept', Component: Dept },
{ path: '/group', Component: Grp }, { path: '/group', Component: Grp },
{ path: '/auth', Component: Auth }, { path: '/auth', Component: Auth },
{ path: '/login', Component: Login }, { path: '/login', Component: Login },

View File

@@ -1,7 +1,6 @@
import { Button, Form, Input, notification } from 'antd'; import { Button, Form, Input, notification, Upload } from 'antd';
import { stringify } from 'qs';
import type React from 'react'; import type React from 'react';
import { useEffect } from 'react'; import { useEffect, useRef, useState } from 'react';
import { AdminServices } from '@/services/AdminServices'; import { AdminServices } from '@/services/AdminServices';
import { useUserStore } from '@/store/UserStore'; import { useUserStore } from '@/store/UserStore';
import type { IRef } from '@/utils/type'; import type { IRef } from '@/utils/type';
@@ -18,8 +17,10 @@ export type IProfileEditFormType = {
export const ProfileEditForm: React.FC<IProps> = (props) => { export const ProfileEditForm: React.FC<IProps> = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const userInfo = useUserStore().user; const userInfo = useUserStore().user;
const [previewUrl, setPreviewUrl] = useState<string>();
const avatarFileRef = useRef<File | null>(null);
// 请求成功回调 // 保存回调
const success = (res: any) => { const success = (res: any) => {
if (res.err_code === 0) { if (res.err_code === 0) {
notification.success({ message: '保存成功' }); notification.success({ message: '保存成功' });
@@ -27,28 +28,96 @@ export const ProfileEditForm: React.FC<IProps> = (props) => {
} }
}; };
const { loading: editLoading, request: editRequest } = useRequest(AdminServices.profile, { onSuccess: success }); const { loading: editLoading, request: editRequest } = useRequest(AdminServices.profile, {
onSuccess: success,
});
// 保存方法
const save = async () => { const save = async () => {
try { try {
const values = await form.validateFields(); const values = await form.getFieldsValue();
editRequest(stringify(values)); console.log('values', values);
// 使用 FormData
const formData = new FormData();
// 避免空密码提交
if (values.password) {
formData.append('password', values.password);
}
// 普通字段
formData.append('nickname', values.nickname);
formData.append('mobile', values.mobile);
formData.append('email', values.email || '');
// 上传头像文件
if (avatarFileRef.current) {
formData.append('avatar', avatarFileRef.current);
}
//console.log('formData entries:');
// formData.forEach((value, key) => {
// console.log(key, value);
// });
//console.log('formData', formData);
// 调用 useRequest
editRequest(formData);
} catch (error) { } catch (error) {
console.log('表单验证未通过', error); console.log('表单验证未通过', error);
} }
}; };
useEffect(() => { useEffect(() => {
const uri = `${userInfo.avatar}?v=${encodeURIComponent(userInfo.update_date)}`;
console.log('uri', uri);
form.setFieldsValue({ form.setFieldsValue({
username: userInfo.username, username: userInfo.username,
mobile: userInfo.mobile, mobile: userInfo.mobile,
email: userInfo.email, email: userInfo.email,
nickname: userInfo.nickname, nickname: userInfo.nickname,
avatar: uri, // 默认头像
}); });
setPreviewUrl(userInfo.avatar);
}, [userInfo]); }, [userInfo]);
return ( return (
<Form form={form} labelCol={{ style: { width: window?.dfConfig?.language === 'zh-cn' ? 80 : 120 } }}> <Form form={form} labelCol={{ style: { width: window?.dfConfig?.language === 'zh-cn' ? 80 : 120 } }}>
<Form.Item style={{ marginBottom: 12, textAlign: 'center' }}>
<Upload
accept='.jpg,.png,.jpeg'
showUploadList={false}
beforeUpload={(file) => {
// 如果有预览 URL释放对象
if (previewUrl) {
URL.revokeObjectURL(previewUrl);
}
avatarFileRef.current = file;
const url = URL.createObjectURL(file);
setPreviewUrl(url);
//src={`${previewUrl}?v=${encodeURIComponent(userInfo.update_date)}`}
// 阻止自动上传
return false;
}}
>
<div style={{ width: 104, height: 104 }}>
<img
src={previewUrl}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
borderRadius: 8,
cursor: 'pointer',
}}
alt='avatar'
/>
</div>
</Upload>
</Form.Item>
<Form.Item label='用户名' name='username'> <Form.Item label='用户名' name='username'>
<Input disabled /> <Input disabled />
</Form.Item> </Form.Item>

View File

@@ -242,9 +242,9 @@ const DepListForm: React.FC = () => {
); );
}; };
const Dep = () => ( const Dept = () => (
<PageContainerPlugin breadcrumb={['权限管理', '组织架构']}> <PageContainerPlugin breadcrumb={['权限管理', '组织架构']}>
<DepListForm /> <DepListForm />
</PageContainerPlugin> </PageContainerPlugin>
); );
export default Dep; export default Dept;

View File

@@ -14,7 +14,7 @@ import { AdminServices } from '@/services/AdminServices';
import { useAuthStore } from '@/store/AuthStore'; import { useAuthStore } from '@/store/AuthStore';
import { tableFixedByPhone, toArray } from '@/utils/common'; import { tableFixedByPhone, toArray } from '@/utils/common';
import { useRequest } from '@/utils/useRequest'; import { useRequest } from '@/utils/useRequest';
import AdminDepSelect from '../Dep/components/AdminDepSelect'; import AdminDepSelect from '../Dept/components/AdminDepSelect';
import AdminGrpSelect from '../Grp/components/AdminGrpSelect'; import AdminGrpSelect from '../Grp/components/AdminGrpSelect';
import { AdminEditModal, type IAdminEditModalType } from './components/AdminEditModal'; import { AdminEditModal, type IAdminEditModalType } from './components/AdminEditModal';

View File

@@ -11,6 +11,7 @@ export type UserInfo = {
wx_nick_name?: string; wx_nick_name?: string;
wx_open_id?: string; wx_open_id?: string;
department_id?: number; department_id?: number;
update_date?: any;
}; };
export type CompanyInfo = { export type CompanyInfo = {

View File

@@ -39,7 +39,7 @@ export const pathAddApiString = (path: string): string => {
if (`${path}`.startsWith('/')) { if (`${path}`.startsWith('/')) {
return `/api/adminrelas${path}`; return `/api/adminrelas${path}`;
} }
return `/api/adminrelas/${path}`; return `/api/adminrelas${path}`;
} }
return path; return path;
}; };

View File

@@ -28,7 +28,7 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite
}, },
'/static': { '/static': {
target: 'http://192.168.1.138:83', target: 'http://www.free.loc',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite
}, },