feat(component): 添加组件基本信息获取功能

- 新增获取组件基本信息的API接口
- 在组件开发页面集成基础信息展示
- 添加当前组件信息的状态管理
- 实现组件加载时自动获取基础信息
- 完善相关类型定义和错误处理
- 更新组件编码页面的状态注释说明
master
钟良源 3 months ago
parent b6053e9abf
commit 473ffc6d42

@ -12,3 +12,8 @@ export function getComponentDesign(componentBaseId) {
export function updateComponentDesign(params) {
return axios.post(`${urlPrefix}/componentDevelopProcess/design`, params);
}
// 获取组件基本信息
export function getComponentBaseInfo(componentBaseId) {
return axios.get(`${urlPrefix}/componentDevelopProcess/baseInfo?componentBaseId=${componentBaseId}`);
}

@ -5,14 +5,16 @@ import { IconFullscreen, IconFullscreenExit } from '@arco-design/web-react/icon'
import { useSelector, useDispatch } from 'react-redux';
import { getMyComponentList } from '@/api/componentBase';
import { updateComponentCodingPath } from '@/store/ideContainer';
import { getComponentBaseInfo } from '@/api/componentDevelopProcess';
const Option = Select.Option;
const ComponentCoding = () => {
const [serverUrl, setServerUrl] = useState('');
const [optionsList, setOptionsList] = useState([]);
const [originList, setOriginList] = useState([]);
const [isFullscreen, setIsFullscreen] = useState(false);
const [serverUrl, setServerUrl] = useState(''); // code-server 地址
const [optionsList, setOptionsList] = useState([]); // 下拉选择菜单
const [originList, setOriginList] = useState([]); // 原始数据-组件列表
const [currentComponent, setCurrentComponent] = useState({}); // 当前组件信息
const [isFullscreen, setIsFullscreen] = useState(false); // 全屏状态
const iframeRef = useRef(null);
const { componentCoding } = useSelector((state: any) => state.ideContainer);
const dispatch = useDispatch();
@ -30,11 +32,19 @@ const ComponentCoding = () => {
}
};
const getComponentInfo = async () => {
const res: any = await getComponentBaseInfo(componentCoding.id);
if (res.code === 200) {
setCurrentComponent(res.data);
}
};
useEffect(() => {
getOptionsList();
}, []);
useEffect(() => {
getComponentInfo();
const uri = process.env.NEXT_PUBLIC_DEV_CODE_SERVER_HOST;
const codeServerFolderPre = '/app/data';

Loading…
Cancel
Save