From 416c1ed03d0cc1860c7a7d2de4ea7defe292829a Mon Sep 17 00:00:00 2001 From: Pine Date: Thu, 10 Sep 2026 16:07:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(miniprogram):=20=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=8F=91=E5=B8=96=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=8F=91=E5=B8=96=E9=A1=B5=E4=B8=8E=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 community-post(发帖/编辑)与 community-post-detail(帖子详情)页面 - app.config.js 移除对应页面注册 - hall 大厅页:社区 tab 移除"+ 发布"入口,帖子不再跳详情,空态文案更新 - utils/hall.js 删除未引用的 communityCreatePost/communityCommentPost --- miniprogram/src/app.config.js | 2 +- .../community-post-detail/index.config.js | 1 - .../community-post-detail/index.jsx | 84 ------------------- .../community-post-detail/index.scss | 32 ------- .../community-post/index.config.js | 1 - .../src/pages-extra/community-post/index.jsx | 43 ---------- .../src/pages-extra/community-post/index.scss | 1 - miniprogram/src/pages/hall/index.jsx | 5 +- miniprogram/src/utils/hall.js | 2 - 9 files changed, 3 insertions(+), 168 deletions(-) delete mode 100644 miniprogram/src/pages-extra/community-post-detail/index.config.js delete mode 100644 miniprogram/src/pages-extra/community-post-detail/index.jsx delete mode 100644 miniprogram/src/pages-extra/community-post-detail/index.scss delete mode 100644 miniprogram/src/pages-extra/community-post/index.config.js delete mode 100644 miniprogram/src/pages-extra/community-post/index.jsx delete mode 100644 miniprogram/src/pages-extra/community-post/index.scss diff --git a/miniprogram/src/app.config.js b/miniprogram/src/app.config.js index 3b87a9e..2ce1a63 100644 --- a/miniprogram/src/app.config.js +++ b/miniprogram/src/app.config.js @@ -18,7 +18,7 @@ export default { 'my-cert/index', 'compute/index', 'pay/index', 'pay-qr/index', 'event-edit/index', 'my-events/index', 'event-bookings/index', 'hall-talents/index', 'hall-talent-detail/index', 'hall-jobs/index', 'hall-job-detail/index', 'hall-services/index', 'hall-service-detail/index', - 'community/index', 'community-post/index', 'community-post-detail/index', + 'community/index', 'hall-task-publish/index', 'hall-service-publish/index', 'hall-job-publish/index', 'talent-edit/index' ] diff --git a/miniprogram/src/pages-extra/community-post-detail/index.config.js b/miniprogram/src/pages-extra/community-post-detail/index.config.js deleted file mode 100644 index 145220d..0000000 --- a/miniprogram/src/pages-extra/community-post-detail/index.config.js +++ /dev/null @@ -1 +0,0 @@ -export default { navigationBarTitleText: '详情', navigationStyle: 'custom' }; diff --git a/miniprogram/src/pages-extra/community-post-detail/index.jsx b/miniprogram/src/pages-extra/community-post-detail/index.jsx deleted file mode 100644 index a2c5276..0000000 --- a/miniprogram/src/pages-extra/community-post-detail/index.jsx +++ /dev/null @@ -1,84 +0,0 @@ -import { View, Text, Input, Button } from '@tarojs/components'; -import Taro from '@tarojs/taro'; -import { useState, useEffect, useCallback } from 'react'; -import { getCurrentInstance } from '@tarojs/taro'; -import { communityLikePost, communityCommentPost } from '@/utils/hall'; -import { request } from '@/utils/api'; -import { isAuthed } from '@/utils/auth'; -import { PageHeader } from '@/components/TopInset'; -import Skeleton from '@/components/skeleton'; -import './index.scss'; - -/* 帖子详情:正文 + 评论列表 + 发评论 */ -export default function CommunityPostDetail() { - const id = (getCurrentInstance().router || {}).params?.id; - const [data, setData] = useState(null); - const [content, setContent] = useState(''); - const [busy, setBusy] = useState(false); - const load = useCallback(() => { - request('GET', `/community/posts/${encodeURIComponent(id)}`).then(setData).catch(() => {}); - }, [id]); - useEffect(load, [load]); - - if (!data) return ; - const { post, comments } = data; - const like = async () => { - if (!isAuthed()) { Taro.showToast({ title: '请先登录', icon: 'none' }); return; } - try { - const r = await communityLikePost(post.id); - setData((d) => ({ ...d, post: { ...d.post, likeCount: Math.max(0, (d.post.likeCount || 0) + (r.liked ? 1 : -1)) } })); - } catch { /* 忽略 */ } - }; - const comment = async () => { - if (!isAuthed()) { Taro.showToast({ title: '请先登录', icon: 'none' }); return; } - if (!content.trim()) return; - setBusy(true); - try { - await communityCommentPost(post.id, { content }); - setContent(''); - load(); - } catch (e) { Taro.showToast({ title: (e && e.message) || '评论失败', icon: 'none' }); } - finally { setBusy(false); } - }; - return ( - - - - {/* 帖子正文卡片 */} - - - {(post.authorName || '·').slice(0, 1)} - - {post.authorName} - {post.topic}{post.pinned ? ' · 置顶' : ''} · {(post.createdAt || '').slice(0, 10)} - - - {post.title} - {post.content} - - 赞 {post.likeCount || 0} - 评论 {post.commentCount || 0} - - - - {/* 评论区 */} - 评论({(comments || []).length}) - {(comments || []).length === 0 && 还没有评论} - {(comments || []).map((c) => ( - - - {c.authorName} - {(c.createdAt || '').slice(0, 10)} - - {c.content} - - ))} - - {/* 评论输入 */} - - setContent(e.detail.value)} /> - - - - ); -} diff --git a/miniprogram/src/pages-extra/community-post-detail/index.scss b/miniprogram/src/pages-extra/community-post-detail/index.scss deleted file mode 100644 index 6f11a76..0000000 --- a/miniprogram/src/pages-extra/community-post-detail/index.scss +++ /dev/null @@ -1,32 +0,0 @@ -/* 社区帖子详情 · 参考任务详情 Soft UI 风格 */ -.cpd { position: relative; z-index: 2; padding: 32rpx 24rpx 60rpx; min-height: 100vh; - background: linear-gradient(165deg, #edf2ff 0%, #f6eefc 34%, #ecf7f6 68%, #eaf4ff 100%); } -.cpd-empty { display: block; padding: 120rpx 0; text-align: center; color: #9aa4c6; font-size: 26rpx; } - -/* 帖子正文卡片 */ -.cpd-post { background: rgba(255,255,255,.82); border: 1rpx solid rgba(99,132,255,.12); border-radius: 22rpx; padding: 24rpx; margin-bottom: 16rpx; box-shadow: 0 8rpx 24rpx rgba(59,79,125,.08); } -.cpd-post-head { display: flex; align-items: center; gap: 16rpx; } -.cpd-avatar { width: 72rpx; height: 72rpx; border-radius: 50%; background: linear-gradient(135deg, #4d7cfe, #7a5ff0); - color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 700; flex: none; } -.cpd-author { font-size: 27rpx; font-weight: 600; color: #2b3a66; } -.cpd-meta { font-size: 22rpx; color: #8a94c0; margin-top: 2rpx; } -.cpd-title { display: block; margin-top: 16rpx; font-size: 34rpx; font-weight: 800; color: #2b3a66; line-height: 1.35; } -.cpd-content { display: block; margin-top: 12rpx; font-size: 27rpx; color: #4a5580; line-height: 1.75; white-space: pre-wrap; } -.cpd-foot { display: flex; gap: 36rpx; margin-top: 18rpx; font-size: 24rpx; color: #8a94c0; } -.cpd-foot-item { display: flex; align-items: center; gap: 6rpx; } - -/* 评论区 */ -.cpd-sec { display: block; font-size: 28rpx; font-weight: 700; color: #2b3a66; margin: 8rpx 4rpx 14rpx; } -.cpd-comment { background: rgba(255,255,255,.6); border: 1rpx solid rgba(99,132,255,.08); border-radius: 18rpx; padding: 20rpx 22rpx; margin-bottom: 12rpx; } -.cpd-comment-head { display: flex; align-items: center; gap: 12rpx; } -.cpd-comment-author { font-size: 25rpx; font-weight: 600; color: #2b3a66; } -.cpd-comment-time { font-size: 22rpx; color: #8a94c0; } -.cpd-comment-content { display: block; margin-top: 8rpx; font-size: 25rpx; color: #4a5580; line-height: 1.65; } - -/* 评论输入区 */ -.cpd-input-row { display: flex; gap: 14rpx; margin-top: 16rpx; } -.cpd-input { flex: 1; min-width: 0; height: 72rpx; line-height: 72rpx; padding: 0 22rpx; - border-radius: 16rpx; background: rgba(255,255,255,.8); font-size: 25rpx; border: 1rpx solid rgba(99,132,255,.12); } -.cpd-send { flex: none; width: 140rpx; height: 72rpx; line-height: 72rpx; border-radius: 999rpx; - background: linear-gradient(135deg, #4d7cfe, #7a5ff0); color: #fff; font-size: 25rpx; font-weight: 600; padding: 0; border: none; } -.cpd-send::after { border: none; } diff --git a/miniprogram/src/pages-extra/community-post/index.config.js b/miniprogram/src/pages-extra/community-post/index.config.js deleted file mode 100644 index a4049ce..0000000 --- a/miniprogram/src/pages-extra/community-post/index.config.js +++ /dev/null @@ -1 +0,0 @@ -export default { navigationStyle: 'custom' }; diff --git a/miniprogram/src/pages-extra/community-post/index.jsx b/miniprogram/src/pages-extra/community-post/index.jsx deleted file mode 100644 index 7486256..0000000 --- a/miniprogram/src/pages-extra/community-post/index.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import { View, Text, Input, Textarea, Button } from '@tarojs/components'; -import Taro from '@tarojs/taro'; -import { useState } from 'react'; -import { communityCreatePost } from '@/utils/hall'; -import { isAuthed } from '@/utils/auth'; -import { PageHeader } from '@/components/TopInset'; -import '@/styles/hall.scss'; - -const TOPICS = ['交流', '求助', '资源', '经验', '公告']; - -export default function CommunityPost() { - const [f, setF] = useState({ topic: '交流', title: '', content: '' }); - const [msg, setMsg] = useState(''); - const [busy, setBusy] = useState(false); - const submit = async () => { - if (!isAuthed()) { Taro.showToast({ title: '请先登录', icon: 'none' }); return; } - setBusy(true); setMsg(''); - try { - await communityCreatePost(f); - Taro.showToast({ title: '发布成功', icon: 'success' }); - setTimeout(() => Taro.navigateBack(), 800); - } catch (e) { setMsg((e && e.message) || '发布失败'); } - finally { setBusy(false); } - }; - return ( - - - - - {TOPICS.map((t) => ( - setF((s) => ({ ...s, topic: t }))}>{t} - ))} - - setF((s) => ({ ...s, title: e.detail.value }))} /> -