feat: 首页查看更多
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"usingComponents": {
|
||||
"nav-bar": "/components3.0/nav-bar/nav-bar",
|
||||
"category-tabs": "/components3.0/category-tabs/category-tabs",
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"toy-icon": "../../toy/icon/icon"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
}
|
||||
|
||||
.home-section-panel {
|
||||
margin-top: @section-gap;
|
||||
margin-top: 48rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
}
|
||||
|
||||
.home-track-scroll {
|
||||
margin-top: @section-gap-sm;
|
||||
margin-top: 16rpx;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
// padding: 16rpx 0 20rpx;
|
||||
@@ -286,7 +286,7 @@
|
||||
}
|
||||
|
||||
.home-age-scroll {
|
||||
margin-top: @section-gap-sm;
|
||||
margin-top: @section-gap-xs;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -341,7 +341,7 @@
|
||||
}
|
||||
|
||||
.home-hot-list {
|
||||
margin-top: @section-gap-sm;
|
||||
margin-top: @section-gap-xs;
|
||||
padding: 0 @page-padding-x;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -434,8 +434,10 @@
|
||||
background: @brand;
|
||||
color: #2b2b2b;
|
||||
font-size: 36rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NAV_INNER_PX } from '../../utils/navMetrics';
|
||||
import { parseMiniProgramUrl } from '../../utils/index';
|
||||
import {
|
||||
HOME_CURRENT_CAPABILITY_DATA,
|
||||
type HomeDisplayItem,
|
||||
@@ -35,6 +36,7 @@ const AGE_BAND_ICONS = ['🌱', '🚀', '🎓', '🧠', '🏆'] as const;
|
||||
const SECTION_ANCHOR_PREFIX = 'section-';
|
||||
const TAB_BAR_PATHS = new Set([
|
||||
'/pages/home/home',
|
||||
'/pages/category/category',
|
||||
'/pages/age/age',
|
||||
'/pages/favorites/favorites',
|
||||
'/pages/profile/profile',
|
||||
@@ -65,7 +67,6 @@ function sortSectionsByTabs(
|
||||
}
|
||||
|
||||
function navigateByPath(path?: string, fallbackTitle?: string) {
|
||||
console.log('path-----:', path);
|
||||
if (!path) {
|
||||
wx.showToast({
|
||||
title: fallbackTitle ? `${fallbackTitle} 即将上线` : '即将上线',
|
||||
@@ -74,12 +75,23 @@ function navigateByPath(path?: string, fallbackTitle?: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TAB_BAR_PATHS.has(path)) {
|
||||
wx.switchTab({ url: path });
|
||||
const { path: basePath, query } = parseMiniProgramUrl(path);
|
||||
|
||||
if (TAB_BAR_PATHS.has(basePath)) {
|
||||
// tabBar 页面不支持携带 query/hash,统一跳到 basePath
|
||||
if (Object.keys(query).length > 0) {
|
||||
console.warn(
|
||||
'[navigateByPath] tabBar 不支持携带参数,已忽略 query:',
|
||||
basePath,
|
||||
query,
|
||||
);
|
||||
}
|
||||
wx.switchTab({ url: basePath });
|
||||
return;
|
||||
}
|
||||
|
||||
wx.navigateTo({ url: path });
|
||||
wx.navigateTo({ url: path }).catch((err) => {
|
||||
console.error('navigateByPath error:', err);
|
||||
});
|
||||
}
|
||||
|
||||
// ── Skeleton data ──
|
||||
|
||||
@@ -142,8 +142,9 @@
|
||||
<view
|
||||
wx:if="{{!item.skeleton}}"
|
||||
class="home-hot-card__action"
|
||||
>›</view
|
||||
>
|
||||
>
|
||||
<toy-icon name="arrow-right" size="36rpx" color="#2b2b2b" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user