| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="onboarding-overlay" v-if="show">
- <view class="onboarding-card">
- <!-- 顶部品牌条 -->
- <view class="onboarding-topbar"></view>
- <!-- 步骤内容 -->
- <view class="onboarding-content" :key="currentStep">
- <text class="onboarding-icon">{{ steps[currentStep].icon }}</text>
- <text class="onboarding-title">{{ steps[currentStep].title }}</text>
- <text class="onboarding-desc">{{ steps[currentStep].desc }}</text>
- </view>
- <!-- 步进器 -->
- <view class="onboarding-dots">
- <view
- v-for="(s, i) in steps"
- :key="i"
- class="dot"
- :class="{ active: i === currentStep }">
- </view>
- </view>
- <!-- 按钮 -->
- <view class="onboarding-action">
- <view
- class="onboarding-btn"
- :class="{ 'onboarding-btn--last': currentStep === steps.length - 1 }"
- @click="handleNext">
- <text>{{ currentStep < steps.length - 1 ? '下一步' : '开始体验!' }}</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var PARENT_STEPS = [
- {
- icon: '🌏',
- title: '五维能量沙盘',
- desc: '这是你家的五维全景图,身·心·智·行·富,每个维度一目了然,帮你全面掌握家庭成长状态'
- },
- {
- icon: '📋',
- title: '任务激励系统',
- desc: '给孩子布置小任务,完成后获得星星积分,养成好习惯就这么简单'
- },
- {
- icon: '🎁',
- title: '心愿兑换',
- desc: '孩子用积分兑换心愿,努力就有回报,培养目标感和延迟满足能力'
- }
- ]
- var CHILD_STEPS = [
- {
- icon: '🌟',
- title: '赚星星',
- desc: '完成爸爸妈妈布置的任务,就能获得星星积分,越努力越多!'
- },
- {
- icon: '🎮',
- title: '玩中学',
- desc: '完成任务后可以玩小游戏、兑换心愿,学习和快乐两不误!'
- },
- {
- icon: '🏆',
- title: '升级挑战',
- desc: '从星星宝宝到宇宙小英雄,一步步升级,看看你能走多远!'
- }
- ]
- export default {
- name: 'OnboardingGuide',
- props: {
- role: { type: String, default: 'parent' },
- show: { type: Boolean, default: false }
- },
- data() {
- return {
- currentStep: 0
- }
- },
- computed: {
- steps() {
- if (this.role === 'child') return CHILD_STEPS
- return PARENT_STEPS
- }
- },
- watch: {
- show(val) {
- if (val) {
- this.currentStep = 0
- }
- }
- },
- methods: {
- handleNext() {
- if (this.currentStep < this.steps.length - 1) {
- this.currentStep++
- } else {
- uni.setStorageSync('_onboardingDone', true)
- this.$emit('close')
- }
- }
- }
- }
- </script>
- <style scoped>
- /* ============================================================
- OnboardingGuide — 首次登录引导浮层
- 设计体系:统一使用 uni.scss design tokens
- ============================================================ */
- .onboarding-overlay {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 9998;
- animation: fadeIn 0.25s ease;
- }
- .onboarding-card {
- width: 640rpx;
- min-height: 680rpx;
- background: var(--surface, #FFFFFF);
- border-radius: var(--radius-xl, 32rpx);
- display: flex;
- flex-direction: column;
- align-items: center;
- overflow: hidden;
- box-shadow: var(--shadow-lg, 0 8rpx 32rpx rgba(91, 155, 213, 0.10));
- animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
- }
- /* 顶部品牌装饰条 — 暖珊瑚色 */
- .onboarding-topbar {
- width: 100%;
- height: 12rpx;
- background: var(--color-primary, #F97316);
- flex-shrink: 0;
- }
- /* ============================================================
- 内容区 — flex 居中,带淡入动画
- ============================================================ */
- .onboarding-content {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 80rpx 56rpx 48rpx;
- animation: fadeIn 0.3s ease;
- }
- .onboarding-icon {
- font-size: 80rpx;
- margin-bottom: 32rpx;
- display: block;
- }
- .onboarding-title {
- font-size: 36rpx;
- font-weight: 700;
- color: var(--text, #1E293B);
- text-align: center;
- margin-bottom: 20rpx;
- display: block;
- line-height: 1.3;
- }
- .onboarding-desc {
- font-size: 28rpx;
- color: var(--text-secondary, #64748B);
- text-align: center;
- line-height: 1.6;
- display: block;
- padding: 0 16rpx;
- }
- /* ============================================================
- 步进器圆点
- ============================================================ */
- .onboarding-dots {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 16rpx;
- padding: 0 56rpx 40rpx;
- flex-shrink: 0;
- }
- .dot {
- width: 14rpx;
- height: 14rpx;
- border-radius: 50%;
- background: var(--border, #CBD5E1);
- transition: background 0.3s ease, transform 0.3s ease;
- }
- .dot.active {
- background: var(--color-primary, #F97316);
- transform: scale(1.3);
- }
- /* ============================================================
- 底部按钮
- ============================================================ */
- .onboarding-action {
- width: 100%;
- padding: 0 56rpx 48rpx;
- flex-shrink: 0;
- box-sizing: border-box;
- }
- .onboarding-btn {
- width: 100%;
- height: 88rpx;
- border-radius: 999rpx;
- background: var(--color-primary, #5B9BD5);
- color: #FFFFFF;
- font-size: 32rpx;
- font-weight: 700;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: opacity 0.2s ease, transform 0.15s ease;
- box-shadow: 0 4rpx 16rpx rgba(91, 155, 213, 0.25);
- }
- .onboarding-btn:active {
- opacity: 0.85;
- transform: scale(0.97);
- }
- /* 最后一步:暖珊瑚色按钮 */
- .onboarding-btn--last {
- background: var(--color-primary, #F97316);
- box-shadow: 0 4rpx 16rpx rgba(249, 115, 22, 0.30);
- }
- </style>
|