Skip to content

Commit 06da2f5

Browse files
committed
update
1 parent 681a41a commit 06da2f5

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

src/pages/list/list/index.tsx

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ const TableList: React.FC = () => {
205205
render: (dom: any) => {
206206
if (!item.hideInTable && item.table && item.table.type === 'image') {
207207
if (Array.isArray(dom)) {
208-
return dom.map((i: any) => <Image height={100} src={i?.thumbUrl} />);
208+
return dom.map((i: any) => <Image height={100} src={i} />);
209209
} else {
210-
return <Image height={100} src={dom[0]?.thumbUrl} />;
210+
return <Image height={100} src={dom} />;
211211
}
212212
}
213213
if (!item.hideInTable && item.table && item.table.type === 'time') {
@@ -292,9 +292,9 @@ const TableList: React.FC = () => {
292292
render: (text: any) => {
293293
if (!item.hideInTable && item.view && item.view.type === 'image') {
294294
if (Array.isArray(text)) {
295-
return text.map((i: any) => <Image height={300} src={i?.thumbUrl} />);
295+
return text.map((i: any) => <Image height={300} src={i} />);
296296
} else {
297-
return <Image height={300} src={text[0]?.thumbUrl} />;
297+
return <Image height={300} src={text} />;
298298
}
299299
}
300300
if (!item.hideInTable && item.view && item.view.type === 'time') {
@@ -358,7 +358,10 @@ const TableList: React.FC = () => {
358358
ghost={true}
359359
rowKey="id"
360360
search={{
361-
labelWidth: 80,
361+
labelWidth: 100,
362+
optionRender: (searchConfig, formProps, dom) => {
363+
return dom;
364+
},
362365
}}
363366
toolBarRender={() => [
364367
<Button
@@ -490,6 +493,9 @@ const TableList: React.FC = () => {
490493
visible={createModalVisible}
491494
onVisibleChange={handleModalVisible}
492495
onFinish={async (value) => {
496+
if (value.images) {
497+
value.images = [value.images];
498+
}
493499
const success = await handleAdd(value as TableListItem);
494500
if (success) {
495501
handleModalVisible(false);
@@ -529,20 +535,20 @@ const TableList: React.FC = () => {
529535
form = (
530536
<ProFormSwitch {...item.create} label={item.title} name={item.dataIndex} />
531537
);
532-
case 'image':
533-
form = (
534-
<ProFormUploadButton
535-
fieldProps={{
536-
name: 'file',
537-
listType: 'picture-card',
538-
}}
539-
action="/upload.do"
540-
{...item.create}
541-
label={item.title}
542-
name={item.dataIndex}
543-
/>
544-
);
545-
break;
538+
// case 'image':
539+
// form = (
540+
// <ProFormUploadButton
541+
// fieldProps={{
542+
// name: 'file',
543+
// listType: 'picture-card',
544+
// }}
545+
// action="/upload.do"
546+
// {...item.create}
547+
// label={item.title}
548+
// name={item.dataIndex}
549+
// />
550+
// );
551+
// break;
546552
}
547553
return form;
548554
})}
@@ -557,6 +563,9 @@ const TableList: React.FC = () => {
557563
visible={updateModalVisible}
558564
onVisibleChange={handleUpdateModalVisible}
559565
onFinish={async (value) => {
566+
if (value.images) {
567+
value.images = [value.images];
568+
}
560569
const success = await handleEdit(value as TableListItem);
561570
if (success) {
562571
handleUpdateModalVisible(false);
@@ -590,19 +599,19 @@ const TableList: React.FC = () => {
590599
case 'switch':
591600
form = <ProFormSwitch {...item.edit} label={item.title} name={item.dataIndex} />;
592601
break;
593-
case 'image':
594-
form = (
595-
<ProFormUploadButton
596-
fieldProps={{
597-
name: 'file',
598-
listType: 'picture-card',
599-
}}
600-
action="/upload.do"
601-
{...item.create}
602-
label={item.title}
603-
name={item.dataIndex}
604-
/>
605-
);
602+
// case 'image':
603+
// form = (
604+
// <ProFormUploadButton
605+
// fieldProps={{
606+
// name: 'file',
607+
// listType: 'picture-card',
608+
// }}
609+
// action="/upload.do"
610+
// {...item.create}
611+
// label={item.title}
612+
// name={item.dataIndex}
613+
// />
614+
// );
606615
break;
607616
}
608617
return form;

src/pages/list/search/projects/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Projects: FC = () => {
126126
<Card
127127
className={styles.card}
128128
hoverable
129-
cover={<img alt={item.name} src={item.images[0].thumbUrl} />}
129+
cover={<img alt={item.name} src={item.images[0]} />}
130130
>
131131
<Card.Meta
132132
title={<a>{item.name}</a>}

src/pages/list/search/projects/style.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
line-height: 22px;
1919
}
2020
}
21-
2221
&:hover {
2322
:global {
2423
.ant-card-meta-title > a {
@@ -45,6 +44,12 @@
4544
}
4645
.cardList {
4746
margin-top: 24px;
47+
.ant-card-cover {
48+
img {
49+
height: 300px;
50+
object-fit: contain;
51+
}
52+
}
4853
}
4954

5055
:global {

0 commit comments

Comments
 (0)