feat(finance): add financial disclosure publishing

This commit is contained in:
2026-08-13 17:17:33 +08:00
parent 39a2e53e61
commit 65d23eab4a
49 changed files with 2096 additions and 3 deletions
+3 -1
View File
@@ -17,7 +17,9 @@
"pages/volunteer-center/volunteer-center",
"pages/content/content",
"pages/content-detail/content-detail",
"pages/notifications/notifications"
"pages/notifications/notifications",
"pages/financial-disclosures/financial-disclosures",
"pages/financial-disclosure-detail/financial-disclosure-detail"
],
"window": {
"backgroundColor": "#F7F5F2",
@@ -0,0 +1 @@
{ "navigationBarTitleText": "财务公开详情" }
@@ -0,0 +1,24 @@
import type { FinancialDisclosureDetail } from '@lehuo/contracts';
import { fetchFinancialDisclosure } from '../../services/financial-disclosures';
Page({
data: { loading: true, message: '', disclosure: null as FinancialDisclosureDetail | null },
onLoad(options) {
const id = String(options['publicId'] || '');
if (!id) {
this.setData({ loading: false, message: '缺少财务公开文档标识,请返回重试' });
return;
}
void this.load(id);
},
async load(id: string) {
this.setData({ loading: true, message: '' });
try {
const result = await fetchFinancialDisclosure(id);
this.setData({ disclosure: result.disclosure });
} catch (error) {
this.setData({ message: error instanceof Error ? error.message : '财务公开内容加载失败' });
} finally {
this.setData({ loading: false });
}
},
});
@@ -0,0 +1 @@
<view class="page disclosure-detail-page"><view wx:if="{{loading}}" class="state-card">正在加载…</view><view wx:elif="{{message}}" class="state-card"><text class="state-title">文档暂时无法查看</text><text class="state-text">{{message}}</text></view><view wx:elif="{{disclosure}}" class="disclosure-paper"><text class="disclosure-title">{{disclosure.title}}</text><text wx:if="{{disclosure.summary}}" class="disclosure-summary">{{disclosure.summary}}</text><view class="disclosure-meta"><text>发布时间</text><text>{{disclosure.publishedAt}}</text></view><scroll-view class="document-scroll" scroll-x="true"><rich-text class="disclosure-rich-text" nodes="{{disclosure.richText}}" selectable="true"></rich-text></scroll-view><text class="disclosure-note">本页面内容由乐活公益管理后台正式发布。</text></view></view>
@@ -0,0 +1,55 @@
@import '../../app.wxss';
.disclosure-paper {
padding: 38rpx 32rpx;
border-radius: 26rpx;
background: #fff;
box-shadow: 0 10rpx 30rpx rgba(38, 42, 48, 0.07);
}
.disclosure-title,
.disclosure-summary,
.disclosure-note {
display: block;
}
.disclosure-title {
color: #25292f;
font-size: 42rpx;
font-weight: 700;
line-height: 1.4;
}
.disclosure-summary {
margin-top: 22rpx;
padding: 22rpx;
border-radius: 16rpx;
background: #fff5ef;
color: #684d40;
font-size: 28rpx;
line-height: 1.7;
}
.disclosure-meta {
display: flex;
justify-content: space-between;
margin: 28rpx 0;
padding-bottom: 22rpx;
border-bottom: 1rpx solid #eceef1;
color: #8c929a;
font-size: 24rpx;
}
.document-scroll {
width: 100%;
}
.disclosure-rich-text {
display: block;
min-width: 100%;
color: #333840;
font-size: 30rpx;
line-height: 1.85;
overflow-wrap: anywhere;
}
.disclosure-note {
margin-top: 36rpx;
padding-top: 24rpx;
border-top: 1rpx solid #eceef1;
color: #9a9fa7;
font-size: 23rpx;
text-align: center;
}
@@ -0,0 +1 @@
{ "navigationBarTitleText": "财务公开" }
@@ -0,0 +1,26 @@
import type { FinancialDisclosureListItem } from '@lehuo/contracts';
import { fetchFinancialDisclosures } from '../../services/financial-disclosures';
Page({
data: { loading: true, message: '', items: [] as FinancialDisclosureListItem[] },
onLoad() {
void this.load();
},
async load() {
this.setData({ loading: true, message: '' });
try {
const result = await fetchFinancialDisclosures();
this.setData({ items: result.items });
} catch (error) {
this.setData({ message: error instanceof Error ? error.message : '财务公开内容加载失败' });
} finally {
this.setData({ loading: false });
}
},
open(event: WechatMiniprogram.BaseEvent) {
const id = String(event.currentTarget.dataset['id'] || '');
if (id)
void wx.navigateTo({
url: `/pages/financial-disclosure-detail/financial-disclosure-detail?publicId=${encodeURIComponent(id)}`,
});
},
});
@@ -0,0 +1 @@
<view class="page financial-list-page"><view class="financial-hero"><text class="financial-hero__eyebrow">公开 · 透明 · 可查阅</text><text class="financial-hero__title">财务公开</text><text class="financial-hero__copy">查看乐活公益经管理端正式发布的财务公开文档。</text></view><view wx:if="{{loading}}" class="state-card">正在加载…</view><view wx:elif="{{message}}" class="state-card"><text class="state-title">暂时无法加载</text><text class="state-text">{{message}}</text><button class="secondary-button" bindtap="load">重新加载</button></view><view wx:elif="{{!items.length}}" class="state-card"><text class="state-title">暂无公开文档</text><text class="state-text">财务公开文档发布后会展示在这里。</text></view><button wx:for="{{items}}" wx:key="publicId" class="financial-card" data-id="{{item.publicId}}" bindtap="open"><view class="financial-card__top"><text wx:if="{{item.isPinned}}" class="pin-tag">置顶</text><text class="financial-card__date">{{item.publishedAt}}</text></view><text class="financial-card__title">{{item.title}}</text><text class="financial-card__summary">{{item.summary || '点击查看完整公开内容'}}</text><text class="financial-card__link">查看详情 ›</text></button></view>
@@ -0,0 +1,74 @@
@import '../../app.wxss';
.financial-hero {
padding: 40rpx 34rpx;
border-radius: 28rpx;
background: linear-gradient(135deg, #ff6b35, #ff9b5f);
color: #fff;
box-shadow: 0 18rpx 40rpx rgba(240, 90, 40, 0.18);
}
.financial-hero text,
.financial-card text {
display: block;
}
.financial-hero__eyebrow {
font-size: 24rpx;
opacity: 0.86;
}
.financial-hero__title {
margin-top: 8rpx;
font-size: 46rpx;
font-weight: 700;
}
.financial-hero__copy {
margin-top: 14rpx;
line-height: 1.65;
}
.financial-card {
width: 100%;
margin-top: 24rpx;
padding: 30rpx;
border: 0;
border-radius: 24rpx;
background: #fff;
text-align: left;
box-shadow: 0 8rpx 28rpx rgba(38, 42, 48, 0.07);
}
.financial-card::after {
border: 0;
}
.financial-card__top {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 38rpx;
}
.pin-tag {
padding: 4rpx 14rpx;
border-radius: 999rpx;
background: #fff0e8;
color: #ee5b27;
font-size: 22rpx;
}
.financial-card__date {
margin-left: auto;
color: #969ba3;
font-size: 22rpx;
}
.financial-card__title {
margin-top: 16rpx;
color: #262a30;
font-size: 34rpx;
font-weight: 700;
}
.financial-card__summary {
margin-top: 14rpx;
color: #676d76;
font-size: 27rpx;
line-height: 1.65;
}
.financial-card__link {
margin-top: 20rpx;
color: #f05a28;
font-size: 26rpx;
font-weight: 600;
}
@@ -43,6 +43,9 @@ Page({
organization() {
void wx.navigateTo({ url: '/pages/content/content?type=ORGANIZATION_INTRO' });
},
financialDisclosures() {
void wx.navigateTo({ url: '/pages/financial-disclosures/financial-disclosures' });
},
openProject(event: WechatMiniprogram.BaseEvent) {
void wx.navigateTo({
url: `/pages/project-detail/project-detail?publicId=${event.currentTarget.dataset['id'] as string}`,
@@ -10,6 +10,6 @@
<view wx:if="{{!activities.length}}" class="empty-strip">暂无可查看活动</view>
<button wx:for="{{activities}}" wx:key="publicId" class="feature-card" data-id="{{item.publicId}}" bindtap="openActivity"><view class="feature-card__art green">♧</view><view class="feature-card__body"><text class="feature-card__tag">{{item.statusLabel}}</text><text class="feature-card__title">{{item.title}}</text><text class="feature-card__copy">{{item.summary}}</text><text class="feature-card__meta">已报名 {{item.activeRegistrationCount}} / {{item.capacity === null ? '不限' : item.capacity}}</text></view></button>
<view class="section-heading"><text class="section-title">了解乐活</text><text class="section-note">所有内容均经审核发布</text></view>
<view class="link-grid"><button bindtap="content"><text class="link-grid__icon orange">闻</text><text>公益动态</text><text>›</text></button><button bindtap="organization"><text class="link-grid__icon blue">乐</text><text>机构介绍</text><text>›</text></button></view>
<view class="link-grid"><button bindtap="content"><text class="link-grid__icon orange">闻</text><text>公益动态</text><text>›</text></button><button bindtap="organization"><text class="link-grid__icon blue">乐</text><text>机构介绍</text><text>›</text></button><button bindtap="financialDisclosures"><text class="link-grid__icon green">财</text><text>财务公开</text><text>›</text></button></view>
</block>
</view>
@@ -0,0 +1,13 @@
import type {
FinancialDisclosureDetailResponse,
PaginatedFinancialDisclosuresResponse,
} from '@lehuo/contracts';
import { apiRequest } from './api-client';
export const fetchFinancialDisclosures = () =>
apiRequest<PaginatedFinancialDisclosuresResponse>(
'/api/v1/financial-disclosures?page=1&pageSize=50',
);
export const fetchFinancialDisclosure = (id: string) =>
apiRequest<FinancialDisclosureDetailResponse>(
`/api/v1/financial-disclosures/${encodeURIComponent(id)}`,
);
+2
View File
@@ -13,6 +13,8 @@ const allowedTags = new Set([
'input',
'label',
'picker',
'rich-text',
'scroll-view',
'switch',
'text',
'textarea',