29 lines
901 B
JavaScript
Executable File
29 lines
901 B
JavaScript
Executable File
import { getApiBase } from '../utils/apiConfig';
|
||
// src/services/industryService.js
|
||
import axios from 'axios';
|
||
|
||
// 判断当前是否是生产环境
|
||
const isProduction = process.env.NODE_ENV === 'production';
|
||
|
||
const API_BASE_URL = getApiBase();
|
||
|
||
// 配置 axios 默认包含 credentials
|
||
axios.defaults.withCredentials = true;
|
||
|
||
export const industryService = {
|
||
/**
|
||
* 获取行业分类完整树形结构
|
||
* @param {string} classification - 可选,指定分类体系名称,不传则返回所有
|
||
* @returns {Promise} 返回树形结构数据
|
||
*/
|
||
async getClassifications(classification) {
|
||
let url = `${API_BASE_URL}/api/classifications`;
|
||
if (classification) {
|
||
url += `?classification=${encodeURIComponent(classification)}`;
|
||
}
|
||
const res = await axios.get(url);
|
||
return res.data;
|
||
}
|
||
|
||
// 注意:getLevels 接口已废弃,使用 getClassifications 替代
|
||
};
|