Initial commit
This commit is contained in:
4
miniprogram/custom-tab-bar/index.json
Normal file
4
miniprogram/custom-tab-bar/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
34
miniprogram/custom-tab-bar/index.ts
Normal file
34
miniprogram/custom-tab-bar/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
unreadCount: 0,
|
||||
tabs: [
|
||||
{ pagePath: '/pages/feed/feed' },
|
||||
{ pagePath: '/pages/nearby/nearby' },
|
||||
{ pagePath: '/pages/friends/friends' },
|
||||
{ pagePath: '/pages/profile/profile' },
|
||||
],
|
||||
},
|
||||
|
||||
methods: {
|
||||
onTab(e: WechatMiniprogram.CustomEvent) {
|
||||
const index = e.currentTarget.dataset.index as number
|
||||
const path = e.currentTarget.dataset.path as string
|
||||
if (index === this.data.selected) return
|
||||
this.setData({ selected: index })
|
||||
wx.switchTab({ url: path })
|
||||
},
|
||||
|
||||
onPost() {
|
||||
wx.navigateTo({ url: '/pages/post/post' })
|
||||
},
|
||||
|
||||
setSelected(index: number) {
|
||||
this.setData({ selected: index })
|
||||
},
|
||||
|
||||
setUnread(count: number) {
|
||||
this.setData({ unreadCount: count })
|
||||
},
|
||||
},
|
||||
})
|
||||
56
miniprogram/custom-tab-bar/index.wxml
Normal file
56
miniprogram/custom-tab-bar/index.wxml
Normal file
@@ -0,0 +1,56 @@
|
||||
<view class="tab-bar">
|
||||
|
||||
<!-- 广场 -->
|
||||
<view class="tab-item {{selected === 0 ? 'active' : ''}}" bindtap="onTab" data-index="0" data-path="/pages/feed/feed">
|
||||
<view class="icon-wrap">
|
||||
<view class="icon-grid">
|
||||
<view class="sq"></view><view class="sq"></view>
|
||||
<view class="sq"></view><view class="sq"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="tab-label">广场</text>
|
||||
</view>
|
||||
|
||||
<!-- 附近 -->
|
||||
<view class="tab-item {{selected === 1 ? 'active' : ''}}" bindtap="onTab" data-index="1" data-path="/pages/nearby/nearby">
|
||||
<view class="icon-wrap">
|
||||
<view class="icon-pin">
|
||||
<view class="pin-head"></view>
|
||||
<view class="pin-tail"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="tab-label">附近</text>
|
||||
</view>
|
||||
|
||||
<!-- 发布 FAB -->
|
||||
<view class="tab-fab-wrap">
|
||||
<view class="tab-fab" bindtap="onPost">
|
||||
<text class="fab-plus">+</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 汪友 -->
|
||||
<view class="tab-item {{selected === 2 ? 'active' : ''}}" bindtap="onTab" data-index="2" data-path="/pages/friends/friends">
|
||||
<view class="icon-wrap" style="position:relative">
|
||||
<view class="icon-ppl">
|
||||
<view class="ppl-head ppl-head-l"></view>
|
||||
<view class="ppl-head ppl-head-r"></view>
|
||||
<view class="ppl-body"></view>
|
||||
</view>
|
||||
<view wx:if="{{unreadCount > 0}}" class="badge">{{unreadCount > 99 ? '99+' : unreadCount}}</view>
|
||||
</view>
|
||||
<text class="tab-label">汪友</text>
|
||||
</view>
|
||||
|
||||
<!-- 我的 -->
|
||||
<view class="tab-item {{selected === 3 ? 'active' : ''}}" bindtap="onTab" data-index="3" data-path="/pages/profile/profile">
|
||||
<view class="icon-wrap">
|
||||
<view class="icon-user">
|
||||
<view class="user-head"></view>
|
||||
<view class="user-body"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="tab-label">我的</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
218
miniprogram/custom-tab-bar/index.wxss
Normal file
218
miniprogram/custom-tab-bar/index.wxss
Normal file
@@ -0,0 +1,218 @@
|
||||
/* ── 底部导航栏 ── */
|
||||
.tab-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.65);
|
||||
background: rgba(255, 255, 255, 0.90);
|
||||
padding: 10rpx 0 calc(10rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -10rpx 24rpx rgba(110, 78, 131, 0.08);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/* ── Tab 项 ── */
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 5rpx;
|
||||
border-radius: 22rpx;
|
||||
padding: 8rpx 0 6rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background: linear-gradient(180deg, rgba(255, 79, 145, 0.12), rgba(255, 225, 90, 0.08));
|
||||
}
|
||||
|
||||
.tab-label {
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
color: #9b8fa8;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-label {
|
||||
color: #ff4f91;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
/* ── 图标容器 ── */
|
||||
.icon-wrap {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* ── 广场图标:2×2 圆角方块网格 ── */
|
||||
.icon-grid {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
gap: 5rpx;
|
||||
}
|
||||
|
||||
.icon-grid .sq {
|
||||
background: #9b8fa8;
|
||||
border-radius: 4rpx;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.tab-item.active .icon-grid .sq {
|
||||
background: #ff4f91;
|
||||
}
|
||||
|
||||
/* ── 附近图标:地图 Pin ── */
|
||||
.icon-pin {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.pin-head {
|
||||
width: 22rpx;
|
||||
height: 22rpx;
|
||||
border-radius: 50% 50% 50% 0;
|
||||
background: #9b8fa8;
|
||||
transform: rotate(-45deg);
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.pin-tail {
|
||||
width: 4rpx;
|
||||
height: 8rpx;
|
||||
background: #9b8fa8;
|
||||
border-radius: 0 0 4rpx 4rpx;
|
||||
margin-top: -2rpx;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.tab-item.active .pin-head,
|
||||
.tab-item.active .pin-tail {
|
||||
background: #ff4f91;
|
||||
}
|
||||
|
||||
/* ── 汪友图标:双人轮廓 ── */
|
||||
.icon-ppl {
|
||||
width: 36rpx;
|
||||
height: 30rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ppl-head {
|
||||
position: absolute;
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
border-radius: 50%;
|
||||
background: #9b8fa8;
|
||||
top: 0;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.ppl-head-l { left: 2rpx; }
|
||||
.ppl-head-r { right: 2rpx; }
|
||||
|
||||
.ppl-body {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 14rpx;
|
||||
background: #9b8fa8;
|
||||
border-radius: 8rpx 8rpx 0 0;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.tab-item.active .ppl-head,
|
||||
.tab-item.active .ppl-body {
|
||||
background: #ff4f91;
|
||||
}
|
||||
|
||||
/* ── 我的图标:单人轮廓 ── */
|
||||
.icon-user {
|
||||
width: 28rpx;
|
||||
height: 34rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.user-head {
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
background: #9b8fa8;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.user-body {
|
||||
width: 28rpx;
|
||||
height: 14rpx;
|
||||
border-radius: 8rpx 8rpx 0 0;
|
||||
background: #9b8fa8;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.tab-item.active .user-head,
|
||||
.tab-item.active .user-body {
|
||||
background: #ff4f91;
|
||||
}
|
||||
|
||||
/* ── 发布 FAB ── */
|
||||
.tab-fab-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.tab-fab {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, #ff4f91, #ff9f1c 55%, #ffe15a);
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.90);
|
||||
box-shadow: 0 10rpx 22rpx rgba(255, 79, 145, 0.28);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.fab-plus {
|
||||
font-size: 52rpx;
|
||||
color: #fff;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
margin-top: -4rpx;
|
||||
}
|
||||
|
||||
/* ── 未读角标 ── */
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -4rpx;
|
||||
right: -6rpx;
|
||||
min-width: 30rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 15rpx;
|
||||
background: #ff4f91;
|
||||
color: #fff;
|
||||
font-size: 18rpx;
|
||||
font-weight: 800;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 6rpx;
|
||||
border: 2rpx solid #fff;
|
||||
}
|
||||
Reference in New Issue
Block a user