|
|
@@ -1,54 +1,78 @@
|
|
|
<template>
|
|
|
<view class="tab-bar-wrap" v-if="isLoggedIn">
|
|
|
- <!-- 普通用户TabBar -->
|
|
|
+ <!-- 普通用户TabBar:4 Tab + 中间五维启动器 -->
|
|
|
<view v-if="currentRole !== 'teacher'" class="tab-bar">
|
|
|
- <view
|
|
|
- v-for="(item, index) in normalTabs"
|
|
|
- :key="index"
|
|
|
+ <!-- 前2个Tab -->
|
|
|
+ <view v-for="(item, index) in mainTabs.slice(0, 2)" :key="index"
|
|
|
class="tab-item"
|
|
|
:class="{ active: currentIndex === index }"
|
|
|
- @click="switchTab(item, index)"
|
|
|
- >
|
|
|
- <image
|
|
|
- class="tab-icon"
|
|
|
- :src="currentIndex === index ? item.selectedIcon : item.icon"
|
|
|
- mode="aspectFit"
|
|
|
- ></image>
|
|
|
+ @click="switchTab(item, index)">
|
|
|
+ <image class="tab-icon" :src="currentIndex === index ? item.selectedIcon : item.icon" mode="aspectFit" />
|
|
|
+ <text class="tab-text">{{ item.text }}</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 中间五维启动器按钮 -->
|
|
|
+ <view class="tab-center-btn" @click="toggleDimOverlay">
|
|
|
+ <view class="center-btn-inner">
|
|
|
+ <text class="center-btn-icon">⭐</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 后2个Tab -->
|
|
|
+ <view v-for="(item, index) in mainTabs.slice(2, 4)" :key="index + 2"
|
|
|
+ class="tab-item"
|
|
|
+ :class="{ active: currentIndex === index + 2 }"
|
|
|
+ @click="switchTab(item, index + 2)">
|
|
|
+ <image class="tab-icon" :src="currentIndex === index + 2 ? item.selectedIcon : item.icon" mode="aspectFit" />
|
|
|
<text class="tab-text">{{ item.text }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <!-- 规划师TabBar -->
|
|
|
+ <!-- 规划师TabBar(保持不变) -->
|
|
|
<view v-else class="tab-bar">
|
|
|
- <view
|
|
|
- v-for="(item, index) in teacherTabs"
|
|
|
- :key="index"
|
|
|
+ <view v-for="(item, index) in teacherTabs" :key="index"
|
|
|
class="tab-item"
|
|
|
:class="{ active: currentIndex === index }"
|
|
|
- @click="switchTab(item, index)"
|
|
|
- >
|
|
|
- <image
|
|
|
- class="tab-icon"
|
|
|
- :src="currentIndex === index ? item.selectedIcon : item.icon"
|
|
|
- mode="aspectFit"
|
|
|
- ></image>
|
|
|
+ @click="switchTab(item, index)">
|
|
|
+ <image class="tab-icon" :src="currentIndex === index ? item.selectedIcon : item.icon" mode="aspectFit" />
|
|
|
<text class="tab-text">{{ item.text }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 五维半屏浮层 -->
|
|
|
+ <view class="dim-overlay-mask" v-if="showDimOverlay" @click="toggleDimOverlay">
|
|
|
+ <view class="dim-overlay" @click.stop>
|
|
|
+ <view class="dim-overlay-header">
|
|
|
+ <text class="dim-overlay-title">五维能量</text>
|
|
|
+ <text class="dim-overlay-close" @click="toggleDimOverlay">✕</text>
|
|
|
+ </view>
|
|
|
+ <view class="dim-grid">
|
|
|
+ <view class="dim-item" v-for="dim in dimensions" :key="dim.code" @click="goDimPage(dim)">
|
|
|
+ <view class="dim-icon-wrap" :style="{ background: dim.bgColor }">
|
|
|
+ <text class="dim-icon">{{ dim.icon }}</text>
|
|
|
+ </view>
|
|
|
+ <text class="dim-name">{{ dim.name }}</text>
|
|
|
+ <text class="dim-title">{{ dim.title }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+var nav = require('../utils/nav.js')
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
currentIndex: 0,
|
|
|
- normalTabs: [
|
|
|
- { text: '行', pagePath: '/pages/index-home/index', icon: '/static/tab-action.png', selectedIcon: '/static/tab-action-active.png' },
|
|
|
- { text: '心', pagePath: '/pages/mind/index', icon: '/static/tab-mind.png', selectedIcon: '/static/tab-mind-active.png' },
|
|
|
- { text: '身', pagePath: '/pages/body/index', icon: '/static/tab-body.png', selectedIcon: '/static/tab-body-active.png' },
|
|
|
- { text: '智', pagePath: '/pages/wisdom/index', icon: '/static/tab-wisdom.png', selectedIcon: '/static/tab-wisdom-active.png' },
|
|
|
- { text: '富', pagePath: '/pages/wealth/index', icon: '/static/tab-wealth.png', selectedIcon: '/static/tab-wealth-active.png' }
|
|
|
+ showDimOverlay: false,
|
|
|
+ mainTabs: [
|
|
|
+ { text: '首页', pagePath: '/pages/index-home/index', icon: '/static/tab-action.png', selectedIcon: '/static/tab-action-active.png' },
|
|
|
+ { text: '健康', pagePath: '/pages/health/index', icon: '/static/tab-body.png', selectedIcon: '/static/tab-body-active.png' },
|
|
|
+ { text: '成长', pagePath: '/pages/growth/index', icon: '/static/tab-growth.png', selectedIcon: '/static/tab-growth-active.png' },
|
|
|
+ { text: '我的', pagePath: '/pages/profile/profile', icon: '/static/tab-profile.png', selectedIcon: '/static/tab-profile-active.png' }
|
|
|
],
|
|
|
teacherTabs: [
|
|
|
{ text: '首页', pagePath: '/pages/teacher/index', icon: '/static/tab-action.png', selectedIcon: '/static/tab-action-active.png' },
|
|
|
@@ -56,6 +80,13 @@ export default {
|
|
|
{ text: '团队', pagePath: '/pages/teacher/team', icon: '/static/tab-team.png', selectedIcon: '/static/tab-team-active.png' },
|
|
|
{ text: '成长档案', pagePath: '/pages/growth/index', icon: '/static/tab-growth.png', selectedIcon: '/static/tab-growth-active.png' },
|
|
|
{ text: '我的', pagePath: '/pages/teacher/teacher-profile', icon: '/static/tab-profile.png', selectedIcon: '/static/tab-profile-active.png' }
|
|
|
+ ],
|
|
|
+ dimensions: [
|
|
|
+ { code: 'action', name: '行', title: '知行合一', icon: '🌿', color: '#10B981', bgColor: 'rgba(16,185,129,0.15)' },
|
|
|
+ { code: 'mind', name: '心', title: '大爱传承', icon: '🔥', color: '#FF6B9D', bgColor: 'rgba(255,107,157,0.15)' },
|
|
|
+ { code: 'body', name: '身', title: '主动健康', icon: '🌏', color: '#FF8C42', bgColor: 'rgba(255,140,66,0.15)' },
|
|
|
+ { code: 'wisdom', name: '智', title: '赋能未来', icon: '⚡', color: '#6366F1', bgColor: 'rgba(99,102,241,0.15)' },
|
|
|
+ { code: 'wealth', name: '富', title: '利他创富', icon: '💧', color: '#F59E0B', bgColor: 'rgba(245,158,11,0.15)' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
@@ -74,6 +105,13 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
+ toggleDimOverlay() {
|
|
|
+ this.showDimOverlay = !this.showDimOverlay
|
|
|
+ },
|
|
|
+ goDimPage(dim) {
|
|
|
+ this.showDimOverlay = false
|
|
|
+ nav.goDimension(dim.code)
|
|
|
+ },
|
|
|
updateSelected() {
|
|
|
const pages = getCurrentPages()
|
|
|
if (pages.length) {
|
|
|
@@ -84,16 +122,15 @@ export default {
|
|
|
const idx = this.teacherTabs.findIndex(t => t.pagePath === currentPath)
|
|
|
this.currentIndex = idx >= 0 ? idx : 0
|
|
|
} else {
|
|
|
- const idx = this.normalTabs.findIndex(t => t.pagePath === currentPath)
|
|
|
+ const idx = this.mainTabs.findIndex(t => t.pagePath === currentPath)
|
|
|
this.currentIndex = idx >= 0 ? idx : 0
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
switchTab(item, index) {
|
|
|
this.currentIndex = index
|
|
|
- // 原生TabBar页使用switchTab,非Tab页使用redirectTo(比reLaunch轻量)
|
|
|
- // 注意:switchTab 只能跳转 pages.json 中 tabBar.list 注册的页面,否则会触发路由系统错误
|
|
|
- const nativeTabPages = ['/pages/index-home/index', '/pages/mind/index', '/pages/body/index', '/pages/wisdom/index', '/pages/wealth/index']
|
|
|
+ // 只有 TabBar 注册页才能用 switchTab
|
|
|
+ const nativeTabPages = ['/pages/index-home/index', '/pages/health/index', '/pages/growth/index', '/pages/profile/profile']
|
|
|
if (nativeTabPages.includes(item.pagePath)) {
|
|
|
uni.switchTab({ url: item.pagePath })
|
|
|
} else {
|
|
|
@@ -119,6 +156,7 @@ export default {
|
|
|
background: #fff;
|
|
|
padding-bottom: env(safe-area-inset-bottom);
|
|
|
border-top: 1rpx solid #eee;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
.tab-item {
|
|
|
@@ -143,4 +181,121 @@ export default {
|
|
|
.tab-item.active .tab-text {
|
|
|
color: #F97316;
|
|
|
}
|
|
|
+
|
|
|
+/* 中间五维启动器按钮 */
|
|
|
+.tab-center-btn {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 100rpx;
|
|
|
+ position: relative;
|
|
|
+ top: -20rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.center-btn-inner {
|
|
|
+ width: 88rpx;
|
|
|
+ height: 88rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: linear-gradient(135deg, #F97316, #FB923C);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ box-shadow: 0 4rpx 16rpx rgba(249,115,22,0.4);
|
|
|
+}
|
|
|
+
|
|
|
+.center-btn-icon {
|
|
|
+ font-size: 40rpx;
|
|
|
+}
|
|
|
+
|
|
|
+/* 五维半屏浮层 */
|
|
|
+.dim-overlay-mask {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0,0,0,0.5);
|
|
|
+ z-index: 1000;
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-overlay {
|
|
|
+ width: 100%;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 32rpx 32rpx 0 0;
|
|
|
+ padding: 40rpx 30rpx 60rpx;
|
|
|
+ animation: slideUp 0.3s ease;
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes slideUp {
|
|
|
+ from { transform: translateY(100%); }
|
|
|
+ to { transform: translateY(0); }
|
|
|
+}
|
|
|
+
|
|
|
+.dim-overlay-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 32rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-overlay-title {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-overlay-close {
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: #999;
|
|
|
+ padding: 8rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-grid {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 20rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-item {
|
|
|
+ width: calc(33.33% - 14rpx);
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ padding: 24rpx 0;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ background: #f8f9fa;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-item:active {
|
|
|
+ opacity: 0.7;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-icon-wrap {
|
|
|
+ width: 80rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ margin-bottom: 12rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-icon {
|
|
|
+ font-size: 36rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-name {
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.dim-title {
|
|
|
+ font-size: 20rpx;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 4rpx;
|
|
|
+}
|
|
|
</style>
|