diff --git a/pets-be/internal/service/user_profile.go b/pets-be/internal/service/user_profile.go
index e2233b3..3d4ae2d 100644
--- a/pets-be/internal/service/user_profile.go
+++ b/pets-be/internal/service/user_profile.go
@@ -188,7 +188,14 @@ func (s *Service) UpdateDecoration(userID string, bio, bgFileID, theme *string,
// ListUserPosts 某人发布的帖子
func (s *Service) ListUserPosts(viewerID, userID string, offset, limit int) ([]model.Post, int64, error) {
- q := s.db.Model(&model.Post{}).Where("user_id = ? AND status = ?", userID, "published")
+ q := s.db.Model(&model.Post{}).Where("user_id = ?", userID)
+ if viewerID == userID {
+ // 看自己:待审核/未通过的也要能看到(带状态展示),只藏软删除的
+ q = q.Where("status <> ?", model.PostDeleted)
+ } else {
+ // 看别人:只放已过审的
+ q = q.Where("status = ?", model.PostPublished)
+ }
var total int64
if err := q.Count(&total).Error; err != nil {
return nil, 0, err
diff --git a/pets-fe/components/bottom-sheet/bottom-sheet.js b/pets-fe/components/bottom-sheet/bottom-sheet.js
index 9d9c383..238fb0b 100644
--- a/pets-fe/components/bottom-sheet/bottom-sheet.js
+++ b/pets-fe/components/bottom-sheet/bottom-sheet.js
@@ -609,7 +609,7 @@ Component({
if (this.data.saving) return;
this.setData({ saving: true });
try {
- await api.createPost({
+ const post = await api.createPost({
pet_id: identity === 'petName' ? store.currentPetId() : null,
identity,
content,
@@ -618,6 +618,17 @@ Component({
});
this.triggerEvent('posted');
this.close();
+ // 内容安全审核:没直接过审的,明确告诉用户在审核,别以为发失败/是 bug
+ if (post && post.status && post.status !== 'published') {
+ wx.showModal({
+ title: '发布成功,审核中',
+ content: '内容需要通过安全审核后才会出现在社区。可在「我的 → 我的帖子」查看审核状态。',
+ showCancel: false,
+ confirmText: '知道了',
+ });
+ } else {
+ wx.showToast({ title: '已发布', icon: 'success' });
+ }
} catch (e) {
wx.showToast({ title: e.message || '发布失败', icon: 'none' });
this.setData({ saving: false });
diff --git a/pets-fe/pages/mine/mine.js b/pets-fe/pages/mine/mine.js
index 1bab4e1..9b41413 100644
--- a/pets-fe/pages/mine/mine.js
+++ b/pets-fe/pages/mine/mine.js
@@ -39,6 +39,12 @@ Page({
const uid = this.data.user && this.data.user.id;
if (uid) wx.navigateTo({ url: `/pages/user/user?id=${uid}` });
},
+ // 我的帖子:进自己的主页,能看到待审核/未通过的帖子及状态
+ goMyPosts() {
+ const uid = this.data.user && this.data.user.id;
+ if (!uid) return wx.showToast({ title: '请先登录', icon: 'none' });
+ wx.navigateTo({ url: '/pages/user/user?id=' + uid });
+ },
goSettings() {
wx.navigateTo({ url: '/pages/settings/settings' });
},
diff --git a/pets-fe/pages/mine/mine.wxml b/pets-fe/pages/mine/mine.wxml
index ea1d2ad..85a0d33 100644
--- a/pets-fe/pages/mine/mine.wxml
+++ b/pets-fe/pages/mine/mine.wxml
@@ -29,8 +29,13 @@
还没有毛孩子,先建一份档案
-
+
+
+
+ 我的帖子看审核状态
+
+
设置
diff --git a/pets-fe/pages/user/user.js b/pets-fe/pages/user/user.js
index 60c66be..a4da6c5 100644
--- a/pets-fe/pages/user/user.js
+++ b/pets-fe/pages/user/user.js
@@ -3,6 +3,8 @@ const store = require('../../utils/store.js');
const { toastErr } = require('../../utils/ui.js');
const TAG_CLASS = { 求助: 'warn', 经验: 'blue', 精选: 'purple', 避坑: 'red', 晒宠: '' };
+// 审核状态 → 展示文案(只在看自己主页时出现)
+const STATUS_TEXT = { pending: '审核中', rejected: '未通过' };
function fmtAgo(iso) {
if (!iso) return '';
@@ -47,6 +49,8 @@ Page({
author_emoji: p.author_emoji || '🐾',
tag,
tagClass: TAG_CLASS[tag] || '',
+ // 只有看自己主页才会拿到非「已发布」的帖子,给个审核状态标
+ statusText: STATUS_TEXT[p.status] || '',
};
});
const merged = page === 1 ? list : this.data.posts.concat(list);
diff --git a/pets-fe/pages/user/user.wxml b/pets-fe/pages/user/user.wxml
index 39b4d14..fee2bff 100644
--- a/pets-fe/pages/user/user.wxml
+++ b/pets-fe/pages/user/user.wxml
@@ -20,8 +20,11 @@ module.exports.isUrl = function (s) { return s && s.indexOf('http') === 0; }
{{item.author_name}}
{{item.timeText}}
+ {{item.statusText}}
{{item.tag}}
+ 内容审核中,通过后其他人才能看到
+ 未通过内容安全审核,仅你可见
{{item.content}}
diff --git a/pets-fe/pages/user/user.wxss b/pets-fe/pages/user/user.wxss
index dba8ff6..3e9ff8c 100644
--- a/pets-fe/pages/user/user.wxss
+++ b/pets-fe/pages/user/user.wxss
@@ -1,2 +1,15 @@
/* 头部整块(头像/昵称/签名/计数/养宠数据/宠物墙)已抽成 components/profile-head,
帖子卡走 app.wxss 的 .post-card。这里没有页面独有样式了。 */
+
+/* 审核状态标(只在看自己主页出现) */
+.post-status{
+ padding:2rpx var(--sp-2);border-radius:var(--r-full);
+ font-size:var(--fs-cap);font-weight:var(--fw-b);margin-right:var(--sp-2);
+}
+.post-status.st-pending{background:#FDECC8;color:#B26A00}
+.post-status.st-rejected{background:var(--red-soft);color:var(--red-ink)}
+.status-note{
+ margin:0 0 var(--sp-2);padding:var(--sp-2) var(--sp-3);border-radius:var(--r-sm);
+ background:var(--surface-2);color:var(--muted);font-size:var(--fs-cap);line-height:1.5;
+}
+.status-note.st-note-red{background:var(--red-soft);color:var(--red-ink)}