chore: establish V1.1 recovery baseline

This commit is contained in:
2026-09-09 22:05:00 +08:00
commit b46b48eb33
947 changed files with 155471 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
/**
* 举报页 U26(重构:用 safetyService.submitReport + ui-nav-bar + ui-textarea)
*
* 流程:原因选择 → 补充说明(高风险必填)→ 证据截图(选填)→ 提交
*
* 不变量(AGENTS.md):
* - 第 8 条:敏感数据默认拒绝——本页只接收 reason + 证据截图,不接受身份证/手机号等敏感字段。
* - 第 4 条:Block 优先级最高——举报不会自动 Block,是否拉黑由用户主动操作;举报后由运营人工处置。
* - 第 6 条:单向意向不泄露——举报内容仅提交给运营,不向对方透露。
* 幂等:safetyService.submitReport 内部以 targetUserId+reportType+秒级时间生成 Idempotency-Key。
*/
const { appStore } = require('../../stores');
const { safetyService } = require('../../services');
// 举报原因选项(reportType 对齐后端枚举)
const REPORT_REASONS = [
{ value: 'fake_profile', label: '虚假资料' },
{ value: 'fake_marital_status', label: '婚姻状态疑似虚假' },
{ value: 'harassment', label: '骚扰' },
{ value: 'pornography', label: '色情低俗' },
{ value: 'advertising', label: '广告营销' },
{ value: 'fraud', label: '诈骗' },
{ value: 'money_inducement', label: '金钱诱导' },
{ value: 'impersonation', label: '冒充他人' },
{ value: 'other', label: '其他' },
];
// 高风险举报需必填说明
const HIGH_RISK_REASONS = new Set(['fraud', 'money_inducement', 'impersonation', 'fake_marital_status']);
const MAX_EVIDENCE = 9;
Page({
data: {
targetUserId: '',
targetName: '',
reportType: '',
description: '',
evidenceFiles: [],
submitting: false,
submitted: false,
reportReasons: REPORT_REASONS,
highRiskReason: false,
descError: '',
statusBarHeight: 20,
navBarHeight: 44,
},
onLoad(options) {
try {
const info = (wx.getWindowInfo && wx.getWindowInfo()) || wx.getSystemInfoSync();
this.setData({
statusBarHeight: info.statusBarHeight || 20,
navBarHeight: info.platform === 'android' ? 48 : 44,
});
} catch (e) { /* 使用默认值 */ }
if (options.userId) this.setData({ targetUserId: decodeURIComponent(options.userId) });
if (options.name) this.setData({ targetName: decodeURIComponent(options.name) });
},
onReasonChange(e) {
const value = e.currentTarget.dataset.value;
const isHighRisk = HIGH_RISK_REASONS.has(value);
this.setData({
reportType: value,
highRiskReason: isHighRisk,
descError: '',
});
},
onDescInput(e) {
const value = e.detail.value;
this.setData({ description: value, descError: '' });
},
// ============ 证据截图 ============
chooseImage() {
const remain = MAX_EVIDENCE - this.data.evidenceFiles.length;
if (remain <= 0) {
appStore.toast('最多上传 9 张截图');
return;
}
wx.chooseMedia({
count: remain,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const files = res.tempFiles.map((f) => f.tempFilePath);
this.setData({ evidenceFiles: [...this.data.evidenceFiles, ...files] });
},
});
},
previewImage(e) {
wx.previewImage({
current: e.currentTarget.dataset.url,
urls: this.data.evidenceFiles,
});
},
removeImage(e) {
const idx = e.currentTarget.dataset.index;
const files = this.data.evidenceFiles;
files.splice(idx, 1);
this.setData({ evidenceFiles: files });
},
// ============ 提交 ============
async submitReport() {
const { targetUserId, reportType, description, highRiskReason } = this.data;
if (!targetUserId) {
appStore.toast('缺少举报对象');
return;
}
if (!reportType) {
appStore.toast('请选择举报原因');
return;
}
const desc = (description || '').trim();
if (highRiskReason && !desc) {
this.setData({ descError: '该类举报需补充说明(必填)' });
return;
}
this.setData({ submitting: true });
try {
await safetyService.submitReport({
targetUserId,
reportType,
description: desc,
// 证据上传至 OSS 后回填 fileId;当前阶段先以本地路径占位,由后端证据服务接入后补全
evidenceFileIds: [],
});
this.setData({ submitted: true, submitting: false });
appStore.toastSuccess('举报已提交');
} catch (err) {
appStore.toastError(err);
this.setData({ submitting: false });
}
},
goBack() {
if (this.data.submitted) {
wx.navigateBack();
} else {
wx.navigateBack();
}
},
onBack() {
wx.navigateBack();
},
});
+11
View File
@@ -0,0 +1,11 @@
{
"navigationStyle": "custom",
"navigationBarTitleText": "举报",
"backgroundColor": "#FFF8F7",
"backgroundTextStyle": "dark",
"usingComponents": {
"ui-nav-bar": "/components/nav-bar/index",
"ui-section-header": "/components/section-header/index",
"ui-textarea": "/components/textarea/index"
}
}
+87
View File
@@ -0,0 +1,87 @@
<!-- 举报页 U26(重构:safetyService + ui-nav-bar + ui-textarea) -->
<view class="page">
<ui-nav-bar
title="举报"
show-back="{{true}}"
status-bar-height="{{statusBarHeight}}"
nav-bar-height="{{navBarHeight}}"
bind:back="onBack"
/>
<!-- 提交成功态 -->
<view wx:if="{{submitted}}" class="body" style="padding-top: {{statusBarHeight + navBarHeight}}px;">
<view class="success-wrap">
<view class="success-icon">✓</view>
<text class="success-title">举报已提交</text>
<text class="success-hint">工作人员会尽快核实处理,感谢您的监督。</text>
<button class="btn-primary" bindtap="goBack">返回</button>
</view>
</view>
<!-- 表单态 -->
<view wx:else class="body" style="padding-top: {{statusBarHeight + navBarHeight}}px;">
<view wx:if="{{targetName}}" class="target-bar">
<text>被举报人:{{targetName}}</text>
</view>
<!-- 举报原因 -->
<view class="card">
<ui-section-header title="举报原因" subtitle="必填" />
<view class="reason-grid">
<view
class="reason-item {{reportType === r.value ? 'active' : ''}}"
wx:for="{{reportReasons}}"
wx:key="value"
wx:for-item="r"
data-value="{{r.value}}"
bindtap="onReasonChange"
>
<text>{{r.label}}</text>
</view>
</view>
</view>
<!-- 补充说明 -->
<view wx:if="{{reportType}}" class="card">
<ui-section-header title="补充说明" subtitle="{{highRiskReason ? '高风险必填' : '选填'}}" />
<ui-textarea
value="{{description}}"
placeholder="请描述您遇到的情况,帮助工作人员核实..."
maxlength="500"
error="{{descError}}"
bind:input="onDescInput"
/>
</view>
<!-- 证据截图 -->
<view class="card">
<ui-section-header title="证据截图" subtitle="选填,最多9张" />
<view class="evidence-list">
<view
class="evidence-item"
wx:for="{{evidenceFiles}}"
wx:key="index"
data-url="{{item}}"
bindtap="previewImage"
>
<image src="{{item}}" mode="aspectFill" />
<view class="remove-btn" catchtap="removeImage" data-index="{{index}}">✕</view>
</view>
<view class="evidence-add" bindtap="chooseImage" wx:if="{{evidenceFiles.length < 9}}">
<text class="add-icon">+</text>
<text class="add-text">添加截图</text>
</view>
</view>
</view>
<button class="btn-submit" bindtap="submitReport" loading="{{submitting}}" disabled="{{!reportType}}">
提交举报
</button>
<text class="hint">提交后工作人员会尽快核实,不会向对方透露举报人信息</text>
<!-- 公益免费标识 -->
<view class="free-badge">
<text>本平台为公益服务,举报受理永久免费</text>
</view>
</view>
</view>
+212
View File
@@ -0,0 +1,212 @@
/* 举报页 U26 — Design Tokens */
.page {
min-height: 100vh;
background: #FFF8F7;
}
.body {
padding: 24rpx;
box-sizing: border-box;
}
/* 被举报人提示条 */
.target-bar {
background: #FFF3F2;
border-radius: 12rpx;
padding: 20rpx 24rpx;
margin-bottom: 24rpx;
font-size: 26rpx;
color: #E96B6B;
}
/* 卡片 */
.card {
background: #fff;
border-radius: 20rpx;
padding: 24rpx 32rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
}
/* 举报原因网格 */
.reason-grid {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
margin-top: 16rpx;
}
.reason-item {
flex: 0 0 calc(33.333% - 12rpx);
box-sizing: border-box;
text-align: center;
padding: 20rpx 0;
border-radius: 12rpx;
background: #F7F8FA;
font-size: 26rpx;
color: #666;
border: 2rpx solid transparent;
transition: all 0.2s;
}
.reason-item.active {
background: #FFF3F2;
color: #E96B6B;
border-color: #E96B6B;
font-weight: bold;
}
/* 证据截图 */
.evidence-list {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
margin-top: 16rpx;
}
.evidence-item {
position: relative;
width: 160rpx;
height: 160rpx;
border-radius: 12rpx;
overflow: hidden;
}
.evidence-item image {
width: 100%;
height: 100%;
}
.remove-btn {
position: absolute;
top: 4rpx;
right: 4rpx;
width: 36rpx;
height: 36rpx;
line-height: 32rpx;
text-align: center;
background: rgba(0, 0, 0, 0.5);
color: #fff;
border-radius: 50%;
font-size: 22rpx;
}
.evidence-add {
width: 160rpx;
height: 160rpx;
border-radius: 12rpx;
background: #F7F8FA;
border: 2rpx dashed #D0D0D0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #999;
}
.add-icon {
font-size: 48rpx;
color: #B0B0B0;
line-height: 1;
}
.add-text {
font-size: 22rpx;
margin-top: 8rpx;
}
/* 提交按钮 */
.btn-submit {
width: 100%;
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
background: #E96B6B;
color: #fff;
font-size: 32rpx;
border: none;
margin-top: 8rpx;
}
.btn-submit::after {
border: none;
}
.btn-submit[disabled] {
opacity: 0.5;
}
.btn-primary {
width: 80%;
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
background: #E96B6B;
color: #fff;
font-size: 32rpx;
border: none;
margin-top: 48rpx;
}
.btn-primary::after {
border: none;
}
.hint {
display: block;
text-align: center;
font-size: 22rpx;
color: #B0B0B0;
margin-top: 20rpx;
padding: 0 24rpx;
}
/* 成功态 */
.success-wrap {
display: flex;
flex-direction: column;
align-items: center;
padding: 120rpx 48rpx;
}
.success-icon {
width: 120rpx;
height: 120rpx;
line-height: 120rpx;
text-align: center;
border-radius: 50%;
background: #E8F5E9;
color: #1A6B3E;
font-size: 64rpx;
margin-bottom: 32rpx;
}
.success-title {
font-size: 36rpx;
font-weight: bold;
color: #1A1A1A;
margin-bottom: 16rpx;
}
.success-hint {
font-size: 26rpx;
color: #999;
text-align: center;
line-height: 1.6;
}
/* 公益免费标识 */
.free-badge {
text-align: center;
padding: 24rpx;
margin-top: 16rpx;
}
.free-badge text {
display: inline-block;
font-size: 22rpx;
color: #1A6B3E;
background: #E8F5E9;
padding: 8rpx 24rpx;
border-radius: 24rpx;
}