import PropTypes from "prop-types"; // @mui import { Box, Card, colors, IconButton, Stack, Tooltip, Typography, } from "@mui/material"; import { styled } from "@mui/material/styles"; // utils // components import IconFont from "@/components/IconFont"; import Label from "@/components/label"; import difftime from "@/utils/difftime"; import CheckIcon from "@mui/icons-material/Check"; import DeleteIcon from "@mui/icons-material/Delete"; import EditIcon from "@mui/icons-material/Edit"; import { history } from "@umijs/max"; import dayjs from "dayjs"; import { useState } from "react"; // ---------------------------------------------------------------------- const StyledProductImg = styled("img")({ top: 0, width: "92%", height: "92%", marginTop: "4%", objectFit: "cover", position: "absolute", }); // ---------------------------------------------------------------------- ShopProductCard.propTypes = { product: PropTypes.object, }; export default function ShopProductCard({ product, remove, edit, copy, publish, authorized, }) { const { courseName, picUrl, createTime, typeName, type } = product; const [confirm, setconfirm] = useState(false); const [shut, setshut] = useState(false); return ( {typeName && ( )} {type == 1 && ( { edit(product); }} > {confirm ? ( { remove(product); }} sx={{ marginLeft: 2 }} > ) : ( { setconfirm("1"); setTimeout(() => { setconfirm(true); }, 200); setTimeout(() => { setconfirm(false); }, 3000); }} > )} )}
{type !== 3 && ( {shut ? ( { publish(product, { type: 3 }); }} > ) : ( { setshut("1"); setTimeout(() => { setshut(true); }, 200); setTimeout(() => { setshut(false); }, 3000); }} > )} )}
{courseName} {difftime(dayjs(), dayjs(createTime))} {type == 3 ? (
) : ( { publish(product); }} > {type == 1 ? ( ) : ( )} )} {type === 1 ? ( { authorized(product); }} > ) : (
)}
{type === 1 && ( { history.push("/work/dolessons/" + product.id); }} > )} { copy(product); }} >
); }