|
|
- <template>
- <!-- 悬浮按钮 - 只在最后一页显示 -->
- <div v-if="isLastPage" class="floating-buttons">
- <button
- v-if="hasNextCourse"
- class="floating-button next-lesson"
- @click="handleNextCourse"
- >
- <span class="floating-button-text">下一课</span>
- </button>
- <button
- class="floating-button back-to-start"
- @click="handleBackToStart"
- >
- <span class="floating-button-text">回到开始</span>
- </button>
- </div>
- </template>
-
- <script>
- export default {
- name: 'FloatingButtons',
- props: {
- // 是否为最后一页
- isLastPage: {
- type: Boolean,
- default: false
- },
- // 是否有下一课
- hasNextCourse: {
- type: Boolean,
- default: false
- }
- },
- methods: {
- // 跳转到下一课
- handleNextCourse() {
- this.$emit('next-course');
- },
- // 回到开始
- handleBackToStart() {
- this.$emit('back-to-start');
- }
- }
- }
- </script>
-
- <style scoped>
- /* 悬浮按钮样式 */
- .floating-buttons {
- position: fixed;
- top: 50%;
- right: 30rpx;
- transform: translateY(-50%);
- z-index: 1000;
- display: flex;
- flex-direction: column;
- gap: 16rpx;
- }
-
- .floating-button {
- width: 180rpx;
- height: 88rpx;
- background: linear-gradient(135deg, #06DADC 0%, #04B8BA 100%);
- border-radius: 44rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 6rpx 24rpx rgba(6, 218, 220, 0.25);
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- border: none;
- outline: none;
- position: relative;
- overflow: hidden;
- }
-
- .floating-button::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
- border-radius: 44rpx;
- opacity: 0;
- transition: opacity 0.3s ease;
- }
-
- .floating-button:hover::before {
- opacity: 1;
- }
-
- .floating-button:active {
- transform: scale(0.96);
- box-shadow: 0 3rpx 12rpx rgba(6, 218, 220, 0.35);
- }
-
- .floating-button-text {
- font-family: PingFang SC, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
- font-weight: 600;
- font-size: 26rpx;
- color: #FFFFFF;
- text-align: center;
- line-height: 1;
- letter-spacing: 0.5rpx;
- position: relative;
- z-index: 1;
- }
-
- .floating-button.next-lesson {
- background: linear-gradient(135deg, #06DADC 0%, #04B8BA 100%);
- box-shadow: 0 6rpx 24rpx rgba(6, 218, 220, 0.25);
- }
-
- .floating-button.next-lesson:active {
- box-shadow: 0 3rpx 12rpx rgba(6, 218, 220, 0.35);
- }
-
- .floating-button.back-to-start {
- background: linear-gradient(135deg, #FF7B7B 0%, #FF6B6B 100%);
- box-shadow: 0 6rpx 24rpx rgba(255, 107, 107, 0.25);
- }
-
- .floating-button.back-to-start:active {
- box-shadow: 0 3rpx 12rpx rgba(255, 107, 107, 0.35);
- }
-
- /* 响应式调整 */
- @media (max-width: 750px) {
- .floating-buttons {
- top: 50%;
- right: 24rpx;
- transform: translateY(-50%);
- }
-
- .floating-button {
- width: 160rpx;
- height: 80rpx;
- border-radius: 40rpx;
- }
-
- .floating-button-text {
- font-size: 24rpx;
- }
- }
- </style>
|