refactor(StarryBackground): 设置默认背景图片并移除重复代码
将背景图片URL设为StarryBackground组件的默认值 移除多个视图组件中重复的背景图片变量
Showing
5 changed files
with
5 additions
and
9 deletions
| ... | @@ -23,7 +23,7 @@ const props = defineProps({ | ... | @@ -23,7 +23,7 @@ const props = defineProps({ |
| 23 | // 背景图片 URL | 23 | // 背景图片 URL |
| 24 | bgImage: { | 24 | bgImage: { |
| 25 | type: String, | 25 | type: String, |
| 26 | - default: '' | 26 | + default: 'https://cdn.ipadbiz.cn/mlaj/recall/img/bg01@2x.png' |
| 27 | }, | 27 | }, |
| 28 | // 星星数量 | 28 | // 星星数量 |
| 29 | starCount: { | 29 | starCount: { | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="points-page h-screen bg-cover bg-center bg-no-repeat relative overflow-hidden flex flex-col"> | 2 | <div class="points-page h-screen bg-cover bg-center bg-no-repeat relative overflow-hidden flex flex-col"> |
| 3 | <!-- Starry Background Effect --> | 3 | <!-- Starry Background Effect --> |
| 4 | - <StarryBackground :bg-image="bgImg" /> | 4 | + <StarryBackground /> |
| 5 | 5 | ||
| 6 | <!-- 头部积分球区域 --> | 6 | <!-- 头部积分球区域 --> |
| 7 | <div class="header-bubbles relative h-48 w-full pt-6 flex-shrink-0"> | 7 | <div class="header-bubbles relative h-48 w-full pt-6 flex-shrink-0"> |
| ... | @@ -121,7 +121,6 @@ import { ref, onMounted } from 'vue' | ... | @@ -121,7 +121,6 @@ import { ref, onMounted } from 'vue' |
| 121 | 121 | ||
| 122 | import { getPointsListAPI } from '@/api/points' | 122 | import { getPointsListAPI } from '@/api/points' |
| 123 | 123 | ||
| 124 | -const bgImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/bg01@2x.png' | ||
| 125 | const ppImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/pp@2x.png' | 124 | const ppImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/pp@2x.png' |
| 126 | const jbImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/jb@2x.png' | 125 | const jbImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/jb@2x.png' |
| 127 | const pzImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/pz@2x.png' | 126 | const pzImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/pz@2x.png' | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="recall-boot w-full min-h-screen relative overflow-hidden flex flex-col items-center"> | 2 | <div class="recall-boot w-full min-h-screen relative overflow-hidden flex flex-col items-center"> |
| 3 | <!-- Starry Background Effect --> | 3 | <!-- Starry Background Effect --> |
| 4 | - <StarryBackground :bg-image="bgImg" /> | 4 | + <StarryBackground /> |
| 5 | 5 | ||
| 6 | <!-- Title Section --> | 6 | <!-- Title Section --> |
| 7 | <div class="mt-16 flex flex-col items-center z-10 w-full px-8"> | 7 | <div class="mt-16 flex flex-col items-center z-10 w-full px-8"> |
| ... | @@ -54,7 +54,6 @@ import { useRouter, useRoute } from 'vue-router' | ... | @@ -54,7 +54,6 @@ import { useRouter, useRoute } from 'vue-router' |
| 54 | import { useTitle } from '@vueuse/core' | 54 | import { useTitle } from '@vueuse/core' |
| 55 | 55 | ||
| 56 | const titleImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title02@2x.png' | 56 | const titleImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title02@2x.png' |
| 57 | -const bgImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/bg01@2x.png' | ||
| 58 | const starImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/xing@2x.png' | 57 | const starImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/xing@2x.png' |
| 59 | 58 | ||
| 60 | const router = useRouter() | 59 | const router = useRouter() | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="recall-login w-full min-h-screen relative overflow-hidden flex flex-col items-center"> | 2 | <div class="recall-login w-full min-h-screen relative overflow-hidden flex flex-col items-center"> |
| 3 | <!-- Starry Background Effect --> | 3 | <!-- Starry Background Effect --> |
| 4 | - <StarryBackground :bg-image="bgImg" /> | 4 | + <StarryBackground /> |
| 5 | 5 | ||
| 6 | <!-- Title Section --> | 6 | <!-- Title Section --> |
| 7 | <div class="mt-10 flex flex-col items-center z-10 w-full px-8"> | 7 | <div class="mt-10 flex flex-col items-center z-10 w-full px-8"> |
| ... | @@ -94,7 +94,6 @@ import { loginAPI, userInfoAPI } from '@/api/recall_users' | ... | @@ -94,7 +94,6 @@ import { loginAPI, userInfoAPI } from '@/api/recall_users' |
| 94 | import { useTracking } from '@/composables/useTracking' | 94 | import { useTracking } from '@/composables/useTracking' |
| 95 | // 导入图片 | 95 | // 导入图片 |
| 96 | const titleImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title01@2x.png' | 96 | const titleImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title01@2x.png' |
| 97 | -const bgImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/bg01@2x.png' | ||
| 98 | 97 | ||
| 99 | // 路由相关 | 98 | // 路由相关 |
| 100 | const $route = useRoute() | 99 | const $route = useRoute() | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="timeline-page w-full h-screen relative overflow-hidden"> | 2 | <div class="timeline-page w-full h-screen relative overflow-hidden"> |
| 3 | <!-- Shared Background --> | 3 | <!-- Shared Background --> |
| 4 | - <StarryBackground :bg-image="bgImg" class="absolute inset-0 z-0" /> | 4 | + <StarryBackground /> |
| 5 | 5 | ||
| 6 | <!-- Swiper --> | 6 | <!-- Swiper --> |
| 7 | <swiper :direction="'vertical'" :modules="[Mousewheel]" :mousewheel="true" :speed="800" | 7 | <swiper :direction="'vertical'" :modules="[Mousewheel]" :mousewheel="true" :speed="800" |
| ... | @@ -97,7 +97,6 @@ import 'swiper/css' | ... | @@ -97,7 +97,6 @@ import 'swiper/css' |
| 97 | import { userInfoAPI, searchOldActivityAPI } from '@/api/recall_users' | 97 | import { userInfoAPI, searchOldActivityAPI } from '@/api/recall_users' |
| 98 | 98 | ||
| 99 | 99 | ||
| 100 | -const bgImg = 'https://cdn.ipadbiz.cn/mlaj/recall/img/bg01@2x.png' | ||
| 101 | const title03 = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title03@2x.png' | 100 | const title03 = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title03@2x.png' |
| 102 | const title04 = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title04@2x.png' | 101 | const title04 = 'https://cdn.ipadbiz.cn/mlaj/recall/img/title04@2x.png' |
| 103 | const arrowDown = 'https://cdn.ipadbiz.cn/mlaj/recall/img/xia@2x.png' | 102 | const arrowDown = 'https://cdn.ipadbiz.cn/mlaj/recall/img/xia@2x.png' | ... | ... |
-
Please register or login to post a comment