From 649da2a6fdabd1a1962bf0256dc2b036147699fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Wed, 4 Feb 2026 18:02:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9D=E8=B4=9D=E7=9B=91?= =?UTF-8?q?=E6=8A=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/api/babyhealth.js | 145 +++++ src/api/file.js | 36 ++ src/api/upload.js | 42 ++ src/env.d.ts | 28 + .../apps/babyhealth/babys/components/edit.vue | 376 ++++++++++++ src/views/apps/babyhealth/babys/index.vue | 400 +++++++++++++ src/views/apps/babyhealth/dashborad/index.vue | 196 +++++++ src/views/apps/babyhealth/index.vue | 8 + .../users/components/changePassword.vue | 198 +++++++ .../babyhealth/users/components/preview.vue | 190 ++++++ .../babyhealth/users/components/userEdit.vue | 539 ++++++++++++++++++ src/views/apps/babyhealth/users/index.vue | 328 +++++++++++ src/views/basicSettings/roles/index.vue | 2 +- src/views/system/fileManager/index.vue | 17 +- 15 files changed, 2502 insertions(+), 4 deletions(-) create mode 100644 src/api/babyhealth.js create mode 100644 src/api/upload.js create mode 100644 src/env.d.ts create mode 100644 src/views/apps/babyhealth/babys/components/edit.vue create mode 100644 src/views/apps/babyhealth/babys/index.vue create mode 100644 src/views/apps/babyhealth/dashborad/index.vue create mode 100644 src/views/apps/babyhealth/index.vue create mode 100644 src/views/apps/babyhealth/users/components/changePassword.vue create mode 100644 src/views/apps/babyhealth/users/components/preview.vue create mode 100644 src/views/apps/babyhealth/users/components/userEdit.vue create mode 100644 src/views/apps/babyhealth/users/index.vue diff --git a/components.d.ts b/components.d.ts index 7c51ee8..18c57d4 100644 --- a/components.d.ts +++ b/components.d.ts @@ -55,6 +55,7 @@ declare module 'vue' { ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSlider: typeof import('element-plus/es')['ElSlider'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] diff --git a/src/api/babyhealth.js b/src/api/babyhealth.js new file mode 100644 index 0000000..b15f6c9 --- /dev/null +++ b/src/api/babyhealth.js @@ -0,0 +1,145 @@ +import request from "@/utils/request"; + +/************************************************* + ****************** 宝贝相关接口 ****************** + *************************************************/ + +/** + * 获取宝贝列表 + * @returns {Promise} + */ +export function getBabyList() { + return request({ + url: "/admin/babys/list", + method: "get", + }); +} + +/** + * 获取宝贝详情 + * @param {number} id 宝贝ID + * @returns {Promise} + */ +export function getDetail(id) { + return request({ + url: `/admin/babys/${id}`, + method: "get", + }); +} + +/** + * 创建宝贝数据 + * @param {Object} data 宝贝数据 + * @returns {Promise} + */ +export function create(data) { + return request({ + url: "/admin/babys", + method: "post", + data: data, + headers: { + "Content-Type": "multipart/form-data" + } + }); +} + +/** + * 更新宝贝数据 + * @param {number} id 宝贝ID + * @param {Object} data 更新的数据 + * @returns {Promise} + */ +export function update(id, data) { + return request({ + url: `/admin/babys/${id}`, + method: "put", + data: data, + headers: { + "Content-Type": "multipart/form-data" + } + }); +} + +/** + * 删除宝贝数据 + * @param {number} id 宝贝ID + * @returns {Promise} + */ +export function del(id) { + return request({ + url: `/admin/babys/${id}`, + method: "delete", + }); +} + +/************************************************* + ****************** 用户相关接口 ****************** + *************************************************/ + +/** + * 获取用户列表 + * @returns {Promise} + */ +export function getUserList() { + return request({ + url: "/admin/babyhealthUser/list", + method: "get", + }); +} + +/** + * 获取用户详情 + * @param {number} id 用户ID + * @returns {Promise} + */ +export function getUserDetail(id) { + return request({ + url: `/admin/babyhealthUser/${id}`, + method: "get", + }); +} + +/** + * 创建用户数据 + * @param {Object} data 用户数据 + * @returns {Promise} + */ +export function createUser(data) { + return request({ + url: "/admin/babyhealthUser", + method: "post", + data: data, + headers: { + "Content-Type": "multipart/form-data" + } + }); +} + +/** + * 更新用户数据 + * @param {number} id 用户ID + * @param {Object} data 更新的数据 + * @returns {Promise} + */ +export function updateUser(id, data) { + return request({ + url: `/admin/babyhealthUser/${id}`, + method: "put", + data: data, + headers: { + "Content-Type": "multipart/form-data" + } + }); +} + +/** + * 删除用户数据 + * @param {number} id 用户ID + * @returns {Promise} + */ +export function deleteUser(id) { + return request({ + url: `/admin/babyhealthUser/${id}`, + method: "delete", + }); +} \ No newline at end of file diff --git a/src/api/file.js b/src/api/file.js index e5c4ffc..c08533e 100644 --- a/src/api/file.js +++ b/src/api/file.js @@ -156,4 +156,40 @@ export function moveFile(id, cate) { method: "get", params: { cate }, }); +} + +/** + * 上传头像 + * @param {FormData} formData 文件数据 + * @param {Object} options 额外选项 + * @param {string} [options.cate] + * @returns {Promise} + */ +export function uploadAvatar(formData, options = {}) { + if (options.cate) { + formData.append('cate', options.cate); + } + + return request({ + url: "/admin/uploadavatar", + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data" + } + }); +} + +/** + * 更新头像 + * @param {number|string} id 文件ID + * @param {Object} fileData 更新头像 + * @returns {Promise} + */ +export function updateAvatar(id, fileData) { + return request({ + url: `/admin/uploadavatar/${id}`, + method: "post", + data: fileData, + }); } \ No newline at end of file diff --git a/src/api/upload.js b/src/api/upload.js new file mode 100644 index 0000000..0f9cf52 --- /dev/null +++ b/src/api/upload.js @@ -0,0 +1,42 @@ +import request from '@/utils/request'; + +/** + * 上传头像 + * @param {FormData} data 表单数据 + * @param {Object} params 查询参数 + * @returns {Promise} Promise对象 + */ +export function uploadAvatar(data, params) { + return request({ + url: '/admin/uploadavatar', + method: 'post', + data, + params, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 上传文件 + * @param {FormData} data 表单数据 + * @param {Object} params 查询参数 + * @returns {Promise} Promise对象 + */ +export function uploadFile(data, params) { + return request({ + url: '/admin/upload', + method: 'post', + data, + params, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +export default { + uploadAvatar, + uploadFile +}; diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..08f9c63 --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,28 @@ +/// + +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + const component: DefineComponent<{}, {}, any>; + export default component; +} + +declare module '@/*' { + import type { ComponentOptions } from 'vue'; + const component: ComponentOptions; + export default component; +} + +interface ImportMetaEnv { + readonly VITE_API_BASE_URL: string; + // 添加其他环境变量... +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} + +declare module 'vue-cropper' { + import { DefineComponent } from 'vue'; + const VueCropper: DefineComponent<{}, {}, any>; + export default VueCropper; +} diff --git a/src/views/apps/babyhealth/babys/components/edit.vue b/src/views/apps/babyhealth/babys/components/edit.vue new file mode 100644 index 0000000..d451878 --- /dev/null +++ b/src/views/apps/babyhealth/babys/components/edit.vue @@ -0,0 +1,376 @@ + + + + + diff --git a/src/views/apps/babyhealth/babys/index.vue b/src/views/apps/babyhealth/babys/index.vue new file mode 100644 index 0000000..0d68146 --- /dev/null +++ b/src/views/apps/babyhealth/babys/index.vue @@ -0,0 +1,400 @@ + + + + + diff --git a/src/views/apps/babyhealth/dashborad/index.vue b/src/views/apps/babyhealth/dashborad/index.vue new file mode 100644 index 0000000..19b4fbc --- /dev/null +++ b/src/views/apps/babyhealth/dashborad/index.vue @@ -0,0 +1,196 @@ + + + + + \ No newline at end of file diff --git a/src/views/apps/babyhealth/index.vue b/src/views/apps/babyhealth/index.vue new file mode 100644 index 0000000..d89194d --- /dev/null +++ b/src/views/apps/babyhealth/index.vue @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/views/apps/babyhealth/users/components/changePassword.vue b/src/views/apps/babyhealth/users/components/changePassword.vue new file mode 100644 index 0000000..2577cac --- /dev/null +++ b/src/views/apps/babyhealth/users/components/changePassword.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/src/views/apps/babyhealth/users/components/preview.vue b/src/views/apps/babyhealth/users/components/preview.vue new file mode 100644 index 0000000..3843d82 --- /dev/null +++ b/src/views/apps/babyhealth/users/components/preview.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/views/apps/babyhealth/users/components/userEdit.vue b/src/views/apps/babyhealth/users/components/userEdit.vue new file mode 100644 index 0000000..c24a072 --- /dev/null +++ b/src/views/apps/babyhealth/users/components/userEdit.vue @@ -0,0 +1,539 @@ + + + + + diff --git a/src/views/apps/babyhealth/users/index.vue b/src/views/apps/babyhealth/users/index.vue new file mode 100644 index 0000000..db6421c --- /dev/null +++ b/src/views/apps/babyhealth/users/index.vue @@ -0,0 +1,328 @@ + + + + + diff --git a/src/views/basicSettings/roles/index.vue b/src/views/basicSettings/roles/index.vue index 1f7fb4c..7224bcd 100644 --- a/src/views/basicSettings/roles/index.vue +++ b/src/views/basicSettings/roles/index.vue @@ -134,7 +134,7 @@ const fetchRoles = async () => { const res = await getAllRoles(); if (res.code === 200) { roles.value = res.data || []; - console.log('角色列表:', roles.value); + // console.log('角色列表:', roles.value); } else { error.value = res.msg || "获取角色列表失败"; ElMessage.error(error.value); diff --git a/src/views/system/fileManager/index.vue b/src/views/system/fileManager/index.vue index 10a736a..4d96b68 100644 --- a/src/views/system/fileManager/index.vue +++ b/src/views/system/fileManager/index.vue @@ -57,7 +57,7 @@
{{ group.total }} 个文件
-
+
{ return `${import.meta.env.VITE_API_BASE_URL}${url}`; }; -// 未分类分组(固定,不可编辑) +//未分类分组(固定,不可编辑) const uncategorizedGroup = ref({ id: 0, name: "未分类", @@ -508,9 +508,17 @@ const uncategorizedGroup = ref({ description: "未分类的文件", }); +// 头像分组(固定,不可编辑) +const avatarGroup = ref({ + id: 999, + name: "头像", + total: 0, + description: "用户头像", +}); + // 过滤后的分组列表(未分类组置顶) const filteredGroups = computed(() => { - let result = [uncategorizedGroup.value, ...groups.value]; + let result = [uncategorizedGroup.value, avatarGroup.value, ...groups.value]; if (groupSearchQuery.value) { const query = groupSearchQuery.value.toLowerCase(); @@ -643,6 +651,9 @@ const loadFiles = async () => { if (selectedGroup.value.id === 0) { // 更新未分类组的文件数量 uncategorizedGroup.value.total = res.data.total || 0; + } else if (selectedGroup.value.id === 999) { + // 更新头像组的文件数量 + avatarGroup.value.total = res.data.total || 0; } else { // 更新普通分组的文件数量 const group = groups.value.find(