Browse Source

feat: 支持后台统一用户

pull/193/head
cp3hnu 11 months ago
parent
commit
4a55df23ca
7 changed files with 8 additions and 12 deletions
  1. +1
    -1
      react-ui/src/components/IFramePage/index.tsx
  2. +0
    -2
      react-ui/src/pages/Experiment/index.jsx
  3. +2
    -1
      react-ui/src/pages/System/User/components/ResetPwd.tsx
  4. +2
    -2
      react-ui/src/pages/System/User/edit.tsx
  5. +1
    -1
      react-ui/src/pages/System/User/index.tsx
  6. +1
    -5
      react-ui/src/services/system/user.ts
  7. +1
    -0
      react-ui/src/types/system/user.d.ts

+ 1
- 1
react-ui/src/components/IFramePage/index.tsx View File

@@ -52,7 +52,7 @@ type IframePageProps = {
}; };


/** 系统内嵌 iframe,目前系统有数据标注、应用开发、开发环境、GitLink 四个子系统,使用时可以添加其他子系统 */ /** 系统内嵌 iframe,目前系统有数据标注、应用开发、开发环境、GitLink 四个子系统,使用时可以添加其他子系统 */
function IframePage({ type, openInTab = true, className, style }: IframePageProps) {
function IframePage({ type, openInTab = false, className, style }: IframePageProps) {
const [iframeUrl, setIframeUrl] = useState(''); const [iframeUrl, setIframeUrl] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);




+ 0
- 2
react-ui/src/pages/Experiment/index.jsx View File

@@ -286,8 +286,6 @@ function Experiment() {
message.success('运行成功'); message.success('运行成功');
refreshExperimentList(); refreshExperimentList();
refreshExperimentIns(id); refreshExperimentIns(id);
} else {
message.error('运行失败');
} }
}; };




+ 2
- 1
react-ui/src/pages/System/User/components/ResetPwd.tsx View File

@@ -17,6 +17,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const loginPassword = Form.useWatch('password', form); const loginPassword = Form.useWatch('password', form);
const userId = props.values.userId; const userId = props.values.userId;
const originPassword = props.values.originPassword;


const intl = useIntl(); const intl = useIntl();
const handleOk = () => { const handleOk = () => {
@@ -26,7 +27,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
props.onCancel(); props.onCancel();
}; };
const handleFinish = async (values: Record<string, any>) => { const handleFinish = async (values: Record<string, any>) => {
props.onSubmit({ ...values, userId } as FormValueType);
props.onSubmit({ password: values.password, userId, originPassword } as FormValueType);
}; };


const checkPassword = (rule: any, value: string) => { const checkPassword = (rule: any, value: string) => {


+ 2
- 2
react-ui/src/pages/System/User/edit.tsx View File

@@ -80,6 +80,7 @@ const UserForm: React.FC<UserFormProps> = (props) => {
const params = { const params = {
...values, ...values,
userId: props.values.userId, userId: props.values.userId,
originPassword: props.values.originPassword,
}; };
props.onSubmit(params as UserFormData); props.onSubmit(params as UserFormData);
}; };
@@ -194,7 +195,7 @@ const UserForm: React.FC<UserFormProps> = (props) => {
id: 'system.user.user_name', id: 'system.user.user_name',
defaultMessage: '用户账号', defaultMessage: '用户账号',
})} })}
hidden={userId}
disabled={!!props.values.userId}
placeholder="请输入用户账号" placeholder="请输入用户账号"
colProps={{ md: 12, xl: 12 }} colProps={{ md: 12, xl: 12 }}
rules={[ rules={[
@@ -214,7 +215,6 @@ const UserForm: React.FC<UserFormProps> = (props) => {
id: 'system.user.password', id: 'system.user.password',
defaultMessage: '密码', defaultMessage: '密码',
})} })}
hidden={userId}
placeholder="请输入密码" placeholder="请输入密码"
colProps={{ md: 12, xl: 12 }} colProps={{ md: 12, xl: 12 }}
fieldProps={{ fieldProps={{


+ 1
- 1
react-ui/src/pages/System/User/index.tsx View File

@@ -560,7 +560,7 @@ const UserTableList: React.FC = () => {
/> />
<ResetPwd <ResetPwd
onSubmit={async (values: any) => { onSubmit={async (values: any) => {
const success = await resetUserPwd(values.userId, values.password);
const success = await resetUserPwd(values);
if (success) { if (success) {
setResetPwdModalVisible(false); setResetPwdModalVisible(false);
setSelectedRows([]); setSelectedRows([]);


+ 1
- 5
react-ui/src/services/system/user.ts View File

@@ -94,11 +94,7 @@ export function updateUserProfile(data: API.CurrentUser) {
} }


// 用户密码重置 // 用户密码重置
export function resetUserPwd(userId: number, password: string) {
const data = {
userId,
password,
};
export function resetUserPwd(data: any) {
return request<API.Result>('/api/system/user/resetPwd', { return request<API.Result>('/api/system/user/resetPwd', {
method: 'put', method: 'put',
data: data, data: data,


+ 1
- 0
react-ui/src/types/system/user.d.ts View File

@@ -22,6 +22,7 @@ declare namespace API.System {
gitLinkUsername?: string; gitLinkUsername?: string;
gitLinkPassword?: string; gitLinkPassword?: string;
credit?: number; credit?: number;
originPassword?: string;
} }


export interface UserListParams { export interface UserListParams {


Loading…
Cancel
Save