From d27997682287fe4879a999bb57896748ea8b9615 Mon Sep 17 00:00:00 2001 From: zerosaturation Date: Sat, 4 Jul 2026 00:22:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E9=93=B8=E9=80=A0?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/pages.json | 9 + frontend/pages/ai-dazi/index.vue | 14 +- frontend/pages/castlove/craft-select.vue | 2 +- .../pages/castlove/create-laser-upload.css | 117 ++ frontend/pages/castlove/create.vue | 1560 +++++++++++++++++ .../pages/castlove/laser/laser-result.vue | 3 +- frontend/pages/profile/profile.vue | 8 +- .../composables/useContributionRealtime.js | 3 +- .../composables/useMessageRealtime.js | 3 +- frontend/pages/support-activity/index.vue | 81 +- .../utils/laser-card/laserPreviewWebgl.js | 27 + 11 files changed, 1779 insertions(+), 48 deletions(-) create mode 100644 frontend/pages/castlove/create-laser-upload.css create mode 100644 frontend/pages/castlove/create.vue diff --git a/frontend/pages.json b/frontend/pages.json index 430c843..2982b4b 100644 --- a/frontend/pages.json +++ b/frontend/pages.json @@ -203,6 +203,15 @@ } } }, + { + "path": "pages/castlove/create", + "style": { + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" + } + } + }, { "path": "pages/castlove/craft-select", "style": { diff --git a/frontend/pages/ai-dazi/index.vue b/frontend/pages/ai-dazi/index.vue index 3d20e09..eedb990 100644 --- a/frontend/pages/ai-dazi/index.vue +++ b/frontend/pages/ai-dazi/index.vue @@ -112,11 +112,19 @@ isErrorProcessing: false // 防止错误重复触发 }, onLoad() { this.initSession() - this.initWebSocket() }, onReady() { console.log('[AI Chat] onReady called') }, + onShow() { + // 页面可见时连接 WebSocket(包括首次进入和从其他页面返回) + this.initWebSocket() + }, + onHide() { + // 页面不可见时断开,不再占用连接 + this.clearStreamTimeout() + this.closeWebSocket() + }, onUnload() { this.clearStreamTimeout() this.closeWebSocket() @@ -196,11 +204,10 @@ isErrorProcessing: false // 防止错误重复触发 }) // 设置断开回调 - 在对话框提示用户 - socket.off('disconnect', this._disconnectHandler) + const prevDisconnect = this._disconnectHandler this._disconnectHandler = () => { console.log('[AI Chat] WebSocket disconnected') if (this.isTyping) { - // 先保存已收到的部分回复 if (this.currentAssistantMessage) { this.messages.push({ role: 'assistant', @@ -217,6 +224,7 @@ isErrorProcessing: false // 防止错误重复触发 this.scrollToBottom() } } + socket.off('disconnect', prevDisconnect) socket.on('disconnect', this._disconnectHandler) // 设置连接成功回调 diff --git a/frontend/pages/castlove/craft-select.vue b/frontend/pages/castlove/craft-select.vue index a39705f..30097a7 100644 --- a/frontend/pages/castlove/craft-select.vue +++ b/frontend/pages/castlove/craft-select.vue @@ -410,7 +410,7 @@ export default { fail: (err) => { // 路径写错 / pages.json 未注册 → 兜底 toast,不闪退 console.error("[castlove] navigateTo fail", card.route_path, err); - uni.showToast({ title: "页面不存在", icon: "none" }); + uni.showToast({ title: "功能待开发", icon: "none" }); }, }); }, diff --git a/frontend/pages/castlove/create-laser-upload.css b/frontend/pages/castlove/create-laser-upload.css new file mode 100644 index 0000000..a26a70f --- /dev/null +++ b/frontend/pages/castlove/create-laser-upload.css @@ -0,0 +1,117 @@ +/** + * 铸爱 create 页 — 镭射卡上传区样式(独立 CSS,由 create.vue import,确保各端构建必进包) + * 根类 castlove-laser-upload-root 全局唯一,避免 scoped / 第二 style 块在部分端未生效 + */ +.castlove-laser-upload-root { + position: relative; + width: 100%; + /* 略偏竖版小卡比例,接近设计稿「大卡 + 内虚线」观感 */ + height: 520rpx; + box-sizing: border-box; + border-radius: 32rpx; + border: 1rpx solid rgba(255, 255, 255, 0.38); + background: rgba(255, 255, 255, 0.18); + backdrop-filter: blur(22rpx); + -webkit-backdrop-filter: blur(22rpx); + overflow: hidden; + box-shadow: + 0 22rpx 56rpx rgba(40, 22, 80, 0.36), + inset 0 0 0 1rpx rgba(255, 255, 255, 0.22); +} + +.castlove-laser-upload-root .uploaded-image { + width: 100%; + height: 100%; + border-radius: 24rpx; + box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.22); +} + +.castlove-laser-upload-root .upload-laser-stack { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + box-sizing: border-box; +} + +/* 与设计稿一致:卡内淡色「卡面 / 人像」底图(与工艺选择同款素材) */ +.castlove-laser-upload-root .upload-laser-photo-bg { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + width: 100%; + height: 100%; + z-index: 0; + opacity: 0.22; + pointer-events: none; + filter: saturate(1.15) contrast(0.92); +} + +.castlove-laser-upload-root .upload-laser-watermark { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + z-index: 1; + opacity: 1; + pointer-events: none; + /* 叠在底图上:压暗边缘 + 轻微幻彩,避免只剩「灰蒙一块」 */ + background: + linear-gradient( + 118deg, + rgba(255, 170, 220, 0.12) 0%, + transparent 40%, + rgba(170, 210, 255, 0.1) 62%, + transparent 82%, + rgba(255, 210, 190, 0.08) 100% + ), + radial-gradient(ellipse 55% 75% at 50% 100%, rgba(35, 22, 70, 0.45), transparent 58%), + radial-gradient(ellipse 40% 48% at 50% 32%, rgba(100, 75, 150, 0.28), transparent 55%), + linear-gradient(185deg, rgba(255, 220, 245, 0.08) 0%, rgba(55, 35, 95, 0.25) 100%); +} + +.castlove-laser-upload-root .upload-laser-inset { + position: absolute; + /* 收紧留白:虚线框更贴外框,接近设计稿「整卡即相框」 */ + left: 14rpx; + right: 14rpx; + top: 14rpx; + bottom: 14rpx; + z-index: 2; + box-sizing: border-box; +} + +.castlove-laser-upload-root .upload-laser-dashed-inner { + width: 100%; + height: 100%; + box-sizing: border-box; + border: 2rpx dashed rgba(255, 255, 255, 0.95); + border-radius: 26rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 20rpx; + padding: 24rpx 16rpx; + background: rgba(255, 255, 255, 0.02); +} + +.castlove-laser-upload-root .upload-plus--laser { + font-size: 96rpx; + line-height: 0.88; + color: #ffffff; + font-weight: 100; + text-shadow: 0 2rpx 18rpx rgba(60, 30, 100, 0.35); +} + +.castlove-laser-upload-root .upload-text--laser { + font-size: 28rpx; + color: rgba(255, 255, 255, 0.96); + font-weight: 500; + letter-spacing: 1rpx; + text-shadow: 0 2rpx 12rpx rgba(40, 20, 80, 0.4); +} diff --git a/frontend/pages/castlove/create.vue b/frontend/pages/castlove/create.vue new file mode 100644 index 0000000..3070683 --- /dev/null +++ b/frontend/pages/castlove/create.vue @@ -0,0 +1,1560 @@ +