From 6cc3e9e3481b26961610a735b59a04cd85b5cb82 Mon Sep 17 00:00:00 2001 From: ailanyin Date: Thu, 20 Jul 2023 17:26:43 +0800 Subject: [PATCH] bug fix and performance improvements --- src/api/admin/agent/home.js | 12 + src/api/admin/laboratory/home.js | 9 + src/api/admin/research/home.js | 9 + src/api/common.js | 9 + src/api/login.js | 106 ++++---- src/components/WebsiteHeader/index.vue | 7 +- src/i18n/message/admin/index.js | 36 +-- src/i18n/message/admin/statistics/ru.js | 26 ++ src/i18n/message/admin/statistics/zh.js | 27 ++ src/layout/components/Navbar.vue | 7 +- src/router/index.js | 2 +- src/store/modules/user.js | 4 +- .../admin/agent/bill/bill-list/index.vue | 142 ++++++----- .../admin/agent/bill/commission/index.vue | 2 +- .../agent/bill/commission/withdraw-record.vue | 4 +- src/views/admin/agent/index.vue | 66 +++++ .../admin/agent/service/enterprise/index.vue | 12 +- .../service/enterprise/technology-demand.vue | 6 +- .../agent/service/matching-demand/index.vue | 10 +- src/views/admin/components/wordcloud.vue | 2 +- src/views/admin/laboratory/index.vue | 180 +++++-------- src/views/admin/research/index.vue | 63 ++++- src/views/components/LaboratoryForm/index.vue | 238 ++++++++++-------- src/views/components/StatisticsPanel.vue | 93 +++++++ src/views/system/user/profile/userAvatar.vue | 103 ++++---- .../searchList/components/wordcloud.vue | 2 +- vite.config.js | 2 +- 27 files changed, 757 insertions(+), 422 deletions(-) create mode 100644 src/api/admin/agent/home.js create mode 100644 src/api/admin/laboratory/home.js create mode 100644 src/api/admin/research/home.js create mode 100644 src/api/common.js create mode 100644 src/i18n/message/admin/statistics/ru.js create mode 100644 src/i18n/message/admin/statistics/zh.js create mode 100644 src/views/admin/agent/index.vue create mode 100644 src/views/components/StatisticsPanel.vue diff --git a/src/api/admin/agent/home.js b/src/api/admin/agent/home.js new file mode 100644 index 0000000..0503f73 --- /dev/null +++ b/src/api/admin/agent/home.js @@ -0,0 +1,12 @@ +import request from "@/utils/request"; + +/** + * 获取经纪人统计数据 + * @return {*} + */ +export const getBrokerStatistic = () => { + return request({ + url: "/app/broker/statistic", + method: "get", + }); +}; diff --git a/src/api/admin/laboratory/home.js b/src/api/admin/laboratory/home.js new file mode 100644 index 0000000..0a4d3f6 --- /dev/null +++ b/src/api/admin/laboratory/home.js @@ -0,0 +1,9 @@ +import request from "@/utils/request"; + +// /app/laboratory/statistic +export const getLaboratoryStatistic = () => { + return request({ + url: "/app/laboratory/statistic", + method: "get", + }); +}; diff --git a/src/api/admin/research/home.js b/src/api/admin/research/home.js new file mode 100644 index 0000000..a0fe2b2 --- /dev/null +++ b/src/api/admin/research/home.js @@ -0,0 +1,9 @@ +import request from "@/utils/request"; + +// /app/research/statistic +export const getResearchStatistic = () => { + return request({ + url: "/app/research/statistic", + method: "get", + }); +}; diff --git a/src/api/common.js b/src/api/common.js new file mode 100644 index 0000000..5038e92 --- /dev/null +++ b/src/api/common.js @@ -0,0 +1,9 @@ +import request from "@/utils/request"; + +export const upload = (data) => { + return request({ + url: "/common/upload", + method: "post", + data: data, + }); +} \ No newline at end of file diff --git a/src/api/login.js b/src/api/login.js index 6d2621a..13db493 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -2,69 +2,83 @@ import request from "@/utils/request"; // 登录方法 export function login(username, password, code, uuid) { - const data = { - username, - password, - code, - uuid, - }; - return request({ - url: "/app/login", - headers: { - isToken: false, - }, - method: "post", - data: data, - }); + const data = { + username, + password, + code, + uuid, + }; + return request({ + url: "/app/login", + headers: { + isToken: false, + }, + method: "post", + data: data, + }); } // 注册方法 export function register(data) { - return request({ - url: "/app/register", - headers: { - isToken: false, - }, - method: "post", - data: data, - }); + return request({ + url: "/app/register", + headers: { + isToken: false, + }, + method: "post", + data: data, + }); } // 获取用户详细信息 export function getInfo() { - return request({ - url: "/app/info", - method: "get", - }); + return request({ + url: "/app/info", + method: "get", + }); } // 退出方法 export function logout() { - return request({ - url: "/logout", - method: "post", - }); + return request({ + url: "/logout", + method: "post", + }); } // 获取验证码 export function getCodeImg() { - return request({ - url: "/app/captchaImage", - headers: { - isToken: false, - }, - method: "get", - timeout: 20000, - }); + return request({ + url: "/app/captchaImage", + headers: { + isToken: false, + }, + method: "get", + timeout: 20000, + }); } + // 重置密码 export function resetPassword() { - return request({ - url: "/captchaImage", - headers: { - isToken: false, - }, - method: "get", - timeout: 20000, - }); + return request({ + url: "/captchaImage", + headers: { + isToken: false, + }, + method: "get", + timeout: 20000, + }); } + +/** + * 更新头像 + * @param data + * @return {*} + */ +export function updateAvatar(data) { + return request({ + url: "/app/updateAvatar", + method: "put", + data: data, + }); +} \ No newline at end of file diff --git a/src/components/WebsiteHeader/index.vue b/src/components/WebsiteHeader/index.vue index 72ca5ae..0ceda14 100644 --- a/src/components/WebsiteHeader/index.vue +++ b/src/components/WebsiteHeader/index.vue @@ -117,7 +117,10 @@
- +
@@ -190,7 +193,7 @@ let state = reactive({}); let pagePath = ref(""); const route = useRoute(); const router = useRouter(); - +const baseUrl =ref(import.meta.env.VITE_APP_BASE_API); const categoryList = ref([]); // 当前的语言 const currentLocale = ref("zh"); diff --git a/src/i18n/message/admin/index.js b/src/i18n/message/admin/index.js index 84ed0cb..6782704 100644 --- a/src/i18n/message/admin/index.js +++ b/src/i18n/message/admin/index.js @@ -10,25 +10,29 @@ import table_zh from "./table/zh"; import table_ru from "./table/ru"; import validation_zh from "./validation/zh"; import validation_ru from "./validation/ru"; +import statistics_zh from "./statistics/zh"; +import statistics_ru from "./statistics/ru"; export const admin_zh = { - identity: { - entrance: entrance_zh, - }, - common: common_zh, - form: form_zh, - broker: broker_zh, - table: table_zh, - validation: validation_zh, + identity: { + entrance: entrance_zh, + }, + common: common_zh, + form: form_zh, + broker: broker_zh, + table: table_zh, + validation: validation_zh, + statistics: statistics_zh, }; export const admin_ru = { - identity: { - entrance: entrance_ru, - }, - common: common_ru, - form: form_ru, - broker: broker_ru, - table: table_ru, - validation: validation_ru, + identity: { + entrance: entrance_ru, + }, + common: common_ru, + form: form_ru, + broker: broker_ru, + table: table_ru, + validation: validation_ru, + statistics: statistics_ru, }; diff --git a/src/i18n/message/admin/statistics/ru.js b/src/i18n/message/admin/statistics/ru.js new file mode 100644 index 0000000..860d352 --- /dev/null +++ b/src/i18n/message/admin/statistics/ru.js @@ -0,0 +1,26 @@ +const statistics = { + // 企业数量, 正在服务需求数, 订单总数, 需求总数 + enterpriseCount: "Количество предприятий", + serviceDemandCount: "Количество обслуживаемых потребностей", + orderCount: "Количество заказов", + demandCount: "Количество потребностей", + // 专利数量 成果数量 专家数量 实验室数量 + patentCount: "Количество патентов", + achievementCount: "Количество достижений", + expertCount: "Количество экспертов", + laboratoryCount: "Количество лабораторий", + // 论文数量 + paperCount: "Количество статей", + unit: { + enterprise: "шт", + serviceDemand: "шт", + order: "шт", + demand: "шт", + patent: "шт", + achievement: "шт", + expert: "шт", + laboratory: "шт", + paper: "шт", + } +} +export default statistics; \ No newline at end of file diff --git a/src/i18n/message/admin/statistics/zh.js b/src/i18n/message/admin/statistics/zh.js new file mode 100644 index 0000000..0e960fd --- /dev/null +++ b/src/i18n/message/admin/statistics/zh.js @@ -0,0 +1,27 @@ +const statistics = { +// 企业数量, 正在服务需求数, 订单总数, 需求总数 + enterpriseCount: "企业数量", + serviceDemandCount: "正在服务需求数", + orderCount: "订单总数", + demandCount: "需求总数", + // 专利数量 成果数量 专家数量 实验室数量 + patentCount: "专利数量", + achievementCount: "成果数量", + expertCount: "专家数量", + laboratoryCount: "实验室数量", + // 论文数量 + paperCount: "论文数量", + unit: { + enterprise: "家", + serviceDemand: "个", + order: "个", + demand: "个", + patent: "项", + achievement: "项", + expert: "位", + laboratory: "个", + paper: "篇", + } + +} +export default statistics; \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index aa071aa..dc056c6 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -42,7 +42,8 @@ trigger="click" >
- + + @@ -103,13 +104,13 @@ import useUserStore from "@/store/modules/user"; import useSettingsStore from "@/store/modules/settings"; import { useI18n } from "vue-i18n"; import { ref } from "vue"; - +import defaultAvatar from '@/assets/logo/avatar.png' const appStore = useAppStore(); const userStore = useUserStore(); const settingsStore = useSettingsStore(); const { t, locale } = useI18n(); const avatarRef = ref(); - +const baseUrl =ref(import.meta.env.VITE_APP_BASE_API); function toggleSideBar() { appStore.toggleSideBar(); } diff --git a/src/router/index.js b/src/router/index.js index 2ac39c6..699cb3b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1114,7 +1114,7 @@ export const agentRoutes = [ children: [ { path: "index", - component: () => import("@/views/admin/research/index"), + component: () => import("@/views/admin/agent/index"), name: "Index", meta: { title: "首页", diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8a3f880..c65d894 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -43,9 +43,9 @@ const useUserStore = defineStore("user", { const enterprise = res.data.enterprise; const userId = user.userId; const avatar = - user.avatar == "" || user.avatar == null + /* user.avatar == "" || user.avatar == null ? defAva - : import.meta.env.VITE_APP_BASE_API + user.avatar; + : import.meta.env.VITE_APP_BASE_API + */user.avatar; if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 diff --git a/src/views/admin/agent/bill/bill-list/index.vue b/src/views/admin/agent/bill/bill-list/index.vue index 6f623da..1f8edc1 100644 --- a/src/views/admin/agent/bill/bill-list/index.vue +++ b/src/views/admin/agent/bill/bill-list/index.vue @@ -1,16 +1,16 @@ + + + + diff --git a/src/views/admin/agent/service/enterprise/index.vue b/src/views/admin/agent/service/enterprise/index.vue index 411c970..f1fd3d1 100644 --- a/src/views/admin/agent/service/enterprise/index.vue +++ b/src/views/admin/agent/service/enterprise/index.vue @@ -148,7 +148,7 @@ getList(); :placeholder=" t('admin.form.placeholder', { type: t('admin.common.company') }) " - size="small" + @keyup.enter.prevent="handleQuery" /> @@ -156,13 +156,13 @@ getList(); {{ t("admin.common.search") }} - + {{ t("admin.common.reset") }} @@ -210,7 +210,7 @@ getList();