提交 a9923fae 作者: ZhangLingKun

功能:代码优化

上级 ac608a22
流水线 #8126 已通过 于阶段
in 5 分 23 秒
import React from 'react';
import { Button } from 'antd';
import styled from 'styled-components';
import { InterListType } from '@/api/interface';
import { ListTenderInfoType } from '@/api/interface/home';
// 详情类型
type DetailType = InterListType<ListTenderInfoType>[0];
const NewsTenderItem: React.FC<{ detail: DetailType }> = ({ detail }) => {
return (
<NewsTenderWrap>
<div className="title">
<div className="text">{detail?.tenderTitle}</div>
<Button className="action" type="primary">
联系合作
</Button>
</div>
<div className="tags">
<div className="tag">{detail?.tenderPrice}万元</div>
<div className="tag">{detail?.createTime}</div>
</div>
</NewsTenderWrap>
);
};
export default NewsTenderItem;
// 样式
const NewsTenderWrap = styled.div`
position: relative;
width: 86%;
//width: 100%;
box-sizing: border-box;
margin: 0 auto 0.83rem;
min-height: 4.8rem;
background: #ffffff;
box-shadow: 0 0.17rem 1rem 0 rgba(102, 120, 192, 0.11);
border-radius: 0.5rem;
display: flex;
align-items: flex-start;
justify-content: center;
flex-direction: column;
padding: 0.25rem 0.83rem 0.5rem 0.83rem;
cursor: pointer;
.title {
position: relative;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.text {
font-size: 16px;
font-weight: bold;
color: #333333;
margin-bottom: 0.5rem;
}
}
.tags {
position: relative;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
.tag:not(:last-child) {
margin-right: 0.5rem;
}
.tag {
color: #ff552d;
background: #fff5f4;
box-sizing: border-box;
padding: 0 0.5rem;
}
}
`;
...@@ -9,6 +9,7 @@ import LayoutView from '@/components/layout'; ...@@ -9,6 +9,7 @@ import LayoutView from '@/components/layout';
import ProductListView from '@/components/productList'; import ProductListView from '@/components/productList';
import NewsListItem from '@/pages/news/comp/_newsListItem'; import NewsListItem from '@/pages/news/comp/_newsListItem';
import NewsSwiperView from '@/pages/news/comp/_newsSwiper'; import NewsSwiperView from '@/pages/news/comp/_newsSwiper';
import NewsTenderItem from '@/pages/news/comp/_newsTenderItem';
// 新闻列表类型 // 新闻列表类型
type NewsListType = InterListType<ListNewsType>; type NewsListType = InterListType<ListNewsType>;
...@@ -145,11 +146,7 @@ const NewsListView = () => { ...@@ -145,11 +146,7 @@ const NewsListView = () => {
))} ))}
{tabIndex === '2' && {tabIndex === '2' &&
(tenderList?.length ? ( (tenderList?.length ? (
tenderList?.map((i, j) => ( tenderList?.map((i, j) => <NewsTenderItem key={j} detail={i} />)
<div className={'w-full'} key={j}>
{i?.tenderTitle}
</div>
))
) : ( ) : (
<div className="list-empty flex-center"> <div className="list-empty flex-center">
<Empty /> <Empty />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论