Merge branch 'feature/manage' of http://gogs.lvfunai.com:444/ai-team/lingji-work-fe into feature/manage

This commit is contained in:
lq
2025-06-21 11:39:36 +08:00
10 changed files with 208 additions and 36 deletions

View File

@ -96,7 +96,7 @@ export const fetchGenderDistributionsList = (params: any) => {
// 导出一个函数,用于获取产品列表
export const fetchProductList = () => {
// 使用Http.get方法发送GET请求获取产品列表
return Http.get('/v1/products/list', {}, { headers: { 'enterprise-id': 1 } });
return Http.get('/v1/products/list');
};
// 导出一个函数,用于获取成功案例列表
@ -107,12 +107,12 @@ export const fetchSuccessCaseList = () => {
// 试用产品
export const trialProduct = (id: number) => {
return Http.post(`/v1/products/${id}/try`, {}, { headers: { 'enterprise-id': 1 } });
return Http.post(`/v1/products/${id}/try`);
};
// 修改企业名称
export const updateEnterpriseName = (data: any) => {
return Http.patch(`/v1/enterprises/name`, data, { headers: { 'enterprise-id': 1 } });
return Http.patch(`/v1/enterprises/name`, data);
};
// 发送修改手机号验证码
@ -132,7 +132,7 @@ export const updateMyInfo = (data: any) => {
// 获取企业账号分页
export const fetchSubAccountPage = (params: any) => {
return Http.get(`/v1/enterprises/users`, params, { headers: { 'enterprise-id': 1 } });
return Http.get(`/v1/enterprises/users`, params);
};
// 获取企业账号分页
@ -142,10 +142,20 @@ export const fetchImageUploadFile = (params: any) => {
// 移除企业子账号
export const removeEnterpriseAccount = (userId: number) => {
return Http.delete(`/v1/enterprises/users/${userId}`, { headers: { 'enterprise-id': 1 } });
return Http.delete(`/v1/enterprises/users/${userId}`);
};
// 获取企业邀请码
export const getEnterpriseInviteCode = () => {
return Http.get(`/v1/enterprises/invite-code`, {}, { headers: { 'enterprise-id': 1 } });
return Http.get(`/v1/enterprises/invite-code`);
};
// 根据邀请码获取企业信息
export const getEnterpriseByInviteCode = (inviteCode: string) => {
return Http.get(`/v1/enterprises/by-invite-code`, { invite_code: inviteCode });
};
// 根据邀请码加入企业
export const joinEnterpriseByInviteCode = (inviteCode: string) => {
return Http.post(`/v1/enterprises/join`, { invite_code: inviteCode });
};

View File

@ -8,7 +8,10 @@
import axios from 'axios';
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { useEnterpriseStore } from '@/stores/modules/enterprise';
import pinia from '@/stores';
const store = useEnterpriseStore(pinia);
const enterprise = store.getEnterpriseInfo();
//* 导出Request类可以用来自定义传递配置来创建实例
export class Request {
//* axios 实例
@ -27,6 +30,10 @@ export class Request {
} else {
config.headers!.satoken = '123';
}
if (enterprise) {
config.headers!['enterprise-id'] = enterprise.id;
}
return config;
},
(err: any) => {