|
|
|
@@ -13,6 +13,7 @@ import { |
|
|
|
} from '@/pages/Dataset/config'; |
|
|
|
import GraphLegend from '@/pages/Model/components/GraphLegend'; |
|
|
|
import ModelEvolution from '@/pages/Model/components/ModelEvolution'; |
|
|
|
import { praiseResourceReq, unpraiseResourceReq } from '@/services/dataset'; |
|
|
|
import { VersionChangedMessage } from '@/utils/constant'; |
|
|
|
import { openAntdModal } from '@/utils/modal'; |
|
|
|
import { to } from '@/utils/promise'; |
|
|
|
@@ -189,6 +190,20 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// 处理点赞 |
|
|
|
const handlePraise = async () => { |
|
|
|
const request = info.praised === true ? unpraiseResourceReq : praiseResourceReq; |
|
|
|
const [res] = await to(request(info.id)); |
|
|
|
if (res) { |
|
|
|
message.success('操作成功'); |
|
|
|
setInfo({ |
|
|
|
...info, |
|
|
|
praised: !info.praised, |
|
|
|
praises_count: info.praised ? info.praises_count - 1 : info.praises_count + 1, |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const items = [ |
|
|
|
{ |
|
|
|
key: ResourceInfoTabKeys.Introduction, |
|
|
|
@@ -248,6 +263,9 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { |
|
|
|
{(info[tagPropertyName] as string) || '--'} |
|
|
|
</div> |
|
|
|
)} |
|
|
|
<Button type="primary" onClick={handlePraise}> |
|
|
|
{info.praised ? '取消点赞' : '点赞'} {info.praises_count} |
|
|
|
</Button> |
|
|
|
</Flex> |
|
|
|
<Flex align="center"> |
|
|
|
<span style={{ marginRight: '10px' }}>版本号:</span> |
|
|
|
|