01250227
This commit is contained in:
parent
4dd07771c2
commit
6214ac308c
|
@ -451,7 +451,7 @@ export class BaseService<
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
where?: WhereArgs<A['findMany']>;
|
where?: WhereArgs<A['findMany']>;
|
||||||
select?: SelectArgs<A['findMany']>;
|
select?: SelectArgs<A['findMany']>;
|
||||||
}): Promise<{ items: R['findMany']; totalPages: number }> {
|
}): Promise<{ items: R['findMany']; totalPages: number, totalCount: number }> {
|
||||||
const { page = 1, pageSize = 10, where, select } = args;
|
const { page = 1, pageSize = 10, where, select } = args;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -470,6 +470,7 @@ export class BaseService<
|
||||||
return {
|
return {
|
||||||
items,
|
items,
|
||||||
totalPages,
|
totalPages,
|
||||||
|
totalCount: total
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error, 'read');
|
this.handleError(error, 'read');
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"@nice/common": "workspace:^",
|
"@nice/common": "workspace:^",
|
||||||
"@nice/iconer": "workspace:^",
|
"@nice/iconer": "workspace:^",
|
||||||
"@nice/theme": "workspace:^",
|
"@nice/theme": "workspace:^",
|
||||||
|
"@nice/utils": "workspace:^",
|
||||||
"@nice/ui": "workspace:^",
|
"@nice/ui": "workspace:^",
|
||||||
"@tanstack/query-async-storage-persister": "^5.51.9",
|
"@tanstack/query-async-storage-persister": "^5.51.9",
|
||||||
"@tanstack/react-query": "^5.51.21",
|
"@tanstack/react-query": "^5.51.21",
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
import { motion } from "framer-motion";
|
import { LetterFormProvider } from "@web/src/components/models/post/editor/context/LetterEditorContext";
|
||||||
import LetterEditorLayout from "@web/src/components/models/post/editor/layout/LetterEditorLayout";
|
import { LetterBasicForm } from "@web/src/components/models/post/editor/form/LetterBasicForm";
|
||||||
|
import WriteHeader from "../write/WriteHeader";
|
||||||
|
import { useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
|
export default function LetterEditorPage() {
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
const receiverId = searchParams.get("receiverId");
|
||||||
|
const termId = searchParams.get("termId");
|
||||||
|
|
||||||
export default function EditorLetterPage() {
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen ">
|
<div className="min-h-screen rounded-xl bg-gradient-to-b from-slate-100 to-slate-50 ">
|
||||||
<motion.div
|
<WriteHeader></WriteHeader>
|
||||||
initial={{ opacity: 0, y: 20 }}
|
<LetterFormProvider receiverId={receiverId} termId={termId}>
|
||||||
animate={{ opacity: 1, y: 0 }}
|
<LetterBasicForm />
|
||||||
exit={{ opacity: 0, y: -20 }}
|
</LetterFormProvider>
|
||||||
transition={{ duration: 0.6, ease: "easeOut" }}>
|
|
||||||
<LetterEditorLayout />
|
|
||||||
</motion.div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
|
import LetterList from "@web/src/components/models/post/list/LetterList";
|
||||||
import { Header } from "./Header";
|
import { Header } from "./Header";
|
||||||
|
|
||||||
export default function LetterListPage() {
|
export default function LetterListPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// 添加 flex flex-col 使其成为弹性布局容器
|
// 添加 flex flex-col 使其成为弹性布局容器
|
||||||
<div className="min-h-screen bg-gradient-to-b from-slate-50 to-slate-100 flex flex-col">
|
<div className="min-h-screen rounded-xl overflow-hidden bg-gradient-to-b from-slate-100 to-slate-50 flex flex-col">
|
||||||
<Header />
|
<Header />
|
||||||
{/* 添加 flex-grow 使内容区域自动填充剩余空间 */}
|
{/* 添加 flex-grow 使内容区域自动填充剩余空间 */}
|
||||||
|
|
||||||
|
<LetterList params={{
|
||||||
|
where: {
|
||||||
|
isPublic: true
|
||||||
|
}
|
||||||
|
}}></LetterList>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,42 @@
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { PaperAirplaneIcon } from '@heroicons/react/24/outline';
|
|
||||||
import { StaffDto } from "@nice/common";
|
import { StaffDto } from "@nice/common";
|
||||||
import { Button } from 'antd';
|
import { Button, Tooltip, Badge } from 'antd';
|
||||||
|
import { SendOutlined } from '@ant-design/icons';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
export interface SendCardProps {
|
export interface SendCardProps {
|
||||||
staff: StaffDto;
|
staff: StaffDto;
|
||||||
|
termId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SendCard({ staff }: SendCardProps) {
|
export function SendCard({ staff, termId }: SendCardProps) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleSendLetter = () => {
|
||||||
|
navigate(`/editor?termId=${termId || ''}&receiverId=${staff.id}`);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, y: 20 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
whileHover={{ scale: 1.005 }}
|
whileHover={{ scale: 1.005 }}
|
||||||
transition={{ duration: 0.2 }}
|
transition={{ duration: 0.2 }}
|
||||||
className={`
|
className="bg-white rounded-xl shadow-lg overflow-hidden border-2 border-gray-100 hover:border-primary-200 transition-all duration-300"
|
||||||
bg-white rounded-xl shadow-sm overflow-hidden border border-gray-100
|
|
||||||
`}
|
|
||||||
>
|
>
|
||||||
<div className="flex flex-col sm:flex-row">
|
<div className="flex flex-col sm:flex-row">
|
||||||
{/* Image Container */}
|
{/* Image Container */}
|
||||||
<div className="sm:w-48 h-64 sm:h-auto flex-shrink-0 bg-gray-100 flex items-center justify-center">
|
<div className="sm:w-56 h-72 sm:h-auto flex-shrink-0 bg-gradient-to-br from-gray-50 to-gray-100 flex items-center justify-center relative">
|
||||||
{staff.meta?.photoUrl ? (
|
{staff.meta?.photoUrl ? (
|
||||||
<img
|
<img
|
||||||
src={staff.meta.photoUrl}
|
src={staff.meta.photoUrl}
|
||||||
alt={staff.showname}
|
alt={staff.showname}
|
||||||
className="w-full h-full object-cover"
|
className="w-full h-full object-cover hover:scale-105 transition-transform duration-300"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col items-center justify-center text-gray-400">
|
<div className="flex flex-col items-center justify-center text-gray-400">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
className="h-16 w-16 mb-2"
|
className="h-20 w-20 mb-3 text-gray-300"
|
||||||
fill="none"
|
fill="none"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
@ -49,50 +54,59 @@ export function SendCard({ staff }: SendCardProps) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Content Container */}
|
{/* Content Container */}
|
||||||
<div className="flex-1 p-6">
|
<div className="flex-1 p-8">
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex flex-col h-full">
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<div className="flex items-center justify-between mb-3">
|
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4">
|
||||||
<h3 className="text-xl font-semibold text-gray-900">
|
<div>
|
||||||
{staff.showname}
|
<div className="flex items-center gap-3 mb-2">
|
||||||
</h3>
|
<h3 className="text-2xl font-semibold text-gray-900">
|
||||||
<span className="px-3 py-1 text-sm font-medium bg-blue-50 text-primary rounded-full">
|
{staff.showname}
|
||||||
{staff.meta?.rank || '未设置职级'}
|
</h3>
|
||||||
</span>
|
<Badge status="success" />
|
||||||
|
</div>
|
||||||
|
<p className="text-gray-600 text-lg font-medium">{staff.department?.name || '未设置部门'}</p>
|
||||||
|
</div>
|
||||||
|
<Tooltip title="职级">
|
||||||
|
<span className="inline-flex items-center px-4 py-1.5 text-sm font-medium bg-gradient-to-r from-blue-50 to-blue-100 text-primary rounded-full hover:from-blue-100 hover:to-blue-200 transition-colors shadow-sm">
|
||||||
|
{staff.meta?.rank || '未设置职级'}
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-gray-600 mb-4">{staff.department?.name || '未设置部门'}</p>
|
|
||||||
|
|
||||||
{/* Contact Information */}
|
{/* Contact Information */}
|
||||||
<div className="space-y-2 text-sm text-gray-600">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm text-gray-600 mb-6">
|
||||||
<p className="flex items-center">
|
<div className="flex items-center bg-gray-50 rounded-lg p-3 hover:bg-gray-100 transition-all duration-200 hover:shadow-sm">
|
||||||
<svg className="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4 mr-2 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
||||||
d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
|
d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
|
||||||
</svg>
|
</svg>
|
||||||
{staff.meta?.email || '未设置邮箱'}
|
<span className="truncate">{staff.meta?.email || '未设置邮箱'}</span>
|
||||||
</p>
|
</div>
|
||||||
<p className="flex items-center">
|
<div className="flex items-center bg-gray-50 rounded-lg p-3 hover:bg-gray-100 transition-all duration-200 hover:shadow-sm">
|
||||||
<svg className="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4 mr-2 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
||||||
d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
||||||
</svg>
|
</svg>
|
||||||
{staff.phoneNumber || '未设置电话'}
|
<span className="truncate">{staff.phoneNumber || '未设置电话'}</span>
|
||||||
</p>
|
</div>
|
||||||
<p className="flex items-center">
|
<div className="flex items-center bg-gray-50 rounded-lg p-3 hover:bg-gray-100 transition-all duration-200 hover:shadow-sm md:col-span-2">
|
||||||
<svg className="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4 mr-2 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
|
||||||
d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
||||||
</svg>
|
</svg>
|
||||||
{staff.meta?.office || '未设置办公室'}
|
<span className="truncate">{staff.meta?.office || '未设置办公室'}</span>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
size='large'
|
size="large"
|
||||||
|
icon={<SendOutlined />}
|
||||||
|
onClick={handleSendLetter}
|
||||||
|
|
||||||
>
|
>
|
||||||
<PaperAirplaneIcon className="w-5 h-5" />
|
|
||||||
发送信件
|
发送信件
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default function Header() {
|
export default function WriteHeader() {
|
||||||
return <header className="bg-gradient-to-r from-primary to-primary-400 text-white p-6">
|
return <header className=" rounded-t-xl bg-gradient-to-r from-primary to-primary-400 text-white p-6">
|
||||||
<div className="flex flex-col space-y-6">
|
<div className="flex flex-col space-y-6">
|
||||||
{/* 主标题 */}
|
{/* 主标题 */}
|
||||||
<div>
|
<div>
|
|
@ -1,31 +0,0 @@
|
||||||
import { Leader } from "./types";
|
|
||||||
|
|
||||||
export const leaders: Leader[] = [
|
|
||||||
{
|
|
||||||
id: "1",
|
|
||||||
name: "John Mitchell",
|
|
||||||
rank: "General",
|
|
||||||
division: "Air Combat Command",
|
|
||||||
imageUrl:
|
|
||||||
"https://th.bing.com/th/id/OIP.ea0spF2OAgI4I1KzgZFtTgHaHX?rs=1&pid=ImgDetMain",
|
|
||||||
email: "j.mitchell@af.mil",
|
|
||||||
phone: "(555) 123-4567",
|
|
||||||
office: "Pentagon, Wing A-123",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
name: "Sarah Williams",
|
|
||||||
rank: "Colonel",
|
|
||||||
division: "Air Force Space Command",
|
|
||||||
imageUrl:
|
|
||||||
"https://th.bing.com/th/id/OIP.ea0spF2OAgI4I1KzgZFtTgHaHX?rs=1&pid=ImgDetMain",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "3",
|
|
||||||
name: "Michael Roberts",
|
|
||||||
rank: "Major General",
|
|
||||||
division: "Air Mobility Command",
|
|
||||||
imageUrl:
|
|
||||||
"https://th.bing.com/th/id/OIP.ea0spF2OAgI4I1KzgZFtTgHaHX?rs=1&pid=ImgDetMain",
|
|
||||||
},
|
|
||||||
];
|
|
|
@ -1,14 +1,18 @@
|
||||||
import { useState, useMemo, useCallback, useEffect } from 'react';
|
import { useState, useCallback, useEffect } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import Header from './header';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { SendCard } from './SendCard';
|
import { SendCard } from './SendCard';
|
||||||
import { Spin, Empty, Input, Alert, message, Pagination } from 'antd';
|
import { Spin, Empty, Input, Alert, Pagination } from 'antd';
|
||||||
import { api } from '@nice/client';
|
import { api } from '@nice/client';
|
||||||
import DepartmentSelect from '@web/src/components/models/department/department-select';
|
import DepartmentSelect from '@web/src/components/models/department/department-select';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
|
import WriteHeader from './WriteHeader';
|
||||||
|
|
||||||
export default function WriteLetterPage() {
|
export default function WriteLetterPage() {
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
const termId = searchParams.get('termId');
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [selectedDept, setSelectedDept] = useState<string>();
|
const [selectedDept, setSelectedDept] = useState<string>();
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
|
@ -30,19 +34,19 @@ export default function WriteLetterPage() {
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
|
||||||
console.log(selectedDept)
|
const resetPage = useCallback(() => {
|
||||||
console.log(data)
|
|
||||||
console.log(searchQuery)
|
|
||||||
}, [selectedDept, data, searchQuery])
|
|
||||||
// Reset to first page when search query or department changes
|
|
||||||
useCallback(() => {
|
|
||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
}, [searchQuery, selectedDept]);
|
}, []);
|
||||||
|
|
||||||
|
// Reset page when search or department changes
|
||||||
|
useEffect(() => {
|
||||||
|
resetPage();
|
||||||
|
}, [searchQuery, selectedDept, resetPage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-b from-slate-50 to-slate-100">
|
<div className="min-h-screen bg-gradient-to-b from-slate-100 to-slate-50">
|
||||||
<Header />
|
<WriteHeader />
|
||||||
<div className="container mx-auto px-4 py-8">
|
<div className="container mx-auto px-4 py-8">
|
||||||
<div className="mb-8 space-y-4">
|
<div className="mb-8 space-y-4">
|
||||||
{/* Search and Filter Section */}
|
{/* Search and Filter Section */}
|
||||||
|
@ -86,10 +90,11 @@ export default function WriteLetterPage() {
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
exit={{ opacity: 0 }}
|
exit={{ opacity: 0 }}
|
||||||
>
|
>
|
||||||
{data?.items.map((item) => (
|
{data?.items.map((item: any) => (
|
||||||
<SendCard
|
<SendCard
|
||||||
key={item.id}
|
key={item.id}
|
||||||
staff={item as any}
|
staff={item}
|
||||||
|
termId={termId || undefined}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
export interface Leader {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
rank: string;
|
|
||||||
division: string;
|
|
||||||
imageUrl: string;
|
|
||||||
email: string; // Added
|
|
||||||
phone: string; // Added
|
|
||||||
office: string; // Added
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function useNavItem() {
|
||||||
|
|
||||||
// 构建分类导航项
|
// 构建分类导航项
|
||||||
const categoryItems = data.map(term => ({
|
const categoryItems = data.map(term => ({
|
||||||
to: `/write-letter?category=${term.id}`,
|
to: `/write-letter?termId=${term.id}`,
|
||||||
label: term.name
|
label: term.name
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -1,164 +1,106 @@
|
||||||
import { Form, Input, Button, Checkbox, Select } from "antd";
|
import { Form, Input, Button, Checkbox, Select } from "antd";
|
||||||
import { useState } from "react";
|
|
||||||
import { useLetterEditor } from "../context/LetterEditorContext";
|
import { useLetterEditor } from "../context/LetterEditorContext";
|
||||||
import { api } from "@nice/client";
|
import { SendOutlined } from "@ant-design/icons";
|
||||||
import {
|
|
||||||
UserOutlined,
|
|
||||||
FolderOutlined,
|
|
||||||
TagOutlined,
|
|
||||||
FileTextOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
|
|
||||||
import QuillEditor from "@web/src/components/common/editor/quill/QuillEditor";
|
import QuillEditor from "@web/src/components/common/editor/quill/QuillEditor";
|
||||||
import { PostBadge } from "../../detail/badge/PostBadge";
|
import StaffSelect from "../../../staff/staff-select";
|
||||||
|
import TermSelect from "../../../term/term-select";
|
||||||
|
|
||||||
export function LetterBasicForm() {
|
export function LetterBasicForm() {
|
||||||
const { onSubmit, receiverId, termId, form } = useLetterEditor();
|
const { onSubmit, receiverId, termId, form } = useLetterEditor();
|
||||||
const { data: receiver } = api.staff.findFirst.useQuery(
|
|
||||||
{
|
|
||||||
where: {
|
|
||||||
id: receiverId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
enabled: !!receiverId,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const { data: term } = api.term.findFirst.useQuery(
|
|
||||||
{
|
|
||||||
where: { id: termId },
|
|
||||||
},
|
|
||||||
{ enabled: !!termId }
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleFinish = async (values: any) => {
|
const handleFinish = async (values: any) => {
|
||||||
await onSubmit(values);
|
await onSubmit(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full space-y-6 p-8">
|
<div className=" p-6 ">
|
||||||
<Form
|
<Form
|
||||||
|
|
||||||
|
size="large"
|
||||||
form={form}
|
form={form}
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
initialValues={{ meta: { tags: [] }, isPublic: true }}>
|
initialValues={{ meta: { tags: [] }, receiverId, termId, isPublic: true }}
|
||||||
{/* 收件人和板块信息行 */}
|
>
|
||||||
<div className="flex justify-start items-center gap-8 ">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="flex items-center font-semibold text-primary">
|
<Form.Item label='收件人' name={'receiverId'}>
|
||||||
<UserOutlined className="w-5 h-5 mr-2 text-primary" />
|
<StaffSelect multiple placeholder="选择收信人员" />
|
||||||
<div>收件人:{receiver?.showname}</div>
|
</Form.Item>
|
||||||
</div>
|
<Form.Item label='分类' name={'termId'}>
|
||||||
<PostBadge type="category" value={term?.name}></PostBadge>
|
<TermSelect placeholder="选择信件分类" />
|
||||||
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
|
<Form.Item
|
||||||
|
name="title"
|
||||||
|
rules={[{ required: true, message: "请输入信件标题" }]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
maxLength={20}
|
||||||
|
showCount
|
||||||
|
placeholder="请输入信件标题"
|
||||||
|
|
||||||
{/* 主题输入框 */}
|
|
||||||
<div className="space-y-2 mt-4">
|
/>
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
required={false} //不显示星号
|
|
||||||
label={
|
{/* Tags Input */}
|
||||||
<div className="mb-1 items-center">
|
<Form.Item name={["meta", "tags"]} className="mb-6">
|
||||||
<TagOutlined className="mr-2 text-primary" />
|
<Select
|
||||||
标题
|
mode="tags"
|
||||||
<span className="text-secondary-400">
|
placeholder="输入标签后按回车添加"
|
||||||
(必选)
|
value={form.getFieldValue(["meta", "tags"]) || []}
|
||||||
|
onChange={(value) => form.setFieldValue(["meta", "tags"], value)}
|
||||||
|
tokenSeparators={[",", " "]}
|
||||||
|
className="w-full"
|
||||||
|
dropdownStyle={{ display: "none" }}
|
||||||
|
tagRender={({ label, onClose }) => (
|
||||||
|
<div className="bg-primary-50 text-primary-600 px-3 py-1 rounded-full text-sm mr-2 mb-1 flex items-center">
|
||||||
|
{label}
|
||||||
|
<span
|
||||||
|
className="ml-2 cursor-pointer hover:text-primary-700"
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
×
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
name="title"
|
/>
|
||||||
rules={[{ required: true, message: "请输入标题" }]}
|
</Form.Item>
|
||||||
labelCol={{ span: 24 }}
|
|
||||||
wrapperCol={{ span: 24 }}>
|
{/* Content Editor */}
|
||||||
<Input maxLength={20} placeholder="请输入标题" />
|
<Form.Item
|
||||||
</Form.Item>
|
name="content"
|
||||||
</div>
|
rules={[{ required: true, message: "请输入内容" }]}
|
||||||
|
required={false}
|
||||||
|
>
|
||||||
|
<div className="rounded-lg border border-gray-200 bg-white shadow-sm">
|
||||||
|
<QuillEditor
|
||||||
|
maxLength={10000}
|
||||||
|
placeholder="请输入内容"
|
||||||
|
minRows={16}
|
||||||
|
onChange={(content) => form.setFieldValue("content", content)}
|
||||||
|
|
||||||
{/* 标签输入 */}
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Form.Item
|
|
||||||
label={
|
|
||||||
<span className="block mb-1">
|
|
||||||
<TagOutlined className=" mr-2 text-primary" />
|
|
||||||
标签
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
name={["meta", "tags"]}
|
|
||||||
labelCol={{ span: 24 }}
|
|
||||||
wrapperCol={{ span: 24 }}>
|
|
||||||
<Select
|
|
||||||
mode="tags"
|
|
||||||
placeholder="输入标签后按回车添加"
|
|
||||||
value={form.getFieldValue(["meta", "tags"]) || []}
|
|
||||||
onChange={(value) => {
|
|
||||||
form.setFieldValue(["meta", "tags"], value);
|
|
||||||
}}
|
|
||||||
tokenSeparators={[",", " "]}
|
|
||||||
className="w-full"
|
|
||||||
dropdownStyle={{ display: "none" }}
|
|
||||||
style={{
|
|
||||||
backgroundColor: "#f0f4ff",
|
|
||||||
borderColor: "#00308F",
|
|
||||||
borderRadius: "6px",
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</div>
|
||||||
</div>
|
</Form.Item>
|
||||||
|
|
||||||
{/* 内容输入框 */}
|
{/* Footer Actions */}
|
||||||
<div className="space-y-2">
|
<div className="flex flex-col-reverse sm:flex-row items-center justify-between gap-4 mt-6">
|
||||||
<Form.Item
|
|
||||||
label={
|
|
||||||
<span className="block mb-1">
|
|
||||||
<FileTextOutlined className=" mr-2 text-primary" />
|
|
||||||
内容
|
|
||||||
<span className="text-secondary-400">
|
|
||||||
(必选)
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
name="content"
|
|
||||||
rules={[{ required: true, message: "请输入内容" }]}
|
|
||||||
required={false} //不显示星号
|
|
||||||
labelCol={{ span: 24 }}
|
|
||||||
wrapperCol={{ span: 24 }}>
|
|
||||||
<div className="relative rounded-lg border border-slate-200 bg-white shadow-sm">
|
|
||||||
<QuillEditor
|
|
||||||
maxLength={1000}
|
|
||||||
placeholder="请输入内容"
|
|
||||||
minRows={6}
|
|
||||||
maxRows={12}
|
|
||||||
onChange={(content) =>
|
|
||||||
form.setFieldValue("content", content)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-end gap-4 border-t border-secondary-100 pt-4">
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="isPublic"
|
name="isPublic"
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
className="mb-0"
|
|
||||||
initialValue={true}>
|
|
||||||
<Checkbox>是否公开</Checkbox>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
|
initialValue={true}
|
||||||
|
>
|
||||||
|
<Checkbox className="text-gray-600 hover:text-gray-900 transition-colors text-sm">
|
||||||
|
是否公开
|
||||||
|
</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => form.submit()}
|
onClick={() => form.submit()}
|
||||||
className="bg-primary hover:bg-primary-600 w-full sm:w-auto"
|
size="large"
|
||||||
style={{
|
icon={<SendOutlined />}
|
||||||
transform: "scale(1)",
|
className="w-full sm:w-40"
|
||||||
transition: "all 0.2s",
|
>
|
||||||
}}
|
发送信件
|
||||||
onMouseEnter={(e) => {
|
|
||||||
e.currentTarget.style.transform = "scale(1.02)";
|
|
||||||
}}
|
|
||||||
onMouseLeave={(e) => {
|
|
||||||
e.currentTarget.style.transform = "scale(1)";
|
|
||||||
}}>
|
|
||||||
提交
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
|
||||||
import { motion } from "framer-motion";
|
|
||||||
import { PaperAirplaneIcon } from "@heroicons/react/24/outline";
|
|
||||||
import { LetterFormProvider } from "../context/LetterEditorContext";
|
|
||||||
import { LetterBasicForm } from "../form/LetterBasicForm";
|
|
||||||
import { useTheme } from "@nice/theme";
|
|
||||||
|
|
||||||
export default function LetterEditorLayout() {
|
|
||||||
const location = useLocation();
|
|
||||||
const params = new URLSearchParams(location.search);
|
|
||||||
// const {} = useTheme();
|
|
||||||
const receiverId = params.get("receiverId");
|
|
||||||
const termId = params.get("termId");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<motion.div
|
|
||||||
className="min-h-screen overflow-hidden border border-gray-200 shadow-lg" // 添加圆角和溢出隐藏
|
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
transition={{ duration: 0.8 }}>
|
|
||||||
<div className="bg-gradient-to-r from-primary to-primary-400 text-white py-8">
|
|
||||||
<div className="w-full px-4 max-w-7xl mx-auto">
|
|
||||||
<motion.div
|
|
||||||
className="flex items-center justify-center mb-6"
|
|
||||||
initial={{ scale: 0 }}
|
|
||||||
animate={{ scale: 1 }}
|
|
||||||
transition={{
|
|
||||||
delay: 0.2,
|
|
||||||
type: "spring",
|
|
||||||
stiffness: 100,
|
|
||||||
}}>
|
|
||||||
{/* <PaperAirplaneIcon className="h-12 w-12" /> */}
|
|
||||||
<h1 className="text-3xl font-bold ml-4">撰写信件</h1>
|
|
||||||
</motion.div>
|
|
||||||
|
|
||||||
{/* 隐私保护说明 */}
|
|
||||||
<div className="flex flex-wrap gap-6 text-sm justify-center mb-4">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<svg
|
|
||||||
className="w-5 h-5"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
strokeWidth="2"
|
|
||||||
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<span>个人信息严格保密</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<svg
|
|
||||||
className="w-5 h-5"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
strokeWidth="2"
|
|
||||||
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<span>支持匿名反映问题</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<svg
|
|
||||||
className="w-5 h-5"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
strokeWidth="2"
|
|
||||||
d="M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<span>网络数据加密存储</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 隐私承诺 */}
|
|
||||||
<div className="text-sm text-blue-100 border-t border-blue-400/30 pt-4 max-w-4xl mx-auto text-center">
|
|
||||||
<p>
|
|
||||||
我们承诺:您的个人信息将被严格保密,不向任何第三方透露。您可以选择匿名反映问题,平台会自动过滤可能暴露身份的信息。
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full px-2 py-2">
|
|
||||||
<LetterFormProvider receiverId={receiverId} termId={termId}>
|
|
||||||
<LetterBasicForm />
|
|
||||||
</LetterFormProvider>
|
|
||||||
</div>
|
|
||||||
</motion.div>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,18 +1,111 @@
|
||||||
|
import { useState, useEffect, useMemo } from 'react';
|
||||||
|
import { Input, Pagination, Empty } from 'antd';
|
||||||
import { api, RouterInputs } from "@nice/client";
|
import { api, RouterInputs } from "@nice/client";
|
||||||
import { Prisma } from "packages/common/dist";
|
|
||||||
import { LetterCard } from "../LetterCard";
|
import { LetterCard } from "../LetterCard";
|
||||||
|
import { NonVoid } from "@nice/utils";
|
||||||
export default function LetterList({ params }: { params: RouterInputs["post"]["findManyWithPagination"] }) {
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
|
import debounce from 'lodash/debounce';
|
||||||
|
export default function LetterList({ params }: { params: NonVoid<RouterInputs["post"]["findManyWithPagination"]> }) {
|
||||||
|
const [searchText, setSearchText] = useState('');
|
||||||
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
|
|
||||||
const { data, isLoading } = api.post.findManyWithPagination.useQuery({
|
const { data, isLoading } = api.post.findManyWithPagination.useQuery({
|
||||||
page: 1,
|
page: currentPage,
|
||||||
pageSize: 1,
|
pageSize: params.pageSize,
|
||||||
where: {},
|
where: {
|
||||||
select: {}
|
OR: [{
|
||||||
})
|
title: {
|
||||||
return <div className="flex-grow flex flex-col gap-2">
|
contains: searchText
|
||||||
{data?.items.map((letter: any) => (
|
}
|
||||||
<LetterCard key={letter.id} letter={letter} />
|
}],
|
||||||
))}
|
...params?.where
|
||||||
</div>
|
},
|
||||||
|
select: params.select
|
||||||
|
});
|
||||||
|
|
||||||
|
// Debounced search function
|
||||||
|
const debouncedSearch = useMemo(
|
||||||
|
() =>
|
||||||
|
debounce((value: string) => {
|
||||||
|
setSearchText(value);
|
||||||
|
setCurrentPage(1);
|
||||||
|
}, 300),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
// Cleanup debounce on unmount
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
debouncedSearch.cancel();
|
||||||
|
};
|
||||||
|
}, [debouncedSearch]);
|
||||||
|
const handleSearch = (value: string) => {
|
||||||
|
debouncedSearch(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePageChange = (page: number) => {
|
||||||
|
setCurrentPage(page);
|
||||||
|
// Scroll to top when page changes
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col h-full">
|
||||||
|
{/* Search Bar */}
|
||||||
|
<div className="p-6 mb-6 transition-all ">
|
||||||
|
<div className="max-w-2xl ">
|
||||||
|
<Input
|
||||||
|
placeholder="搜索信件标题..."
|
||||||
|
allowClear
|
||||||
|
size="large"
|
||||||
|
onChange={(e) => handleSearch(e.target.value)}
|
||||||
|
prefix={<SearchOutlined className="text-gray-400" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Content Area */}
|
||||||
|
<div className="flex-grow overflow-auto px-4">
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 animate-pulse">
|
||||||
|
{[...Array(6)].map((_, index) => (
|
||||||
|
<div key={index} className="h-48 bg-gray-100 rounded-lg"></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : data?.items.length ? (
|
||||||
|
<>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-6">
|
||||||
|
{data.items.map((letter: any) => (
|
||||||
|
<LetterCard key={letter.id} letter={letter} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-center pb-6">
|
||||||
|
<Pagination
|
||||||
|
current={currentPage}
|
||||||
|
total={data.totalCount}
|
||||||
|
pageSize={params.pageSize}
|
||||||
|
onChange={handlePageChange}
|
||||||
|
showSizeChanger={false}
|
||||||
|
showQuickJumper
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="flex flex-col justify-center items-center h-96">
|
||||||
|
<Empty
|
||||||
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||||
|
description={
|
||||||
|
<span className="text-gray-600">
|
||||||
|
{searchText ? "未找到相关信件" : "暂无信件"}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
className="flex flex-col items-center"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ import { Button, Select, Spin } from "antd";
|
||||||
import type { SelectProps } from "antd";
|
import type { SelectProps } from "antd";
|
||||||
import { api } from "@nice/client";
|
import { api } from "@nice/client";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { SizeType } from "antd/es/config-provider/SizeContext";
|
||||||
interface StaffSelectProps {
|
interface StaffSelectProps {
|
||||||
value?: string | string[];
|
value?: string | string[];
|
||||||
onChange?: (value: string | string[]) => void;
|
onChange?: (value: string | string[]) => void;
|
||||||
|
@ -10,6 +11,7 @@ interface StaffSelectProps {
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
domainId?: string;
|
domainId?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
size?: SizeType
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function StaffSelect({
|
export default function StaffSelect({
|
||||||
|
@ -19,6 +21,7 @@ export default function StaffSelect({
|
||||||
style,
|
style,
|
||||||
multiple,
|
multiple,
|
||||||
domainId,
|
domainId,
|
||||||
|
size
|
||||||
}: StaffSelectProps) {
|
}: StaffSelectProps) {
|
||||||
const [keyword, setQuery] = useState<string>("");
|
const [keyword, setQuery] = useState<string>("");
|
||||||
|
|
||||||
|
@ -67,6 +70,7 @@ export default function StaffSelect({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Select
|
<Select
|
||||||
|
size={size}
|
||||||
allowClear
|
allowClear
|
||||||
showSearch
|
showSearch
|
||||||
mode={multiple ? "multiple" : undefined}
|
mode={multiple ? "multiple" : undefined}
|
||||||
|
|
|
@ -23,13 +23,13 @@ export default function TermSelect({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
className,
|
className,
|
||||||
placeholder = "选择单位",
|
placeholder = "选择术语",
|
||||||
multiple = false,
|
multiple = false,
|
||||||
taxonomyId,
|
taxonomyId,
|
||||||
domainId,
|
domainId,
|
||||||
// rootId = null,
|
|
||||||
disabled = false,
|
disabled = false,
|
||||||
// domain = undefined,
|
|
||||||
}: TermSelectProps) {
|
}: TermSelectProps) {
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
const [listTreeData, setListTreeData] = useState<
|
const [listTreeData, setListTreeData] = useState<
|
||||||
|
@ -170,11 +170,7 @@ export default function TermSelect({
|
||||||
showSearch
|
showSearch
|
||||||
allowClear
|
allowClear
|
||||||
// ref={selectRef}
|
// ref={selectRef}
|
||||||
dropdownStyle={{
|
|
||||||
width: "300px", // 固定宽度
|
|
||||||
minWidth: "200px", // 最小宽度
|
|
||||||
maxWidth: "600px", // 最大宽度
|
|
||||||
}}
|
|
||||||
defaultValue={defaultValue}
|
defaultValue={defaultValue}
|
||||||
value={value}
|
value={value}
|
||||||
className={className}
|
className={className}
|
||||||
|
|
|
@ -40,24 +40,7 @@
|
||||||
/* 垂直居中 */
|
/* 垂直居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* styles.css */
|
|
||||||
.ant-table {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-thead>tr>th {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-tbody>tr>td {
|
|
||||||
background-color: transparent !important;
|
|
||||||
border-bottom-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-cell {
|
|
||||||
background-color: transparent !important;
|
|
||||||
border-bottom-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 滚动条轨道 */
|
/* 滚动条轨道 */
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
|
@ -101,236 +84,3 @@
|
||||||
.no-wrap-header .ant-table-thead>tr>th {
|
.no-wrap-header .ant-table-thead>tr>th {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-table .ant-table-cell {
|
|
||||||
white-space: normal;
|
|
||||||
/* 允许换行 */
|
|
||||||
word-wrap: break-word;
|
|
||||||
/* 强制单词换行 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-table .ant-table-cell {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
/* 设置单元格边框 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-table .ant-table-tbody>tr>td {
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
/* 设置表格行底部边框 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-table .ant-table-tbody>tr:last-child>td {
|
|
||||||
border-bottom: none;
|
|
||||||
/* 去除最后一行的底部边框 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.quill-editor-container .ql-toolbar.ql-snow,
|
|
||||||
.quill-editor-container .ql-container.ql-snow {
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quill-editor-container .ql-toolbar.ql-snow {
|
|
||||||
background: rgb(248, 250, 252);
|
|
||||||
border-top-left-radius: 0.5rem;
|
|
||||||
border-top-right-radius: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quill-editor-container .ql-container.ql-snow {
|
|
||||||
background: transparent;
|
|
||||||
border-bottom-left-radius: 0.5rem;
|
|
||||||
border-bottom-right-radius: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quill-editor-container .ql-editor {
|
|
||||||
min-height: 120px;
|
|
||||||
color: rgb(30, 41, 59);
|
|
||||||
/* slate-800 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.quill-editor-container .ql-editor.ql-blank::before {
|
|
||||||
color: rgb(100, 116, 139);
|
|
||||||
/* slate-500 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.ql-editor {
|
|
||||||
|
|
||||||
/* 代码块容器 */
|
|
||||||
.ql-code-block-container {
|
|
||||||
background: #1e293b;
|
|
||||||
color: #e2e8f0;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
||||||
monospace;
|
|
||||||
|
|
||||||
/* 代码块内容 */
|
|
||||||
.ql-code-block {
|
|
||||||
padding: 0.2rem;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
line-height: 1.2;
|
|
||||||
overflow-x: auto;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 代码块 */
|
|
||||||
pre.ql-syntax {
|
|
||||||
background: #1e293b;
|
|
||||||
color: #e2e8f0;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding: 1rem;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
||||||
monospace;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
overflow-x: auto;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 引用块 */
|
|
||||||
blockquote {
|
|
||||||
border-left: 4px solid #3b82f6;
|
|
||||||
background: #f8fafc;
|
|
||||||
padding: 1rem 1.2rem;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
color: #475569;
|
|
||||||
font-style: italic;
|
|
||||||
|
|
||||||
/* 嵌套引用 */
|
|
||||||
blockquote {
|
|
||||||
border-left-color: #64748b;
|
|
||||||
background: #f1f5f9;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 有序列表 */
|
|
||||||
ol {
|
|
||||||
list-style-type: decimal;
|
|
||||||
padding-left: 2rem;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
/* 嵌套有序列表 */
|
|
||||||
ol {
|
|
||||||
list-style-type: lower-alpha;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
ol {
|
|
||||||
list-style-type: lower-roman;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
padding-left: 0.5rem;
|
|
||||||
margin-bottom: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
&::marker {
|
|
||||||
color: #3b82f6;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 无序列表 */
|
|
||||||
ul {
|
|
||||||
list-style-type: disc;
|
|
||||||
padding-left: 2rem;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
/* 嵌套无序列表 */
|
|
||||||
ul {
|
|
||||||
list-style-type: circle;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style-type: square;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
padding-left: 0.5rem;
|
|
||||||
margin-bottom: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
&::marker {
|
|
||||||
color: #3b82f6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 标题 */
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3 {
|
|
||||||
color: #1e3a8a;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1.25;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2em;
|
|
||||||
border-bottom: 2px solid #e2e8f0;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分割线 */
|
|
||||||
hr {
|
|
||||||
border: 0;
|
|
||||||
border-top: 2px solid #e2e8f0;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 段落 */
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表格 */
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
/* 更新 */
|
|
||||||
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
padding: 0.75rem;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
background: #f8fafc;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:nth-child(even) {
|
|
||||||
background: #f8fafc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@ import LetterListPage from "../app/main/letter/list/page";
|
||||||
import LetterProgressPage from "../app/main/letter/progress/page";
|
import LetterProgressPage from "../app/main/letter/progress/page";
|
||||||
import HelpPage from "../app/main/help/page";
|
import HelpPage from "../app/main/help/page";
|
||||||
import AuthPage from "../app/auth/page";
|
import AuthPage from "../app/auth/page";
|
||||||
import EditorLetterPage from "../app/main/letter/editor/page";
|
import LetterEditorPage from "../app/main/letter/editor/page";
|
||||||
import LetterDetailPage from "../app/main/letter/detail/page";
|
import LetterDetailPage from "../app/main/letter/detail/page";
|
||||||
import AdminLayout from "../components/layout/admin/AdminLayout";
|
import AdminLayout from "../components/layout/admin/AdminLayout";
|
||||||
import { CustomRouteObject } from "./types";
|
import { CustomRouteObject } from "./types";
|
||||||
|
@ -46,7 +46,7 @@ export const routes: CustomRouteObject[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "editor",
|
path: "editor",
|
||||||
element: <EditorLetterPage></EditorLetterPage>,
|
element: <LetterEditorPage></LetterEditorPage>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "write-letter",
|
path: "write-letter",
|
||||||
|
|
|
@ -21,3 +21,5 @@ export function generateUniqueId(prefix?: string): string {
|
||||||
// 如果提供了前缀,则添加前缀
|
// 如果提供了前缀,则添加前缀
|
||||||
return prefix ? `${prefix}_${uniquePart}` : uniquePart;
|
return prefix ? `${prefix}_${uniquePart}` : uniquePart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from "./types"
|
|
@ -0,0 +1 @@
|
||||||
|
export type NonVoid<T> = T extends void ? never : T;
|
|
@ -299,6 +299,9 @@ importers:
|
||||||
'@nice/ui':
|
'@nice/ui':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/ui
|
version: link:../../packages/ui
|
||||||
|
'@nice/utils':
|
||||||
|
specifier: workspace:^
|
||||||
|
version: link:../../packages/utils
|
||||||
'@tanstack/query-async-storage-persister':
|
'@tanstack/query-async-storage-persister':
|
||||||
specifier: ^5.51.9
|
specifier: ^5.51.9
|
||||||
version: 5.62.16
|
version: 5.62.16
|
||||||
|
|
Loading…
Reference in New Issue