From f28f10089c0a0c4e88537654f7a502a54bf35500 Mon Sep 17 00:00:00 2001
From: wangxi <123456>
Date: Fri, 4 Mar 2022 15:15:23 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/src/pages/course/option/index.tsx | 52 ++++++++++++------------
admin/src/pages/course/option/service.ts | 12 ++++--
2 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx
index 59c91f4..933419d 100644
--- a/admin/src/pages/course/option/index.tsx
+++ b/admin/src/pages/course/option/index.tsx
@@ -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={()=>{
+
+ }}
>
}>上传视频
@@ -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) => [
{
- 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 = () => {
,
{
- 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 = () => {
,
]}
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 && (
@@ -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}}
>
@@ -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);
diff --git a/admin/src/pages/course/option/service.ts b/admin/src/pages/course/option/service.ts
index b15cae6..88b29da 100644
--- a/admin/src/pages/course/option/service.ts
+++ b/admin/src/pages/course/option/service.ts
@@ -55,8 +55,8 @@ export async function queryCourseListByTag(
/**
* 获取主题列表
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
- * @param params
- * @returns
+ * @param params
+ * @returns
*/
export async function querySubjectList(params: {
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 || {}),
});
-}
\ No newline at end of file
+}