Commit d93a98b3 by liimin

chore(env): 更新生产环境配置和依赖锁定文件

- 将生产环境API地址从mock服务更改为本地开发服务器
- 生成package-lock.json文件以锁定项目依赖版本
- 添加完整的npm包依赖树和版本控制信息
1 parent d5fa64f6
...@@ -22,4 +22,4 @@ VITE_DROP_CONSOLE = true ...@@ -22,4 +22,4 @@ VITE_DROP_CONSOLE = true
VITE_PWA = true VITE_PWA = true
# 线上环境接口地址 # 线上环境接口地址
VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e" VITE_API_URL = "http://192.168.1.1:3000"
This diff could not be displayed because it is too large.
...@@ -33,26 +33,24 @@ import pinia from "@/stores"; ...@@ -33,26 +33,24 @@ import pinia from "@/stores";
// errorHandler // errorHandler
import errorHandler from "@/utils/errorHandler"; import errorHandler from "@/utils/errorHandler";
import { useGlobalStore } from "@/stores/modules/global"; import { useGlobalStore } from "@/stores/modules/global";
import { fetchData } from "@/utils/mock"; // import { fetchData } from "@/utils/mock";
const baseURL = import.meta.env.VITE_API_URL;
const app = createApp(App); const app = createApp(App);
app.config.errorHandler = errorHandler; app.config.errorHandler = errorHandler;
// register the element Icons component // register the element Icons component
Object.keys(Icons).forEach(key => { Object.keys(Icons).forEach(key => {
app.component(key, Icons[key as keyof typeof Icons]); app.component(key, Icons[key as keyof typeof Icons]);
}); });
app.use(ElementPlus).use(directives).use(router).use(I18n).use(pinia); app.use(ElementPlus).use(directives).use(router).use(I18n).use(pinia);
// 在挂载应用之前执行fetch操作 const initialData = {
fetchData() request: {
.then(initialData => { baseURL: baseURL,
const dataStore = useGlobalStore(); timeout: 180000,
console.log(initialData, "initialData"); withCredentials: true,
dataStore.setInitialData(initialData); responseType: "json"
app.mount("#app"); }
}) };
.catch(error => { const dataStore = useGlobalStore();
// 处理fetch错误 dataStore.setInitialData(initialData);
console.error("Failed to fetch initial data:", error); app.mount("#app");
});
...@@ -61,6 +61,10 @@ interface ImportMetaEnv extends ViteEnv { ...@@ -61,6 +61,10 @@ interface ImportMetaEnv extends ViteEnv {
__: unknown; __: unknown;
} }
interface ImportMeta {
readonly env: ImportMetaEnv;
}
/* __APP_INFO__ */ /* __APP_INFO__ */
declare const __APP_INFO__: { declare const __APP_INFO__: {
pkg: { pkg: {
......
/// <reference types="vite/client" /> /// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
declare module '*.scss' {
const content: Record<string, string>
export default content
}
declare module '*.css' {
const content: Record<string, string>
export default content
}
declare module 'element-plus' {
const ElementPlus: any
export default ElementPlus
}
declare module '@element-plus/icons-vue' {
export const Icons: any
export default Icons
}
declare module 'virtual:svg-icons-register' {
const content: any
export default content
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!