feat: security hardening, wechat pay v3 platform cert integration, companion certification revocation, and audit closed-loop

这个提交包含在:
xcbyy
2026-10-16 17:38:17 +08:00
父节点 3bf38db8b6
当前提交 78117bb4e1
共有 58 个文件被更改,包括 12971 次插入 和 952 次删除

查看文件

@@ -56,12 +56,23 @@
<view class="input-row">
<text class="row-label">活动时段</text>
<input
class="row-input"
v-model="form.startTime"
placeholder="点选快捷时段或自定义输入"
placeholder-class="ph"
/>
<picker
class="time-picker-flex"
mode="multiSelector"
:range="timePickerRange"
:value="timePickerIndex"
@change="onTimePickerChange"
>
<view class="picker-display-box btn-active">
<text class="picker-val" :class="{ placeholder: !form.startTime }">
{{ form.startTime || '请选择活动开始时段' }}
</text>
<view class="picker-right-tag">
<text class="picker-tag-text">选择时间</text>
<text class="picker-arrow">›</text>
</view>
</view>
</picker>
</view>
<!-- 快捷时段点选胶囊 (告别纯手打易错) -->
@@ -73,24 +84,32 @@
:key="timeItem"
class="time-chip btn-active"
:class="{ selected: form.startTime === timeItem }"
@click="form.startTime = timeItem"
@click="selectQuickTime(timeItem)"
>
{{ timeItem }}
</view>
</view>
</view>
<view class="input-row">
<view class="label-with-action">
<view class="location-block">
<view class="location-header-row">
<text class="row-label">地点/商圈</text>
<text class="btn-choose-loc btn-active" @click="handleChooseLocation">地图选点</text>
<view class="btn-choose-loc btn-active" @click="handleChooseLocation">
<image class="loc-pin-svg" :src="ICONS.mapPin" mode="aspectFit" />
<text class="loc-btn-text">地图选点</text>
<text class="loc-btn-arrow">›</text>
</view>
</view>
<view class="location-input-box">
<textarea
class="location-textarea"
auto-height
v-model="form.location"
maxlength="120"
placeholder="请输入详细活动地点,或点击上方地图选点 / 下方合规商圈"
placeholder-class="ph"
/>
</view>
<input
class="row-input"
v-model="form.location"
placeholder="如:北京市朝阳区三里屯聚宝源 / 工体纯KTV 888包厢"
placeholder-class="ph"
/>
</view>
<!-- 合规示范商圈一键点选 (防风控与合规保障) -->
@@ -323,8 +342,9 @@
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ICONS } from '@/common/icons.js';
import { createActivity, getSafetyPlaces, getNavCategories } from '@/common/api.js';
import { createActivity, getSafetyPlaces, getNavCategories, getPlatformConfigs } from '@/common/api.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
import { ensureLoginOrRedirect } from '@/common/role.js';
const games = ref(['美食陪吃', '同城陪唱', '下午茶陪喝', '同城微醺', '同城桌游', '热门电竞']);
const currentThemeKey = ref(getCurrentThemeKey());
@@ -342,6 +362,9 @@ onMounted(() => {
});
onShow(() => {
if (!ensureLoginOrRedirect('/pages/activity/create')) {
return;
}
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
loadLivePlaces();
@@ -355,13 +378,13 @@ const form = ref({
payType: 'PROJECT',
game: '美食陪吃',
title: '',
startTime: '周六 18:30',
location: '北京市朝阳区三里屯商圈',
startTime: '',
location: '',
maxParticipants: 4,
aaFee: 50,
aaFee: '',
pricingMode: 'PER_PERSON',
perPersonFee: 500,
totalFee: 2000,
perPersonFee: '',
totalFee: '',
allowDynamicPrice: true,
priceAdjustRule: 'UNIFIED_HIGH',
});
@@ -398,6 +421,55 @@ const presetTimeOptions = ref([
'周日 15:00'
]);
const timePickerDays = (() => {
const baseDays = ['今晚', '今天', '明天', '后天', '周五', '周六', '周日'];
const weekNames = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const now = new Date();
for (let i = 1; i <= 7; i++) {
const d = new Date(now.getTime() + i * 86400000);
const m = d.getMonth() + 1;
const day = d.getDate();
const w = weekNames[d.getDay()];
baseDays.push(`${m}月${day}日(${w})`);
}
return baseDays;
})();
const timePickerSlots = [
'09:00', '09:30', '10:00', '10:30', '11:00', '11:30',
'12:00', '12:30', '13:00', '13:30', '14:00', '14:30',
'15:00', '15:30', '16:00', '16:30', '17:00', '17:30',
'18:00', '18:30', '19:00', '19:30', '20:00', '20:30',
'21:00', '21:30', '22:00', '22:30', '23:00', '23:30',
'00:00', '00:30', '01:00'
];
const timePickerRange = ref([timePickerDays, timePickerSlots]);
const timePickerIndex = ref([5, 19]); // 默认对应 周六 18:30
const onTimePickerChange = (e) => {
const val = (e && e.detail && Array.isArray(e.detail.value)) ? e.detail.value : [0, 0];
const dayIdx = Number(val[0]) || 0;
const slotIdx = Number(val[1]) || 0;
timePickerIndex.value = [dayIdx, slotIdx];
const dayStr = timePickerDays[dayIdx] || timePickerDays[0];
const slotStr = timePickerSlots[slotIdx] || timePickerSlots[0];
form.value.startTime = `${dayStr} ${slotStr}`;
};
const selectQuickTime = (timeItem) => {
form.value.startTime = timeItem;
const parts = String(timeItem).split(' ');
if (parts.length === 2) {
const dIdx = timePickerDays.indexOf(parts[0]);
const sIdx = timePickerSlots.indexOf(parts[1]);
timePickerIndex.value = [
dIdx >= 0 ? dIdx : 0,
sIdx >= 0 ? sIdx : 0
];
}
};
const handleChooseLocation = () => {
// #ifdef MP-WEIXIN || APP-PLUS
uni.chooseLocation({
@@ -491,24 +563,80 @@ const changeParticipants = (delta) => {
};
const handleSubmit = async () => {
// P1 敏感商圈安全风控友好预检拦截
if (!ensureLoginOrRedirect('/pages/activity/create')) {
return;
}
// 1. 必填项完整校验(严禁未填写任何内容直接发布)
if (!form.value.game || !String(form.value.game).trim()) {
uni.showToast({ title: '请选择活动品类', icon: 'none' });
return;
}
const trimmedTitle = String(form.value.title || '').trim();
if (!trimmedTitle) {
uni.showToast({ title: '请填写活动标题', icon: 'none' });
return;
}
if (trimmedTitle.length < 2) {
uni.showToast({ title: '活动标题至少2个字', icon: 'none' });
return;
}
const trimmedTime = String(form.value.startTime || '').trim();
if (!trimmedTime) {
uni.showToast({ title: '请选择活动时段', icon: 'none' });
return;
}
const trimmedLocation = String(form.value.location || '').trim();
if (!trimmedLocation) {
uni.showToast({ title: '请填写或选择活动地点', icon: 'none' });
return;
}
// 2. P1 敏感商圈安全风控友好预检拦截
const sensitivePattern = /(酒店|客房|宾馆|民宿|旅馆|公寓|小区|住宅|私密|住宅区|私人房|卧室)/;
if (sensitivePattern.test(form.value.location)) {
if (sensitivePattern.test(trimmedLocation)) {
riskModalVisible.value = true;
return;
}
if (!form.value.title.trim()) {
form.value.title = `【${form.value.game}】同城聚会组局`;
// 3. 费用与预算必填及数值合法性校验
const isProject = form.value.payType === 'PROJECT';
if (!isProject) {
const aaVal = Number(form.value.aaFee);
if (!form.value.aaFee || isNaN(aaVal) || aaVal <= 0) {
uni.showToast({ title: '请填写有效的人均分摊', icon: 'none' });
return;
}
} else if (form.value.pricingMode === 'PER_PERSON') {
const ppVal = Number(form.value.perPersonFee);
if (!form.value.perPersonFee || isNaN(ppVal) || ppVal <= 0) {
uni.showToast({ title: '请填写或选择单人出价', icon: 'none' });
return;
}
} else {
const totalVal = Number(form.value.totalFee);
if (!form.value.totalFee || isNaN(totalVal) || totalVal <= 0) {
uni.showToast({ title: '请填写或选择总预算', icon: 'none' });
return;
}
}
const isProject = form.value.payType === 'PROJECT';
const perPerson = isProject && form.value.pricingMode === 'PER_PERSON' ? (Number(form.value.perPersonFee) || 0) : 0;
const perPerson = isProject && form.value.pricingMode === 'PER_PERSON'
? (Number(form.value.perPersonFee) || 0)
: (!isProject ? (Number(form.value.aaFee) || 0) : 0);
const cachedUser = uni.getStorageSync('userInfo') || uni.getStorageSync('USER_INFO') || {};
if (cachedUser.status === '已封禁' || cachedUser.status === '封禁') {
uni.showToast({ title: '账号已被封禁,无法发起组局', icon: 'none' });
return;
}
const currentUserId = Number(uni.getStorageSync('userId')) || Number(cachedUser.id) || 1001;
const newActivityPayload = {
creatorId: 1001,
creatorId: currentUserId,
game: form.value.game,
title: form.value.title,
title: trimmedTitle,
payType: form.value.payType,
pricingMode: isProject ? form.value.pricingMode : 'AA',
perPersonFee: perPerson,
@@ -517,10 +645,10 @@ const handleSubmit = async () => {
totalFee: calcTotalFee.value,
aaFee: Number(form.value.aaFee) || 0,
maxParticipants: form.value.maxParticipants,
startTime: form.value.startTime,
location: form.value.location,
creatorNickname: '同城局长',
creatorAvatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop',
startTime: trimmedTime,
location: trimmedLocation,
creatorNickname: cachedUser.nickname || '同城局长',
creatorAvatar: cachedUser.avatar || 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop',
};
uni.showLoading({ title: '正在发布组局...' });
@@ -528,8 +656,15 @@ const handleSubmit = async () => {
try {
await createActivity(newActivityPayload);
uni.hideLoading();
// 重置已填表单项
form.value.title = '';
form.value.startTime = '';
form.value.location = '';
form.value.aaFee = '';
form.value.perPersonFee = '';
form.value.totalFee = '';
uni.showToast({
title: '组局发起成功!等待好友加入',
title: '组局发起成功',
icon: 'success',
duration: 1500
});
@@ -677,6 +812,52 @@ const handleSubmit = async () => {
}
}
.time-picker-flex {
flex: 1;
.picker-display-box {
display: flex;
align-items: center;
justify-content: space-between;
height: 52rpx;
.picker-val {
font-size: 26rpx;
font-weight: 600;
color: #F8FAFC;
font-variant-numeric: tabular-nums;
&.placeholder {
color: #475569;
font-weight: 400;
}
}
.picker-right-tag {
display: flex;
align-items: center;
gap: 6rpx;
background: rgba(99, 102, 241, 0.14);
border: 1px solid rgba(99, 102, 241, 0.3);
padding: 4rpx 14rpx;
border-radius: 20rpx;
.picker-tag-text {
font-size: 20rpx;
font-weight: 600;
color: #818CF8;
}
.picker-arrow {
font-size: 24rpx;
font-weight: 700;
color: #818CF8;
line-height: 1;
}
}
}
}
.ph {
color: #475569;
}
@@ -686,26 +867,76 @@ const handleSubmit = async () => {
font-weight: normal;
color: #475569;
}
}
.label-with-action {
width: 220rpx;
.location-block {
padding: 20rpx 0 18rpx;
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
.location-header-row {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 16rpx;
box-sizing: border-box;
margin-bottom: 14rpx;
.row-label {
width: auto;
font-size: 26rpx;
color: #CBD5E1;
font-weight: 500;
}
.btn-choose-loc {
font-size: 20rpx;
color: #38BDF8;
background: rgba(56, 189, 248, 0.12);
padding: 4rpx 10rpx;
border-radius: 6rpx;
cursor: pointer;
display: flex;
align-items: center;
gap: 6rpx;
background: rgba(56, 189, 248, 0.14);
border: 1px solid rgba(56, 189, 248, 0.35);
padding: 4rpx 16rpx;
border-radius: 22rpx;
white-space: nowrap;
flex-shrink: 0;
.loc-pin-svg {
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
}
.loc-btn-text {
font-size: 20rpx;
font-weight: 600;
color: #38BDF8;
line-height: 1.2;
}
.loc-btn-arrow {
font-size: 24rpx;
font-weight: 700;
color: #38BDF8;
line-height: 1;
}
}
}
.location-input-box {
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 16rpx;
padding: 16rpx 20rpx;
.location-textarea {
width: 100%;
min-height: 40rpx;
font-size: 26rpx;
font-weight: 600;
color: #F8FAFC;
line-height: 1.45;
box-sizing: border-box;
}
.ph {
color: #475569;
font-weight: 400;
}
}
}
@@ -1132,10 +1363,80 @@ const handleSubmit = async () => {
font-weight: 800;
}
}
.time-picker-flex .picker-display-box {
.picker-val {
color: #1C1917;
&.placeholder {
color: #A8A29E;
}
}
.picker-right-tag {
background: #FFF7ED;
border-color: #FDBA74;
.picker-tag-text,
.picker-arrow {
color: #EA580C;
}
}
}
.ph,
.price-ph {
color: #A8A29E;
}
}
.location-block {
border-bottom-color: #F5F2EC;
.location-header-row {
.row-label {
color: #1C1917;
}
.btn-choose-loc {
background: #FFF7ED;
border-color: #FDBA74;
.loc-btn-text,
.loc-btn-arrow {
color: #EA580C;
}
}
}
.location-input-box {
background: #FAF8F5;
border-color: #E7E5E4;
.location-textarea {
color: #1C1917;
}
.ph {
color: #A8A29E;
}
}
}
.quick-chip-row {
border-bottom-color: #F5F2EC;
.chip-label {
color: #78716C;
}
.quick-chips {
.time-chip,
.zone-chip-item {
background: #F8F5F0;
border-color: #E7E5E4;
color: #57534E;
&.selected {
background: #FFF7ED;
border-color: #EA580C;
color: #EA580C;
font-weight: 700;
}
}
}
}
.calc-preview {
background: #F8F5F0;
.preview-label {

文件差异内容过多而无法显示 加载差异