|
|
|
@ -9,7 +9,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
|
import type { FormValueType } from './components/UpdateForm';
|
|
|
|
|
|
|
|
|
|
import { queryTagList, saveCourse, removeCourse, queryCourseList } from './service';
|
|
|
|
|
import { queryTagList, saveCourse, removeCourse, queryCourseList,viewCourse } from './service';
|
|
|
|
|
import type { TableListItem, TableListPagination } from './data';
|
|
|
|
|
import Tags from './components/Tags';
|
|
|
|
|
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
|
|
|
|
@ -68,7 +68,6 @@ console.log('fields',fields)
|
|
|
|
|
const handleRemove = async (selectedRows: TableListItem[]) => {
|
|
|
|
|
const hide = message.loading('正在删除');
|
|
|
|
|
if (!selectedRows) return true;
|
|
|
|
|
console.log('key', selectedRows);
|
|
|
|
|
try {
|
|
|
|
|
const {code, msg} = await removeCourse({
|
|
|
|
|
key: selectedRows.map((row) => row.key),
|
|
|
|
@ -78,10 +77,9 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
|
|
|
|
|
message.success('删除成功,即将刷新');
|
|
|
|
|
}else{
|
|
|
|
|
message.warning(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('error', error)
|
|
|
|
|
hide();
|
|
|
|
|
message.error('删除失败,请重试');
|
|
|
|
|
return false;
|
|
|
|
@ -171,7 +169,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
{
|
|
|
|
|
title: '课时',
|
|
|
|
|
dataIndex: 'course_minutes',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
valueType: 'digit',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
@ -184,6 +182,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
required: true,
|
|
|
|
|
message: '此项为必填项',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/*{
|
|
|
|
|
max: 4,
|
|
|
|
|
message: '最大长度为4字符',
|
|
|
|
@ -251,7 +250,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
action='/dsideal_yy/res/plupload/'
|
|
|
|
|
defaultFileList={item.initialValue ? [item.initialValue] : []}
|
|
|
|
|
beforeUpload={(file) => {
|
|
|
|
|
console.log('file', file)
|
|
|
|
|
// console.log('file', file)
|
|
|
|
|
// 获取文件名
|
|
|
|
|
SetUploadFileName(file?.name);
|
|
|
|
|
// 获取最后一个.的位置
|
|
|
|
@ -267,6 +266,9 @@ const CourseList: React.FC = () => {
|
|
|
|
|
}}
|
|
|
|
|
maxCount={1}
|
|
|
|
|
multiple={false}
|
|
|
|
|
file={()=>{
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Button icon={<UploadOutlined />}>上传视频</Button>
|
|
|
|
|
</Upload>
|
|
|
|
@ -303,7 +305,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
{
|
|
|
|
|
title: '创建时间',
|
|
|
|
|
dataIndex: 'create_time',
|
|
|
|
|
valueType: 'dateRange',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: true,
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: true,
|
|
|
|
@ -318,8 +320,9 @@ const CourseList: React.FC = () => {
|
|
|
|
|
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => [
|
|
|
|
|
<a
|
|
|
|
|
key="detail"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
onClick={async() => {
|
|
|
|
|
const info= await viewCourse({course_id:record.course_id});
|
|
|
|
|
setCurrentRow(info.data);
|
|
|
|
|
handleDetailModalVisible(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
@ -327,8 +330,9 @@ const CourseList: React.FC = () => {
|
|
|
|
|
</a>,
|
|
|
|
|
<a
|
|
|
|
|
key="update"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
onClick={async() => {
|
|
|
|
|
const info= await viewCourse({course_id:record.course_id});
|
|
|
|
|
setCurrentRow(info.data);
|
|
|
|
|
handleUpdateModalVisible(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
@ -355,14 +359,11 @@ const CourseList: React.FC = () => {
|
|
|
|
|
|
|
|
|
|
/** 获取列数据初始值 */
|
|
|
|
|
const getInitialValues = (cols: any[], vals: any) => {
|
|
|
|
|
console.log('getInitialValues-columns', columns);
|
|
|
|
|
console.log('getInitialValues-values', vals);
|
|
|
|
|
const initialValues: any[] = [];
|
|
|
|
|
cols.forEach((column: { dataIndex: string }) => {
|
|
|
|
|
const key: any = column?.dataIndex || '';
|
|
|
|
|
initialValues.push({ ...column, initialValue: key ? vals[key] : '' });
|
|
|
|
|
});
|
|
|
|
|
console.log('initialValues::', initialValues);
|
|
|
|
|
return initialValues || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -397,7 +398,6 @@ const CourseList: React.FC = () => {
|
|
|
|
|
</Button>,
|
|
|
|
|
]}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
console.log('value', value)
|
|
|
|
|
const { create_time } = value;
|
|
|
|
|
if (create_time) {
|
|
|
|
|
value.begin_time = create_time[0]
|
|
|
|
@ -456,17 +456,14 @@ const CourseList: React.FC = () => {
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
//playerRef?.current?.ended();
|
|
|
|
|
playerRef?.current?.dispose();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//videoRef.current.play()
|
|
|
|
|
console.log('playerRef:', playerRef.current)
|
|
|
|
|
setCurrentRow(undefined); // 设置当前行
|
|
|
|
|
handleDetailModalVisible(false);
|
|
|
|
|
}}
|
|
|
|
|
footer={null}
|
|
|
|
|
centered
|
|
|
|
|
>
|
|
|
|
|
{console.log('currentRow', currentRow)}
|
|
|
|
|
{console.log('columns', columns.slice(0, columns.length - 1))}
|
|
|
|
|
{currentRow?.course_id && (
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={14}>
|
|
|
|
@ -504,8 +501,8 @@ const CourseList: React.FC = () => {
|
|
|
|
|
play.on("timeupdate", function (event) {
|
|
|
|
|
//const _timeCurrent = Date.parse(new Date().toString()) / 1000; // 当前时间
|
|
|
|
|
//setTimeUpdateState(_timeCurrent); //timeUpdateState
|
|
|
|
|
console.log('play--', play.currentTime())
|
|
|
|
|
console.log('play-%-', parseInt(play.currentTime()) % 15)
|
|
|
|
|
// console.log('play--', play.currentTime())
|
|
|
|
|
// console.log('play-%-', parseInt(play.currentTime()) % 15)
|
|
|
|
|
if (parseInt(play.currentTime()) % 15 === 0) { // 每15秒更新进度
|
|
|
|
|
console.log()
|
|
|
|
|
}
|
|
|
|
@ -544,6 +541,8 @@ const CourseList: React.FC = () => {
|
|
|
|
|
title="标签管理"
|
|
|
|
|
visible={tagsModalVisible}
|
|
|
|
|
onVisibleChange={handleTagsModalVisible}
|
|
|
|
|
|
|
|
|
|
onFinish={()=>{return true}}
|
|
|
|
|
>
|
|
|
|
|
<Tags />
|
|
|
|
|
</ModalForm>
|
|
|
|
@ -567,11 +566,10 @@ const CourseList: React.FC = () => {
|
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
|
// 表单处理
|
|
|
|
|
//console.log('columns:', columns);
|
|
|
|
|
console.log('values:', values);
|
|
|
|
|
console.log('uploadFileName', uploadFileName)
|
|
|
|
|
//return false;
|
|
|
|
|
// values.attachment_json.response.file.response.url
|
|
|
|
|
//console.log('currentRow', currentRow)
|
|
|
|
|
console.log('values00000000000ss',values)
|
|
|
|
|
await handleAdd({
|
|
|
|
|
...values,
|
|
|
|
|
//course_id: currentRow?.course_id,
|
|
|
|
@ -600,7 +598,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
width="60%"
|
|
|
|
|
visible={updateModalVisible}
|
|
|
|
|
destroyOnClose
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
handleUpdateModalVisible(false); // 隐藏编辑窗口
|
|
|
|
|
}}
|
|
|
|
|
footer={null}
|
|
|
|
@ -616,12 +614,14 @@ const CourseList: React.FC = () => {
|
|
|
|
|
console.log('currentRow', currentRow)
|
|
|
|
|
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
|
|
|
|
|
//console.log('url', url)
|
|
|
|
|
console.log('values编辑',values)
|
|
|
|
|
await handleUpdate({
|
|
|
|
|
...values,
|
|
|
|
|
attachment_filesize: attachment_json?.size || 0, // Bit 字节
|
|
|
|
|
course_id: currentRow?.course_id,
|
|
|
|
|
attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
|
|
|
|
|
});
|
|
|
|
|
attachment_json: `{"img":"", "name":"${values.attachment_json.file.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
handleUpdateModalVisible(false); // 隐藏编辑窗口
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
console.log(values);
|
|
|
|
|