feat: 完善对象存储上传与真实条码二维码引擎,彻底剥离保底Mock数据

这个提交包含在:
xcbyy
2026-10-09 17:18:14 +08:00
父节点 6d3076cdb8
当前提交 d0f4050cdc
共有 329 个文件被更改,包括 54416 次插入 和 926 次删除

查看文件

@@ -1,144 +1,150 @@
<template>
<view class="expert-detail-container">
<!-- 顶部封面与基本信息 -->
<view class="hero-header">
<image class="cover-bg" :src="expert.coverImage || expert.avatar" mode="aspectFill" />
<view class="cover-mask"></view>
<!-- 大神主页骨架屏 (首屏加载中流光占位,杜绝视觉空白) -->
<skeleton-screen v-if="isLoading" type="expert" />
<view class="profile-card">
<view class="avatar-wrap">
<image class="avatar-img" :src="expert.avatar" mode="aspectFill" />
<view class="status-badge" :class="{ online: expert.isOnline }">
<view class="pulse-dot" v-if="expert.isOnline"></view>
<text>{{ expert.isOnline ? '在线' : '离线' }}</text>
</view>
</view>
<!-- 真实内容 (数据加载完成平滑展示) -->
<view v-else class="expert-body-wrapper">
<!-- 顶部封面与基本信息 -->
<view class="hero-header">
<image class="cover-bg" :src="expert.coverImage || expert.avatar" mode="aspectFill" />
<view class="cover-mask"></view>
<view class="info-wrap">
<view class="name-row">
<text class="nickname">{{ expert.nickname }}</text>
<text class="level-tag">{{ expert.levelTag }}</text>
</view>
<view class="rank-row">
<text class="game-tag">{{ expert.game }}</text>
<text class="rank-tag">{{ expert.rankTag }}</text>
</view>
<view class="city-row" v-if="expert.city">
<image class="city-pin-svg" :src="ICONS.mapPin" mode="aspectFit" />
<text class="city-text">{{ expert.city }}</text>
</view>
<view class="data-row">
<view class="rating-box">
<image class="star-svg" :src="ICONS.star" mode="aspectFit" />
<text class="rating-val">{{ expert.rating }}</text>
<view class="profile-card">
<view class="avatar-wrap">
<image class="avatar-img" :src="expert.avatar" mode="aspectFill" />
<view class="status-badge" :class="{ online: expert.isOnline }">
<view class="pulse-dot" v-if="expert.isOnline"></view>
<text>{{ expert.isOnline ? '在线' : '离线' }}</text>
</view>
<text class="order-val">已陪玩 {{ expert.orderCount }} 次</text>
</view>
</view>
</view>
</view>
<!-- 专属打招呼试听语音 (矢量SVG播放条) -->
<view class="voice-card btn-active" @click="toggleVoice">
<view class="voice-icon-wrap">
<image class="play-svg" :src="isPlayingVoice ? ICONS.pause : ICONS.play" mode="aspectFit" />
</view>
<view class="voice-info">
<text class="voice-title">{{ isPlayingVoice ? '正在连麦试听语音...' : '点击试听打招呼原声' }}</text>
<view class="voice-wave" v-if="isPlayingVoice">
<view class="bar b1"></view>
<view class="bar b2"></view>
<view class="bar b3"></view>
<view class="bar b4"></view>
</view>
<text class="voice-dur" v-else>{{ expert.voiceDuration }}s 真实原声</text>
</view>
<text class="listen-tag">试听</text>
</view>
<!-- 个人简介 -->
<view class="section-card">
<view class="sec-title">个人介绍</view>
<text class="bio-text">{{ expert.bio }}</text>
</view>
<!-- 服务项目选择 -->
<view class="section-card">
<view class="sec-title">服务项目</view>
<view class="service-list">
<view
v-for="srv in expert.services"
:key="srv.id"
class="service-item btn-active"
:class="{ selected: selectedServiceId === srv.id }"
@click="selectService(srv)"
>
<view class="srv-left">
<view class="srv-title">{{ srv.title }}</view>
<view class="srv-desc">{{ srv.desc }}</view>
</view>
<view class="srv-right">
<text class="price-sym">¥</text>
<text class="price-num">{{ srv.price }}</text>
<text class="price-unit">/{{ srv.unit }}</text>
</view>
</view>
</view>
<!-- 线下安全守则提示卡 -->
<view class="offline-safety-card" v-if="expert.city">
<image class="safety-icon-svg" :src="ICONS.shield" mode="aspectFit" />
<view class="safety-content">
<text class="safety-title">绿色合规陪伴服务承诺</text>
<text class="safety-desc">该大神已完成公安实名联网比对与健康认证。同城陪玩/陪吃/陪喝仅限在公开正规商业场所履约,到场出示4位核销码现场签到。</text>
</view>
</view>
</view>
<!-- 战绩与生活照片 -->
<view class="section-card" v-if="expert.photos && expert.photos.length > 0">
<view class="sec-title">战绩相册</view>
<scroll-view scroll-x class="gallery-scroll" :show-scrollbar="false">
<view class="gallery-list">
<image
v-for="(photo, index) in expert.photos"
:key="index"
class="gallery-item"
:src="photo"
mode="aspectFill"
@click="previewImage(index)"
/>
</view>
</scroll-view>
</view>
<!-- 真实买家评价 -->
<view class="section-card">
<view class="sec-header">
<text class="sec-title">服务好评 ({{ expert.reviews ? expert.reviews.length : 0 }})</text>
<text class="rate-percent">好评率 99.8%</text>
</view>
<view class="review-list" v-if="expert.reviews && expert.reviews.length > 0">
<view v-for="rev in expert.reviews" :key="rev.id" class="review-item">
<image class="rev-avatar" :src="rev.userAvatar" mode="aspectFill" />
<view class="rev-body">
<view class="rev-top">
<text class="rev-name">{{ rev.userNickname }}</text>
<text class="rev-time">{{ rev.time }}</text>
<view class="info-wrap">
<view class="name-row">
<text class="nickname">{{ expert.nickname }}</text>
<text class="level-tag">{{ expert.levelTag }}</text>
</view>
<view class="tag-row">
<text class="rev-tag" v-for="(t, i) in rev.tags" :key="i">{{ t }}</text>
<view class="rank-row">
<text class="game-tag">{{ expert.game }}</text>
<text class="rank-tag">{{ expert.rankTag }}</text>
</view>
<view class="city-row" v-if="expert.city">
<image class="city-pin-svg" :src="ICONS.mapPin" mode="aspectFit" />
<text class="city-text">{{ expert.city }}</text>
</view>
<view class="data-row">
<view class="rating-box">
<image class="star-svg" :src="ICONS.star" mode="aspectFit" />
<text class="rating-val">{{ expert.rating }}</text>
</view>
<text class="order-val">已陪玩 {{ expert.orderCount }} 次</text>
</view>
<text class="rev-content">{{ rev.content }}</text>
</view>
</view>
</view>
<view v-else class="empty-reviews">
<text>近期新增服务,暂无评价记录</text>
<!-- 专属打招呼试听语音 (矢量SVG播放条) -->
<view class="voice-card btn-active" @click="toggleVoice">
<view class="voice-icon-wrap">
<image class="play-svg" :src="isPlayingVoice ? ICONS.pause : ICONS.play" mode="aspectFit" />
</view>
<view class="voice-info">
<text class="voice-title">{{ isPlayingVoice ? '正在连麦试听语音...' : '点击试听打招呼原声' }}</text>
<view class="voice-wave" v-if="isPlayingVoice">
<view class="bar b1"></view>
<view class="bar b2"></view>
<view class="bar b3"></view>
<view class="bar b4"></view>
</view>
<text class="voice-dur" v-else>{{ expert.voiceDuration }}s 真实原声</text>
</view>
<text class="listen-tag">试听</text>
</view>
<!-- 个人简介 -->
<view class="section-card">
<view class="sec-title">个人介绍</view>
<text class="bio-text">{{ expert.bio }}</text>
</view>
<!-- 服务项目选择 -->
<view class="section-card">
<view class="sec-title">服务项目</view>
<view class="service-list">
<view
v-for="srv in expert.services"
:key="srv.id"
class="service-item btn-active"
:class="{ selected: selectedServiceId === srv.id }"
@click="selectService(srv)"
>
<view class="srv-left">
<view class="srv-title">{{ srv.title }}</view>
<view class="srv-desc">{{ srv.desc }}</view>
</view>
<view class="srv-right">
<text class="price-sym">¥</text>
<text class="price-num">{{ srv.price }}</text>
<text class="price-unit">/{{ srv.unit }}</text>
</view>
</view>
</view>
<!-- 线下安全守则提示卡 -->
<view class="offline-safety-card" v-if="expert.city">
<image class="safety-icon-svg" :src="ICONS.shield" mode="aspectFit" />
<view class="safety-content">
<text class="safety-title">绿色合规陪伴服务承诺</text>
<text class="safety-desc">该大神已完成公安实名联网比对与健康认证。同城陪玩/陪吃/陪喝仅限在公开正规商业场所履约,到场出示4位核销码现场签到。</text>
</view>
</view>
</view>
<!-- 战绩与生活照片 -->
<view class="section-card" v-if="expert.photos && expert.photos.length > 0">
<view class="sec-title">战绩相册</view>
<scroll-view scroll-x class="gallery-scroll" :show-scrollbar="false">
<view class="gallery-list">
<image
v-for="(photo, index) in expert.photos"
:key="index"
class="gallery-item"
:src="photo"
mode="aspectFill"
@click="previewImage(index)"
/>
</view>
</scroll-view>
</view>
<!-- 真实买家评价 -->
<view class="section-card">
<view class="sec-header">
<text class="sec-title">服务好评 ({{ expert.reviews ? expert.reviews.length : 0 }})</text>
<text class="rate-percent">好评率 99.8%</text>
</view>
<view class="review-list" v-if="expert.reviews && expert.reviews.length > 0">
<view v-for="rev in expert.reviews" :key="rev.id" class="review-item">
<image class="rev-avatar" :src="rev.userAvatar" mode="aspectFill" />
<view class="rev-body">
<view class="rev-top">
<text class="rev-name">{{ rev.userNickname }}</text>
<text class="rev-time">{{ rev.time }}</text>
</view>
<view class="tag-row">
<text class="rev-tag" v-for="(t, i) in rev.tags" :key="i">{{ t }}</text>
</view>
<text class="rev-content">{{ rev.content }}</text>
</view>
</view>
</view>
<view v-else class="empty-reviews">
<text>近期新增服务,暂无评价记录</text>
</view>
</view>
</view>
@@ -160,22 +166,63 @@
<script setup>
import { ref, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { EXPERTS_LIST } from '@/common/mock.js';
import SkeletonScreen from '@/components/SkeletonScreen.vue';
import { getCompanionDetail, getExpertReviews } from '@/common/api.js';
import { ICONS } from '@/common/icons.js';
const expert = ref(EXPERTS_LIST[0]);
const selectedServiceId = ref(EXPERTS_LIST[0].services[0] ? EXPERTS_LIST[0].services[0].id : null);
const isLoading = ref(true);
const expert = ref({
id: '',
nickname: '同城陪伴师',
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=300',
gender: 'female',
levelTag: '平台认证',
game: '同城陪伴',
rankTag: '专业级',
city: '北京市 · 朝阳/海淀',
rating: 5.0,
orderCount: 0,
bio: '专业同城生活陪伴,健康阳光公开。',
voiceDuration: 15,
price: 68,
services: [],
photos: [],
reviews: []
});
const selectedServiceId = ref(null);
const isPlayingVoice = ref(false);
onLoad((query) => {
if (query && query.id) {
const found = EXPERTS_LIST.find(e => e.id === query.id);
if (found) {
expert.value = found;
if (found.services && found.services.length > 0) {
selectedServiceId.value = found.services[0].id;
onLoad(async (query) => {
const targetId = (query && query.id) ? query.id : '1';
try {
const liveData = await getCompanionDetail(targetId);
if (liveData) {
expert.value = liveData;
if (liveData.services && liveData.services.length > 0) {
selectedServiceId.value = liveData.services[0].id;
}
}
try {
const liveReviews = await getExpertReviews(targetId);
if (Array.isArray(liveReviews) && liveReviews.length > 0) {
expert.value.reviews = liveReviews.map(r => ({
id: r.id,
userNickname: r.userNickname || '买家玩家',
userAvatar: r.userAvatar || 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=100',
rating: r.rating || 5,
tags: r.tags || [],
content: r.content || '好评!',
time: r.createdAt ? '近期' : '刚刚'
}));
}
} catch (_) {}
} catch (err) {
console.warn('[ExpertDetail] 获取线上大神详情异常:', err);
} finally {
setTimeout(() => {
isLoading.value = false;
}, 200);
}
});
@@ -199,7 +246,27 @@ const toggleVoice = () => {
};
const chatOnline = () => {
uni.showToast({ title: '已开启即时加密连麦通道', icon: 'none' });
uni.showActionSheet({
itemList: [
`与【${expert.value.nickname}】开启即时连麦`,
`向【${expert.value.nickname}】发送打招呼私信`,
`复制大神游戏开黑专属房号`
],
success: (res) => {
if (res.tapIndex === 0) {
uni.showToast({ title: '已建立加密连麦通道', icon: 'success' });
} else if (res.tapIndex === 1) {
uni.showToast({ title: '打招呼私信已送达', icon: 'success' });
} else {
uni.setClipboardData({
data: `PW-${expert.value.id}-${Math.floor(1000 + Math.random() * 9000)}`,
success: () => {
uni.showToast({ title: '专属房号已复制', icon: 'success' });
}
});
}
}
});
};
const previewImage = (index) => {