测试bug修改

master
wangxi 3 years ago
parent 1c9b8f147f
commit f28f10089c

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

@ -55,8 +55,8 @@ export async function queryCourseListByTag(
/** /**
* *
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
* @param params * @param params
* @returns * @returns
*/ */
export async function querySubjectList(params: { export async function querySubjectList(params: {
page_size: number; page_size: number;
@ -67,6 +67,12 @@ export async function querySubjectList(params: {
}); });
} }
export async function viewCourse(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request(' /dsideal_yy/ypt/careerTraining/course/view', {
params,
});
}
@ -153,4 +159,4 @@ export async function queryTagList(
}, },
...(options || {}), ...(options || {}),
}); });
} }

Loading…
Cancel
Save