mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
feat(timeout): 添加多语言页面加载超时提示
This commit is contained in:
+29
-3
@@ -301,6 +301,34 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
const timeoutEl = document.getElementById('loading-timeout');
|
const timeoutEl = document.getElementById('loading-timeout');
|
||||||
if (timeoutEl) {
|
if (timeoutEl) {
|
||||||
|
// 适配多语言
|
||||||
|
const lang = navigator.language || 'zh-CN';
|
||||||
|
const messages = {
|
||||||
|
'zh-CN': {
|
||||||
|
text: '页面加载似乎遇到了阻碍,请尝试',
|
||||||
|
btn: '清除缓存'
|
||||||
|
},
|
||||||
|
'zh-TW': {
|
||||||
|
text: '頁面載入似乎遇到了阻礙,請嘗試',
|
||||||
|
btn: '清除快取'
|
||||||
|
},
|
||||||
|
'en-US': {
|
||||||
|
text: 'Page loading seems to be blocked, please try',
|
||||||
|
btn: 'Clear Cache'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 默认匹配前缀,如 en-GB 匹配 en-US 的逻辑
|
||||||
|
let msg = messages['zh-CN'];
|
||||||
|
if (lang.startsWith('zh-TW') || lang.startsWith('zh-HK')) {
|
||||||
|
msg = messages['zh-TW'];
|
||||||
|
} else if (lang.startsWith('en')) {
|
||||||
|
msg = messages['en-US'];
|
||||||
|
} else if (lang.startsWith('zh')) {
|
||||||
|
msg = messages['zh-CN'];
|
||||||
|
}
|
||||||
|
|
||||||
|
timeoutEl.innerHTML = msg.text + ' <a href="javascript:void(0)" onclick="window.clearAndReload()" id="timeout-btn">' + msg.btn + '</a>';
|
||||||
timeoutEl.style.display = 'block';
|
timeoutEl.style.display = 'block';
|
||||||
}
|
}
|
||||||
}, 15000); // 15秒后显示超时提示
|
}, 15000); // 15秒后显示超时提示
|
||||||
@@ -319,9 +347,7 @@
|
|||||||
<div class="effect-3 effects"></div>
|
<div class="effect-3 effects"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 超时提示 - 默认隐藏 -->
|
<!-- 超时提示 - 默认隐藏 -->
|
||||||
<div id="loading-timeout">
|
<div id="loading-timeout"></div>
|
||||||
页面加载似乎遇到了阻碍,请尝试 <a href="javascript:void(0)" onclick="window.clearAndReload()" id="timeout-btn">清除缓存</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ function releaseTime(releaseDate: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 强制清除缓存
|
// 强制清除缓存
|
||||||
async function cleanCache() {
|
async function clearCache() {
|
||||||
await clearCachesAndServiceWorker()
|
await clearCachesAndServiceWorker()
|
||||||
// 刷新页面,添加时间戳参数以强制更新
|
// 刷新页面,添加时间戳参数以强制更新
|
||||||
reloadWithTimestamp()
|
reloadWithTimestamp()
|
||||||
@@ -191,12 +191,12 @@ onMounted(() => {
|
|||||||
size="x-small"
|
size="x-small"
|
||||||
variant="tonal"
|
variant="tonal"
|
||||||
class="ms-2"
|
class="ms-2"
|
||||||
@click="cleanCache"
|
@click="clearCache"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon icon="mdi-refresh" size="14" />
|
<VIcon icon="mdi-refresh" size="14" />
|
||||||
</template>
|
</template>
|
||||||
{{ t('setting.about.cleanCache') }}
|
{{ t('setting.about.clearCache') }}
|
||||||
</VBtn>
|
</VBtn>
|
||||||
</span>
|
</span>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -1250,7 +1250,7 @@ export default {
|
|||||||
dataDirectory: '/moviepilot',
|
dataDirectory: '/moviepilot',
|
||||||
expand: 'Expand',
|
expand: 'Expand',
|
||||||
collapse: 'Collapse',
|
collapse: 'Collapse',
|
||||||
cleanCache: 'Clear Cache',
|
clearCache: 'Clear Cache',
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
custom: 'Custom',
|
custom: 'Custom',
|
||||||
|
|||||||
@@ -1247,7 +1247,7 @@ export default {
|
|||||||
dataDirectory: '/moviepilot',
|
dataDirectory: '/moviepilot',
|
||||||
expand: '展开',
|
expand: '展开',
|
||||||
collapse: '收起',
|
collapse: '收起',
|
||||||
cleanCache: '清除缓存',
|
clearCache: '清除缓存',
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
custom: '自定义',
|
custom: '自定义',
|
||||||
|
|||||||
@@ -1235,7 +1235,7 @@ export default {
|
|||||||
dataDirectory: '/moviepilot',
|
dataDirectory: '/moviepilot',
|
||||||
expand: '展開',
|
expand: '展開',
|
||||||
collapse: '收起',
|
collapse: '收起',
|
||||||
cleanCache: '清除緩存',
|
clearCache: '清除快取',
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
custom: '自定義',
|
custom: '自定義',
|
||||||
|
|||||||
Reference in New Issue
Block a user