feat(企业微信): 添加企业基本信息查询功能

- 新增企业基本信息接口及DTO定义
- 在store中添加企业基本信息状态管理
- 在欢迎页面集成企业基本信息显示
This commit is contained in:
dzq 2025-12-01 11:20:47 +08:00
parent 3e47804f7e
commit 1304c8f31e
3 changed files with 60 additions and 3 deletions

29
src/api/qy/corp.ts Normal file
View File

@ -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<ResponseData<QyAuthCorpBasicInfoDTO>>("get", "/qywx/authCorpInfo/basicInfo", {
params: { corpid }
});
};

View File

@ -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<boolean>(false);
const qyUser = ref<QyUserLoginDTO>(null);
// 企业授权基本信息
const authCorpBasicInfo = ref<QyAuthCorpBasicInfoDTO>(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
}
})

View File

@ -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<ShopDTO[]>([]);
const currentShop = ref<ShopDTO | null>(null);
const selectedShopId = ref<number | null>(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" />
<div class="shop-details">
<div class="shop-name-container">
<h3 class="shop-name">{{ currentShop.shopName }}</h3>
<h3 class="shop-name">{{ authCorpBasicInfo?.corpName || '' }}</h3>
<!-- <el-select
v-model="selectedShopId"
placeholder="选择商店"