From e0291868bc851640a43f7033b77a7040d0d5e6e1 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Mon, 11 Aug 2025 01:45:23 +0800 Subject: [PATCH] feat: add lottery post type options --- frontend_nuxt/components/PostTypeSelect.vue | 46 +++++ frontend_nuxt/package-lock.json | 23 +++ frontend_nuxt/package.json | 4 +- frontend_nuxt/pages/new-post.vue | 191 +++++++++++++++++++- 4 files changed, 259 insertions(+), 5 deletions(-) create mode 100644 frontend_nuxt/components/PostTypeSelect.vue diff --git a/frontend_nuxt/components/PostTypeSelect.vue b/frontend_nuxt/components/PostTypeSelect.vue new file mode 100644 index 000000000..2f2791349 --- /dev/null +++ b/frontend_nuxt/components/PostTypeSelect.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/frontend_nuxt/package-lock.json b/frontend_nuxt/package-lock.json index 0262f98eb..9395676f6 100644 --- a/frontend_nuxt/package-lock.json +++ b/frontend_nuxt/package-lock.json @@ -8,6 +8,7 @@ "dependencies": { "cropperjs": "^1.6.2", "echarts": "^5.6.0", + "flatpickr": "^4.6.13", "highlight.js": "^11.11.1", "ldrs": "^1.0.0", "markdown-it": "^14.1.0", @@ -16,6 +17,7 @@ "vditor": "^3.11.1", "vue-easy-lightbox": "^1.19.0", "vue-echarts": "^7.0.3", + "vue-flatpickr-component": "^12.0.0", "vue-toastification": "^2.0.0-rc.5" } }, @@ -4868,6 +4870,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flatpickr": { + "version": "4.6.13", + "resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.13.tgz", + "integrity": "sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw==", + "license": "MIT" + }, "node_modules/fn.name": { "version": "1.1.0", "license": "MIT" @@ -10227,6 +10235,21 @@ } } }, + "node_modules/vue-flatpickr-component": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/vue-flatpickr-component/-/vue-flatpickr-component-12.0.0.tgz", + "integrity": "sha512-CJ5jrgTaeD66Z4mjEocSTAdB/n6IGSlUICwdBanpyCI8hswq5rwXvEYQ5IKA3K3uVjP5pBlY9Rg6o3xoszTPpA==", + "license": "MIT", + "dependencies": { + "flatpickr": "^4.6.13" + }, + "engines": { + "node": ">=14.13.0" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, "node_modules/vue-router": { "version": "4.5.1", "license": "MIT", diff --git a/frontend_nuxt/package.json b/frontend_nuxt/package.json index ee734e167..2b6d110e9 100644 --- a/frontend_nuxt/package.json +++ b/frontend_nuxt/package.json @@ -19,6 +19,8 @@ "vditor": "^3.11.1", "vue-easy-lightbox": "^1.19.0", "vue-echarts": "^7.0.3", - "vue-toastification": "^2.0.0-rc.5" + "vue-toastification": "^2.0.0-rc.5", + "flatpickr": "^4.6.13", + "vue-flatpickr-component": "^12.0.0" } } diff --git a/frontend_nuxt/pages/new-post.vue b/frontend_nuxt/pages/new-post.vue index 93f9b4211..51e1bee8e 100644 --- a/frontend_nuxt/pages/new-post.vue +++ b/frontend_nuxt/pages/new-post.vue @@ -10,6 +10,7 @@
+
@@ -32,31 +33,101 @@
发布中...
+
+ +
+ +
+
+ 奖品数量 +
+ + + +
+
+
+ 抽奖结束时间 + + + +
+
@@ -366,6 +478,77 @@ export default { padding-bottom: 50px; } +.lottery-section { + margin-top: 20px; + display: flex; + flex-direction: column; + gap: 20px; +} + +.prize-row { + display: flex; +} + +.prize-container { + position: relative; + width: 100px; + height: 100px; + border-radius: 10px; + overflow: hidden; + cursor: pointer; +} + +.prize-preview { + width: 100%; + height: 100%; + object-fit: cover; +} + +.prize-input { + display: none; +} + +.prize-overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.4); + color: #fff; + display: flex; + align-items: center; + justify-content: center; + opacity: 0; + transition: opacity 0.2s; +} + +.prize-container:hover .prize-overlay { + opacity: 1; +} + +.prize-count-row, +.prize-time-row { + display: flex; + align-items: center; + gap: 10px; +} + +.prize-count-input { + display: flex; + align-items: center; + gap: 5px; +} + +.prize-count-input button { + width: 24px; + height: 24px; +} + +.time-picker { + max-width: 200px; +} + @media (max-width: 768px) { .new-post-page { width: calc(100vw - 20px);