Commit d146a050 authored by krysent's avatar krysent

ccc

parent 480ef123
...@@ -41,7 +41,7 @@ const EditTable = (props) => { ...@@ -41,7 +41,7 @@ const EditTable = (props) => {
} }
const result = await doFetch({ url: path, params: newparams }); const result = await doFetch({ url: path, params: newparams });
//分页结果 //分页结果
let data = result?.data?.page?.list, let data = result?.data?.page?.records,
success = true, success = true,
total = result?.data?.page?.total; total = result?.data?.page?.total;
//不带分页获取结果 //不带分页获取结果
......
...@@ -85,8 +85,8 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => { ...@@ -85,8 +85,8 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => {
function InitForm({ function InitForm({
formRef, formRef,
onFinish = (vals,extra) => { onFinish = (vals, extra) => {
console.log(vals,extra); console.log(vals, extra);
}, },
formKey, formKey,
params = {}, params = {},
...@@ -115,6 +115,7 @@ function InitForm({ ...@@ -115,6 +115,7 @@ function InitForm({
? submitter ? submitter
: { : {
render: (props, doms) => { render: (props, doms) => {
console.log("submitterProps", props);
return [ return [
<Button <Button
type="reset" type="reset"
...@@ -127,7 +128,10 @@ function InitForm({ ...@@ -127,7 +128,10 @@ function InitForm({
type="submit" type="submit"
key="submit" key="submit"
variant="contained" variant="contained"
onClick={() => props.form?.submit?.()} onClick={(e) => {
e.preventDefault();
return props.form?.submit?.()
}}
> >
提交 提交
</Button>, </Button>,
......
...@@ -39,7 +39,7 @@ ShopProductCard.propTypes = { ...@@ -39,7 +39,7 @@ ShopProductCard.propTypes = {
product: PropTypes.object, product: PropTypes.object,
}; };
export default function ShopProductCard({ product, remove, edit, publish }) { export default function ShopProductCard({ product, remove, edit, publish,authorized }) {
const { courseName, picUrl, createTime, statusName, type } = product; const { courseName, picUrl, createTime, statusName, type } = product;
const [confirm, setconfirm] = useState(false); const [confirm, setconfirm] = useState(false);
const [shut, setshut] = useState(false); const [shut, setshut] = useState(false);
...@@ -143,7 +143,11 @@ export default function ShopProductCard({ product, remove, edit, publish }) { ...@@ -143,7 +143,11 @@ export default function ShopProductCard({ product, remove, edit, publish }) {
</IconButton> </IconButton>
</Tooltip> </Tooltip>
<Tooltip title="授权"> <Tooltip title="授权">
<IconButton> <IconButton
onClick={() => {
authorized(product)
}}
>
<IconFont <IconFont
type="icon-shouquanguanli" type="icon-shouquanguanli"
style={{ fontSize: 20, color: "#ffffff" }} style={{ fontSize: 20, color: "#ffffff" }}
......
This diff is collapsed.
This diff is collapsed.
...@@ -608,3 +608,15 @@ h4 { ...@@ -608,3 +608,15 @@ h4 {
} }
} }
} }
.selecttable {
.ant-pro-table-list-toolbar-container{
margin-bottom: 24px!important;
}
.ant-pagination-options {
>div{
width: auto!important;
}
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -9,11 +9,10 @@ import PRODUCTS from "@/_mock/products"; ...@@ -9,11 +9,10 @@ import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, message } from "antd"; import { Empty, message } from "antd";
import { useMemo, useRef, useState } from "react"; import { useMemo, useState } from "react";
import "./index.less"; import "./index.less";
function Lessons() { function Lessons() {
const actionRef = useRef();
const [dialogprops, setdialogprops] = useState({ const [dialogprops, setdialogprops] = useState({
open: false, open: false,
}); });
...@@ -59,6 +58,24 @@ function Lessons() { ...@@ -59,6 +58,24 @@ function Lessons() {
}); });
}; };
const authorized = (row) => {
doFetch({
url: "/sysCourseTeacher/queryRelationTeacher",
params: { courseId: row?.id },
}).then((res) => {
if (res.code === "0000") {
console.log(res?.data?.dataList);
setdialogprops({
open: true,
maxWidth: "xl",
defaultFormValue: { ...row },
teacherIdList: res?.data?.dataList,
title: "授权",
});
}
});
};
const remove = (row) => { const remove = (row) => {
runAsync({ runAsync({
url: "/sysCourse/delete", url: "/sysCourse/delete",
...@@ -109,29 +126,88 @@ function Lessons() { ...@@ -109,29 +126,88 @@ function Lessons() {
dialogprops={dialogprops} dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "xs"} maxWidth={dialogprops?.maxWidth ?? "xs"}
> >
<InitForm {dialogprops?.title === "编辑" ? (
fields={columns} <InitForm
defaultFormValue={dialogprops?.defaultFormValue} fields={columns}
onFinish={(val, extra) => { defaultFormValue={dialogprops?.defaultFormValue}
let postdata = { ...val }; onFinish={(val, extra) => {
switch (dialogprops?.title) { let postdata = { ...val };
case "编辑": switch (dialogprops?.title) {
postdata = { case "编辑":
...val, postdata = {
id: dialogprops?.defaultFormValue?.id, ...val,
}; id: dialogprops?.defaultFormValue?.id,
break; };
default: break;
break; default:
} break;
runAsync({ }
url: "/sysCourse/saveOrUpdate", runAsync({
params: postdata, url: "/sysCourse/saveOrUpdate",
}); params: postdata,
}} });
></InitForm> }}
></InitForm>
) : (
<InitForm
// defaultFormValue={{
// teacherIdList: dialogprops?.teacherIdList,
// }}
fields={[
{
rowKey: "id",
rowName: "id",
valueType: "FormSelectList",
dataIndex: "teacherIdList",
colProps: {
span: 24,
},
columns: [
{
title: "账号",
key: "userAccount",
dataIndex: "userAccount",
readonly: true,
},
{
title: "教师姓名",
key: "name",
dataIndex: "name",
readonly: true,
},
{
title: "学校名称",
key: "schoolName",
dataIndex: "schoolName",
readonly: true,
},
{
title: "院系名称",
key: "departmentName",
dataIndex: "departmentName",
readonly: true,
},
],
path: "/user/page",
params: {
type: "2",
},
},
]}
onFinish={(val) => {
console.log(val);
const teacherIdList = val?.teacherIdList?.map((it) => it?.id);
runAsync({
url: "/sysCourseTeacher/relationCourseTeacher",
params: {
teacherIdList,
courseId: dialogprops?.defaultFormValue?.id,
},
});
}}
/>
)}
</DraggableDialog> </DraggableDialog>
<Box <Box
display={"flex"} display={"flex"}
justifyContent={"space-between"} justifyContent={"space-between"}
...@@ -183,6 +259,7 @@ function Lessons() { ...@@ -183,6 +259,7 @@ function Lessons() {
edit={edit} edit={edit}
remove={remove} remove={remove}
publish={publish} publish={publish}
authorized={authorized}
/> />
</Grid> </Grid>
)) ))
......
// 传入富文本内容 string , 判断当前富文本是否有输入内容
export default (content) => {
let filterContent = content.replace(/<[^<>]+>/g, "").replace(/&nbsp;/gi, "");
if (filterContent == "") return true;
let regu = "^[ ]+$";
let re = new RegExp(regu);
return re.test(filterContent);
};
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