Commit 2d348500 authored by 成旭东's avatar 成旭东

楼盘详情 动态 户型图 楼盘图片查询接口分开

parent 8e7db100
Pipeline #28260 passed with stage
in 6 minutes 6 seconds
......@@ -24,12 +24,38 @@ const HouseImage = (props: any) => {
};
const { baseData, isEdite } = props;
const { houseImage = [] } = baseData;
const [houseImage, setHouseImage]: any = useState([]);
const [form] = Form.useForm();
const [currentHouseImage, setCurrentHouseImage]: any = useState([]);
// 获取基础数据
const getImageData = () => {
const params = {
id: baseData.id,
};
const { dispatch } = props;
dispatch({
type: `estateList/fetchEstateImage`,
payload: params,
callback: (ret: any) => {
if (ret.error) {
message.error(ret.error);
} else {
setHouseImage(ret)
}
}
});
};
useEffect(() => {
getImageData();
}, [baseData]);
// 按照创建时间进行排序
const formatTimeHouseImageData = () => {
const returnData = houseImage.sort((a: any, b: any) => {
......@@ -43,7 +69,7 @@ const HouseImage = (props: any) => {
useEffect(() => {
formatTimeHouseImageData();
}, [baseData]);
}, [houseImage]);
const [firstHouseImage, setFirstHouseImage]: any = useState({});
const [firstFlag, setFirstFlag]: any = useState(false);
......@@ -93,7 +119,7 @@ const HouseImage = (props: any) => {
// 添加数据
const addData = () => {
form.validateFields().then((fieldsValue: any) => {
const { dispatch, getBaseData } = props;
const { dispatch } = props;
dispatch({
type: `estateList/addEstateHouseImage`,
......@@ -107,7 +133,7 @@ const HouseImage = (props: any) => {
} else {
message.success('添加成功');
getBaseData();
getImageData();
setFirstFlag(!firstFlag)
}
}
......@@ -142,11 +168,9 @@ const HouseImage = (props: any) => {
const deleteHouseImage = (obj: any, e: any) => {
e.stopPropagation();
const { getBaseData } = props;
if (obj.id) {
deleteData(obj.id, () => {
getBaseData();
getImageData();
});
} else {
message.error('未添加的图片, 不能删除');
......
......@@ -184,12 +184,38 @@ const DrawerForm = (props: any) => {
const HouseType = (props: any) => {
const { baseData, isEdite } = props;
const { houseLayout = [] } = baseData;
const [houseLayout, setHouseLayout]: any = useState([]);
const [form] = Form.useForm();
const [currentLayout, setCurrentLayout]: any = useState([]);
// 获取基础数据
const getLayoutData = () => {
const params = {
id: baseData.id,
};
const { dispatch } = props;
dispatch({
type: `estateList/fetchEstateLayout`,
payload: params,
callback: (ret: any) => {
if (ret.error) {
message.error(ret.error);
} else {
setHouseLayout(ret)
}
}
});
};
useEffect(() => {
getLayoutData();
}, [baseData]);
// 按照创建时间进行排序
const formatTimeHouseTypeData = () => {
const returnData = houseLayout.sort((a: any, b: any) => {
......@@ -203,7 +229,7 @@ const HouseType = (props: any) => {
useEffect(() => {
formatTimeHouseTypeData();
}, [baseData]);
}, [houseLayout]);
const [firstLayout, setFirstLayout]: any = useState({});
const [firstFlag, setFirstFlag]: any = useState(false);
......@@ -226,7 +252,7 @@ const HouseType = (props: any) => {
// 添加数据
const addLayout = () => {
form.validateFields().then((fieldsValue: any) => {
const { dispatch, getBaseData } = props;
const { dispatch } = props;
dispatch({
type: `estateList/addEstateHouseType`,
......@@ -240,7 +266,7 @@ const HouseType = (props: any) => {
} else {
message.success('添加成功');
getBaseData();
getLayoutData();
setFirstFlag(!firstFlag)
}
}
......@@ -309,11 +335,9 @@ const HouseType = (props: any) => {
const deleteHouseType = (obj: any, e: any) => {
e.stopPropagation();
const { getBaseData } = props;
if (obj.id) {
deleteData(obj.id, () => {
getBaseData();
getLayoutData();
});
} else {
message.error('未添加户型, 不能删除');
......@@ -328,8 +352,6 @@ const HouseType = (props: any) => {
// 抽屉确认
const drawerFormOk = (_: any, fieldsValue: any) => {
const { getBaseData } = props;
if (fieldsValue.id) {
const updateId = fieldsValue.id;
// eslint-disable-next-line no-param-reassign
......@@ -339,7 +361,7 @@ const HouseType = (props: any) => {
setEditeObj({});
setDrawerVisible(!drawerVisible);
getBaseData();
getLayoutData();
});
} else {
message.error('未上传户型,不可编辑');
......
......@@ -152,12 +152,38 @@ const DrawerForm = (props: any) => {
const ProjectTrends = (props: any) => {
const { baseData, isEdite } = props;
const { projectTrends = [] } = baseData;
const [projectTrends, setProjectTrends]: any = useState([]);
const [form] = Form.useForm();
const [currentTrend, setCurrentTrend]: any = useState([]);
// 获取基础数据
const getTrendsData = () => {
const params = {
id: baseData.id,
};
const { dispatch } = props;
dispatch({
type: `estateList/fetchEstateTrends`,
payload: params,
callback: (ret: any) => {
if (ret.error) {
message.error(ret.error);
} else {
setProjectTrends(ret)
}
}
});
};
useEffect(() => {
getTrendsData();
}, [baseData]);
// 按照创建时间进行排序
const formatTimeTrendData = () => {
const returnData = projectTrends.sort((a: any, b: any) => {
......@@ -171,7 +197,7 @@ const ProjectTrends = (props: any) => {
useEffect(() => {
formatTimeTrendData();
}, [baseData]);
}, [projectTrends]);
const [firstTrend, setFirstTrend]: any = useState({});
const [firstFlag, setFirstFlag]: any = useState(false);
......@@ -194,7 +220,7 @@ const ProjectTrends = (props: any) => {
// 添加数据
const addTrend = () => {
form.validateFields().then((fieldsValue: any) => {
const { dispatch, getBaseData } = props;
const { dispatch } = props;
dispatch({
type: `estateList/addEstateTrend`,
......@@ -208,7 +234,7 @@ const ProjectTrends = (props: any) => {
} else {
message.success('添加成功');
getBaseData();
getTrendsData();
setFirstFlag(!firstFlag)
}
}
......@@ -260,8 +286,6 @@ const ProjectTrends = (props: any) => {
// 抽屉确认
const drawerFormOk = (_: any, fieldsValue: any) => {
const { getBaseData } = props;
if (fieldsValue.id) {
const updateId = fieldsValue.id;
// eslint-disable-next-line no-param-reassign
......@@ -271,7 +295,7 @@ const ProjectTrends = (props: any) => {
setEditeObj({});
setDrawerVisible(!drawerVisible);
getBaseData();
getTrendsData();
});
} else {
message.error('未上传动态,不可编辑');
......
......@@ -91,13 +91,13 @@ const VideoList: React.FC<any> = (props) => {
)}
</TabPane>
<TabPane tab="楼盘动态" key="3">
<ProjectTrends baseData={baseData} getBaseData={getBaseData} isEdite={isEdite} />
<ProjectTrends baseData={baseData} isEdite={isEdite} />
</TabPane>
<TabPane tab="户型图" key="4">
<HouseType baseData={baseData} getBaseData={getBaseData} isEdite={isEdite} />
<HouseType baseData={baseData} isEdite={isEdite} />
</TabPane>
<TabPane tab="楼盘图片" key="5">
<HouseImage baseData={baseData} getBaseData={getBaseData} isEdite={isEdite} />
<HouseImage baseData={baseData} isEdite={isEdite} />
</TabPane>
</Tabs>
</Card>
......
import {
fetchEstateList,
fetchEstateBase,
fetchEstateTrends,
fetchEstateLayout,
fetchEstateImage,
fetchEstateTag,
updateEstate,
updateEstateProjectTag,
......@@ -46,6 +49,27 @@ const EstateListModel: EstateListModelType = {
callback(response);
}
},
*fetchEstateTrends({ payload, callback }: any, { call }: any) {
const response = yield call(fetchEstateTrends, payload);
if (callback) {
callback(response);
}
},
*fetchEstateLayout({ payload, callback }: any, { call }: any) {
const response = yield call(fetchEstateLayout, payload);
if (callback) {
callback(response);
}
},
*fetchEstateImage({ payload, callback }: any, { call }: any) {
const response = yield call(fetchEstateImage, payload);
if (callback) {
callback(response);
}
},
*fetchEstateTag({ payload, callback }: any, { call }: any) {
const response = yield call(fetchEstateTag, payload);
......
......@@ -13,6 +13,24 @@ export async function fetchEstateBase(query: any) {
});
}
export async function fetchEstateTrends(query: any) {
return request(`/estate/trends/${query.id}`, {
method: 'GET',
});
}
export async function fetchEstateLayout(query: any) {
return request(`/estate/layout/${query.id}`, {
method: 'GET',
});
}
export async function fetchEstateImage(query: any) {
return request(`/estate/image/${query.id}`, {
method: 'GET',
});
}
export async function fetchEstateTag(query: any) {
return request(`/estate/tag/${query.type}`, {
params: query.data,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment