完善备注面板

This commit is contained in:
xianyi
2025-12-16 18:08:39 +08:00
parent f8a7b41463
commit 1d993e76c5
3 changed files with 35 additions and 9 deletions

View File

@@ -3,9 +3,18 @@ import { useEffect, useState } from 'react';
import { getVerificationCodeImage, loginByPassword } from '../../api';
import { Button, Input } from '../ui';
interface LoginSuccessPayload {
userId: string;
userName: string;
accessToken: string;
refreshToken: string;
roles: string;
username: string;
}
interface LoginModalProps {
onClose: () => void;
onLoginSuccess?: (userName: string) => void;
onLoginSuccess?: (payload: LoginSuccessPayload) => void;
}
const APP_ID = 'b2b49e91d21446aeb14579930f732985';
@@ -72,7 +81,14 @@ export const LoginModal = ({ onClose, onLoginSuccess }: LoginModalProps) => {
verification_code_key: imgCodeKey,
});
if (res.Status === 200 && res.Data?.access_token) {
onLoginSuccess?.(res.Data.user_name || username.trim());
onLoginSuccess?.({
userId: res.Data.user_id,
userName: res.Data.user_name,
accessToken: res.Data.access_token,
refreshToken: res.Data.refresh_token,
roles: res.Data.roles,
username: username.trim(),
});
onClose();
} else {
setError(res.Message || '登录失败');

View File

@@ -13,7 +13,7 @@ export const NoteModal = ({ noteText, onNoteChange, onClose }: NoteModalProps) =
const [saving, setSaving] = useState(false);
const [message, setMessage] = useState<string | null>(null);
const operatorId = typeof window !== 'undefined' ? localStorage.getItem('operatorPhone') || 'unknown' : 'unknown';
const operatorId = typeof window !== 'undefined' ? localStorage.getItem('operatorId') || '' : '';
const operatorName = typeof window !== 'undefined' ? localStorage.getItem('operatorName') || '未知' : '未知';
// 初始化拉取备注