标签管理

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

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

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

@ -13,7 +13,7 @@ import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm';
import { saveRegistration, removeRegistration, queryRegistrationList } from '../service';
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}
centered
>{ console.log('currentRow',currentRow)}
>{console.log('currentRow', currentRow)}
{currentRow?.name && (
<ProDescriptions<TableListItem>
column={2}

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

Loading…
Cancel
Save