Implement data migration tool and enhance KV storage support. Add automatic redirection for legacy data providers, improve user interface for migration settings, and update data handling for Classworks cloud storage. Refactor components for better integration with new storage options.

This commit is contained in:
SunWuyuan
2025-05-10 20:51:56 +08:00
parent c0e33dcbf9
commit a542e9b91f
11 changed files with 355 additions and 204 deletions
+35 -1
View File
@@ -10,17 +10,51 @@
</template>
<script setup>
import { onMounted } from 'vue';
import { onMounted, watch } from 'vue';
import { useTheme } from 'vuetify';
import { getSetting } from '@/utils/settings';
import { useRouter, useRoute } from 'vue-router';
const theme = useTheme();
const router = useRouter();
const route = useRoute();
onMounted(() => {
// 应用保存的主题设置
const savedTheme = getSetting('theme.mode');
theme.global.name.value = savedTheme;
// 检查存储提供者类型
checkProviderType();
});
// 检查存储提供者类型,如果是已废弃的类型则重定向
function checkProviderType() {
const currentProvider = getSetting('server.provider');
// 如果是旧的提供者类型且当前不在迁移页面,则重定向到数据迁移页面
if ((currentProvider === 'server' || currentProvider === 'indexedDB') &&
route.path !== '/datamigration') {
console.log('检测到旧的数据提供者类型,正在重定向到数据迁移页面...');
router.push({
path: '/datamigration',
query: {
reason: 'legacy_provider',
provider: currentProvider
}
});
}
}
// 当路由变化时再次检查,确保用户不会绕过重定向
watch(
() => route.path,
(newPath) => {
if (newPath !== '/datamigration') {
checkProviderType();
}
}
);
</script>
<style>