backup: snapshot before optimization

This commit is contained in:
2026-06-04 16:25:43 +08:00
commit ff2700c067
47 changed files with 3332 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
var themeMod = require('../utils/theme')
Component({
data: {
selected: 0,
themeStyle: ''
},
lifetimes: {
attached: function () {
var theme = themeMod.getCurrentTheme()
this.setData({ themeStyle: themeMod.getThemeStyle(theme) })
}
},
pageLifetimes: {
show: function () {
var theme = themeMod.getCurrentTheme()
this.setData({ themeStyle: themeMod.getThemeStyle(theme) })
}
},
methods: {
switchTab: function (e) {
var index = e.currentTarget.dataset.index
var pages = [
'/pages/index/index',
'/pages/records/records',
'/pages/settings/settings'
]
if (index === this.data.selected) return
wx.switchTab({ url: pages[index] })
}
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
+44
View File
@@ -0,0 +1,44 @@
<view class="tab-bar" style="{{themeStyle}}">
<view
class="tab-item {{selected === 0 ? 'active' : ''}}"
data-index="0"
bindtap="switchTab"
>
<view class="tab-icon">
<view class="icon-home {{selected === 0 ? 'active' : ''}}">
<view class="home-roof"></view>
<view class="home-body"></view>
</view>
</view>
<text class="tab-text">训练</text>
</view>
<view
class="tab-item {{selected === 1 ? 'active' : ''}}"
data-index="1"
bindtap="switchTab"
>
<view class="tab-icon">
<view class="icon-records {{selected === 1 ? 'active' : ''}}">
<view class="bar bar1"></view>
<view class="bar bar2"></view>
<view class="bar bar3"></view>
</view>
</view>
<text class="tab-text">记录</text>
</view>
<view
class="tab-item {{selected === 2 ? 'active' : ''}}"
data-index="2"
bindtap="switchTab"
>
<view class="tab-icon">
<view class="icon-settings {{selected === 2 ? 'active' : ''}}">
<view class="gear-outer"></view>
<view class="gear-center"></view>
</view>
</view>
<text class="tab-text">设置</text>
</view>
</view>
+146
View File
@@ -0,0 +1,146 @@
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 110rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-around;
border-top: 1rpx solid rgba(0, 0, 0, 0.06);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
}
.tab-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 6rpx 0;
flex: 1;
}
.tab-item:active {
transform: scale(0.9);
}
.tab-text {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
line-height: 1;
}
.tab-item.active .tab-text {
color: var(--primary);
font-weight: 600;
}
/* ---- icon: home ---- */
.icon-home {
position: relative;
width: 44rpx;
height: 40rpx;
}
.tab-item.active .icon-home {
animation: bounceSoft 0.5s ease;
}
.home-roof {
width: 0;
height: 0;
border-left: 22rpx solid transparent;
border-right: 22rpx solid transparent;
border-bottom: 18rpx solid #888;
position: absolute;
top: 0;
left: 0;
}
.tab-item.active .home-roof {
border-bottom-color: var(--primary);
}
.home-body {
width: 22rpx;
height: 20rpx;
background: #888;
position: absolute;
bottom: 0;
left: 11rpx;
border-radius: 2rpx 2rpx 0 0;
}
.tab-item.active .home-body {
background: var(--primary);
}
/* ---- icon: records (3 bars) ---- */
.icon-records {
width: 40rpx;
height: 34rpx;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 6rpx;
}
.tab-item.active .icon-records {
animation: bounceSoft 0.5s ease;
}
.bar {
height: 6rpx;
background: #888;
border-radius: 3rpx;
}
.bar1 { width: 100%; }
.bar2 { width: 65%; }
.bar3 { width: 80%; }
.tab-item.active .bar {
background: var(--primary);
}
/* ---- icon: settings (gear) ---- */
.icon-settings {
position: relative;
width: 42rpx;
height: 42rpx;
}
.tab-item.active .icon-settings {
animation: bounceSoft 0.5s ease;
}
.gear-outer {
width: 36rpx;
height: 36rpx;
border: 5rpx solid #888;
border-radius: 50%;
position: absolute;
top: 3rpx;
left: 3rpx;
}
.tab-item.active .gear-outer {
border-color: var(--primary);
}
.gear-center {
width: 12rpx;
height: 12rpx;
background: #888;
border-radius: 50%;
position: absolute;
top: 15rpx;
left: 15rpx;
}
.tab-item.active .gear-center {
background: var(--primary);
}