From 734e71976eb595de3d5ef9fb9ea579e808fd60b1 Mon Sep 17 00:00:00 2001 From: 18278715334 <18278715334@163.com> Date: Fri, 19 Dec 2025 16:57:49 +0800 Subject: [PATCH] add --- components.d.ts | 97 +++++++++++++++++++++ src/api/ui-component.js | 99 +++++++++++++++++++++ src/constants/menu.js | 3 +- src/pages/admin/ui-components/index.vue | 111 ++++++++++++++++++++++-- src/pages/profile/Profile.vue | 79 ++++++++++++++--- src/router/index.js | 6 ++ 6 files changed, 377 insertions(+), 18 deletions(-) create mode 100644 src/api/ui-component.js diff --git a/components.d.ts b/components.d.ts index e69de29..b314e97 100644 --- a/components.d.ts +++ b/components.d.ts @@ -0,0 +1,97 @@ +/* eslint-disable */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +// biome-ignore lint: disable +export {} + +/* prettier-ignore */ +declare module 'vue' { + export interface GlobalComponents { + AppBreadcrumb: typeof import('./src/components/layout/AppBreadcrumb.vue')['default'] + AppHeader: typeof import('./src/components/layout/AppHeader.vue')['default'] + AppLoading: typeof import('./src/components/common/AppLoading.vue')['default'] + AppSidebar: typeof import('./src/components/layout/AppSidebar.vue')['default'] + BusinessConsultationDialog: typeof import('./src/components/common/BusinessConsultationDialog.vue')['default'] + CertificationBanner: typeof import('./src/components/common/CertificationBanner.vue')['default'] + CertificationNotice: typeof import('./src/components/common/CertificationNotice.vue')['default'] + ChartCard: typeof import('./src/components/statistics/ChartCard.vue')['default'] + CodeDisplay: typeof import('./src/components/common/CodeDisplay.vue')['default'] + CustomSteps: typeof import('./src/components/common/CustomSteps.vue')['default'] + DanmakuBar: typeof import('./src/components/common/DanmakuBar.vue')['default'] + ElAlert: typeof import('element-plus/es')['ElAlert'] + ElAside: typeof import('element-plus/es')['ElAside'] + ElAvatar: typeof import('element-plus/es')['ElAvatar'] + ElButton: typeof import('element-plus/es')['ElButton'] + ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] + ElCard: typeof import('element-plus/es')['ElCard'] + ElCol: typeof import('element-plus/es')['ElCol'] + ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] + ElContainer: typeof import('element-plus/es')['ElContainer'] + ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] + ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] + ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] + ElDialog: typeof import('element-plus/es')['ElDialog'] + ElDivider: typeof import('element-plus/es')['ElDivider'] + ElDrawer: typeof import('element-plus/es')['ElDrawer'] + ElDropdown: typeof import('element-plus/es')['ElDropdown'] + ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] + ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] + ElEmpty: typeof import('element-plus/es')['ElEmpty'] + ElForm: typeof import('element-plus/es')['ElForm'] + ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElHeader: typeof import('element-plus/es')['ElHeader'] + ElIcon: typeof import('element-plus/es')['ElIcon'] + ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] + ElLoading: typeof import('element-plus/es')['ElLoading'] + ElMain: typeof import('element-plus/es')['ElMain'] + ElMenu: typeof import('element-plus/es')['ElMenu'] + ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElOption: typeof import('element-plus/es')['ElOption'] + ElPagination: typeof import('element-plus/es')['ElPagination'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] + ElRow: typeof import('element-plus/es')['ElRow'] + ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] + ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] + ElTable: typeof import('element-plus/es')['ElTable'] + ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] + ElTag: typeof import('element-plus/es')['ElTag'] + ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTree: typeof import('element-plus/es')['ElTree'] + ElUpload: typeof import('element-plus/es')['ElUpload'] + ExportDialog: typeof import('./src/components/common/ExportDialog.vue')['default'] + FileUpload: typeof import('./src/components/common/FileUpload.vue')['default'] + FilterItem: typeof import('./src/components/common/FilterItem.vue')['default'] + FilterSection: typeof import('./src/components/common/FilterSection.vue')['default'] + FloatingCustomerService: typeof import('./src/components/common/FloatingCustomerService.vue')['default'] + HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] + ListPageLayout: typeof import('./src/components/common/ListPageLayout.vue')['default'] + MarkdownEditor: typeof import('./src/components/common/MarkdownEditor.vue')['default'] + NotificationPanel: typeof import('./src/components/layout/NotificationPanel.vue')['default'] + PermissionGuard: typeof import('./src/components/auth/PermissionGuard.vue')['default'] + ProductApiConfigDialog: typeof import('./src/components/admin/ProductApiConfigDialog.vue')['default'] + ProductCard: typeof import('./src/components/product/ProductCard.vue')['default'] + ProductDocumentationDialog: typeof import('./src/components/admin/ProductDocumentationDialog.vue')['default'] + ProductFormDialog: typeof import('./src/components/admin/ProductFormDialog.vue')['default'] + ResponsiveActionColumn: typeof import('./src/components/common/ResponsiveActionColumn.vue')['default'] + RichTextEditor: typeof import('./src/components/common/RichTextEditor.vue')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + StatCard: typeof import('./src/components/statistics/StatCard.vue')['default'] + StatisticsDashboard: typeof import('./src/components/statistics/StatisticsDashboard.vue')['default'] + TheWelcome: typeof import('./src/components/TheWelcome.vue')['default'] + VersionInfo: typeof import('./src/components/common/VersionInfo.vue')['default'] + WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default'] + } + export interface GlobalDirectives { + vLoading: typeof import('element-plus/es')['ElLoadingDirective'] + } +} diff --git a/src/api/ui-component.js b/src/api/ui-component.js new file mode 100644 index 0000000..89fb0ab --- /dev/null +++ b/src/api/ui-component.js @@ -0,0 +1,99 @@ +import request from '@/utils/request' + +export const uiComponentApi = { + // 获取UI组件列表 + getUIComponentList(params) { + return request.get('/admin/ui-components', { params }) + }, + + // 获取UI组件详情 + getUIComponentDetail(id) { + return request.get(`/admin/ui-components/${id}`) + }, + + // 创建UI组件 + createUIComponent(data) { + // 确保发送的数据结构与后端期望的完全匹配 + const requestData = { + component_code: data.component_code || '', + component_name: data.component_name || '', + description: data.description || '', + version: data.version || '', + is_active: data.is_active !== undefined ? data.is_active : true, + sort_order: data.sort_order !== undefined ? data.sort_order : 0 + } + + // 添加调试日志 + console.log('创建UI组件请求数据:', requestData) + + return request.post('/admin/ui-components', requestData) + }, + + // 更新UI组件 + updateUIComponent(id, data) { + // 确保发送的数据结构与后端期望的完全匹配 + const requestData = { + id: id, + component_code: data.component_code || '', + component_name: data.component_name || '', + description: data.description || '', + version: data.version || '', + is_active: data.is_active !== undefined ? data.is_active : true, + sort_order: data.sort_order !== undefined ? data.sort_order : 0 + } + + // 添加调试日志 + console.log('更新UI组件请求数据:', requestData) + + return request.put(`/admin/ui-components/${id}`, requestData) + }, + + // 删除UI组件 + deleteUIComponent(id) { + return request.delete(`/admin/ui-components/${id}`) + }, + + // 上传UI组件文件 + uploadUIComponentFile(id, formData) { + return request.post(`/admin/ui-components/${id}/upload`, formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + }, + + // 上传并解压UI组件文件 + uploadAndExtractUIComponentFile(id, formData) { + return request.post(`/admin/ui-components/${id}/upload-extract`, formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + }, + + // 下载UI组件文件 + downloadUIComponentFile(id) { + return request.get(`/admin/ui-components/${id}/download`, { + responseType: 'blob' + }) + }, + + // 获取UI组件文件夹内容 + getUIComponentFolderContent(id) { + return request.get(`/admin/ui-components/${id}/folder-content`) + }, + + // 删除UI组件文件夹 + deleteUIComponentFolder(id) { + return request.delete(`/admin/ui-components/${id}/folder`) + }, + + // 创建UI组件并上传文件(合并操作) + createUIComponentWithFile(formData) { + return request.post('/admin/ui-components/create-with-file', formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + } +} diff --git a/src/constants/menu.js b/src/constants/menu.js index 5bbbb0f..b451b12 100644 --- a/src/constants/menu.js +++ b/src/constants/menu.js @@ -124,7 +124,8 @@ export const getUserAccessibleMenuItems = (userType = 'user') => { { name: '调用记录', path: '/admin/usage', icon: Clipboard }, { name: '消费记录', path: '/admin/transactions', icon: Clipboard }, { name: '充值记录', path: '/admin/recharge-records', icon: CreditCard }, - { name: '发票管理', path: '/admin/invoices', icon: Wallet } + { name: '发票管理', path: '/admin/invoices', icon: Wallet }, + { name: '组件管理', path: '/admin/ui-components', icon: Cube } ] }) } diff --git a/src/pages/admin/ui-components/index.vue b/src/pages/admin/ui-components/index.vue index b4ea450..ac8081c 100644 --- a/src/pages/admin/ui-components/index.vue +++ b/src/pages/admin/ui-components/index.vue @@ -73,7 +73,7 @@ 上传文件 + + + 文件上传 + 文件夹上传 + + + + + +
+ 将文件拖到此处,或点击上传 +
+ +
+