feat: security hardening, wechat pay v3 platform cert integration, companion certification revocation, and audit closed-loop
这个提交包含在:
@@ -246,6 +246,7 @@ import SkeletonScreen from '@/components/SkeletonScreen.vue';
|
||||
import { getCompanionDetail, getExpertReviews, replyOrderReview, submitReport as submitReportApi, checkFavorite, addFavorite as addFavApi, removeFavorite as removeFavApi } from '@/common/api.js';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { ensureLoginOrRedirect } from '@/common/role.js';
|
||||
|
||||
const currentThemeKey = ref(getCurrentThemeKey());
|
||||
|
||||
@@ -272,8 +273,27 @@ const stopPropagation = (e) => {
|
||||
|
||||
const isLoading = ref(true);
|
||||
const isFav = ref(false);
|
||||
const buildDefaultServices = (gameTitle = '同城陪伴', basePrice = 68) => [
|
||||
{
|
||||
id: 'srv_1',
|
||||
name: `${gameTitle} · 基础陪伴 (2小时)`,
|
||||
title: `${gameTitle} · 基础陪伴 (2小时)`,
|
||||
price: basePrice,
|
||||
unit: '小时',
|
||||
desc: '正规公开商圈同城陪伴,AA制或协商消费'
|
||||
},
|
||||
{
|
||||
id: 'srv_2',
|
||||
name: `${gameTitle} · 半日畅享 (3小时)`,
|
||||
title: `${gameTitle} · 半日畅享 (3小时)`,
|
||||
price: Math.round(basePrice * 2.8),
|
||||
unit: '次',
|
||||
desc: '深度互动与陪伴交流,赠送专属点歌或语音祝福'
|
||||
}
|
||||
];
|
||||
|
||||
const expert = ref({
|
||||
id: '',
|
||||
id: '101',
|
||||
nickname: '同城陪伴师',
|
||||
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=300',
|
||||
gender: 'female',
|
||||
@@ -282,15 +302,19 @@ const expert = ref({
|
||||
rankTag: '专业级',
|
||||
city: '北京市 · 朝阳/海淀',
|
||||
rating: 5.0,
|
||||
orderCount: 0,
|
||||
orderCount: 86,
|
||||
isOnline: true,
|
||||
bio: '专业同城生活陪伴,健康阳光公开。',
|
||||
voiceDuration: 15,
|
||||
price: 68,
|
||||
services: [],
|
||||
photos: [],
|
||||
services: buildDefaultServices('同城陪伴', 68),
|
||||
photos: [
|
||||
'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=400',
|
||||
'https://images.unsplash.com/photo-1517841905240-472988babdf9?w=400'
|
||||
],
|
||||
reviews: []
|
||||
});
|
||||
const selectedServiceId = ref(null);
|
||||
const selectedServiceId = ref('srv_1');
|
||||
const isPlayingVoice = ref(false);
|
||||
let currentExpertTargetId = null;
|
||||
|
||||
@@ -309,8 +333,11 @@ onShow(() => {
|
||||
});
|
||||
|
||||
const toggleFavorite = async () => {
|
||||
const targetId = Number(expert.value.id || currentExpertTargetId || 101);
|
||||
if (!ensureLoginOrRedirect(`/pages/expert/detail?id=${targetId}`)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const targetId = Number(expert.value.id || currentExpertTargetId || 101);
|
||||
if (isFav.value) {
|
||||
await removeFavApi(targetId);
|
||||
isFav.value = false;
|
||||
@@ -326,6 +353,10 @@ const toggleFavorite = async () => {
|
||||
};
|
||||
|
||||
const handleReplyReview = (rev) => {
|
||||
const targetId = Number(expert.value.id || currentExpertTargetId || 101);
|
||||
if (!ensureLoginOrRedirect(`/pages/expert/detail?id=${targetId}`)) {
|
||||
return;
|
||||
}
|
||||
const defaultReplies = [
|
||||
'感谢老板的支持与五星好评!开黑配合非常默契,期待下次一起上大分!',
|
||||
'谢谢老板认可!非常准时礼貌的高素质玩家老板,下次继续开黑走起~',
|
||||
@@ -352,15 +383,86 @@ const handleReplyReview = (rev) => {
|
||||
});
|
||||
};
|
||||
|
||||
const safeDecode = (val) => {
|
||||
if (!val) return '';
|
||||
try {
|
||||
return decodeURIComponent(val);
|
||||
} catch (_) {
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(async (query) => {
|
||||
const targetId = (query && query.id) ? query.id : '1';
|
||||
const targetId = (query && query.id) ? safeDecode(query.id) : '1';
|
||||
const queryName = query && query.name ? safeDecode(query.name) : '';
|
||||
const queryAvatar = query && query.avatar ? safeDecode(query.avatar) : '';
|
||||
const queryTag = query && query.tag ? safeDecode(query.tag) : '';
|
||||
const queryCity = query && query.city ? safeDecode(query.city) : '';
|
||||
currentExpertTargetId = targetId;
|
||||
|
||||
const cachedAuthor = uni.getStorageSync('ACTIVE_AUTHOR_PROFILE');
|
||||
const matchedSnapshot = (cachedAuthor && (String(cachedAuthor.id) === String(targetId) || String(cachedAuthor.userId) === String(targetId) || (queryName && cachedAuthor.nickname === queryName)))
|
||||
? cachedAuthor
|
||||
: null;
|
||||
|
||||
if (matchedSnapshot || queryName) {
|
||||
const snapName = queryName || (matchedSnapshot && matchedSnapshot.nickname) || expert.value.nickname;
|
||||
const snapAvatar = queryAvatar || (matchedSnapshot && matchedSnapshot.avatar) || expert.value.avatar;
|
||||
const snapTag = queryTag || (matchedSnapshot && matchedSnapshot.rankTag) || expert.value.rankTag;
|
||||
const snapCity = queryCity || (matchedSnapshot && matchedSnapshot.city) || expert.value.city;
|
||||
const snapGame = (matchedSnapshot && matchedSnapshot.game) || '同城搭子';
|
||||
const snapBio = (matchedSnapshot && matchedSnapshot.bio) || expert.value.bio;
|
||||
const snapPhotos = (matchedSnapshot && Array.isArray(matchedSnapshot.photos) && matchedSnapshot.photos.length > 0)
|
||||
? matchedSnapshot.photos
|
||||
: [snapAvatar];
|
||||
const snapPrice = snapGame === '车队开黑' ? 88 : 128;
|
||||
|
||||
expert.value = {
|
||||
...expert.value,
|
||||
id: String(targetId),
|
||||
nickname: snapName,
|
||||
avatar: snapAvatar,
|
||||
coverImage: snapPhotos[0] || snapAvatar,
|
||||
rankTag: snapTag,
|
||||
levelTag: '实名认证',
|
||||
game: snapGame,
|
||||
city: snapCity,
|
||||
bio: snapBio,
|
||||
price: snapPrice,
|
||||
photos: snapPhotos,
|
||||
services: buildDefaultServices(snapGame, snapPrice)
|
||||
};
|
||||
selectedServiceId.value = expert.value.services[0].id;
|
||||
}
|
||||
|
||||
try {
|
||||
const liveData = await getCompanionDetail(targetId);
|
||||
if (liveData) {
|
||||
expert.value = liveData;
|
||||
if (liveData.services && liveData.services.length > 0) {
|
||||
selectedServiceId.value = liveData.services[0].id;
|
||||
if (queryName || matchedSnapshot) {
|
||||
const finalName = queryName || (matchedSnapshot && matchedSnapshot.nickname) || liveData.nickname;
|
||||
const finalAvatar = queryAvatar || (matchedSnapshot && matchedSnapshot.avatar) || liveData.avatar;
|
||||
const finalTag = queryTag || (matchedSnapshot && matchedSnapshot.rankTag) || liveData.rankTag;
|
||||
const finalCity = queryCity || (matchedSnapshot && matchedSnapshot.city) || liveData.city;
|
||||
const finalBio = (matchedSnapshot && matchedSnapshot.bio) || liveData.bio;
|
||||
const finalPhotos = (matchedSnapshot && Array.isArray(matchedSnapshot.photos) && matchedSnapshot.photos.length > 0)
|
||||
? matchedSnapshot.photos
|
||||
: (liveData.photos || [finalAvatar]);
|
||||
|
||||
expert.value = {
|
||||
...liveData,
|
||||
nickname: finalName,
|
||||
avatar: finalAvatar,
|
||||
coverImage: finalPhotos[0] || finalAvatar,
|
||||
rankTag: finalTag,
|
||||
city: finalCity,
|
||||
bio: finalBio,
|
||||
photos: finalPhotos
|
||||
};
|
||||
} else {
|
||||
expert.value = liveData;
|
||||
}
|
||||
if (expert.value.services && expert.value.services.length > 0) {
|
||||
selectedServiceId.value = expert.value.services[0].id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +546,14 @@ const previewImage = (index) => {
|
||||
};
|
||||
|
||||
const goToOrder = () => {
|
||||
const srv = currentSelectedService.value || expert.value.services[0];
|
||||
const srv = currentSelectedService.value || (expert.value.services && expert.value.services[0]);
|
||||
const srvId = srv ? srv.id : 'srv_1';
|
||||
const targetUrl = `/pages/order/create?expertId=${expert.value.id || currentExpertTargetId || 101}&serviceId=${srvId}`;
|
||||
if (!ensureLoginOrRedirect(targetUrl)) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/create?expertId=${expert.value.id}&serviceId=${srv.id}`
|
||||
url: targetUrl
|
||||
});
|
||||
};
|
||||
|
||||
@@ -467,6 +574,10 @@ const reportForm = ref({
|
||||
});
|
||||
|
||||
const openReportModal = () => {
|
||||
const targetId = Number(expert.value.id || currentExpertTargetId || 101);
|
||||
if (!ensureLoginOrRedirect(`/pages/expert/detail?id=${targetId}`)) {
|
||||
return;
|
||||
}
|
||||
reportForm.value = {
|
||||
reason: '涉黄低俗言论',
|
||||
description: ''
|
||||
|
||||
在新工单中引用
屏蔽一个用户