| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <view class="gate-guide-bar" v-if="showGuide" @click="goGates" :style="{ '--font-scale': fontScale }">
- <text class="guide-icon">🔓</text>
- <text class="guide-text">解锁进度 {{ unlockedCount }}/{{ totalCount }} · {{ guideText }}</text>
- <text class="guide-arrow">→</text>
- </view>
- </template>
- <script>
- /**
- * 首页引导进度条
- * 数据源:从父组件传入 unlockStatus(/api/unlock/status 返回)
- * 主线全解锁后自动隐藏
- */
- import fontScaleMixin from '@/mixins/font-scale.js'
- export default {
- mixins: [fontScaleMixin],
- props: {
- unlockStatus: {
- type: Object,
- default: function() { return null }
- }
- },
- computed: {
- gates: function() {
- var s = this.unlockStatus
- if (!s || !s.gates) return []
- return s.gates
- },
- mainGates: function() {
- return this.gates.filter(function(g) { return g.isRequired === 1 })
- },
- totalCount: function() {
- return this.mainGates.length
- },
- unlockedCount: function() {
- return this.mainGates.filter(function(g) { return g.status === 'UNLOCKED' }).length
- },
- showGuide: function() {
- if (!this.unlockStatus) return false
- if (this.totalCount === 0) return false
- // 全部解锁后隐藏
- return this.unlockedCount < this.totalCount
- },
- currentGate: function() {
- var gates = this.mainGates
- for (var i = 0; i < gates.length; i++) {
- var g = gates[i]
- if (g.status === 'CURRENT' || g.status === 'LOCKED') return g
- }
- return null
- },
- guideText: function() {
- if (this.currentGate) {
- return '完成「' + (this.currentGate.name || '') + '」→'
- }
- return '查看全部关卡 →'
- }
- },
- methods: {
- goGates: function() {
- uni.navigateTo({ url: '/pages/profile-extra/gates' })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .gate-guide-bar {
- display: flex;
- align-items: center;
- padding: 16rpx 24rpx;
- margin: 16rpx $uni-space-lg;
- background: linear-gradient(135deg, $facade-ink-navy, $accent-navy);
- border-radius: 16rpx;
- cursor: pointer;
- }
- .guide-icon {
- font-size: calc(28rpx * var(--font-scale, 1));
- margin-right: 12rpx;
- }
- .guide-text {
- flex: 1;
- font-size: calc(24rpx * var(--font-scale, 1));
- color: #8FC5E8;
- }
- .guide-arrow {
- font-size: calc(28rpx * var(--font-scale, 1));
- color: rgba(143,197,232,0.5);
- margin-left: 8rpx;
- }
- </style>
|