updata:智控台页面添加语言切换,支持中英繁。

This commit is contained in:
rainv123
2025-09-11 17:10:50 +08:00
parent a9b0775469
commit 98a1483032
41 changed files with 3800 additions and 1061 deletions
+31 -31
View File
@@ -1,54 +1,54 @@
<template>
<el-dialog
title="CDN资源缓存状态"
:title="$t('cache.dialogTitle')"
:visible.sync="visible"
width="70%"
:before-close="handleClose"
>
<div v-if="isLoading" class="loading-container">
<p>正在加载缓存信息...</p>
<p>{{ $t('cache.loading') }}</p>
</div>
<div v-else>
<div v-if="!cacheAvailable" class="no-cache-message">
<i class="el-icon-warning-outline"></i>
<p>您的浏览器不支持Cache API或Service Worker未安装</p>
<el-button type="primary" @click="refreshPage">刷新页面</el-button>
<p>{{ $t('cache.notSupported') }}</p>
<el-button type="primary" @click="refreshPage">{{ $t('cache.refreshPage') }}</el-button>
</div>
<div v-else>
<el-alert
v-if="cacheData.totalCached === 0"
title="未发现缓存的CDN资源"
type="warning"
:closable="false"
show-icon
>
<p>Service Worker可能尚未完成初始化或缓存尚未建立请刷新页面或等待一会后再试</p>
</el-alert>
v-if="cacheData.totalCached === 0"
:title="$t('cache.noCachedResources')"
type="warning"
:closable="false"
show-icon
>
<p>{{ $t('cache.noCachedResourcesDesc') }}</p>
</el-alert>
<div v-else>
<el-alert
title="CDN资源缓存状态"
:title="$t('cache.cdnCacheStatus')"
type="success"
:closable="false"
show-icon
>
共发现 {{ cacheData.totalCached }} 个缓存资源
{{ $t('cache.totalCachedResources').replace('{count}', cacheData.totalCached) }}
</el-alert>
<h3>JavaScript 资源 ({{ cacheData.js.length }})</h3>
<h3>{{ $t('cache.jsResources').replace('{count}', cacheData.js.length) }}</h3>
<el-table :data="cacheData.js" stripe style="width: 100%">
<el-table-column prop="url" label="URL" width="auto" show-overflow-tooltip />
<el-table-column prop="cached" label="状态" width="100">
<el-table-column prop="cached" :label="$t('cache.status')" width="100">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.cached">已缓存</el-tag>
<el-tag type="danger" v-else>未缓存</el-tag>
<el-tag type="success" v-if="scope.row.cached">{{ $t('cache.cached') }}</el-tag>
<el-tag type="danger" v-else>{{ $t('cache.notCached') }}</el-tag>
</template>
</el-table-column>
</el-table>
<h3>CSS 资源 ({{ cacheData.css.length }})</h3>
<h3>{{ $t('cache.cssResources').replace('{count}', cacheData.css.length) }}</h3>
<el-table :data="cacheData.css" stripe style="width: 100%">
<el-table-column prop="url" label="URL" width="auto" show-overflow-tooltip />
<el-table-column prop="cached" label="状态" width="100">
@@ -63,9 +63,9 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">关闭</el-button>
<el-button type="primary" @click="refreshCache">刷新缓存状态</el-button>
<el-button type="danger" @click="clearCache">清除缓存</el-button>
<el-button @click="handleClose">{{ $t('button.close') }}</el-button>
<el-button type="primary" @click="refreshCache">{{ $t('cache.refreshStatus') }}</el-button>
<el-button type="danger" @click="clearCache">{{ $t('cache.clearCache') }}</el-button>
</span>
</el-dialog>
</template>
@@ -138,29 +138,29 @@ export default {
async refreshCache() {
this.loadCacheData();
this.$message.success('正在刷新缓存状态');
this.$message.success(this.$t('cache.refreshingStatus'));
},
async clearCache() {
this.$confirm('确定要清除所有缓存吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('cache.confirmClear'), this.$t('message.warning'), {
confirmButtonText: this.$t('button.ok'),
cancelButtonText: this.$t('button.cancel'),
type: 'warning'
}).then(async () => {
try {
const success = await clearAllCaches();
if (success) {
this.$message.success('缓存已清除');
this.$message.success(this.$t('cache.clearedSuccess'));
await this.loadCacheData();
} else {
this.$message.error('清除缓存失败');
this.$message.error(this.$t('cache.clearFailed'));
}
} catch (error) {
console.error('清除缓存失败:', error);
this.$message.error('清除缓存失败');
this.$message.error(this.$t('cache.clearFailed'));
}
}).catch(() => {
this.$message.info('已取消清除');
this.$message.info(this.$t('cache.clearCanceled'));
});
},
@@ -204,4 +204,4 @@ h3 {
margin-bottom: 10px;
font-weight: 500;
}
</style>
</style>