refactor: 前端应用骨架迁移至 zustand 并统一路由权限壳
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { Modal } from 'antd';
|
||||
import { App } from 'antd';
|
||||
import api from '../api';
|
||||
import { message } from '../ui/app-message';
|
||||
|
||||
@@ -13,8 +13,9 @@ import { message } from '../ui/app-message';
|
||||
* already-open confirm modal is destroyed.
|
||||
*/
|
||||
export function useViewSensitive(studentId: number, module: string, canLog: boolean) {
|
||||
const { modal } = App.useApp();
|
||||
const canLogRef = useRef(canLog);
|
||||
const modalRef = useRef<ReturnType<typeof Modal.confirm> | null>(null);
|
||||
const modalRef = useRef<ReturnType<typeof modal.confirm> | null>(null);
|
||||
canLogRef.current = canLog;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -31,7 +32,7 @@ export function useViewSensitive(studentId: number, module: string, canLog: bool
|
||||
return useCallback(
|
||||
(field: string, value: string) => {
|
||||
if (!canLogRef.current) return;
|
||||
modalRef.current = Modal.confirm({
|
||||
modalRef.current = modal.confirm({
|
||||
title: '查看敏感信息',
|
||||
content: `您即将查看 "${field}" 的完整信息。此操作将被记录。`,
|
||||
okText: '确认查看',
|
||||
@@ -50,7 +51,7 @@ export function useViewSensitive(studentId: number, module: string, canLog: bool
|
||||
message.error('操作日志记录失败,请稍后重试');
|
||||
return;
|
||||
}
|
||||
Modal.info({
|
||||
modal.info({
|
||||
title: field,
|
||||
content: value,
|
||||
okText: '关闭',
|
||||
|
||||
Reference in New Issue
Block a user