From 20e6e9fb3fd346c86dd93385671fbd186e1f32d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Thu, 15 Jan 2026 14:26:45 +0800 Subject: [PATCH] 2 --- client/src/components/SnippetModal.vue | 237 +++++++++++++++++-------- client/src/pages/Blog.vue | 26 +-- client/src/pages/Snippets.vue | 21 ++- client/src/pages/Works.vue | 6 +- server/nl_blog.sql | 2 +- 5 files changed, 194 insertions(+), 98 deletions(-) diff --git a/client/src/components/SnippetModal.vue b/client/src/components/SnippetModal.vue index 3212553..e06c7e2 100644 --- a/client/src/components/SnippetModal.vue +++ b/client/src/components/SnippetModal.vue @@ -1,97 +1,182 @@ \ No newline at end of file +// Global mouse listener when modal is open and type is mouse +watch(() => [props.isOpen, props.type], ([open, type]) => { + if (open && type === 'mouse') { + window.addEventListener('mousemove', handleMouseMove) + } else { + window.removeEventListener('mousemove', handleMouseMove) + } +}) + +const mouseBoxStyle = computed(() => { + // Parallax effect + const xOffset = (mouseX.value - 200) / 20 // Approx center offset + const yOffset = (mouseY.value - 200) / 20 + return { + transform: `translate(${xOffset}px, ${yOffset}px)` + } +}) + +const previewBackgroundStyle = { + backgroundImage: ` + linear-gradient(45deg, #1a1a1a 25%, transparent 25%), + linear-gradient(-45deg, #1a1a1a 25%, transparent 25%), + linear-gradient(45deg, transparent 75%, #1a1a1a 75%), + linear-gradient(-45deg, transparent 75%, #1a1a1a 75%)`, + backgroundSize: '20px 20px', + backgroundPosition: '0 0, 0 10px, 10px -10px, -10px 0px' +} + + + \ No newline at end of file diff --git a/client/src/pages/Blog.vue b/client/src/pages/Blog.vue index 8ed65e5..c5068cd 100644 --- a/client/src/pages/Blog.vue +++ b/client/src/pages/Blog.vue @@ -22,22 +22,28 @@
-
-
-
- {{ post.category }} - {{ post.date }} +
+
+ {{ post.category }} + {{ post.date }} +
+
+

+ {{ post.title }} +

+

+ {{ post.excerpt }} +

+
阅读全文 ->
-
-

{{ post.title }}

-

{{ post.excerpt }}

-
+
diff --git a/client/src/pages/Snippets.vue b/client/src/pages/Snippets.vue index cba77a8..1a13698 100644 --- a/client/src/pages/Snippets.vue +++ b/client/src/pages/Snippets.vue @@ -25,17 +25,22 @@
-
- - {{ getSnippetType(snippet.type) }} + +
+
+
+
+
+
+ {{ snippet.title }} +
点击运行 ->
-

{{ snippet.title }}

-
{{ snippet.code }}
-
- + +
+
{{ snippet.code }}
diff --git a/client/src/pages/Works.vue b/client/src/pages/Works.vue index ad4b4ff..73cee5a 100644 --- a/client/src/pages/Works.vue +++ b/client/src/pages/Works.vue @@ -45,7 +45,7 @@
@@ -59,7 +59,7 @@

-
+
-
+
查看项目详情 diff --git a/server/nl_blog.sql b/server/nl_blog.sql index 9524ed7..0eeb60d 100644 --- a/server/nl_blog.sql +++ b/server/nl_blog.sql @@ -305,7 +305,7 @@ CREATE TABLE `operation_logs` ( -- ---------------------------- -- Records of users -- ---------------------------- -INSERT INTO `users` (`id`, `username`, `email`, `password_hash`, `role_id`, `role`, `is_active`, `created_at`, `updated_at`) VALUES (1, 'lq', 'liqiworker@gmail.com', '$2a$10$J9q3NfJ2X8H7Q5z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q', 1, 'admin', 1, '2026-01-13 16:10:14', '2026-01-14 12:57:55'); +INSERT INTO `users` (`id`, `username`, `email`, `password_hash`, `role_id`, `role`, `is_active`, `created_at`, `updated_at`) VALUES (1, 'lq', 'liqiworker@gmail.com', '$2a$10$yl.1yCZ2PSTsW14byyDQ3uekuEiqnC4VBr/TzR6OvMqFVRuiiHu5e', 1, 'admin', 1, '2026-01-13 16:10:14', '2026-01-14 12:57:55'); INSERT INTO `users` (`id`, `username`, `email`, `password_hash`, `role_id`, `role`, `is_active`, `created_at`, `updated_at`) VALUES (2, 'editor', 'editor@example.com', '$2a$10$J9q3NfJ2X8H7Q5z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q7z5Q', 2, 'editor', 1, '2026-01-13 16:10:14', '2026-01-13 16:10:14'); -- ----------------------------