Commit adbe0ad2 authored by wuhao's avatar wuhao 🎯

asd

parent 78dfaa70
...@@ -75,7 +75,7 @@ export default function DraggableDialog({ ...@@ -75,7 +75,7 @@ export default function DraggableDialog({
loadingPosition="start" loadingPosition="start"
startIcon={<SendOutlined />} startIcon={<SendOutlined />}
onClick={() => { onClick={() => {
console.log(formRef?.current?.submit()); formRef?.current?.submit();
}} }}
> >
提交 提交
......
...@@ -4,7 +4,7 @@ import { createFromIconfontCN } from '@ant-design/icons'; ...@@ -4,7 +4,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
import font from './font/iconfont' import font from './font/iconfont'
const IconFont = createFromIconfontCN({ const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/c/font_4010447_84s57xv2oi7.js', scriptUrl: '//at.alicdn.com/t/c/font_4010447_t59htoi0vc8.js',
}); });
export default IconFont; export default IconFont;
...@@ -1111,21 +1111,14 @@ function UploadImg({ value, onChange, fieldProps }) { ...@@ -1111,21 +1111,14 @@ function UploadImg({ value, onChange, fieldProps }) {
accept: ".jpg,.png,.jpeg", accept: ".jpg,.png,.jpeg",
listType: "picture-card", listType: "picture-card",
beforeUpload: beforeUpload, beforeUpload: beforeUpload,
defaultFileList: value, fileList: value,
headers: { token }, headers: { token },
onChange(info) { onChange(info) {
let { let {
file: { status }, file: { status },
fileList, fileList,
} = info; } = info;
if (status == "error") { onChange(fileList);
message.error(`${info.file.name} 上传失败`);
} else if (status === "done") {
const transfile = fileList.map((it) => {
return it?.response ? it?.response.data.dataList[0] : it;
});
onChange(transfile);
}
}, },
onRemove(file) { onRemove(file) {
let uid = file?.response?.data?.dataList[0]?.uid ?? file?.uid; let uid = file?.response?.data?.dataList[0]?.uid ?? file?.uid;
...@@ -1206,13 +1199,26 @@ function UploadImage({ item, colProps }) { ...@@ -1206,13 +1199,26 @@ function UploadImage({ item, colProps }) {
let col = item.colProps ?? colProps; let col = item.colProps ?? colProps;
return ( return (
<Col {...col}> <Col {...col}>
<Form.Item <ProForm.Item
name={item.key ?? item.dataIndex} name={item.key ?? item.dataIndex}
label={item.title} label={item.title}
{...item.formItemProps} {...item.formItemProps}
transform={(value) => {
const key = item.key ?? item.dataIndex;
const transvalue = value?.map((it) => {
if (it.response) {
return it?.response?.data?.dataList[0];
} else {
return it;
}
});
return {
[key]: transvalue,
};
}}
> >
<UploadImg fieldProps={{ ...item?.fieldProps }} /> <UploadImg fieldProps={{ ...item?.fieldProps }} />
</Form.Item> </ProForm.Item>
</Col> </Col>
); );
} }
......
...@@ -158,7 +158,7 @@ function InitForm({ ...@@ -158,7 +158,7 @@ function InitForm({
}} }}
autoFocusFirstInput autoFocusFirstInput
onValuesChange={(changedValues, allValues) => { onValuesChange={(changedValues, allValues) => {
onValuesChange?.(changedValues, allValues); onValuesChange?.(changedValues, allValues,proformRef);
}} }}
> >
<FormRender <FormRender
......
...@@ -64,6 +64,7 @@ export default function ShopProductCard({ ...@@ -64,6 +64,7 @@ export default function ShopProductCard({
zIndex: 9, zIndex: 9,
top: 20, top: 20,
left: 20, left: 20,
position: "absolute", position: "absolute",
textTransform: "uppercase", textTransform: "uppercase",
}} }}
...@@ -82,123 +83,73 @@ export default function ShopProductCard({ ...@@ -82,123 +83,73 @@ export default function ShopProductCard({
sx={{ borderRadius: 2, overflow: "hidden" }} sx={{ borderRadius: 2, overflow: "hidden" }}
> >
<Box className="masker"></Box> <Box className="masker"></Box>
<Box className="edit"> {type == 1 && (
<Tooltip title="编辑"> <Box className="edit">
<IconButton <Tooltip title="编辑">
onClick={() => {
edit(product);
}}
>
<EditIcon
style={{ fontSize: 20, color: colors.blue[200] }}
></EditIcon>
</IconButton>
</Tooltip>
<Tooltip title={confirm ? "确认删除" : "删除"}>
{confirm ? (
<IconButton <IconButton
disabled={confirm === "1"}
onClick={() => { onClick={() => {
remove(product); edit(product);
}} }}
> >
<CheckIcon <EditIcon
style={{ style={{ fontSize: 20, color: colors.blue[200] }}
fontSize: 20, ></EditIcon>
color:
confirm === "1" ? colors.grey[500] : colors.green[500],
}}
></CheckIcon>
</IconButton> </IconButton>
) : ( </Tooltip>
<IconButton
onClick={() => {
setconfirm("1");
setTimeout(() => { <Tooltip title={confirm ? "确认删除" : "删除"}>
setconfirm(true); {confirm ? (
}, 1000); <IconButton
disabled={confirm === "1"}
onClick={() => {
remove(product);
}}
sx={{ marginLeft: 2 }}
>
<CheckIcon
style={{
fontSize: 20,
color:
confirm === "1"
? colors.grey[500]
: colors.green[500],
}}
></CheckIcon>
</IconButton>
) : (
<IconButton
onClick={() => {
setconfirm("1");
setTimeout(() => { setTimeout(() => {
setconfirm(false); setconfirm(true);
}, 3000); }, 200);
}}
> setTimeout(() => {
<DeleteIcon setconfirm(false);
style={{ fontSize: 20, color: colors.red[500] }} }, 3000);
></DeleteIcon> }}
</IconButton> >
)} <DeleteIcon
</Tooltip> style={{ fontSize: 20, color: colors.red[500] }}
</Box> ></DeleteIcon>
</IconButton>
)}
</Tooltip>
</Box>
)}
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
justifyContent="space-around" justifyContent="space-between"
width={"100%"} width={"100%"}
className="stackani" className="stackani"
padding={"0px 12px"}
> >
<Tooltip title="备课"> <div></div>
<IconButton
onClick={() => {
history.push("/work/dolessons/" + product.id);
}}
>
<IconFont
type="icon-beike"
style={{ fontSize: 20, color: "#ffffff" }}
></IconFont>
</IconButton>
</Tooltip>
<Tooltip title="授权">
<IconButton
onClick={() => {
authorized(product);
}}
>
<IconFont
type="icon-shouquanguanli"
style={{ fontSize: 20, color: "#ffffff" }}
></IconFont>
</IconButton>
</Tooltip>
{type == 3 ? null : (
<Tooltip title={type == 1 ? "发布" : type == 2 ? "取消发布" : ""}>
<IconButton
onClick={() => {
publish(product);
}}
>
{type == 1 ? (
<IconFont
type="icon-fabu"
style={{ fontSize: 20, color: "#ffffff" }}
></IconFont>
) : (
<IconFont
type="icon-undo"
style={{ fontSize: 20, color: "#ffffff" }}
></IconFont>
)}
</IconButton>
</Tooltip>
)}
<Tooltip title="复制创建">
<IconButton
onClick={() => {
copy(product);
}}
>
<IconFont
type="icon-fuzhi"
style={{ fontSize: 20, color: "#ffffff" }}
></IconFont>
</IconButton>
</Tooltip>
{type == 2 && ( {type !== 3 && (
<Tooltip title={shut ? "确认关闭" : "关闭"}> <Tooltip title={shut ? "确认关闭" : "关闭"}>
{shut ? ( {shut ? (
<IconButton <IconButton
...@@ -222,7 +173,7 @@ export default function ShopProductCard({ ...@@ -222,7 +173,7 @@ export default function ShopProductCard({
setTimeout(() => { setTimeout(() => {
setshut(true); setshut(true);
}, 1000); }, 200);
setTimeout(() => { setTimeout(() => {
setshut(false); setshut(false);
...@@ -249,9 +200,12 @@ export default function ShopProductCard({ ...@@ -249,9 +200,12 @@ export default function ShopProductCard({
overflow={"hidden"} overflow={"hidden"}
alignItems={"center"} alignItems={"center"}
> >
<Typography variant="subtitle2" noWrap> <Tooltip title={courseName}>
{courseName} <Typography variant="subtitle2" noWrap>
</Typography> {courseName}
</Typography>
</Tooltip>
<Box width={60} textAlign={"right"} flexShrink={0}> <Box width={60} textAlign={"right"} flexShrink={0}>
<Tooltip title={createTime}> <Tooltip title={createTime}>
<Typography <Typography
...@@ -266,6 +220,83 @@ export default function ShopProductCard({ ...@@ -266,6 +220,83 @@ export default function ShopProductCard({
</Tooltip> </Tooltip>
</Box> </Box>
</Stack> </Stack>
<Stack
direction={"row"}
justifyContent={"space-between"}
alignItems={"center"}
>
<Stack direction={"row"} spacing={1}>
{type == 3 ? (
<div></div>
) : (
<Tooltip title={type == 1 ? "发布" : type == 2 ? "取消发布" : ""}>
<IconButton
onClick={() => {
publish(product);
}}
>
{type == 1 ? (
<IconFont
type="icon-fabu"
style={{ fontSize: 20, color: colors.blue[600] }}
></IconFont>
) : (
<IconFont
type="icon-undo"
style={{ fontSize: 20, color: colors.red[600] }}
></IconFont>
)}
</IconButton>
</Tooltip>
)}
{type === 1 ? (
<Tooltip title="授权">
<IconButton
onClick={() => {
authorized(product);
}}
>
<IconFont
type="icon-shouquanguanli"
style={{ fontSize: 20, color: colors.blue[600] }}
></IconFont>
</IconButton>
</Tooltip>
) : (
<div></div>
)}
</Stack>
<Stack direction={"row"} spacing={1}>
{type === 1 && (
<Tooltip title="备课">
<IconButton
onClick={() => {
history.push("/work/dolessons/" + product.id);
}}
>
<IconFont
type="icon-beike"
style={{ fontSize: 20, color: "#333333" }}
></IconFont>
</IconButton>
</Tooltip>
)}
<Tooltip title="复制创建">
<IconButton
onClick={() => {
copy(product);
}}
>
<IconFont
type="icon-fuzhi"
style={{ fontSize: 20, color: "#333" }}
></IconFont>
</IconButton>
</Tooltip>
</Stack>
</Stack>
</Stack> </Stack>
</Card> </Card>
); );
......
...@@ -48,7 +48,8 @@ export default function ShopProductLoadingCard({ product, loading }) { ...@@ -48,7 +48,8 @@ export default function ShopProductLoadingCard({ product, loading }) {
/> />
</Box> </Box>
<Stack spacing={2} sx={{ p: 2 }}> <Stack spacing={2} sx={{ p: 2.5 }}>
<Skeleton animation="wave"/>
<Skeleton animation="wave"/> <Skeleton animation="wave"/>
</Stack> </Stack>
</Card> </Card>
......
This diff is collapsed.
This diff is collapsed.
...@@ -569,7 +569,7 @@ h4 { ...@@ -569,7 +569,7 @@ h4 {
.edit { .edit {
position: absolute; position: absolute;
top: 8px; top: 8px;
right: 8px; right: 11px;
transform: translateY(-80px); transform: translateY(-80px);
} }
......
...@@ -2,8 +2,8 @@ import DraggableDialog from "@/components/DraggableDialog"; ...@@ -2,8 +2,8 @@ import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel"; import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import ShopProductCard from "@/components/ProductCard";
import ShopProductLoadingCard from "@/components/ProductCard/loading"; import ShopProductLoadingCard from "@/components/ProductCard/loading";
import ShopProductCard from "@/components/ProductCard/sxcard";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import PRODUCTS from "@/_mock/products"; import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Stack, Typography } from "@mui/material";
...@@ -51,6 +51,7 @@ function Lessons() { ...@@ -51,6 +51,7 @@ function Lessons() {
); );
const edit = (row) => { const edit = (row) => {
console.log(row);
setdialogprops({ setdialogprops({
open: true, open: true,
defaultFormValue: { ...row }, defaultFormValue: { ...row },
...@@ -120,7 +121,6 @@ function Lessons() { ...@@ -120,7 +121,6 @@ function Lessons() {
dataIndex: "deadline", dataIndex: "deadline",
key: "deadline", key: "deadline",
valueType: "date", valueType: "date",
}, },
{ {
title: "实训封面", title: "实训封面",
...@@ -152,6 +152,27 @@ function Lessons() { ...@@ -152,6 +152,27 @@ function Lessons() {
<InitForm <InitForm
fields={columns} fields={columns}
defaultFormValue={dialogprops?.defaultFormValue} defaultFormValue={dialogprops?.defaultFormValue}
onValuesChange={async (changedValues, allValues, formRef) => {
console.log(changedValues);
if (Object.keys(changedValues)[0] === "courseId") {
let id = Object.values(changedValues)?.[0] ?? null;
let res = await doFetch({
url: "/sysCourse/detail",
params: { id },
});
let pic = res?.data?.data?.pic ?? [];
console.log(pic);
formRef?.current?.setFieldsValue({
pic: [
{
uid: "1655501390426017792",
url: "https://ng-website.oss-cn-hangzhou.aliyuncs.com/2023/05/08/1655501389482299392Bl6w2X.jpg",
name: "a1.jpg",
},
],
});
}
}}
onFinish={(val, extra) => { onFinish={(val, extra) => {
let postdata = { ...val }, let postdata = { ...val },
url = "/busTrain/saveOrUpdate"; url = "/busTrain/saveOrUpdate";
...@@ -270,7 +291,7 @@ function Lessons() { ...@@ -270,7 +291,7 @@ function Lessons() {
{datalist?.loading && !datalist?.data ? ( {datalist?.loading && !datalist?.data ? (
PRODUCTS?.map((product, i) => { PRODUCTS?.map((product, i) => {
return ( return (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}> <Grid key={product.id} item xs={12} sm={6} md={4} lg={3} xl={2.4}>
<ShopProductLoadingCard product={product} /> <ShopProductLoadingCard product={product} />
</Grid> </Grid>
); );
...@@ -281,7 +302,7 @@ function Lessons() { ...@@ -281,7 +302,7 @@ function Lessons() {
</Grid> </Grid>
) : ( ) : (
datalist?.data?.map?.((product) => ( datalist?.data?.map?.((product) => (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}> <Grid key={product.id} item xs={12} sm={6} md={4} lg={3} xl={2.4}>
<ShopProductCard <ShopProductCard
product={product} product={product}
loading={datalist?.loading} loading={datalist?.loading}
......
...@@ -257,7 +257,7 @@ function Lessons() { ...@@ -257,7 +257,7 @@ function Lessons() {
{datalist?.loading && !datalist?.data ? ( {datalist?.loading && !datalist?.data ? (
PRODUCTS?.map((product, i) => { PRODUCTS?.map((product, i) => {
return ( return (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}> <Grid key={product.id} item xs={12} sm={6} md={4} lg={3} xl={2.4}>
<ShopProductLoadingCard product={product} /> <ShopProductLoadingCard product={product} />
</Grid> </Grid>
); );
...@@ -268,7 +268,7 @@ function Lessons() { ...@@ -268,7 +268,7 @@ function Lessons() {
</Grid> </Grid>
) : ( ) : (
datalist?.data?.map?.((product) => ( datalist?.data?.map?.((product) => (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}> <Grid key={product.id} item xs={12} sm={6} md={4} lg={3} xl={2.4}>
<ShopProductCard <ShopProductCard
product={product} product={product}
loading={datalist?.loading} loading={datalist?.loading}
......
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