feat: redesign public relationship services

This commit is contained in:
Codex
2026-09-14 08:51:26 +08:00
parent a6037ded59
commit 1aea6f7791
13 changed files with 178 additions and 199 deletions
@@ -1,4 +1,7 @@
{
"usingComponents": {},
"usingComponents": {
"ui-service-hero": "/components/service-hero/index",
"ui-loading": "/components/loading/index"
},
"navigationBarTitleText": "公益婚恋咨询"
}
@@ -2,7 +2,10 @@ import { request } from '../../utils/requestPromise'
const app = getApp<{ globalData: { apiBase: string; token: string } }>()
Page({
data: {
services: [] as Array<{ type: string; name: string; description: string; icon: string }>
services: [] as Array<{ type: string; name: string; description: string; iconAsset: string }>,
loading: true,
serviceEnabled: false,
disabledReason: '',
},
onLoad() {
@@ -16,17 +19,46 @@ Page({
header: { 'Authorization': `Bearer ${app.globalData.token}` }
});
if (res.statusCode === 200 && res.data.success) {
this.setData({ services: res.data.data });
const iconMap: Record<string, string> = {
relationship_guidance: '/assets/icons/home/counseling.png',
emotional_support: '/assets/icons/home/matchmaker.png',
premarital_guidance: '/assets/icons/home/premarital.png',
anti_fraud_guidance: '/assets/icons/home/anti-fraud.png',
};
this.setData({
services: (res.data.data || []).map((item: any) => ({
...item,
iconAsset: iconMap[item.type] || '/assets/icons/home/counseling.png',
})),
loading: false,
serviceEnabled: true,
});
return;
}
this.setData({ loading: false, serviceEnabled: false, disabledReason: res.data?.message || '服务暂不可用' });
} catch (e) {
console.error('加载咨询介绍失败', e);
this.setData({ loading: false, serviceEnabled: false, disabledReason: '暂时无法获取服务状态' });
}
},
onSelectService(e: any) {
if (!this.data.serviceEnabled) {
wx.showToast({ title: this.data.disabledReason || '服务暂不可用', icon: 'none' });
return;
}
const type = e.currentTarget.dataset.type;
wx.navigateTo({
url: `/pages/counseling-request/counseling-request?type=${type}`
});
},
onBook() {
const type = this.data.services[0]?.type || 'relationship_guidance';
this.onSelectService({ currentTarget: { dataset: { type } } });
},
onMyServices() {
wx.navigateTo({ url: '/pages/my-counseling/my-counseling' });
}
});
@@ -1 +1,19 @@
<view class="service-page reference-page"><view class="hero"><text class="eyebrow">U55 公益婚恋咨询</text><text class="hero-title">当关系让你困扰,可以认真谈一谈</text><text class="hero-desc">由婚恋咨询人员提供关系与情绪支持;咨询服务与公益红娘服务彼此独立。</text></view><view class="content"><view class="block"><text class="block-title">我们可以提供的帮助</text><text class="block-subtitle">选择最接近当前需要的方向</text><view class="card"><view class="feature-row" wx:for="{{services}}" wx:key="type" bindtap="onSelectService" data-type="{{item.type}}"><view class="feature-icon">{{index+1}}</view><view class="feature-copy"><text class="feature-title">{{item.name}}</text><text class="feature-desc">{{item.description}}</text></view><text class="arrow">›</text></view></view></view><view class="notice">咨询内容会按敏感信息保护。公益红娘不能查看咨询正文,咨询人员也只能处理明确分配给自己的服务。</view></view></view>
<view class="service-shell app-page reference-page">
<ui-service-hero eyebrow="专业陪伴 · 严格保密" title="婚恋咨询" subtitle="倾听你的心声,陪你梳理关系与情绪困扰" image-src="/assets/service/counseling-hero.jpg" tone="rose" />
<view class="service-content">
<view class="service-status"><text class="service-status__label">服务状态</text><text class="service-status__value {{!serviceEnabled ? 'disabled' : ''}}">{{loading ? '获取中' : (serviceEnabled ? '可预约' : disabledReason)}}</text></view>
<view class="block"><text class="block-title">我们可以提供的帮助</text><text class="block-subtitle">选择最接近当前需要的方向</text>
<ui-loading wx:if="{{loading}}" mode="skeleton" rows="2" />
<view wx:else class="service-topics">
<view class="service-topic" wx:for="{{services}}" wx:key="type" bindtap="onSelectService" data-type="{{item.type}}">
<view class="service-topic__icon"><image src="{{item.iconAsset}}" mode="aspectFit" /></view>
<text class="service-topic__title">{{item.name}}</text><text class="service-topic__desc">{{item.description}}</text>
</view>
</view>
</view>
<view class="privacy-note"><image src="/assets/icons/home/anti-fraud.png" mode="aspectFit" /><text>咨询内容按敏感信息保护。公益红娘不能查看咨询正文,咨询人员仅处理明确分配给自己的服务。</text></view>
</view>
<view class="fixed-action"><view class="service-actions"><view class="secondary-btn" bindtap="onMyServices">我的咨询</view><view class="primary-btn {{!serviceEnabled ? 'disabled' : ''}}" bindtap="onBook">预约咨询</view></view></view>
</view>