| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- <template>
- <view class="discover-container">
- <!-- ���憭湧� -->
- <PageBanner theme="home"
- tagline="摰嗅滬�亙熒�鞾鵭靽曹��?
- quote="蝏坔�摰嗥�銝�蝡坔�撟貊��鞉�" />
- <!-- 鈭磰�瘝嗵�憸�� -->
- <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">{{ formatPriceWithSymbol(item.price) }}</text>
- <text v-if="item.memberPrice" class="product-member">隡𡁜�{{ formatPriceWithSymbol(item.memberPrice) }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 摰嗅滬隡𡁜��刻��∠� -->
- <view v-if="!isMember" class="member-card" @click="goUpgrade">
- <view class="member-card-bg">
- <text class="member-card-icon">��</text>
- <view class="member-card-texts">
- <text class="member-card-title">撘��𡁜振摨凋��?/text>
- <text class="member-card-desc">鈭思�撅墧��?繚 �鞾鵭�滚𦛚 繚 閫����紡</text>
- </view>
- <view class="member-card-action">
- <text class="member-card-btn">蝡见朖撘��?/text>
- </view>
- </view>
- </view>
- <!-- �亥�銝剖� -->
- <view class="article-section">
- <view class="section-header">
- <text class="section-title">�� �亥�銝剖�</text>
- <text class="section-more" @click="goKnowledgeCenter">�亦��券� �?/text>
- </view>
- <view class="article-list">
- <view v-for="(item, index) in featuredArticles" :key="item.id" class="article-card" @click="goArticleDetail(item.id)">
- <view class="article-cover" :style="{ background: coverGradients[index % coverGradients.length] }">
- <text class="article-cover-icon">{{ coverIcons[index % coverIcons.length] }}</text>
- </view>
- <view class="article-info">
- <text class="article-title">{{ item.title }}</text>
- <text class="article-desc">{{ item.summary || item.title }}</text>
- <text class="article-meta">{{ item.publishedAt ? item.publishedAt.slice(0, 10) : '' }} 繚 {{ item.readTime || 3 }}�����粉</text>
- </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 style="height: 20rpx;"></view>
- </view>
- </template>
- <script>
- import PageBanner from '../../components/PageBanner.vue'
- import { productList, getFeaturedArticles, getMyMembership } from '@/utils/api.js'
- import WuxingSandbox from '../../components/wuxing-sandbox.vue'
- export default {
- components: { PageBanner, 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,
- featuredArticles: [],
- coverGradients: [
- 'linear-gradient(135deg, #D6EAF8, #8FC5E8)',
- 'linear-gradient(135deg, #E8F5E9, #81C784)',
- 'linear-gradient(135deg, #FFF3E0, #FFB74D)',
- 'linear-gradient(135deg, #F3E5F5, #CE93D8)',
- 'linear-gradient(135deg, #FCE4EC, #F06292)'
- ],
- coverIcons: ['�窓', '��', '�㴓', '��', '��'],
- isMember: false
- }
- },
- onLoad(options) {
- if (options && options.type) {
- this.currentType = options.type
- }
- },
- onShow() {
- this.checkMemberStatus()
- this.loadProducts()
- this.loadFeaturedArticles()
- },
- methods: {
- checkMemberStatus() {
- var that = this
- getMyMembership().then(function(res) {
- if (res.data && res.data.memberLevel) {
- that.isMember = res.data.memberLevel !== 'FREE'
- }
- }).catch(function() {})
- },
- goUpgrade() {
- uni.navigateTo({ url: '/pages/membership/upgrade' })
- },
- 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.navigateTo({ url: '/pages/points/mall' })
- },
- goDetail(id) {
- uni.navigateTo({ url: '/pages/shop/detail/detail?id=' + id })
- },
- handleLogin() {
- uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/discover/index') })
- },
- async loadFeaturedArticles() {
- try {
- const res = await getFeaturedArticles({ size: 3 })
- if (res.code === 200 && res.data) {
- let list = Array.isArray(res.data) ? res.data : (res.data.records || [])
- this.featuredArticles = list
- }
- } catch (e) {
- // �䠷�憭��
- }
- },
- goArticleDetail(id) {
- uni.navigateTo({ url: '/pages/mind/article-detail?id=' + id })
- },
- goKnowledgeCenter() {
- uni.navigateTo({ url: '/pages/mind-extra/articles' })
- }
- }
- }
- </script>
- <style scoped>
- .discover-container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 100rpx;
- }
- /* ===== �刻� ===== */
- .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: #5B9BD5;
- }
- .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: #5B9BD5;
- 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: #5B9BD5;
- 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: #5B9BD5;
- 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: #5B9BD5;
- font-weight: bold;
- }
- .card-tag {
- font-size: 18rpx;
- color: #5B9BD5;
- background: rgba(91,155,213,0.1);
- padding: 2rpx 10rpx;
- border-radius: 10rpx;
- }
- /* ===== 摰嗅滬隡𡁜��刻��∠� ===== */
- .member-card {
- margin: 20rpx 30rpx 0;
- }
- .member-card-bg {
- display: flex;
- align-items: center;
- background: linear-gradient(135deg, #F97316, #FB923C);
- border-radius: 20rpx;
- padding: 24rpx 30rpx;
- }
- .member-card-icon {
- font-size: 48rpx;
- margin-right: 16rpx;
- }
- .member-card-texts {
- flex: 1;
- display: flex;
- flex-direction: column;
- }
- .member-card-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #fff;
- }
- .member-card-desc {
- font-size: 22rpx;
- color: rgba(255,255,255,0.85);
- margin-top: 4rpx;
- }
- .member-card-action {
- margin-left: 16rpx;
- }
- .member-card-btn {
- display: inline-block;
- padding: 8rpx 24rpx;
- background: #fff;
- color: #F97316;
- font-size: 24rpx;
- font-weight: bold;
- border-radius: 30rpx;
- }
- /* ===== �刻���� ===== */
- .article-section {
- margin: 20rpx 30rpx 0;
- }
- .article-list {
- display: flex;
- flex-direction: column;
- gap: 16rpx;
- }
- .article-card {
- display: flex;
- background: #fff;
- border-radius: 16rpx;
- overflow: hidden;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
- cursor: pointer;
- }
- .article-cover {
- width: 180rpx;
- flex-shrink: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .article-cover-icon {
- font-size: 48rpx;
- }
- .article-info {
- flex: 1;
- padding: 16rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .article-title {
- font-size: 26rpx;
- font-weight: bold;
- color: #333;
- line-height: 1.4;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .article-desc {
- font-size: 22rpx;
- color: #999;
- line-height: 1.3;
- margin-top: 6rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .article-meta {
- font-size: 20rpx;
- color: #ccc;
- margin-top: 6rpx;
- }
- /* ===== 銝箔��㗇𥋘 ===== */
- .why-section {
- margin: 30rpx;
- }
- .feature-grid {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- .feature-item {
- width: calc(50% - 10rpx);
- box-sizing: border-box;
- background: #fff;
- border-radius: 20rpx;
- padding: 24rpx;
- margin-bottom: 20rpx;
- 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, #5B9BD5, #3A7CC4);
- 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>
|