feat: 新增举报详情功能及相关接口、页面

新增举报详情页面路由与配置
新增举报详情接口及路由规则
新增举报列表状态筛选功能
新增错误信息标准化处理方法
优化举报列表页面UI交互
完善微信登录异常提示处理
这个提交包含在:
2026-11-19 09:16:58 +08:00
父节点 7e22a66de0
当前提交 134267fcd9
共有 31 个文件被更改,包括 2849 次插入 和 572 次删除

查看文件

@@ -68,6 +68,8 @@ export const postApi = {
comment: (id, payload) => post(`/post/${id}/comment`, payload, { silent: true }),
/** 发布者回复评价 */
replyComment: (commentId, payload) => post(`/post/comment/${commentId}/reply`, payload, { silent: true }),
/** 删除自己的评价 */
deleteComment: (commentId) => post(`/post/comment/${commentId}/delete`, {}, { silent: true }),
/** 评价列表(详情页「用户评价」,替代前端写死的假评价) */
comments: (id) => get(`/post/${id}/comments`, {}, { silent: true }),
}

查看文件

@@ -1,8 +1,9 @@
/**
* 接口模块 · 举报(用户端)
* 对应接口契约:
* - POST /report 提交举报 {targetType:'post'|'comment', targetId, reason, detail?, images?} → {reportId}
* - GET /report/my 查询我的举报记录 {page, size} → 分页列表
* - POST /report 提交举报 {targetType:'post'|'comment', targetId, reason, detail?, images?} → {reportId}
* - GET /report/my 查询我的举报记录 {page, size} → 分页列表
* - GET /report/:id 查询单条举报记录详情 → 举报详情对象
*/
import { post, get } from '../utils/request.js'
import { REPORT_REASONS } from '../constants/report.js'
@@ -29,6 +30,13 @@ export const reportApi = {
*/
my: (params = {}) => get('/report/my', params, { silent: true }),
/**
* 查询单条举报记录详情
* @param {number|string} id 举报记录 ID
* @returns {Promise<Object>}
*/
detail: (id) => get(`/report/${id}`, {}, { silent: true }),
/** 举报原因默认清单 */
reasons: REPORT_REASONS,
}

查看文件

@@ -141,7 +141,8 @@ export function request(options = {}) {
if (body.code === 0 || body.code === 200) {
resolve(body.data !== undefined ? body.data : body)
} else {
const err = toErr(body.message || body.msg || '请求失败', body.code)
const msg = normalizeErrorMessage(body.message || body.msg, '请求失败,请稍后重试')
const err = toErr(msg, body.code)
if (!silent) runtime.showToast({ title: err.message, icon: 'none' })
reject(err)
}
@@ -153,6 +154,38 @@ export function request(options = {}) {
})
}
/**
* 将底层英文网络或系统错误消息转换为用户可理解的中文提示
* @param {string} raw 原始错误消息
* @param {string} fallback 默认中文兜底文案
* @returns {string} 中文错误提示
*/
function normalizeErrorMessage(raw, fallback = '网络请求失败,请稍后重试') {
const text = typeof raw === 'string' ? raw.trim() : ''
if (!text) return fallback
const lower = text.toLowerCase()
if (lower.includes('timeout') || lower.includes('timed out')) {
return '网络请求超时,请稍后重试'
}
if (lower.includes('domain list')) {
return '服务域名配置异常,请联系管理员'
}
if (lower.includes('ssl') || lower.includes('certificate')) {
return '安全连接异常,请稍后重试'
}
if (lower.startsWith('request:fail') || lower.includes('network error') || lower.includes('failed to fetch')) {
return '网络连接失败,请检查网络后重试'
}
// 若包含中文且不含常见底层技术报错特征,直接展示
if (/[\u4e00-\u9fa5]/.test(text) && !/sqlstate|curl error|exception/i.test(text)) {
return text
}
return fallback
}
/**
* 失败处理:抛出异常(必要时弹 toast 提示)
* @param {Object} err 错误对象
@@ -160,7 +193,8 @@ export function request(options = {}) {
*/
function handleFail(err, ctx) {
const { silent, runtime, reject } = ctx
const e = toErr(err && (err.errMsg || err.message) ? err.errMsg || err.message : '网络请求失败')
const rawMsg = err && (err.errMsg || err.message) ? err.errMsg || err.message : ''
const e = toErr(normalizeErrorMessage(rawMsg, '网络请求失败,请检查网络后重试'))
if (!silent) runtime.showToast({ title: e.message, icon: 'none' })
reject(e)
}

查看文件

