mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
在 App.vue 中添加登录状态变化的监听,确保登录后重新加载背景图片;同时更新 .vscode/settings.json,增加 i18n-ally.localesPaths 配置。
This commit is contained in:
Vendored
+5
-2
@@ -106,5 +106,8 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"vue3snippets.enable-compile-vue-file-on-did-save-code": false
|
"vue3snippets.enable-compile-vue-file-on-did-save-code": false,
|
||||||
}
|
"i18n-ally.localesPaths": [
|
||||||
|
"src/locales"
|
||||||
|
]
|
||||||
|
}
|
||||||
+15
-7
@@ -27,6 +27,14 @@ const show = ref(false)
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const isLogin = computed(() => authStore.token)
|
const isLogin = computed(() => authStore.token)
|
||||||
|
|
||||||
|
// 监听登录状态变化
|
||||||
|
watch(isLogin, newValue => {
|
||||||
|
if (newValue) {
|
||||||
|
// 登录后重新加载背景图片
|
||||||
|
fetchBackgroundImages().then(() => startBackgroundRotation())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 背景图片
|
// 背景图片
|
||||||
const backgroundImages = ref<string[]>([])
|
const backgroundImages = ref<string[]>([])
|
||||||
const activeImageIndex = ref(0)
|
const activeImageIndex = ref(0)
|
||||||
@@ -134,14 +142,14 @@ function getImgUrl(url: string) {
|
|||||||
// 处理页面可见性变化
|
// 处理页面可见性变化
|
||||||
function handleVisibilityChange() {
|
function handleVisibilityChange() {
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
// 如果已有背景图片数据,直接重启轮换
|
// 强制重新获取背景图片
|
||||||
if (backgroundImages.value.length > 0) {
|
fetchBackgroundImages().then(() => {
|
||||||
|
// 确保在获取到新图片后重新开始轮换
|
||||||
|
if (backgroundRotationTimer) {
|
||||||
|
clearInterval(backgroundRotationTimer)
|
||||||
|
}
|
||||||
startBackgroundRotation()
|
startBackgroundRotation()
|
||||||
}
|
})
|
||||||
// 如果没有背景图片数据,重新获取
|
|
||||||
else {
|
|
||||||
fetchBackgroundImages().then(() => startBackgroundRotation())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user