标签管理

master
xialiang 4 years ago
parent 6a715ab746
commit 9c165d9435

@ -3,9 +3,8 @@ import { Tag, Input, Tooltip } from 'antd';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { useRequest } from 'umi'; import { useRequest } from 'umi';
import { queryTagList } from '../service'; import { queryTagList, saveTag } from '../service';
import styles from '../style.less'; import styles from '../style.less';
//const { Paragraph } = Typography; //const { Paragraph } = Typography;
/* /*
const tags = [ const tags = [
@ -16,19 +15,38 @@ const tags = [
const Tags = () => { const Tags = () => {
const [inputVisible, setInputVisible] = useState<boolean>(false); const [inputVisible, setInputVisible] = useState<boolean>(false);
const [items, setItems] = useState([]); const [items, setItems] = useState([]);
const inputRef = useRef<any>();;
/** 显示输入框 */ /** 显示输入框 */
const showInput = () => { const showInput = async () => {
setInputVisible(true) await setInputVisible(true)
console.log('inputRef', inputRef)
inputRef.current.focus({
cursor: 'start',
});
} }
/** 获取标签数据 */ /** 获取标签数据 */
const { data } = useRequest(queryTagList); const { data } = useRequest(queryTagList);
useEffect(() => { useEffect(() => {
setItems(data?.list || []); setItems(data || []);
console.log('tags',data?.list) console.log('tags', data)
}, [data]); }, [data]);
// 添加标签
const handleInputConfirm = async (e: any) => {
console.log(items)
const res = await saveTag({ tag_name: e.target.value })
console.log(res);
// setItems(data?.list || []);
setInputVisible(false)
}
return ( return (
<div className={styles.tags}> <div className={styles.tags}>
{items.map((tag: any, index: number) => { {items.map((tag: any, index: number) => {
@ -49,15 +67,16 @@ const Tags = () => {
type="text" type="text"
size="small" size="small"
className="tag-input" className="tag-input"
ref={inputRef}
//value={inputValue} //value={inputValue}
//onChange={handleInputChange} // onChange={handleInputChange}
//onBlur={handleInputConfirm} onBlur={handleInputConfirm}
//onPressEnter={handleInputConfirm} onPressEnter={handleInputConfirm}
/> />
)} )}
<Tag className="site-tag-plus" key={''} onClick={showInput}> {!inputVisible && (<Tag className="site-tag-plus" key={''} onClick={showInput}>
<PlusOutlined /> <PlusOutlined />
</Tag> </Tag>)}
</div> </div>
); );
}; };

@ -13,7 +13,7 @@ import UpdateForm from './components/UpdateForm';
import { queryTagList, saveCourse, removeCourse, queryCourseList } from './service'; import { queryTagList, saveCourse, removeCourse, queryCourseList } 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 { DataItem } from '@antv/data-set/lib/transform/tag-cloud'; import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { VideoJS } from './components/VideoJS'; import { VideoJS } from './components/VideoJS';
/** /**
@ -157,7 +157,7 @@ const CourseList: React.FC = () => {
sorter: false, sorter: false,
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: true,
renderFormItem:() => ( renderFormItem: () => (
<Upload > <Upload >
<Button icon={<UploadOutlined />}></Button> <Button icon={<UploadOutlined />}></Button>
</Upload>), </Upload>),
@ -206,7 +206,7 @@ const CourseList: React.FC = () => {
> >
</a>, </a>,
<a key="remove" onClick={()=>{}}> <a key="remove" onClick={() => { }}>
</a>, </a>,
], ],
@ -311,8 +311,8 @@ const CourseList: React.FC = () => {
footer={null} footer={null}
centered centered
> >
{ console.log('currentRow', currentRow)} {console.log('currentRow', currentRow)}
{ console.log('columns', columns.slice(0, columns.length - 1))} {console.log('columns', columns.slice(0, columns.length - 1))}
{currentRow?.course_id && ( {currentRow?.course_id && (
<Row> <Row>
<Col span={14}> <Col span={14}>
@ -343,16 +343,16 @@ const CourseList: React.FC = () => {
fullscreenToggle: true // 全屏按钮 fullscreenToggle: true // 全屏按钮
} }
}} }}
onReady={(play: any)=>{ onReady={(play: any) => {
console.log('play====', play); console.log('play====', play);
playerRef.current = play playerRef.current = play
play.play(); play.play();
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()
} }
//var currentTime = parseInt(this.currentTime()); //当前时间 //var currentTime = parseInt(this.currentTime()); //当前时间
@ -380,7 +380,7 @@ const CourseList: React.FC = () => {
columns={ columns={
columns.slice(0, columns.length - 1) as ProDescriptionsItemProps<TableListItem>[] columns.slice(0, columns.length - 1) as ProDescriptionsItemProps<TableListItem>[]
} }
style={{padding:'0 24px'}} style={{ padding: '0 24px' }}
/> />
</Col> </Col>
</Row> </Row>
@ -389,9 +389,9 @@ const CourseList: React.FC = () => {
<ModalForm <ModalForm
title="标签管理" title="标签管理"
visible={tagsModalVisible} visible={tagsModalVisible}
// onVisibleChange={handleModalVisible} onVisibleChange={handleTagsModalVisible}
> >
<Tags/> <Tags />
</ModalForm> </ModalForm>
<Modal <Modal

@ -1,5 +1,5 @@
import { request } from 'umi'; import { request } from 'umi';
import { TableListItem } from './data'; import type { TableListItem } from './data';
/** 获取课程列表 GET /dsideal_yy/ypt/careerTraining/course/list */ /** 获取课程列表 GET /dsideal_yy/ypt/careerTraining/course/list */
export async function queryCourseList( export async function queryCourseList(
@ -10,7 +10,7 @@ export async function queryCourseList(
/** 页面的容量 */ /** 页面的容量 */
pageSize?: number; pageSize?: number;
}, },
options?: { [key: string]: any }, options?: Record<string, any>,
) { ) {
return request<{ return request<{
data: TableListItem[]; data: TableListItem[];
@ -29,7 +29,7 @@ export async function queryCourseList(
} }
/** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */ /** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveCourse(data: { [key: string]: any }, options?: { [key: string]: any }) { export async function saveCourse(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/save', { return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/save', {
data, data,
method: 'POST', method: 'POST',
@ -38,7 +38,7 @@ export async function saveCourse(data: { [key: string]: any }, options?: { [key:
} }
/** 删除课程 POST /dsideal_yy/ypt/careerTraining/course/delete */ /** 删除课程 POST /dsideal_yy/ypt/careerTraining/course/delete */
export async function removeCourse(data: { key: number[] }, options?: { [key: string]: any }) { export async function removeCourse(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', { return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data, data,
method: 'POST', method: 'POST',
@ -47,7 +47,7 @@ export async function removeCourse(data: { key: number[] }, options?: { [key: st
} }
/** 查看课程仅仅获取课程详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */ /** 查看课程仅仅获取课程详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */
export async function queryCourseView(data: { [key: string]: any }, options?: { [key: string]: any }) { export async function queryCourseView(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/view', { return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/view', {
data, data,
method: 'POST', method: 'POST',
@ -55,6 +55,29 @@ export async function queryCourseView(data: { [key: string]: any }, options?: {
}); });
} }
/** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveTag(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/tag/save', {
data,
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
/** 获取标签列表 GET /dsideal_yy/ypt/careerTraining/tag/list */ /** 获取标签列表 GET /dsideal_yy/ypt/careerTraining/tag/list */
export async function queryTagList( export async function queryTagList(
params: { params: {
@ -64,7 +87,7 @@ export async function queryTagList(
/** 页面的容量 */ /** 页面的容量 */
pageSize?: number; pageSize?: number;
}, },
options?: { [key: string]: any }, options?: Record<string, any>,
) { ) {
return request<{ return request<{
data: TableListItem[]; data: TableListItem[];

@ -13,7 +13,7 @@ import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm'; import UpdateForm from './components/UpdateForm';
import { saveRegistration, removeRegistration, queryRegistrationList } from '../service'; import { saveRegistration, removeRegistration, queryRegistrationList } from '../service';
import type { TableListItem, TableListPagination } from './data'; import type { TableListItem, TableListPagination } from './data';
import { DataItem } from '@antv/data-set/lib/transform/tag-cloud'; import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
/** /**
* *
@ -274,7 +274,7 @@ const RegistrationList: React.FC = () => {
}} }}
footer={null} footer={null}
centered centered
>{ console.log('currentRow',currentRow)} >{console.log('currentRow', currentRow)}
{currentRow?.name && ( {currentRow?.name && (
<ProDescriptions<TableListItem> <ProDescriptions<TableListItem>
column={2} column={2}

@ -1,5 +1,5 @@
import { request } from 'umi'; import { request } from 'umi';
import { TableListItem } from './data'; import type { TableListItem } from './data';
/** 获取考试列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ /** 获取考试列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */
export async function queryExaminationList( export async function queryExaminationList(
@ -10,7 +10,7 @@ export async function queryExaminationList(
/** 页面的容量 */ /** 页面的容量 */
pageSize?: number; pageSize?: number;
}, },
options?: { [key: string]: any }, options?: Record<string, any>,
) { ) {
return request<{ return request<{
data: TableListItem[]; data: TableListItem[];
@ -37,7 +37,7 @@ export async function queryCertificateList(
/** 页面的容量 */ /** 页面的容量 */
pageSize?: number; pageSize?: number;
}, },
options?: { [key: string]: any }, options?: Record<string, any>,
) { ) {
return request<{ return request<{
data: TableListItem[]; data: TableListItem[];
@ -56,7 +56,7 @@ export async function queryCertificateList(
} }
/** 新建/修改考试 POST /dsideal_yy/ypt/careerTraining/course/save */ /** 新建/修改考试 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveExamination(data: { [key: string]: any }, options?: { [key: string]: any }) { export async function saveExamination(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/save', { return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/save', {
data, data,
method: 'POST', method: 'POST',
@ -65,7 +65,23 @@ export async function saveExamination(data: { [key: string]: any }, options?: {
} }
/** 删除考试 POST /dsideal_yy/ypt/careerTraining/course/delete */ /** 删除考试 POST /dsideal_yy/ypt/careerTraining/course/delete */
export async function removeExamination(data: { key: number[] }, options?: { [key: string]: any }) { export async function removeExamination(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data,
method: 'POST',
...(options || {}),
});
}
/** saveRegistration */
export async function saveRegistration(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data,
method: 'POST',
...(options || {}),
});
}
/** removeRegistration */
export async function removeRegistration(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', { return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data, data,
method: 'POST', method: 'POST',
@ -74,7 +90,7 @@ export async function removeExamination(data: { key: number[] }, options?: { [ke
} }
/** 查看考试仅仅获取考试详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */ /** 查看考试仅仅获取考试详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */
export async function queryExaminationView(data: { [key: string]: any }, options?: { [key: string]: any }) { export async function queryExaminationView(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/view', { return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/view', {
data, data,
method: 'POST', method: 'POST',
@ -91,7 +107,7 @@ export async function queryRegistrationList(
/** 页面的容量 */ /** 页面的容量 */
pageSize?: number; pageSize?: number;
}, },
options?: { [key: string]: any }, options?: Record<string, any>,
) { ) {
return request<{ return request<{
data: TableListItem[]; data: TableListItem[];

Loading…
Cancel
Save