feat: redesign public relationship services
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"usingComponents": {
|
||||
"ui-service-hero": "/components/service-hero/index"
|
||||
},
|
||||
"navigationBarTitleText": "婚前辅导"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,52 @@
|
||||
import { request } from '../../utils/requestPromise'
|
||||
|
||||
const app = getApp<{ globalData: { apiBase: string; token: string } }>()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
topics: [
|
||||
{ title: '沟通与期望', description: '表达需求、倾听差异,形成共同约定', iconAsset: '/assets/icons/home/counseling.png' },
|
||||
{ title: '家庭与责任', description: '讨论家庭角色与双方家庭关系', iconAsset: '/assets/icons/home/premarital.png' },
|
||||
{ title: '财务与规划', description: '了解消费习惯并讨论未来安排', iconAsset: '/assets/icons/home/classroom.png' },
|
||||
{ title: '冲突与修复', description: '学习处理分歧并建立修复方式', iconAsset: '/assets/icons/home/anti-fraud.png' },
|
||||
],
|
||||
loading: true,
|
||||
serviceEnabled: false,
|
||||
disabledReason: '',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadAvailability()
|
||||
},
|
||||
|
||||
async loadAvailability() {
|
||||
try {
|
||||
const res = await request<any>({
|
||||
url: `${app.globalData.apiBase}/counseling/services/intro`,
|
||||
header: { Authorization: `Bearer ${app.globalData.token}` },
|
||||
})
|
||||
const services = res.statusCode === 200 && res.data.success ? (res.data.data || []) : []
|
||||
const serviceEnabled = services.some((item: any) => item.type === 'premarital_guidance')
|
||||
this.setData({
|
||||
loading: false,
|
||||
serviceEnabled,
|
||||
disabledReason: serviceEnabled ? '' : (res.data?.message || '服务暂不可用'),
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载婚前辅导服务状态失败', error)
|
||||
this.setData({ loading: false, serviceEnabled: false, disabledReason: '暂时无法获取服务状态' })
|
||||
}
|
||||
},
|
||||
|
||||
onApply() {
|
||||
wx.navigateTo({ url: '/pages/premarital-request/premarital-request' });
|
||||
}
|
||||
});
|
||||
if (!this.data.serviceEnabled) {
|
||||
wx.showToast({ title: this.data.disabledReason || '服务暂不可用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.navigateTo({ url: '/pages/premarital-request/premarital-request?type=premarital_guidance' })
|
||||
},
|
||||
|
||||
onMyServices() {
|
||||
wx.navigateTo({ url: '/pages/my-counseling/my-counseling' })
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1 +1,18 @@
|
||||
<view class="service-page reference-page"><view class="hero"><text class="eyebrow">U58 婚前辅导</text><text class="hero-title">在进入婚姻前,把重要的事认真谈清楚</text><text class="hero-desc">帮助双方讨论共同生活、家庭责任与沟通方式,可邀请伴侣共同参与。</text></view><view class="content"><view class="block"><text class="block-title">辅导内容</text><view class="card"><view class="feature-row"><view class="feature-icon">沟</view><view class="feature-copy"><text class="feature-title">沟通与期望</text><text class="feature-desc">表达需求、倾听差异,形成可以共同遵守的约定</text></view></view><view class="feature-row"><view class="feature-icon">家</view><view class="feature-copy"><text class="feature-title">家庭与责任</text><text class="feature-desc">讨论家庭角色、财务安排与双方家庭关系</text></view></view><view class="feature-row"><view class="feature-icon">伴</view><view class="feature-copy"><text class="feature-title">共同生活</text><text class="feature-desc">对生活方式、未来计划和冲突处理建立共识</text></view></view></view></view><view class="notice">双方共同参与效果更好,但必须基于自愿,不会因为一方申请而自动通知或要求另一方参加。</view></view><view class="fixed-action"><view class="primary-btn" bindtap="onApply">申请婚前辅导</view></view></view>
|
||||
<view class="service-shell app-page reference-page">
|
||||
<ui-service-hero eyebrow="共同成长 · 面向未来" title="婚前辅导" subtitle="在进入婚姻前,把重要的事认真谈清楚" image-src="/assets/service/premarital-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>
|
||||
<view class="service-topics">
|
||||
<view class="service-topic" wx:for="{{topics}}" wx:key="title">
|
||||
<view class="service-topic__icon"><image src="{{item.iconAsset}}" mode="aspectFit" /></view>
|
||||
<text class="service-topic__title">{{item.title}}</text><text class="service-topic__desc">{{item.description}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="privacy-note"><image src="/assets/icons/home/premarital.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="onApply">预约辅导</view></view></view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user