From 1304c8f31e5fdab6e1e19f35d68c413b3579b8a3 Mon Sep 17 00:00:00 2001 From: dzq Date: Mon, 1 Dec 2025 11:20:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=81=E4=B8=9A=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增企业基本信息接口及DTO定义 - 在store中添加企业基本信息状态管理 - 在欢迎页面集成企业基本信息显示 --- src/api/qy/corp.ts | 29 +++++++++++++++++++++++++++++ src/store/modules/wx.ts | 13 +++++++++++-- src/views/welcome/index.vue | 21 ++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 src/api/qy/corp.ts diff --git a/src/api/qy/corp.ts b/src/api/qy/corp.ts new file mode 100644 index 0000000..237a8ec --- /dev/null +++ b/src/api/qy/corp.ts @@ -0,0 +1,29 @@ +import { http } from "@/utils/http"; + +/** + * 企业授权基本信息DTO + * 用于根据corpid查询企业基本信息 + */ +export interface QyAuthCorpBasicInfoDTO { + /** 授权方企业方形头像 */ + corpSquareLogoUrl?: string; + /** 授权方企业名称 */ + corpName?: string; + /** 授权方企业全称 */ + corpFullName?: string; + /** 企业所属行业 */ + corpIndustry?: string; + /** 企业所属子行业 */ + corpSubIndustry?: string; +} + +/** + * 根据corpid查询企业基本信息 + * @param corpid 企业ID + * @returns 企业基本信息 + */ +export const getBasicInfoByCorpidApi = (corpid: string) => { + return http.request>("get", "/qywx/authCorpInfo/basicInfo", { + params: { corpid } + }); +}; \ No newline at end of file diff --git a/src/store/modules/wx.ts b/src/store/modules/wx.ts index c57b186..6ff15fb 100644 --- a/src/store/modules/wx.ts +++ b/src/store/modules/wx.ts @@ -3,6 +3,7 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import { store } from "@/store"; import { QyUserLoginDTO } from "@/api/common/login"; +import { QyAuthCorpBasicInfoDTO } from "@/api/qy/corp"; export const useWxStore = defineStore("wx", () => { @@ -17,6 +18,8 @@ export const useWxStore = defineStore("wx", () => { // 初始化 const isInit = ref(false); const qyUser = ref(null); + // 企业授权基本信息 + const authCorpBasicInfo = ref(null); // 设置 userid const setUserid = (id: string) => { @@ -28,6 +31,12 @@ export const useWxStore = defineStore("wx", () => { qyUser.value = user; } + // 设置企业授权基本信息 + const setAuthCorpBasicInfo = (info: QyAuthCorpBasicInfoDTO) => { + if (!info) return; + authCorpBasicInfo.value = info; + } + const initWx = () => { if (isInit.value) return; isInit.value = true; @@ -57,8 +66,8 @@ export const useWxStore = defineStore("wx", () => { } return { - corpid, code, state, userid, isInit, qyUser, - setUserid, handleWxCallback, initWx, setQyUser + corpid, code, state, userid, isInit, qyUser, authCorpBasicInfo, + setUserid, handleWxCallback, initWx, setQyUser, setAuthCorpBasicInfo } }) diff --git a/src/views/welcome/index.vue b/src/views/welcome/index.vue index d6ff92c..16ab16f 100644 --- a/src/views/welcome/index.vue +++ b/src/views/welcome/index.vue @@ -8,6 +8,8 @@ import { useWxStore } from '@/store/modules/wx'; import { ElDialog, ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus'; import { bindQyUserApi } from '@/api/ab98/user'; import qrcode from '@/assets/qrcode.png'; +import { getBasicInfoByCorpidApi } from '@/api/qy/corp'; +import { storeToRefs } from 'pinia'; defineOptions({ name: "Welcome" @@ -15,6 +17,8 @@ defineOptions({ const wxStore = useWxStore(); +const { authCorpBasicInfo } = storeToRefs(wxStore); + const shopList = ref([]); const currentShop = ref(null); const selectedShopId = ref(null); @@ -126,6 +130,19 @@ const fetchShopList = async () => { } }; +const fetchCorpBasicInfo = async () => { + try { + const { data } = await getBasicInfoByCorpidApi(wxStore.corpid); + if (data) { + // 更新企业基本信息 + wxStore.setAuthCorpBasicInfo(data); + } + } catch (error) { + console.error('获取企业基本信息失败:', error); + ElMessage.error('获取企业基本信息失败'); + } +}; + // 获取借还动态数据 const fetchBorrowReturnDynamic = async () => { loading.value = true; @@ -188,6 +205,8 @@ const parseImages = (images?: string): string[] => { onMounted(async () => { await fetchShopList(); + // 获取企业基本信息 + await fetchCorpBasicInfo(); try { const { data } = await getStats(wxStore.corpid); @@ -241,7 +260,7 @@ onMounted(async () => { class="shop-image" />
-

{{ currentShop.shopName }}

+

{{ authCorpBasicInfo?.corpName || '' }}