refactor: 抽取首页标准模块

This commit is contained in:
que01 committed 2026-09-22 22:39:16 +08:00
1 parent 777bdaa766
commit 0c4efdef1a
15 files changed
+17 -5

No files matched your search

@@ -0,0 +1 @@
Component({ properties: { brand: { type: Object, value: {} } } });
@@ -0,0 +1 @@
{"component":true}
@@ -0,0 +1 @@
<view class="founder"><image class="avatar" src="{{brand.avatarUrl || 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=240&h=240&q=80'}}"/><view><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text class="badge">亲自主理量房</text></view>
@@ -0,0 +1 @@
.founder{display:flex;align-items:center;gap:18rpx;padding:24rpx;background:#fff;border-radius:16rpx}.avatar{width:88rpx;height:88rpx;border-radius:50%;object-fit:cover}.founder-name{display:block;font:34rpx serif}.founder-title{display:block;margin-top:6rpx;color:#77736b;font-size:22rpx}.quote{display:block;margin-top:8rpx;color:#8a6846;font-size:22rpx}.badge{margin-left:auto;padding:8rpx 12rpx;border:1rpx solid #d9c8b2;color:#8a6846;font-size:20rpx;white-space:nowrap}
@@ -0,0 +1 @@
Component({ properties: { offerings: { type: Array, value: [] } }, methods: { open(e) { this.triggerEvent("open", { id: e.currentTarget.dataset.id }); }, more() { this.triggerEvent("more"); } } });
@@ -0,0 +1 @@
{"component":true}
@@ -0,0 +1 @@
<view class="section"><view class="section-head"><view><text class="eyebrow dark">SELECTED WORKS</text><text class="section-title">精选门系统作品</text></view><text class="more" bindtap="more">查看全部 →</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
@@ -0,0 +1 @@
.section{margin-top:22rpx;padding:28rpx;background:#fff}.section-head{display:flex;justify-content:space-between}.eyebrow{display:block;color:#8a6846;font-size:20rpx;letter-spacing:3rpx}.section-title{display:block;margin-top:10rpx;font:40rpx serif}.more{color:#8a6846;font-size:22rpx}.work-card{margin-top:22rpx;overflow:hidden;border:1rpx solid #e6ded5}.work-card image{width:100%;height:300rpx;display:block}.work-info{padding:18rpx}.work-category{display:block;color:#8a6846;font-size:21rpx}.work-name{display:block;margin-top:8rpx;font:30rpx serif}.work-desc{display:block;margin-top:8rpx;color:#77736b;font-size:22rpx}
@@ -0,0 +1 @@
Component({ properties: { content: { type: Object, value: {} } } });
@@ -0,0 +1 @@
{"component":true}
@@ -0,0 +1 @@
<view class="intro"><text class="eyebrow dark">主理人工艺与信任凭证</text><text class="section-title">14 年,只做门与空间的关系</text><text class="body">{{content.bio}}</text><view class="stats"><view wx:for="{{content.stats}}" wx:key="value"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="body">{{item.sub}}</text></view></view></view>
@@ -0,0 +1 @@
.intro{margin-top:22rpx;padding:28rpx;background:#fff}.eyebrow{display:block;color:#8a6846;font-size:20rpx;letter-spacing:3rpx}.section-title{display:block;margin-top:12rpx;font:40rpx serif}.body{display:block;margin-top:12rpx;color:#77736b;font-size:25rpx;line-height:1.7}.stats{display:grid;grid-template-columns:1fr 1fr;margin-top:24rpx}.stats view{padding:16rpx 0;border-top:1rpx solid #e6ded5}.stat-value{display:block;color:#8a6846;font:38rpx serif}.stat-label{display:block;font-size:22rpx}
+1 -1
View File
@@ -3,7 +3,7 @@ const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand, trustContent, offerings, modules: [], theme: {}, loading: false },
onLoad() { this.setData({ loading: true }); loadWorkspaceWithFallback().then((workspace) => { this.setData({ brand: workspace.brand, trustContent: workspace.trustContent || trustContent, offerings: workspace.offerings || offerings, modules: workspace.modules || [], theme: workspace.theme || {}, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); },
selectOffering(e) { wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id }); },
selectOffering(e) { const id = e.detail ? e.detail.id : e.currentTarget.dataset.id; wx.navigateTo({ url: "/pages/offering/detail?id=" + id }); },
goWorks() { wx.switchTab({ url: "/pages/services/index" }); },
goInquiry() { wx.navigateTo({ url: "/pages/inquiry/index" }); },
goProfile() { wx.switchTab({ url: "/pages/bookings/index" }); },
+1 -1
View File
@@ -1 +1 @@
{ "navigationBarTitleText": "品牌首页" }
{"navigationBarTitleText":"品牌首页","usingComponents":{"founder-card":"/components/modules/founder-card/founder-card","trust-proof":"/components/modules/trust-proof/trust-proof","offering-list":"/components/modules/offering-list/offering-list"}}
+3 -3
View File
@@ -1,7 +1,7 @@
<view class="page">
<view class="founder"><image class="avatar" src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=240&h=240&q=80"/><view><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text class="badge">亲自主理量房</text></view>
<founder-card brand="{{brand}}" />
<view class="hero"><image class="hero-image" src="https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80" mode="aspectFill"/><view class="hero-shade"/><view class="hero-copy"><text class="eyebrow">年度落成实景 · 莫干山庄园</text><text class="hero-title">万籁系列 · 铸铜冷锻双轴入户门</text><text class="hero-slogan">门高 3.4m · 德国静音地轴</text><button class="hero-button" bindtap="goWorks">探索全系作品 →</button></view></view>
<view class="intro"><text class="eyebrow dark">主理人工艺与信任凭证</text><text class="section-title">14 年,只做门与空间的关系</text><text class="body">{{brand.bio}}</text><view class="stats"><view wx:for="{{trustContent.stats}}" wx:key="value"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="body">{{item.sub}}</text></view></view></view>
<trust-proof content="{{trustContent}}" />
<view class="trust"><text class="eyebrow">林境门作品质宣言</text><text class="section-title light">拒绝流水线拼装</text><view wx:for="{{trustContent.pillars}}" wx:key="title"><text class="work-name light">{{item.title}}</text><text class="body light-body">{{item.desc}}</text></view></view>
<view class="section"><view class="section-head"><view><text class="eyebrow dark">SELECTED WORKS</text><text class="section-title">精选门系统作品</text></view><text class="more" bindtap="goWorks">查看全部 →</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="selectOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
<offering-list offerings="{{offerings}}" bind:open="selectOffering" bind:more="goWorks" />
</view>