diff --git a/Touchkebao/src/main.tsx b/Touchkebao/src/main.tsx index c1fe6c20..24238f27 100644 --- a/Touchkebao/src/main.tsx +++ b/Touchkebao/src/main.tsx @@ -7,25 +7,16 @@ import dayjs from "dayjs"; import "dayjs/locale/zh-cn"; import App from "./App"; import "./styles/global.scss"; -import { db } from "@/utils/db"; // 引入数据库实例 +import { db } from "./utils/db"; // 引入数据库实例 // 设置dayjs为中文 dayjs.locale("zh-cn"); // 数据库初始化 async function initializeApp() { - try { - // 确保数据库已打开 - await db.open(); - - await db.kfUsers.clear(); - await db.weChatGroup.clear(); - await db.contracts.clear(); - await db.newContractList.clear(); - } catch (error) { - console.error("数据库初始化失败:", error); - // 可以选择显示错误提示或使用降级方案 - } + // 确保数据库已打开 + await db.open(); + console.log("数据库初始化成功"); // 渲染应用 const root = createRoot(document.getElementById("root")!); diff --git a/Touchkebao/tsconfig.json b/Touchkebao/tsconfig.json index f6e4f581..5d6d8515 100644 --- a/Touchkebao/tsconfig.json +++ b/Touchkebao/tsconfig.json @@ -20,7 +20,8 @@ "@/*": ["src/*"], "@weChatStore/*": ["src/store/module/weChat/*"], "@storeModule/*": ["src/store/module/*"], - "@apiModule/*": ["src/api/module/*"] + "@apiModule/*": ["src/api/module/*"], + "@utils/*": ["src/utils/*"] } }, "include": ["src"] diff --git a/Touchkebao/vite.config.ts b/Touchkebao/vite.config.ts index 1730de58..1431a796 100644 --- a/Touchkebao/vite.config.ts +++ b/Touchkebao/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig({ "@storeModule": path.resolve("src/store/module/"), "@weChatStore": path.resolve("src/store/module/weChat"), "@apiModule": path.resolve("src/api/module/"), + "@utils": path.resolve("src/utils/"), }, }, server: {