修改视频列表显示

master
zhengpengju 4 years ago
parent 5b6e67ba61
commit 6e95ec7aba

@ -26,7 +26,7 @@ const uuid = uuidv4();
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
try {
await saveCourse({ ...fields, attachment_filesize:0, attachment_json: `{"img":"", "url": "down/M3u8/${uuid?.substr(0,2)}/${uuid}.m3u8"}` });
await saveCourse({ ...fields, attachment_filesize:0, });
hide();
message.success('添加成功');
return true;
@ -61,14 +61,14 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
};
/**
*
*
* ()
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
console.log('key', selectedRows);
try {
await removeCourse({
key: selectedRows.map((row) => row.key),
@ -77,6 +77,7 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
message.success('删除成功,即将刷新');
return true;
} catch (error) {
console.log('error', error)
hide();
message.error('删除失败,请重试');
return false;
@ -236,14 +237,15 @@ const CourseList: React.FC = () => {
},
{
title: '视频',
dataIndex: 'attachment_filesize',
dataIndex: 'attachment_json',
sorter: false,
hideInTable: true,
hideInForm: false,
hideInSearch: true,
renderFormItem: () => (
renderFormItem: (item, { defaultRender, ...rest }, form) => (
<Upload
action='/dsideal_yy/res/plupload/'
defaultFileList={item.initialValue?[item.initialValue]:[]}
beforeUpload={(file)=>{
console.log('file', file)
// 获取文件名
@ -329,7 +331,9 @@ const CourseList: React.FC = () => {
<a
key="remove"
onClick={() => {
handleRemove(record);
handleRemove([{key: record?.course_id}]); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
@ -479,7 +483,7 @@ const CourseList: React.FC = () => {
}
}}
onReady={(play: any) => {
console.log('play====', play);
//console.log('play====', play);
playerRef.current = play
play.play();
play.on("timeupdate", function (event) {
@ -548,8 +552,14 @@ const CourseList: React.FC = () => {
onFinish={async (values: any) => {
// 表单处理
//console.log('columns:', columns);
//console.log('values:', values);
await handleAdd(values);
console.log('values:', values);
console.log('uploadFileName',uploadFileName)
//return false;
// values.attachment_json.response.file.response.url
await handleAdd({
...values,
attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0,2)}/${uuid}.m3u8"}`
});
handleCreateModalVisible(false);
actionRef.current?.reloadAndRest?.();
}}

@ -39,9 +39,10 @@ export async function saveCourse(data: Record<string, any>, options?: Record<str
}
/** 删除课程 POST /dsideal_yy/ypt/careerTraining/course/delete */
export async function removeCourse(data: { key: number[] }, options?: Record<string, any>) {
export async function removeCourse(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data,
data: {course_id: data?.key[0]}, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),

Loading…
Cancel
Save