| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <view class="discover-container">
- <!-- 品牌头部 -->
- <view class="brand-header">
- <image class="brand-logo" src="/static/logo.png" mode="aspectFit" />
- <text class="brand-title">汐艾福</text>
- <text class="brand-slogan">遵循五行节律,陪伴孩子自然成长</text>
- </view>
- <!-- 五行沙盘预览 -->
- <wuxing-sandbox mode="preview" badgeText="登录查看完整报告" @point-click="handleLogin" />
- <!-- 活动/商品推荐 -->
- <view class="recommend-section">
- <view class="section-header">
- <text class="section-title">🔥 热门推荐</text>
- <text class="section-more" @click="goShop">查看更多 ›</text>
- </view>
- <scroll-view scroll-x enable-flex show-scrollbar="false" class="type-filter-scroll">
- <view
- v-for="item in typeList"
- :key="item.value"
- :class="['filter-chip', currentType === item.value ? 'active' : '']"
- @click="onTypeChange(item.value)"
- >
- {{ item.label }}
- </view>
- </scroll-view>
- <view v-if="loading" class="loading-state">
- <text class="loading-text">加载中...</text>
- </view>
- <view v-else-if="products.length === 0" class="empty-state">
- <text class="empty-text">暂无商品,去商城看看吧</text>
- </view>
- <view v-else class="product-grid">
- <view
- v-for="item in products"
- :key="item.id"
- class="product-card"
- @click="goDetail(item.id)"
- >
- <image class="product-cover" :src="item.coverImage || '/static/default-product.png'" mode="aspectFill" />
- <view class="product-info">
- <text class="product-name">{{ item.name }}</text>
- <view class="product-price-row">
- <text class="product-price">¥{{ item.price }}</text>
- <text v-if="item.memberPrice" class="product-member">会员¥{{ item.memberPrice }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 为何选择汐艾福 -->
- <view class="why-section">
- <view class="section-header">
- <text class="section-title">💡 为什么选择汐艾福</text>
- </view>
- <view class="feature-grid">
- <view class="feature-item">
- <text class="feature-icon">🎯</text>
- <text class="feature-title">科学评估</text>
- <text class="feature-desc">DAN少儿核心素养评估体系</text>
- </view>
- <view class="feature-item">
- <text class="feature-icon">🏆</text>
- <text class="feature-title">积分激励</text>
- <text class="feature-desc">完成任务得积分,兑换心愿</text>
- </view>
- <view class="feature-item">
- <text class="feature-icon">👨👩👧👦</text>
- <text class="feature-title">家庭参与</text>
- <text class="feature-desc">全家一起见证成长每一步</text>
- </view>
- <view class="feature-item">
- <text class="feature-icon">🌟</text>
- <text class="feature-title">专业规划</text>
- <text class="feature-desc">成长规划师一对一指导</text>
- </view>
- </view>
- </view>
- <!-- 底部登录按钮 -->
- <view class="login-footer">
- <button class="login-btn" @click="handleLogin">登录 / 注册</button>
- <text class="login-footer-text">登录即表示同意《用户协议》和《隐私政策》</text>
- </view>
- </view>
- </template>
- <script>
- import { productList } from '@/utils/api.js'
- import WuxingSandbox from '../../components/wuxing-sandbox.vue'
- export default {
- components: { WuxingSandbox },
- data() {
- return {
- typeList: [
- { label: '全部', value: '' },
- { label: '活动', value: 'activity' },
- { label: '课程', value: 'course' },
- { label: '实物', value: 'physical' },
- { label: '数字', value: 'digital' },
- { label: '服务', value: 'service' }
- ],
- currentType: '',
- products: [],
- loading: false
- }
- },
- onShow() {
- this.resetTabBar()
- this.loadProducts()
- },
- methods: {
- resetTabBar() {
- uni.setTabBarItem({ index: 1, text: '发现' })
- uni.setTabBarItem({ index: 2, text: '商城' })
- },
- loadProducts() {
- this.loading = true
- const params = { page: 1, size: 10 }
- if (this.currentType) {
- params.productType = this.currentType
- }
- productList(params).then(res => {
- this.loading = false
- if (res.code === 200 && res.data) {
- this.products = res.data.records || []
- }
- }).catch(() => {
- this.loading = false
- })
- },
- onTypeChange(value) {
- this.currentType = value
- this.loadProducts()
- },
- goShop() {
- uni.switchTab({ url: '/pages/shop/index' })
- },
- goDetail(id) {
- uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + id })
- },
- handleLogin() {
- uni.navigateTo({ url: '/pages/login/login' })
- }
- }
- }
- </script>
- <style scoped>
- .discover-container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 100rpx;
- }
- /* ===== 品牌头部 ===== */
- .brand-header {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 60rpx 30rpx 30rpx;
- background: linear-gradient(180deg, #1a1a2e 0%, #16213e 60%, #f5f7fa 100%);
- }
- .brand-logo {
- width: 120rpx;
- height: 120rpx;
- border-radius: 24rpx;
- margin-bottom: 16rpx;
- }
- .brand-title {
- font-size: 44rpx;
- font-weight: bold;
- color: #FFD700;
- letter-spacing: 8rpx;
- }
- .brand-slogan {
- font-size: 24rpx;
- color: rgba(255, 215, 0, 0.7);
- margin-top: 10rpx;
- }
- /* ===== 推荐 ===== */
- .recommend-section {
- margin: 20rpx 30rpx;
- }
- .section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .section-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
- .section-more {
- font-size: 24rpx;
- color: #F97316;
- }
- .type-filter-scroll {
- white-space: nowrap;
- margin-bottom: 20rpx;
- }
- .filter-chip {
- display: inline-block;
- padding: 8rpx 24rpx;
- font-size: 24rpx;
- color: #666;
- background: #f0f0f0;
- border-radius: 30rpx;
- margin-right: 16rpx;
- }
- .filter-chip.active {
- background: #F97316;
- color: #fff;
- }
- .loading-state,
- .empty-state {
- display: flex;
- justify-content: center;
- padding: 60rpx 0;
- }
- .loading-text,
- .empty-text {
- font-size: 26rpx;
- color: #999;
- }
- .product-grid {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- .product-card {
- width: 48%;
- background: #fff;
- border-radius: 16rpx;
- overflow: hidden;
- margin-bottom: 20rpx;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
- }
- .product-cover {
- width: 100%;
- height: 200rpx;
- background: #f0f0f0;
- }
- .product-info {
- padding: 14rpx;
- }
- .product-name {
- display: block;
- font-size: 26rpx;
- color: #333;
- margin-bottom: 10rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .product-price-row {
- display: flex;
- align-items: baseline;
- }
- .product-price {
- font-size: 28rpx;
- color: #F97316;
- font-weight: bold;
- margin-right: 10rpx;
- }
- .product-member {
- font-size: 20rpx;
- color: #999;
- }
- .recommend-scroll {
- display: flex;
- white-space: nowrap;
- overflow-x: auto;
- padding-bottom: 10rpx;
- }
- .recommend-card {
- display: inline-flex;
- flex-direction: column;
- width: 260rpx;
- background: #fff;
- border-radius: 20rpx;
- overflow: hidden;
- margin-right: 20rpx;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- }
- .card-banner {
- padding: 14rpx 20rpx;
- background: #F97316;
- color: #fff;
- font-size: 22rpx;
- font-weight: bold;
- text-align: center;
- }
- .card-body {
- padding: 16rpx;
- white-space: normal;
- }
- .card-title {
- font-size: 24rpx;
- font-weight: bold;
- color: #333;
- display: block;
- margin-bottom: 6rpx;
- }
- .card-desc {
- font-size: 20rpx;
- color: #999;
- display: block;
- margin-bottom: 10rpx;
- }
- .card-meta {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .card-price {
- font-size: 26rpx;
- color: #F97316;
- font-weight: bold;
- }
- .card-tag {
- font-size: 18rpx;
- color: #F97316;
- background: rgba(255,107,107,0.1);
- padding: 2rpx 10rpx;
- border-radius: 10rpx;
- }
- /* ===== 为何选择 ===== */
- .why-section {
- margin: 30rpx;
- }
- .feature-grid {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 20rpx;
- }
- .feature-item {
- background: #fff;
- border-radius: 20rpx;
- padding: 24rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- }
- .feature-icon {
- font-size: 48rpx;
- margin-bottom: 10rpx;
- }
- .feature-title {
- font-size: 24rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 6rpx;
- }
- .feature-desc {
- font-size: 20rpx;
- color: #999;
- }
- /* ===== 底部登录 ===== */
- .login-footer {
- margin: 40rpx 30rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .login-btn {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 32rpx;
- font-weight: bold;
- border-radius: 44rpx;
- text-align: center;
- border: none;
- }
- .login-btn::after {
- border: none;
- }
- .login-footer-text {
- font-size: 20rpx;
- color: #bbb;
- margin-top: 16rpx;
- }
- </style>
|