From a8a743572114059f612f1aa9f7755d6c956f4f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=AB=E5=9C=B0=E5=83=A7?= <357099073@qq.com> Date: Sat, 7 Feb 2026 00:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dapp=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=92=8C=E6=8E=A5=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 12 +- env.d.ts | 10 + main.js | 21 +- pages/login/index.vue | 511 +++++++-------- src/api/index.js | 607 ------------------ src/api/login.js | 17 + src/api/request.js | 108 ++++ src/api/user.js | 60 ++ src/config/index.js | 31 +- src/store/authStore.js | 57 +- tsconfig.json | 28 + .../dist/cache/.vite/deps/_metadata.json | 8 +- .../.vite/deps/pinia-plugin-persistedstate.js | 2 +- .../.vite/deps_temp_766ef8a9/package.json | 3 + .../pinia-plugin-persistedstate.js | 143 +++++ .../pinia-plugin-persistedstate.js.map | 7 + vite.config.js | 14 + 17 files changed, 694 insertions(+), 945 deletions(-) create mode 100644 env.d.ts delete mode 100644 src/api/index.js create mode 100644 src/api/login.js create mode 100644 src/api/request.js create mode 100644 src/api/user.js create mode 100644 tsconfig.json create mode 100644 unpackage/dist/cache/.vite/deps_temp_766ef8a9/package.json create mode 100644 unpackage/dist/cache/.vite/deps_temp_766ef8a9/pinia-plugin-persistedstate.js create mode 100644 unpackage/dist/cache/.vite/deps_temp_766ef8a9/pinia-plugin-persistedstate.js.map create mode 100644 vite.config.js diff --git a/.env b/.env index fb74ae2..f88c72b 100644 --- a/.env +++ b/.env @@ -1,16 +1,16 @@ # =========================================== # API配置 - 根据你的后端接口修改 # =========================================== -# 开发环境 -VUE_APP_API_BASE_URL=https://localhost:8000 -VUE_APP_API_TIMEOUT=10000 +# 开发环境(Vite 只能识别 VITE_ 前缀) +VITE_APP_API_BASE_URL=http://localhost:8000 +VITE_APP_API_TIMEOUT=10000 # =========================================== # 应用配置 # =========================================== -VUE_APP_APP_NAME=babyhealth -VUE_APP_APP_VERSION=1.0.0 -VUE_APP_DEBUG=true +VITE_APP_APP_NAME=babyhealth +VITE_APP_APP_VERSION=1.0.0 +VITE_APP_DEBUG=true # =========================================== # 其他配置 (可选) diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..b4c46e7 --- /dev/null +++ b/env.d.ts @@ -0,0 +1,10 @@ +/// + +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} + +// uni-app 的全局对象(让 TS 不再提示 uni 未定义) +declare const uni: any diff --git a/main.js b/main.js index def4853..19fff3f 100644 --- a/main.js +++ b/main.js @@ -1,29 +1,12 @@ import { createSSRApp } from 'vue' -// 引入 createPinia 方法(命名导出) import { createPinia } from 'pinia' import App from './App.vue' import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' -// 引入 lime-echart 组件 -import LEchart from './uni_modules/lime-echart/components/l-echart/l-echart.vue' -// FontAwesome CSS 将通过 App.vue 中的全局样式引入 export function createApp() { const app = createSSRApp(App) - // 创建 Pinia 实例 const pinia = createPinia() - // 注册 Pinia 持久化 - pinia.use(piniaPluginPersistedstate) - // 注册 Pinia + pinia.use(piniaPluginPersistedstate) app.use(pinia) - - // 暂时注释掉 uView,因为与 Vue 3 有兼容性问题 - // 后续可以使用 uView Plus 或其他 Vue 3 兼容的 UI 库 - // app.use(uView) - - // 全局注册 lime-echart 组件 - app.component('l-echart', LEchart) - - return { - app - } + return { app } } \ No newline at end of file diff --git a/pages/login/index.vue b/pages/login/index.vue index fd731c0..eaace94 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -11,7 +11,7 @@ - + @@ -27,73 +27,90 @@ 欢迎回来,开始您的工作之旅 - + 登录账户 请输入您的登录信息 - + - + - + @focus="handleAccountFocus" + @blur="handleAccountBlur" + @input="clearAccountError" + /> - {{ usernameError }} + {{ + accountError + }} - + - + - + @input="clearPasswordError" + /> - + - {{ passwordError }} + {{ + passwordError + }} - + - + 记住我 - 忘记密码? + 忘记密码? - + - + @@ -119,228 +138,161 @@ -