@@ -30,6 +30,7 @@ import { groupAreaTree } from '@/common/utils/area.js'
*/
export default {
name: 'FcAreaPicker',
emits: ['change'],
props: {
// 平铺服务区域:[{ id, province, city, district }]
areas: { type: Array, default: () => [] },

查看文件

@@ -349,6 +349,7 @@ export default {
.report-modal__panel {
width: 100%;
max-height: 85vh;
overflow: hidden;
background: #ffffff;
border-radius: 36rpx 36rpx 0 0;
box-shadow: 0 -8rpx 36rpx rgba(15, 23, 42, 0.12);
@@ -361,6 +362,7 @@ export default {
}
.report-modal__handle-bar {
flex-shrink: 0;
width: 72rpx;
height: 8rpx;
background: #e2e8f0;
@@ -369,6 +371,7 @@ export default {
}
.report-modal__header {
flex-shrink: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
@@ -437,9 +440,11 @@ export default {
.report-modal__scroll {
flex: 1;
max-height: 58vh;
min-height: 0;
max-height: 50vh;
padding: 0 32rpx;
box-sizing: border-box;
overflow-y: auto;
}
.report-modal__section {
@@ -644,6 +649,7 @@ export default {
}
.report-modal__footer {
flex-shrink: 0;
padding: 18rpx 32rpx 20rpx;
background: #ffffff;
border-top: 1rpx solid #f1f5f9;

查看文件

@@ -224,6 +224,15 @@
"backgroundColor": "#f2fef7"
}
},
{
"path": "pages/mine/report-detail",
"style": {
"navigationBarTitleText": "举报详情",
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"backgroundColor": "#f2fef7"
}
},
{
"path": "pages/order/detail",
"style": {

查看文件

@@ -372,7 +372,10 @@
</view>
<view v-for="c in comments" :key="c.id" class="detail__cmt">
<view class="detail__cmt-top">
<text class="detail__cmt-user">{{ c.user }}</text>
<view class="detail__cmt-user-wrap">
<text class="detail__cmt-user">{{ c.user }}</text>
<text v-if="c.status === 0" class="detail__cmt-hidden-tag">已隐藏(仅自己可见)</text>
</view>
<view class="detail__cmt-score">
<image
v-for="n in 5"
@@ -393,7 +396,10 @@
<image class="fc-icon fc-icon--xs" :src="iconUrl('edit')" mode="aspectFit" />
<text class="detail__cmt-action-text">{{ c.reply ? '修改回复' : '回复' }}</text>
</view>
<view class="detail__cmt-report-btn" @click="openCommentReport(c)">
<view v-if="c.isMine" class="detail__cmt-report-btn" @click="onDeleteComment(c)">
<text class="detail__cmt-del-text">删除</text>
</view>
<view v-if="!c.isMine" class="detail__cmt-report-btn" @click="openCommentReport(c)">
<text class="detail__cmt-report-text">举报</text>
</view>
</view>
@@ -1412,6 +1418,30 @@ export default {
this.reportTargetTitle = comment.content || '用户评价'
this.reportModalVisible = true
},
/**
* 删除自己发表的评价
* @param {Object} comment 评价对象
*/
onDeleteComment(comment) {
if (!comment || !comment.id) return
if (!this.ensureLogin()) return
uni.showModal({
title: '删除评价',
content: '确认删除这条评价?删除后不可恢复。',
confirmText: '删除',
confirmColor: '#EF4444',
success: async (res) => {
if (!res.confirm) return
try {
await postApi.deleteComment(comment.id)
this.comments = this.comments.filter((item) => item.id !== comment.id)
uni.showToast({ title: '已删除', icon: 'success' })
} catch (e) {
uni.showToast({ title: (e && e.message) || '删除失败', icon: 'none' })
}
},
})
},
/**
* 举报成功后回调处理
* @param {Object} payload 提交的举报载荷
@@ -2845,11 +2875,26 @@ export default {
align-items: center;
justify-content: space-between;
}
.detail__cmt-user-wrap {
display: flex;
align-items: center;
gap: 12rpx;
flex: 1;
min-width: 0;
}
.detail__cmt-user {
font-size: $fc-font;
font-weight: 600;
color: $fc-text;
}
.detail__cmt-hidden-tag {
font-size: 20rpx;
color: #D97706;
background: #FEF3C7;
padding: 2rpx 10rpx;
border-radius: 6rpx;
flex-shrink: 0;
}
.detail__cmt-score {
display: flex;
align-items: center;
@@ -2905,6 +2950,10 @@ export default {
color: $fc-text-secondary;
}
}
.detail__cmt-del-text {
font-size: $fc-font-xs;
color: #EF4444;
}
.detail__cmt-action-btn {
display: inline-flex;
align-items: center;

查看文件

@@ -0,0 +1,688 @@
<template>
<view class="report-detail-page fc-page">
<!-- 顶部统一渐变沉浸式导航栏 -->
<fc-navbar title="举报详情" theme="gradient" :show-back="true" />
<!-- 首屏骨架加载态 -->
<view v-if="loading && !detail" class="report-detail__loading">
<view class="fc-skeleton report-detail__skeleton-hero"></view>
<view class="fc-skeleton report-detail__skeleton-card"></view>
<view class="fc-skeleton report-detail__skeleton-card"></view>
</view>
<!-- 记录不存在或加载失败 -->
<fc-empty
v-else-if="!detail"
icon="inbox"
:text="errorText || '举报记录不存在'"
btn-text="返回举报列表"
@action="goBack"
/>
<!-- 详情主体内容 -->
<view v-else class="report-detail__body">
<!-- 1. 状态总览卡片 -->
<view class="detail-card detail-card--hero">
<view class="detail-hero__top">
<view
class="detail-hero__badge"
:class="isHandled ? 'detail-hero__badge--handled' : 'detail-hero__badge--pending'"
>
<image
v-if="isHandled"
class="fc-icon fc-icon--xs"
:src="iconUrl('verify')"
mode="aspectFit"
/>
<view v-else class="detail-hero__dot"></view>
<text>{{ detail.statusText }}</text>
</view>
<text class="detail-hero__no">编号 #{{ detail.id }}</text>
</view>
<text class="detail-hero__title">
{{ isHandled ? '平台已完成核实与处置' : '平台正在核实您提交的举报' }}
</text>
<text class="detail-hero__sub">
{{ isHandled ? '感谢您对社区健康环境的监督与支持' : '通常会在 1-3 个工作日内完成核实并反馈结果' }}
</text>
</view>
<!-- 2. 处理进度时间线 -->
<view class="detail-card">
<view class="detail-card__head">
<text class="detail-card__title">处理进度</text>
</view>
<view class="timeline">
<view class="timeline__item timeline__item--done">
<view class="timeline__dot"></view>
<view class="timeline__content">
<text class="timeline__name">提交举报</text>
<text class="timeline__time">{{ formatTime(detail.createdAt) }}</text>
</view>
</view>
<view
class="timeline__item"
:class="isHandled ? 'timeline__item--done' : 'timeline__item--active'"
>
<view class="timeline__dot"></view>
<view class="timeline__content">
<text class="timeline__name">平台核实中</text>
<text class="timeline__time">{{ isHandled ? '已完成核实' : '工作人员审核中' }}</text>
</view>
</view>
<view
class="timeline__item timeline__item--last"
:class="isHandled ? 'timeline__item--done' : ''"
>
<view class="timeline__dot"></view>
<view class="timeline__content">
<text class="timeline__name">处理结果反馈</text>
<text class="timeline__time">{{ isHandled ? formatTime(detail.updatedAt) : '等待处理' }}</text>
</view>
</view>
</view>
<!-- 平台处理反馈 -->
<view v-if="isHandled" class="detail-result">
<view class="detail-result__head">
<image class="fc-icon fc-icon--xs" :src="iconUrl('verify')" mode="aspectFit" />
<text class="detail-result__title">平台处理反馈</text>
</view>
<text class="detail-result__content">
{{ detail.handleRemark || '平台已核实并对违规行为进行了处置,感谢您的支持。' }}
</text>
</view>
</view>
<!-- 3. 被举报对象信息 -->
<view class="detail-card">
<view class="detail-card__head">
<text class="detail-card__title">被举报对象</text>
<text
class="detail-type-tag"
:class="'detail-type-tag--' + detail.targetType"
>
{{ detail.targetType === 'post' ? '信息举报' : '评价举报' }}
</text>
</view>
<view
class="detail-target"
:class="{ 'detail-target--clickable': canJumpTarget }"
@click="goTarget"
>
<view class="detail-target__main">
<text class="detail-target__title">{{ detail.targetTitle }}</text>
<text
v-if="detail.targetContent && detail.targetContent !== detail.targetTitle"
class="detail-target__content"
:class="{ 'fc-ellipsis-2': detail.targetType === 'post' }"
>
{{ detail.targetContent }}
</text>
</view>
<view v-if="canJumpTarget" class="detail-target__action">
<text>查看原信息</text>
<text class="detail-target__arrow">›</text>
</view>
<text v-else-if="!detail.targetExists" class="detail-target__deleted">已下架或删除</text>
</view>
</view>
<!-- 4. 举报内容与凭证 -->
<view class="detail-card">
<view class="detail-card__head">
<text class="detail-card__title">举报信息</text>
</view>
<view class="info-list">
<view class="info-list__row">
<text class="info-list__label">举报原因</text>
<text class="info-list__val info-list__val--strong">{{ detail.reason }}</text>
</view>
<view class="info-list__row">
<text class="info-list__label">提交时间</text>
<text class="info-list__val">{{ formatTime(detail.createdAt) }}</text>
</view>
<view class="info-list__block">
<text class="info-list__label">补充说明</text>
<text class="info-list__desc">{{ detail.detail || '未填写补充说明' }}</text>
</view>
<view v-if="detail.images && detail.images.length" class="info-list__block">
<text class="info-list__label">举报凭证(点击查看大图)</text>
<view class="detail-images">
<image
v-for="(img, idx) in detail.images"
:key="idx"
class="detail-images__item"
:src="assetUrl(img)"
mode="aspectFill"
@click="previewImage(idx)"
/>
</view>
</view>
</view>
</view>
</view>
<!-- 底部操作栏 -->
<view v-if="detail" class="detail-footer">
<button class="detail-footer__btn detail-footer__btn--ghost" @click="goBack">
返回列表
</button>
<button class="detail-footer__btn detail-footer__btn--primary" @click="fetchDetail">
刷新状态
</button>
</view>
</view>
</template>
<script>
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
import reportApi from '@/common/api/report.js'
import { safeNavigateTo, safeBack } from '@/common/utils/nav.js'
import { iconUrl } from '@/common/store/ui.js'
import { assetUrl, formatTime } from '@/common/utils/format.js'
export default {
components: { FcNavbar, FcEmpty },
data() {
return {
reportId: 0,
detail: null,
loading: false,
errorText: '',
}
},
computed: {
/**
* 当前举报是否已处理完成
* @returns {boolean}
*/
isHandled() {
return !!(this.detail && this.detail.status === 'handled')
},
/**
* 是否允许跳转到被举报的原信息页
* @returns {boolean}
*/
canJumpTarget() {
return !!(
this.detail &&
this.detail.targetType === 'post' &&
this.detail.targetId > 0 &&
this.detail.targetExists !== false
)
},
},
/**
* 页面加载生命周期
* @param {Object} options 页面路由参数
*/
onLoad(options = {}) {
this.reportId = Number(options.id) || 0
if (!this.reportId) {
this.errorText = '参数缺失,无法查看举报详情'
return
}
this.fetchDetail()
},
/**
* 下拉刷新生命周期
*/
onPullDownRefresh() {
this.fetchDetail()
},
methods: {
iconUrl,
assetUrl,
formatTime,
/**
* 获取举报记录详情
*/
async fetchDetail() {
if (!this.reportId || this.loading) {
uni.stopPullDownRefresh()
return
}
this.loading = true
this.errorText = ''
try {
const res = await reportApi.detail(this.reportId)
this.detail = res || null
} catch (e) {
if (!this.detail) {
this.errorText = (e && e.message) || '加载失败'
} else {
uni.showToast({ title: (e && e.message) || '刷新失败', icon: 'none' })
}
} finally {
this.loading = false
uni.stopPullDownRefresh()
}
},
/**
* 预览举报凭证图片
* @param {number} current 当前点击的图片索引
*/
previewImage(current = 0) {
const images = (this.detail && this.detail.images) || []
if (!images.length) return
const fullUrls = images.map((u) => assetUrl(u))
uni.previewImage({
urls: fullUrls,
current: fullUrls[current] || fullUrls[0],
})
},
/**
* 跳转至被举报的信息详情页
*/
goTarget() {
if (!this.canJumpTarget) return
safeNavigateTo(`/pages/detail/detail?id=${this.detail.targetId}`)
},
/**
* 返回举报列表或上一页
*/
goBack() {
safeBack()
},
},
}
</script>
<style lang="scss" scoped>
.report-detail-page {
min-height: 100vh;
background: #F2FEF7;
padding-bottom: 140rpx;
}
.report-detail {
&__loading {
padding: 24rpx;
}
&__skeleton-hero {
height: 200rpx;
border-radius: $fc-radius;
margin-bottom: 24rpx;
}
&__skeleton-card {
height: 260rpx;
border-radius: $fc-radius;
margin-bottom: 24rpx;
}
&__body {
padding: 24rpx;
}
}
.detail-card {
background: #FFFFFF;
border-radius: $fc-radius;
padding: 28rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
&--hero {
background: linear-gradient(135deg, #FFFFFF 0%, #E8FBF0 100%);
border: 1rpx solid rgba(0, 210, 106, 0.16);
}
&__head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
&__title {
font-size: 30rpx;
font-weight: 600;
color: #1E293B;
}
}
.detail-hero {
&__top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
}
&__badge {
display: inline-flex;
align-items: center;
gap: 8rpx;
padding: 6rpx 16rpx;
border-radius: 999rpx;
font-size: 22rpx;
font-weight: 600;
&--pending {
background: #FEF3C7;
color: #D97706;
}
&--handled {
background: #E8F9F0;
color: #00A854;
}
}
&__dot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #F59E0B;
}
&__no {
font-size: $fc-font-xs;
color: #64748B;
}
&__title {
display: block;
font-size: 34rpx;
font-weight: 700;
color: #1E293B;
margin-bottom: 8rpx;
}
&__sub {
display: block;
font-size: $fc-font-xs;
color: #64748B;
line-height: 1.5;
}
}
.timeline {
padding-left: 8rpx;
&__item {
position: relative;
display: flex;
align-items: flex-start;
padding-left: 36rpx;
padding-bottom: 28rpx;
&::before {
content: '';
position: absolute;
left: 9rpx;
top: 22rpx;
bottom: -4rpx;
width: 2rpx;
background: #E2E8F0;
}
&--last {
padding-bottom: 0;
&::before {
display: none;
}
}
&--done {
&::before {
background: #00D26A;
}
.timeline__dot {
background: #00D26A;
box-shadow: 0 0 0 6rpx rgba(0, 210, 106, 0.16);
}
.timeline__name {
color: #1E293B;
}
}
&--active {
.timeline__dot {
background: #F59E0B;
box-shadow: 0 0 0 6rpx rgba(245, 158, 11, 0.16);
}
.timeline__name {
color: #D97706;
}
}
}
&__dot {
position: absolute;
left: 0;
top: 8rpx;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
background: #CBD5E1;
}
&__content {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
&__name {
font-size: $fc-font;
font-weight: 500;
color: #94A3B8;
}
&__time {
font-size: $fc-font-xs;
color: #94A3B8;
}
}
.detail-result {
margin-top: 24rpx;
padding: 20rpx;
background: #F2FEF7;
border-radius: 12rpx;
border-left: 6rpx solid #00D26A;
&__head {
display: flex;
align-items: center;
gap: 8rpx;
margin-bottom: 8rpx;
}
&__title {
font-size: $fc-font-sm;
font-weight: 600;
color: #00A854;
}
&__content {
display: block;
font-size: $fc-font-sm;
color: #334155;
line-height: 1.6;
}
}
.detail-type-tag {
font-size: 20rpx;
font-weight: 600;
padding: 4rpx 12rpx;
border-radius: 6rpx;
background: #E8F9F0;
color: #00A854;
&--comment {
background: #EFF6FF;
color: #2563EB;
}
}
.detail-target {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
background: #F8FAFC;
border-radius: 12rpx;
padding: 20rpx;
&--clickable:active {
background: #F1F5F9;
}
&__main {
flex: 1;
min-width: 0;
}
&__title {
display: block;
font-size: $fc-font;
font-weight: 600;
color: #1E293B;
line-height: 1.5;
}
&__content {
display: block;
margin-top: 8rpx;
font-size: $fc-font-sm;
color: #64748B;
line-height: 1.5;
}
&__action {
display: flex;
align-items: center;
flex-shrink: 0;
font-size: $fc-font-xs;
color: #00A854;
font-weight: 600;
}
&__arrow {
font-size: 30rpx;
margin-left: 4rpx;
line-height: 1;
}
&__deleted {
flex-shrink: 0;
font-size: $fc-font-xs;
color: #94A3B8;
}
}
.info-list {
&__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12rpx 0;
border-bottom: 1rpx solid #F1F5F9;
}
&__block {
padding-top: 16rpx;
}
&__label {
display: block;
font-size: $fc-font-sm;
color: #64748B;
}
&__val {
font-size: $fc-font-sm;
color: #334155;
&--strong {
font-weight: 600;
color: #1E293B;
}
}
&__desc {
display: block;
margin-top: 10rpx;
padding: 16rpx 20rpx;
background: #F8FAFC;
border-radius: 10rpx;
font-size: $fc-font-sm;
color: #334155;
line-height: 1.6;
}
}
.detail-images {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
margin-top: 14rpx;
&__item {
width: 160rpx;
height: 160rpx;
border-radius: 10rpx;
background: #E2E8F0;
}
}
.detail-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
gap: 20rpx;
padding: 20rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
background: rgba(255, 255, 255, 0.96);
border-top: 1rpx solid #E2E8F0;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.03);
&__btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 999rpx;
font-size: $fc-font;
font-weight: 600;
text-align: center;
border: none;
&::after {
border: none;
}
&--ghost {
background: #F1F5F9;
color: #334155;
}
&--primary {
background: linear-gradient(135deg, #00E070 0%, #00D26A 100%);
color: #FFFFFF;
}
}
}
</style>

查看文件

@@ -3,6 +3,19 @@
<!-- 顶部统一渐变沉浸式导航栏 -->
<fc-navbar title="我的举报" theme="gradient" :show-back="true" />
<!-- 状态筛选栏 -->
<view class="report-tabs">
<view
v-for="tab in tabs"
:key="tab.value"
class="report-tabs__item"
:class="{ 'report-tabs__item--active': activeStatus === tab.value }"
@click="switchTab(tab.value)"
>
<text>{{ tab.label }}</text>
</view>
</view>
<!-- 首屏骨架加载态 -->
<view v-if="loading && !list.length" class="report-page__loading">
<view v-for="i in 3" :key="i" class="fc-skeleton report-page__skeleton"></view>
@@ -12,15 +25,20 @@
<fc-empty
v-else-if="!list.length"
icon="inbox"
text="暂无举报记录"
:text="emptyText"
btn-text="返回个人中心"
@action="goBack"
/>
<!-- 举报卡片列表 -->
<view v-else class="report-page__list">
<view v-for="item in list" :key="item.id" class="report-card fc-card">
<!-- 卡片头部:对象类型徽章 + 状态标签 -->
<view
v-for="item in list"
:key="item.id"
class="report-card fc-card"
@click="goReportDetail(item)"
>
<!-- 卡片头部:对象类型徽章 + 原因 + 状态胶囊 -->
<view class="report-card__header">
<view class="report-card__tags">
<text class="report-card__type-tag" :class="'report-card__type-tag--' + item.targetType">
@@ -28,57 +46,65 @@
</text>
<text class="report-card__reason-tag">{{ item.reason }}</text>
</view>
<text
<view
class="report-card__status"
:class="{
'report-card__status--pending': item.status === 'pending',
'report-card__status--handled': item.status === 'handled'
}"
:class="item.status === 'handled' ? 'report-card__status--handled' : 'report-card__status--pending'"
>
{{ item.statusText }}
</text>
<view class="report-card__status-dot"></view>
<text>{{ item.statusText }}</text>
</view>
</view>
<!-- 举报目标摘要(如果是帖子支持点击前往查看) -->
<view class="report-card__target" @click="handleTargetClick(item)">
<!-- 被举报对象摘要 -->
<view
class="report-card__target"
:class="{ 'report-card__target--link': canJumpTarget(item) }"
@click.stop="handleTargetClick(item)"
>
<text class="report-card__target-title fc-ellipsis-2">{{ item.targetTitle }}</text>
<text v-if="item.targetType === 'post'" class="report-card__target-arrow">›</text>
<view v-if="canJumpTarget(item)" class="report-card__target-link">
<text>原信息</text>
<text class="report-card__target-arrow">›</text>
</view>
</view>
<!-- 用户补充说明 -->
<!-- 补充说明(单行精简展示) -->
<view v-if="item.detail" class="report-card__detail">
<text class="report-card__detail-label">补充说明:</text>
<text class="report-card__detail-text">{{ item.detail }}</text>
<text class="report-card__detail-label">说明:</text>
<text class="report-card__detail-text fc-ellipsis">{{ item.detail }}</text>
</view>
<!-- 凭证图片展示 -->
<!-- 凭证缩略图(最多展示 3 张,避免卡片过长) -->
<view v-if="item.images && item.images.length" class="report-card__images">
<image
v-for="(img, imgIdx) in item.images"
v-for="(img, imgIdx) in item.images.slice(0, 3)"
:key="imgIdx"
class="report-card__img"
:src="assetUrl(img)"
mode="aspectFill"
@click.stop="previewImage(item.images, imgIdx)"
/>
</view>
<!-- 时间戳 -->
<view class="report-card__time">
<text>提交时间:{{ item.createdAt }}</text>
</view>
<!-- 平台处理结果反馈区域(仅已处理项展示) -->
<view v-if="item.status === 'handled'" class="report-card__result">
<view class="report-card__result-head">
<image class="fc-icon fc-icon--xs" :src="iconUrl('verify')" mode="aspectFit" />
<text class="report-card__result-title">平台处理反馈</text>
<text class="report-card__result-time">{{ item.updatedAt }}</text>
<view v-if="item.images.length > 3" class="report-card__img-more">
<text>+{{ item.images.length - 3 }}</text>
</view>
<text class="report-card__result-content">
{{ item.handleRemark ? item.handleRemark : '平台已核实并对违规行为进行了严肃处置,感谢您对维护社区健康环境的支持!' }}
</view>
<!-- 已处理简报 -->
<view v-if="item.status === 'handled'" class="report-card__result">
<image class="fc-icon fc-icon--xs" :src="iconUrl('verify')" mode="aspectFit" />
<text class="report-card__result-text fc-ellipsis">
{{ item.handleRemark || '平台已核实并完成处置' }}
</text>
</view>
<!-- 底部元信息:格式化时间 + 详情入口 -->
<view class="report-card__footer">
<text class="report-card__time">{{ formatTime(item.createdAt) }}</text>
<view class="report-card__more">
<text>查看详情</text>
<text class="report-card__more-arrow">›</text>
</view>
</view>
</view>
<!-- 分页底线 -->
@@ -95,14 +121,20 @@
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
import reportApi from '@/common/api/report.js'
import { safeNavigateTo, safeNavigateBack, safeBack } from '@/common/utils/nav.js'
import { safeNavigateTo, safeBack } from '@/common/utils/nav.js'
import { iconUrl } from '@/common/store/ui.js'
import { assetUrl } from '@/common/utils/format.js'
import { assetUrl, formatTime } from '@/common/utils/format.js'
export default {
components: { FcNavbar, FcEmpty },
data() {
return {
tabs: [
{ label: '全部', value: '' },
{ label: '核实中', value: 'pending' },
{ label: '已处理', value: 'handled' },
],
activeStatus: '',
list: [],
page: 1,
size: 10,
@@ -111,6 +143,17 @@ export default {
loading: false,
}
},
computed: {
/**
* 根据当前筛选状态返回空状态提示文案
* @returns {string}
*/
emptyText() {
if (this.activeStatus === 'pending') return '暂无核实中的举报'
if (this.activeStatus === 'handled') return '暂无已处理的举报'
return '暂无举报记录'
},
},
/**
* 页面加载生命周期
*/
@@ -134,6 +177,16 @@ export default {
methods: {
iconUrl,
assetUrl,
formatTime,
/**
* 切换顶部状态筛选标签
* @param {string} status 状态值
*/
switchTab(status) {
if (this.activeStatus === status) return
this.activeStatus = status
this.fetchList(true)
},
/**
* 拉取我的举报列表数据
* @param {boolean} [reset=false] 是否重置为第一页
@@ -146,7 +199,11 @@ export default {
if (this.loading) return
this.loading = true
try {
const res = await reportApi.my({ page: this.page, size: this.size })
const params = { page: this.page, size: this.size }
if (this.activeStatus) {
params.status = this.activeStatus
}
const res = await reportApi.my(params)
const rows = (res && res.list) || []
this.total = (res && res.total) || 0
this.list = reset ? rows : [...this.list, ...rows]
@@ -166,6 +223,19 @@ export default {
this.page += 1
this.fetchList(false)
},
/**
* 判断是否支持直接跳转到被举报原信息
* @param {Object} item 举报项对象
* @returns {boolean}
*/
canJumpTarget(item) {
return !!(
item &&
item.targetType === 'post' &&
item.targetId > 0 &&
item.targetExists !== false
)
},
/**
* 预览凭证图片
* @param {string[]} images 图片数组
@@ -179,14 +249,24 @@ export default {
current: fullUrls[current] || fullUrls[0],
})
},
/**
* 跳转至举报记录详情页
* @param {Object} item 举报项对象
*/
goReportDetail(item) {
if (!item || !item.id) return
safeNavigateTo(`/pages/mine/report-detail?id=${item.id}`)
},
/**
* 点击被举报对象(如果是信息且未删除,可跳转查看)
* @param {Object} item 举报项对象
*/
handleTargetClick(item) {
if (item.targetType === 'post' && item.targetId > 0) {
if (this.canJumpTarget(item)) {
safeNavigateTo(`/pages/detail/detail?id=${item.targetId}`)
return
}
this.goReportDetail(item)
},
/**
* 返回上一页
@@ -215,24 +295,53 @@ export default {
}
&__list {
padding: 24rpx;
padding: 20rpx 24rpx 24rpx;
}
&__more {
text-align: center;
padding: 30rpx 0 10rpx;
padding: 24rpx 0 10rpx;
font-size: $fc-font-xs;
color: $fc-text-placeholder;
}
}
.report-tabs {
display: flex;
align-items: center;
gap: 16rpx;
padding: 16rpx 24rpx 4rpx;
&__item {
padding: 10rpx 26rpx;
border-radius: 999rpx;
font-size: $fc-font-sm;
color: #64748B;
background: rgba(255, 255, 255, 0.85);
border: 1rpx solid #E2E8F0;
transition: all 0.2s;
&--active {
background: #00D26A;
color: #FFFFFF;
border-color: #00D26A;
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(0, 210, 106, 0.22);
}
}
}
.report-card {
background: #ffffff;
background: #FFFFFF;
border-radius: $fc-radius;
padding: 24rpx;
margin-bottom: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
&:active {
transform: scale(0.992);
}
&__header {
display: flex;
align-items: center;
@@ -243,7 +352,8 @@ export default {
&__tags {
display: flex;
align-items: center;
gap: 12rpx;
gap: 10rpx;
flex-wrap: wrap;
}
&__type-tag {
@@ -269,15 +379,37 @@ export default {
}
&__status {
font-size: 24rpx;
display: inline-flex;
align-items: center;
gap: 8rpx;
padding: 4rpx 14rpx;
border-radius: 999rpx;
font-size: 22rpx;
font-weight: 600;
flex-shrink: 0;
&-dot {
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
&--pending {
color: #F59E0B;
background: #FEF3C7;
color: #D97706;
.report-card__status-dot {
background: #F59E0B;
}
}
&--handled {
background: #E8F9F0;
color: #00A854;
.report-card__status-dot {
background: #00D26A;
}
}
}
@@ -285,91 +417,128 @@ export default {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
background: #F8FAFC;
border-radius: 10rpx;
padding: 16rpx 20rpx;
margin-bottom: 16rpx;
padding: 16rpx 18rpx;
margin-bottom: 14rpx;
&--link:active {
background: #F1F5F9;
}
&-title {
font-size: $fc-font;
font-weight: 500;
color: #1E293B;
line-height: 1.4;
line-height: 1.45;
flex: 1;
}
&-link {
display: flex;
align-items: center;
flex-shrink: 0;
font-size: $fc-font-xs;
color: #00A854;
font-weight: 500;
}
&-arrow {
font-size: 32rpx;
color: #94A3B8;
margin-left: 12rpx;
font-size: 28rpx;
margin-left: 4rpx;
line-height: 1;
}
}
&__detail {
margin-bottom: 16rpx;
display: flex;
align-items: center;
margin-bottom: 14rpx;
font-size: $fc-font-sm;
line-height: 1.5;
line-height: 1.4;
&-label {
color: #64748B;
flex-shrink: 0;
}
&-text {
color: #334155;
flex: 1;
min-width: 0;
}
}
&__images {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12rpx;
margin-bottom: 16rpx;
margin-bottom: 14rpx;
}
&__img {
width: 140rpx;
height: 140rpx;
width: 104rpx;
height: 104rpx;
border-radius: 8rpx;
background: #E2E8F0;
}
&__img-more {
width: 104rpx;
height: 104rpx;
border-radius: 8rpx;
background: #F1F5F9;
color: #64748B;
font-size: $fc-font-sm;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
}
&__result {
display: flex;
align-items: center;
gap: 10rpx;
padding: 12rpx 16rpx;
margin-bottom: 14rpx;
background: #F2FEF7;
border-radius: 8rpx;
border-left: 4rpx solid #00D26A;
&-text {
flex: 1;
min-width: 0;
font-size: $fc-font-xs;
color: #00A854;
}
}
&__footer {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 12rpx;
border-top: 1rpx solid #F1F5F9;
}
&__time {
font-size: $fc-font-xs;
color: $fc-text-placeholder;
margin-bottom: 12rpx;
}
&__result {
margin-top: 16rpx;
padding: 20rpx;
background: #F2FEF7;
border-radius: 12rpx;
border-left: 6rpx solid #00D26A;
&__more {
display: flex;
align-items: center;
font-size: $fc-font-xs;
color: #00A854;
font-weight: 600;
&-head {
display: flex;
align-items: center;
gap: 8rpx;
margin-bottom: 8rpx;
}
&-title {
font-size: $fc-font-sm;
font-weight: 600;
color: #00A854;
flex: 1;
}
&-time {
font-size: 20rpx;
color: #94A3B8;
}
&-content {
display: block;
font-size: $fc-font-sm;
color: #334155;
line-height: 1.5;
&-arrow {
font-size: 28rpx;
margin-left: 4rpx;
line-height: 1;
}
}
}

查看文件

@@ -1773,8 +1773,13 @@ export default {
},
})
},
/** 级联选择器选中服务区域 */
/**
* 级联选择器选中服务区域
* @param {Object|null} area
*/
onRegionPicked(area) {
// 防御:忽略根元素原生 picker 透传的无 areaId 事件对象
if (area && area.detail && area.areaId === undefined) return
this.form.areaId = area ? Number(area.areaId) || 0 : 0
this.form.area = area ? area.district || '' : ''
this.form.province = area ? area.province || '' : ''