fix: 修复后台文章计数为0 + 分类编辑补全描述字段 + CSP放行外部图片 + 更新关于页描述
- 文章管理:计数请求补 page=1 参数,命中分页接口返回正确的 total - 分类管理:编辑模式新增描述输入框,保存时一并提交 description - CSP:img-src 加入 https: 允许加载外部图片 - 关于页:数据存储描述从 JSON 文件更正为 SQLite 数据库 - Footer:添加 ICP 备案号
This commit is contained in:
@@ -16,6 +16,14 @@ interface GsapRevealProps {
|
||||
once?: boolean;
|
||||
}
|
||||
|
||||
const VARIANTS = {
|
||||
"fade-up": { y: 40, opacity: 0 },
|
||||
"fade-in": { opacity: 0 },
|
||||
"slide-left": { x: -40, opacity: 0 },
|
||||
"slide-right": { x: 40, opacity: 0 },
|
||||
scale: { scale: 0.92, opacity: 0 },
|
||||
} as const;
|
||||
|
||||
export default function GsapReveal({
|
||||
children,
|
||||
variant = "fade-up",
|
||||
@@ -28,25 +36,20 @@ export default function GsapReveal({
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) return;
|
||||
|
||||
const el = ref.current;
|
||||
const children = el.children.length > 1 ? el.children : [el];
|
||||
if (!el) return;
|
||||
|
||||
const variants = {
|
||||
"fade-up": { y: 40, opacity: 0 },
|
||||
"fade-in": { opacity: 0 },
|
||||
"slide-left": { x: -40, opacity: 0 },
|
||||
"slide-right": { x: 40, opacity: 0 },
|
||||
scale: { scale: 0.92, opacity: 0 },
|
||||
};
|
||||
// 关键降级:尊重用户系统设置,无障碍优先,不做任何位移。
|
||||
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
if (reduceMotion) return;
|
||||
|
||||
const targets = el.children.length > 1 ? Array.from(el.children) : [el];
|
||||
|
||||
const ctx = gsap.context(() => {
|
||||
if (stagger > 0 && children.length > 1) {
|
||||
// Each child gets its own ScrollTrigger so off-screen items animate when scrolled into view
|
||||
Array.from(children).forEach((child, i) => {
|
||||
if (stagger > 0 && targets.length > 1) {
|
||||
targets.forEach((child, i) => {
|
||||
gsap.from(child, {
|
||||
...variants[variant],
|
||||
...VARIANTS[variant],
|
||||
duration,
|
||||
delay: delay + i * stagger,
|
||||
ease: "power3.out",
|
||||
@@ -58,8 +61,8 @@ export default function GsapReveal({
|
||||
});
|
||||
});
|
||||
} else {
|
||||
gsap.from(children, {
|
||||
...variants[variant],
|
||||
gsap.from(targets, {
|
||||
...VARIANTS[variant],
|
||||
duration,
|
||||
delay,
|
||||
ease: "power3.out",
|
||||
|
||||
Reference in New Issue
Block a user