Commit adbe0ad2 authored by wuhao's avatar wuhao 🎯

asd

parent 78dfaa70
......@@ -75,7 +75,7 @@ export default function DraggableDialog({
loadingPosition="start"
startIcon={<SendOutlined />}
onClick={() => {
console.log(formRef?.current?.submit());
formRef?.current?.submit();
}}
>
提交
......
......@@ -4,7 +4,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
import font from './font/iconfont'
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;
......@@ -1111,21 +1111,14 @@ function UploadImg({ value, onChange, fieldProps }) {
accept: ".jpg,.png,.jpeg",
listType: "picture-card",
beforeUpload: beforeUpload,
defaultFileList: value,
fileList: value,
headers: { token },
onChange(info) {
let {
file: { status },
fileList,
} = info;
if (status == "error") {
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);
}
onChange(fileList);
},
onRemove(file) {
let uid = file?.response?.data?.dataList[0]?.uid ?? file?.uid;
......@@ -1206,13 +1199,26 @@ function UploadImage({ item, colProps }) {
let col = item.colProps ?? colProps;
return (
<Col {...col}>
<Form.Item
<ProForm.Item
name={item.key ?? item.dataIndex}
label={item.title}
{...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 }} />
</Form.Item>
</ProForm.Item>
</Col>
);
}
......
......@@ -158,7 +158,7 @@ function InitForm({
}}
autoFocusFirstInput
onValuesChange={(changedValues, allValues) => {
onValuesChange?.(changedValues, allValues);
onValuesChange?.(changedValues, allValues,proformRef);
}}
>
<FormRender
......
......@@ -64,6 +64,7 @@ export default function ShopProductCard({
zIndex: 9,
top: 20,
left: 20,
position: "absolute",
textTransform: "uppercase",
}}
......@@ -82,6 +83,7 @@ export default function ShopProductCard({
sx={{ borderRadius: 2, overflow: "hidden" }}
>
<Box className="masker"></Box>
{type == 1 && (
<Box className="edit">
<Tooltip title="编辑">
<IconButton
......@@ -94,6 +96,7 @@ export default function ShopProductCard({
></EditIcon>
</IconButton>
</Tooltip>
<Tooltip title={confirm ? "确认删除" : "删除"}>
{confirm ? (
<IconButton
......@@ -101,12 +104,15 @@ export default function ShopProductCard({
onClick={() => {
remove(product);
}}
sx={{ marginLeft: 2 }}
>
<CheckIcon
style={{
fontSize: 20,
color:
confirm === "1" ? colors.grey[500] : colors.green[500],
confirm === "1"
? colors.grey[500]
: colors.green[500],
}}
></CheckIcon>
</IconButton>
......@@ -117,7 +123,7 @@ export default function ShopProductCard({
setTimeout(() => {
setconfirm(true);
}, 1000);
}, 200);
setTimeout(() => {
setconfirm(false);
......@@ -131,74 +137,19 @@ export default function ShopProductCard({
)}
</Tooltip>
</Box>
)}
<Stack
direction="row"
alignItems="center"
justifyContent="space-around"
justifyContent="space-between"
width={"100%"}
className="stackani"
padding={"0px 12px"}
>
<Tooltip title="备课">
<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>
<div></div>
{type == 2 && (
{type !== 3 && (
<Tooltip title={shut ? "确认关闭" : "关闭"}>
{shut ? (
<IconButton
......@@ -222,7 +173,7 @@ export default function ShopProductCard({
setTimeout(() => {
setshut(true);
}, 1000);
}, 200);
setTimeout(() => {
setshut(false);
......@@ -249,9 +200,12 @@ export default function ShopProductCard({
overflow={"hidden"}
alignItems={"center"}
>
<Tooltip title={courseName}>
<Typography variant="subtitle2" noWrap>
{courseName}
</Typography>
</Tooltip>
<Box width={60} textAlign={"right"} flexShrink={0}>
<Tooltip title={createTime}>
<Typography
......@@ -266,6 +220,83 @@ export default function ShopProductCard({
</Tooltip>
</Box>
</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>
</Card>
);
......
......@@ -48,7 +48,8 @@ export default function ShopProductLoadingCard({ product, loading }) {
/>
</Box>
<Stack spacing={2} sx={{ p: 2 }}>
<Stack spacing={2} sx={{ p: 2.5 }}>
<Skeleton animation="wave"/>
<Skeleton animation="wave"/>
</Stack>
</Card>
......
This diff is collapsed.
This diff is collapsed.
......@@ -569,7 +569,7 @@ h4 {
.edit {
position: absolute;
top: 8px;
right: 8px;
right: 11px;
transform: translateY(-80px);
}
......
......@@ -2,8 +2,8 @@ import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductCard from "@/components/ProductCard";
import ShopProductLoadingCard from "@/components/ProductCard/loading";
import ShopProductCard from "@/components/ProductCard/sxcard";
import { doFetch } from "@/utils/doFetch";
import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material";
......@@ -51,6 +51,7 @@ function Lessons() {
);
const edit = (row) => {
console.log(row);
setdialogprops({
open: true,
defaultFormValue: { ...row },
......@@ -120,7 +121,6 @@ function Lessons() {
dataIndex: "deadline",
key: "deadline",
valueType: "date",
},
{
title: "实训封面",
......@@ -152,6 +152,27 @@ function Lessons() {
<InitForm
fields={columns}
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) => {
let postdata = { ...val },
url = "/busTrain/saveOrUpdate";
......@@ -270,7 +291,7 @@ function Lessons() {
{datalist?.loading && !datalist?.data ? (
PRODUCTS?.map((product, i) => {
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} />
</Grid>
);
......@@ -281,7 +302,7 @@ function Lessons() {
</Grid>
) : (
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
product={product}
loading={datalist?.loading}
......
......@@ -257,7 +257,7 @@ function Lessons() {
{datalist?.loading && !datalist?.data ? (
PRODUCTS?.map((product, i) => {
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} />
</Grid>
);
......@@ -268,7 +268,7 @@ function Lessons() {
</Grid>
) : (
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
product={product}
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