From fd0d380ae9b5408cbbfdb3f5abcc9f4a220bb0ed Mon Sep 17 00:00:00 2001 From: LYC Date: Sat, 26 Apr 2025 23:11:00 +0800 Subject: [PATCH] =?UTF-8?q?[tag]=20=E5=AE=9E=E7=8E=B0=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E5=8A=9F=E8=83=BDdemo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 8 +- src/router/elegant/routes.ts | 3 +- src/typings/components.d.ts | 41 +------ src/utils/api.ts | 50 ++++++--- src/views/ai/index.vue | 4 +- src/views/department/index.vue | 6 +- src/views/facility/index.vue | 152 +++++++++++++++++++++++++- src/views/home/index.vue | 4 +- src/views/plan/index.vue | 183 +++++++++++++++++++++++++++++++- src/views/user-center/index.vue | 2 +- 10 files changed, 379 insertions(+), 74 deletions(-) diff --git a/.env.prod b/.env.prod index 9b4481c..eb6154b 100644 --- a/.env.prod +++ b/.env.prod @@ -1,7 +1,7 @@ # backend service base url, prod environment -VITE_SERVICE_BASE_URL=http://localhost:8080 +VITE_SERVICE_BASE_URL=http://154.219.110.17:8080 # other backend service base url, prod environment -VITE_OTHER_SERVICE_BASE_URL= `{ - "demo": "http://localhost:9529" -}` +# VITE_OTHER_SERVICE_BASE_URL= `{ +# "demo": "http://localhost:9529" +# }` diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 5b7d901..d94d72d 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -109,7 +109,8 @@ export const generatedRoutes: GeneratedRoute[] = [ title: 'function', i18nKey: 'route.function', icon: 'icon-park-outline:all-application', - order: 6 + order: 6, + hideInMenu: true }, children: [ { diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index 81e99a0..305a155 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -7,46 +7,22 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { - ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb'] - ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem'] AButton: typeof import('ant-design-vue/es')['Button'] ACard: typeof import('ant-design-vue/es')['Card'] - ACheckbox: typeof import('ant-design-vue/es')['Checkbox'] ACol: typeof import('ant-design-vue/es')['Col'] - ADescriptions: typeof import('ant-design-vue/es')['Descriptions'] - ADescriptionsItem: typeof import('ant-design-vue/es')['DescriptionsItem'] - ADivider: typeof import('ant-design-vue/es')['Divider'] - ADrawer: typeof import('ant-design-vue/es')['Drawer'] - ADropdown: typeof import('ant-design-vue/es')['Dropdown'] AEmpty: typeof import('ant-design-vue/es')['Empty'] AForm: typeof import('ant-design-vue/es')['Form'] AFormItem: typeof import('ant-design-vue/es')['FormItem'] AInput: typeof import('ant-design-vue/es')['Input'] AInputNumber: typeof import('ant-design-vue/es')['InputNumber'] - AInputPassword: typeof import('ant-design-vue/es')['InputPassword'] - AInputSearch: typeof import('ant-design-vue/es')['InputSearch'] - AList: typeof import('ant-design-vue/es')['List'] - AListItem: typeof import('ant-design-vue/es')['ListItem'] - AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta'] - AMenu: typeof import('ant-design-vue/es')['Menu'] - AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider'] - AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AModal: typeof import('ant-design-vue/es')['Modal'] - APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] - APopover: typeof import('ant-design-vue/es')['Popover'] + APagination: typeof import('ant-design-vue/es')['Pagination'] AppProvider: typeof import('./../components/common/app-provider.vue')['default'] - ARadio: typeof import('ant-design-vue/es')['Radio'] - ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARow: typeof import('ant-design-vue/es')['Row'] - ASegmented: typeof import('ant-design-vue/es')['Segmented'] ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] - ASpace: typeof import('ant-design-vue/es')['Space'] - AStatistic: typeof import('ant-design-vue/es')['Statistic'] - ASwitch: typeof import('ant-design-vue/es')['Switch'] ATable: typeof import('ant-design-vue/es')['Table'] ATag: typeof import('ant-design-vue/es')['Tag'] - ATooltip: typeof import('ant-design-vue/es')['Tooltip'] ATree: typeof import('ant-design-vue/es')['Tree'] AWatermark: typeof import('ant-design-vue/es')['Watermark'] BetterScroll: typeof import('./../components/custom/better-scroll.vue')['default'] @@ -55,21 +31,6 @@ declare module 'vue' { DarkModeContainer: typeof import('./../components/common/dark-mode-container.vue')['default'] ExceptionBase: typeof import('./../components/common/exception-base.vue')['default'] FullScreen: typeof import('./../components/common/full-screen.vue')['default'] - IconAntDesignReloadOutlined: typeof import('~icons/ant-design/reload-outlined')['default'] - IconAntDesignSettingOutlined: typeof import('~icons/ant-design/setting-outlined')['default'] - IconCarbonAdd: typeof import('~icons/carbon/add')['default'] - IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default'] - IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default'] - 'IconIc:roundPlus': typeof import('~icons/ic/round-plus')['default'] - IconIcRoundDelete: typeof import('~icons/ic/round-delete')['default'] - IconIcRoundPlus: typeof import('~icons/ic/round-plus')['default'] - IconIcRoundRefresh: typeof import('~icons/ic/round-refresh')['default'] - IconIcRoundRemove: typeof import('~icons/ic/round-remove')['default'] - IconIcRoundSearch: typeof import('~icons/ic/round-search')['default'] - IconLocalBanner: typeof import('~icons/local/banner')['default'] - IconLocalLogo: typeof import('~icons/local/logo')['default'] - IconMdiDrag: typeof import('~icons/mdi/drag')['default'] - IconMdiRefresh: typeof import('~icons/mdi/refresh')['default'] LangSwitch: typeof import('./../components/common/lang-switch.vue')['default'] LookForward: typeof import('./../components/custom/look-forward.vue')['default'] MenuToggler: typeof import('./../components/common/menu-toggler.vue')['default'] diff --git a/src/utils/api.ts b/src/utils/api.ts index c67a85e..d7dcd6a 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -3,17 +3,39 @@ import axios from 'axios'; import { localStg } from '@/utils/storage'; // 封装网络请求的接口 -export const apiRequest = async (path: string, data: any) => { - let url = "http://localhost:8080" + path; - const token = localStg.get('token'); // 获取 token - try { - const response = await axios.post(url, data, { - headers: { - Authorization: `Bearer ${token}`, // 添加 Authorization 头 - }, - }); - return response.data; // 返回响应数据 - } catch (error) { - throw new Error('请求失败'); // 抛出错误 - } -}; \ No newline at end of file +export const apiRequest = async (method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, data?: any) => { + let url = "http://localhost:8080" + path; + const token = localStg.get('token'); // 获取 token + try { + const response = await axios({ + method, + url, + data, + headers: { + Authorization: `Bearer ${token}`, // 添加 Authorization 头 + }, + }); + return response.data; // 返回响应数据 + } catch (error) { + throw new Error('请求失败'); // 抛出错误 + } +}; + +export const apiRequestGet = async (path: string) => { + let url = "http://localhost:8080" + path; + const token = localStg.get('token'); // 获取 token + try { + return axios.get( + url, + { + headers: { + Authorization: `Bearer ${token}`, // 添加 Authorization 头 + }, + } + ); + } catch (error) { + throw new Error('请求失败'); // 抛出错误 + } +}; + +export default apiRequest; \ No newline at end of file diff --git a/src/views/ai/index.vue b/src/views/ai/index.vue index 00034ac..8c3538d 100644 --- a/src/views/ai/index.vue +++ b/src/views/ai/index.vue @@ -35,7 +35,7 @@ const services = ref([ id: 1, name: '图像识别模型', status: 'Running', - responseTime: 120, + responseTime: Math.floor(Math.random() * 500), health: 'Healthy', lastUpdated: new Date().toLocaleTimeString(), }, @@ -43,7 +43,7 @@ const services = ref([ id: 2, name: '大语言模型', status: 'Running', - responseTime: 0, + responseTime: Math.floor(Math.random() * 500), health: 'Healthy', lastUpdated: new Date().toLocaleTimeString(), } diff --git a/src/views/department/index.vue b/src/views/department/index.vue index fabda97..3eebb0b 100644 --- a/src/views/department/index.vue +++ b/src/views/department/index.vue @@ -74,7 +74,8 @@ import { ref, onMounted } from 'vue'; import { message, Modal } from 'ant-design-vue'; import axios from 'axios'; - +import { apiRequestGet } from '@/utils/api' +import { localStg } from '@/utils/storage'; // 部门树数据 const treeData = ref([]); // 弹窗相关 @@ -96,7 +97,8 @@ const selectedKeys = ref([]); // 获取部门数据 const fetchDepartments = async () => { try { - const response = await axios.get('http://localhost:8080/api/departments'); + const response = await apiRequestGet('/api/department/allDepartment'); + if (response.data.success) { // 过滤重复数据并构建树结构 const deptMap = new Map(); diff --git a/src/views/facility/index.vue b/src/views/facility/index.vue index bd71c09..4f927ef 100644 --- a/src/views/facility/index.vue +++ b/src/views/facility/index.vue @@ -1,7 +1,151 @@ - - + - + + + \ No newline at end of file diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 8091796..7e0aad4 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -22,9 +22,9 @@ import CreativityBanner from './modules/creativity-banner.vue'; --> - +