feat(企业微信): 添加企业基本信息查询功能
- 新增企业基本信息接口及DTO定义 - 在store中添加企业基本信息状态管理 - 在欢迎页面集成企业基本信息显示
This commit is contained in:
parent
3e47804f7e
commit
1304c8f31e
|
|
@ -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 }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -3,6 +3,7 @@ import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import { QyUserLoginDTO } from "@/api/common/login";
|
import { QyUserLoginDTO } from "@/api/common/login";
|
||||||
|
import { QyAuthCorpBasicInfoDTO } from "@/api/qy/corp";
|
||||||
|
|
||||||
|
|
||||||
export const useWxStore = defineStore("wx", () => {
|
export const useWxStore = defineStore("wx", () => {
|
||||||
|
|
@ -17,6 +18,8 @@ export const useWxStore = defineStore("wx", () => {
|
||||||
// 初始化
|
// 初始化
|
||||||
const isInit = ref<boolean>(false);
|
const isInit = ref<boolean>(false);
|
||||||
const qyUser = ref<QyUserLoginDTO>(null);
|
const qyUser = ref<QyUserLoginDTO>(null);
|
||||||
|
// 企业授权基本信息
|
||||||
|
const authCorpBasicInfo = ref<QyAuthCorpBasicInfoDTO>(null);
|
||||||
|
|
||||||
// 设置 userid
|
// 设置 userid
|
||||||
const setUserid = (id: string) => {
|
const setUserid = (id: string) => {
|
||||||
|
|
@ -28,6 +31,12 @@ export const useWxStore = defineStore("wx", () => {
|
||||||
qyUser.value = user;
|
qyUser.value = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置企业授权基本信息
|
||||||
|
const setAuthCorpBasicInfo = (info: QyAuthCorpBasicInfoDTO) => {
|
||||||
|
if (!info) return;
|
||||||
|
authCorpBasicInfo.value = info;
|
||||||
|
}
|
||||||
|
|
||||||
const initWx = () => {
|
const initWx = () => {
|
||||||
if (isInit.value) return;
|
if (isInit.value) return;
|
||||||
isInit.value = true;
|
isInit.value = true;
|
||||||
|
|
@ -57,8 +66,8 @@ export const useWxStore = defineStore("wx", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
corpid, code, state, userid, isInit, qyUser,
|
corpid, code, state, userid, isInit, qyUser, authCorpBasicInfo,
|
||||||
setUserid, handleWxCallback, initWx, setQyUser
|
setUserid, handleWxCallback, initWx, setQyUser, setAuthCorpBasicInfo
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import { useWxStore } from '@/store/modules/wx';
|
||||||
import { ElDialog, ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus';
|
import { ElDialog, ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus';
|
||||||
import { bindQyUserApi } from '@/api/ab98/user';
|
import { bindQyUserApi } from '@/api/ab98/user';
|
||||||
import qrcode from '@/assets/qrcode.png';
|
import qrcode from '@/assets/qrcode.png';
|
||||||
|
import { getBasicInfoByCorpidApi } from '@/api/qy/corp';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "Welcome"
|
name: "Welcome"
|
||||||
|
|
@ -15,6 +17,8 @@ defineOptions({
|
||||||
|
|
||||||
const wxStore = useWxStore();
|
const wxStore = useWxStore();
|
||||||
|
|
||||||
|
const { authCorpBasicInfo } = storeToRefs(wxStore);
|
||||||
|
|
||||||
const shopList = ref<ShopDTO[]>([]);
|
const shopList = ref<ShopDTO[]>([]);
|
||||||
const currentShop = ref<ShopDTO | null>(null);
|
const currentShop = ref<ShopDTO | null>(null);
|
||||||
const selectedShopId = ref<number | 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 () => {
|
const fetchBorrowReturnDynamic = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
|
@ -188,6 +205,8 @@ const parseImages = (images?: string): string[] => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchShopList();
|
await fetchShopList();
|
||||||
|
// 获取企业基本信息
|
||||||
|
await fetchCorpBasicInfo();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await getStats(wxStore.corpid);
|
const { data } = await getStats(wxStore.corpid);
|
||||||
|
|
@ -241,7 +260,7 @@ onMounted(async () => {
|
||||||
class="shop-image" />
|
class="shop-image" />
|
||||||
<div class="shop-details">
|
<div class="shop-details">
|
||||||
<div class="shop-name-container">
|
<div class="shop-name-container">
|
||||||
<h3 class="shop-name">{{ currentShop.shopName }}</h3>
|
<h3 class="shop-name">{{ authCorpBasicInfo?.corpName || '' }}</h3>
|
||||||
<!-- <el-select
|
<!-- <el-select
|
||||||
v-model="selectedShopId"
|
v-model="selectedShopId"
|
||||||
placeholder="选择商店"
|
placeholder="选择商店"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue