xialiang 3 years ago
commit 30e310a1f8

@ -14,6 +14,8 @@ import type { TableListItem, TableListPagination } from './data';
import Tags from './components/Tags';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { VideoJS } from './components/VideoJS';
import { getInfo } from 'react-mediainfo';
import { v4 as uuidv4 } from 'uuid';
const uuid = uuidv4();
@ -247,9 +249,16 @@ const CourseList: React.FC = () => {
hideInDescriptions: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => (
<Upload
accept='.mp4'
action='/dsideal_yy/res/plupload/'
defaultFileList={item.initialValue ? [item.initialValue] : []}
beforeUpload={(file) => {
beforeUpload={async (file) => {
/** 获取视频文件信息 */
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
if(Video.format !== 'AVC' || Audio.format !== 'AAC'){
message.error('视频编码格式不正确视频采用AVC音频采用AAC')
return false;
}
// console.log('file', file)
// 获取文件名
SetUploadFileName(file?.name);

@ -439,10 +439,26 @@ export default () => {
label="主题图片"
max={2}
fieldProps={{
accept:'.jpg,.jpeg,.git,.png',
name: 'file',
listType: 'picture-card',
maxCount: 1,
beforeUpload: (file) => {
//限制图片 格式、size、分辨率
const isJPG = file.type === 'image/jpeg';
const isJPEG = file.type === 'image/jpeg';
const isGIF = file.type === 'image/gif';
const isPNG = file.type === 'image/png';
if (!(isJPG || isJPEG || isGIF || isPNG)) {
message.error('只能上传JPG 、JPEG 、GIF、 PNG格式的图片~');
return false;
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('超过2M限制不允许上传~');
return false;
}
// 获取文件名
SetUploadFileName(file?.name);
// 获取最后一个.的位置

@ -376,13 +376,17 @@ const QuestionBank = () => {
console.log('del selectedRowsState', selectedRowsState)
const selectedRows = selectedRowsState?.map((item)=>({key:item?.id}))
console.log('selectedRows', selectedRows)
const success = await handleRemove(selectedRows);
if (success) {
// handleModalVisible(false);
if (actionRef.current) {
setSelectedRows([]);
actionRef.current?.reload();
if(selectedRows?.length > 0){
const success = await handleRemove(selectedRows);
if (success) {
// handleModalVisible(false);
if (actionRef.current) {
setSelectedRows([]);
actionRef.current?.reload();
}
}
}else{
message.warn('请选择删除项')
}
}}>
<DeleteOutlined />

@ -55,7 +55,7 @@
"@ant-design/pro-descriptions": "^1.6.8",
"@ant-design/pro-form": "^1.18.3",
"@ant-design/pro-layout": "^6.15.3",
"@ant-design/pro-table": "^2.30.8",
"@ant-design/pro-table": "^2.67.0",
"@antv/data-set": "^0.11.0",
"@antv/l7": "^2.3.7",
"@antv/l7-maps": "^2.3.7",
@ -65,7 +65,7 @@
"@umijs/route-utils": "^1.0.36",
"ahooks": "^3.0.5",
"ahooks-v2": "^2.10.15",
"antd": "^4.14.0",
"antd": "^4.19.2",
"base-64": "^1.0.0",
"bizcharts": "^3.5.3-beta.0",
"bizcharts-plugin-slider": "^2.1.1-beta.1",

@ -8,7 +8,7 @@ import { currentUser as queryCurrentUser, queryPersonTxByYw } from './services/a
import { BookOutlined, LinkOutlined } from '@ant-design/icons';
import { RequestConfig } from 'umi';
import { ResponseError } from 'umi-request';
import { notification } from 'antd';
import { message, notification } from 'antd';
import cookie from 'react-cookies';
const isDev = process.env.NODE_ENV === 'development';
@ -87,14 +87,34 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
};
};
/** 全局响应拦截 */
const responseInterceptor = async (response: any, options: any) => {
const data = await response.clone().json();
if (data && data?.status === '0') {
//location.href = location.pathname + '#/user/login'; // /#/user/login
history.push('/user/login')
}
console.log('返回了', response);
console.log('options', options);
console.log('data', data)
if(data?.success === false && options?.url === '/dsideal_yy/checkLoginStatus'){
message.error(data?.info)
}
return response;
};
/** request 用于配置全局的网络请求,你可以在这里做拦截器,全局错误处理,鉴权的配置。*/
export const request: RequestConfig = {
errorHandler: (error: ResponseError) => {
/*notification.error({
console.log('RequestConfig errorHandler', error)
/*
notification.error({
description: '您的网络发生异常,无法连接服务器',
message: '网络异常',
});*/
throw error;
},
//middlewares?: OnionMiddleware[],
//requestInterceptors: [requestInterceptor], // 请求前拦截器
responseInterceptors: [responseInterceptor], // 响应拦截器
};

@ -17,14 +17,13 @@ import VideoJS from '../components/VideoJS';
const { Paragraph } = Typography;
const CardList = () => {
const params = useParams();
const ids = params.msg.split(',');//chapter_id,course_id,subject_id
const [currentLearning, SetCurrentLearning] = useState();
const [courseId, SetCourseId] = useState();
const [courseId, SetCourseId] = useState(ids[1]);
let time=0;
const videoRef = useRef<HTMLVideoElement>(null);
const params = useParams();
const ids = params.msg.split(',');//chapter_id,course_id,subject_id
console.log('courseIdcourseIdcourseIdcourseId',courseId)
/** 获取课节 */
@ -139,7 +138,8 @@ const CardList = () => {
<Col span={6} style={{paddingRight:24}}>
<Menu
mode="inline"
selectedKeys={[ids[1].toString()]}
// selectedKeys={[ids[1].toString()]}
selectedKeys={[courseId.toString()]}
defaultOpenKeys={['sub1']}
style={{ height: '100%', width:'100%' }}
>
@ -196,13 +196,13 @@ const CardList = () => {
</Col>
</Row>
<a onClick={()=>{
const data = videoRef?.current?.currentTime();
<a onClick={()=>{
const data = videoRef?.current?.currentTime();
console.log('getData', data)
}}>videoRef get</a>
}}>videoRef get</a>
<a onClick={()=>{
const data = videoRef?.current?.currentTime(300);
<a onClick={()=>{
const data = videoRef?.current?.currentTime(300);
console.log('setData', data)
}}>videoRef set</a>

@ -260,26 +260,49 @@ const Workplace: FC = () => {
position: 'top-center',
}}
point={{ size: 5 }}
tooltip={{
customContent: (title: any, items: any): any => {
console.log('title',title);
console.log('items',items);
return(
<div style={{ padding: '12px 14px', fontSize: '12px', width: '180px', height: '68px',lineHeight:'20px' }}>
<div>{title}</div>
<div>{items[0]?items[0].data.learning_minutes:''}</div>
</div>
)
}
}}
/>
</div>
</Card>
<Card
bodyStyle={{ padding: 15 }}
bordered={false}
className={styles.studyCard}
title="当前学习"
loading={activitiesLoading}
// cover={<img alt="example" src={lastLearningList?.course_attachment_json?.img} />}
cover={<Image preview={false} width={200} height={150} src={`/dsideal_yy/html/${lastLearningList?.subject_attachment_json?.url}`} fallback="../fallback.svg" />}
{
JSON.stringify(lastLearningList)!=='{}'?
<Card
bodyStyle={{ padding: 15 }}
bordered={false}
className={styles.studyCard}
title="当前学习"
loading={activitiesLoading}
// cover={<img alt="example" src={lastLearningList?.course_attachment_json?.img} />}
cover={<Image preview={false} width={200} height={150} src={`/dsideal_yy/html/${lastLearningList?.subject_attachment_json?.url}`} fallback="../fallback.svg" />}
>
<Descriptions title={lastLearningList?.course_name} layout='horizontal' column={1} >
<Descriptions.Item label="主将人">{lastLearningList?.lecture_teacher}</Descriptions.Item>
<Descriptions.Item label="章节">{lastLearningList?.chapter_name}</Descriptions.Item>
<Descriptions.Item label="主题">{lastLearningList?.subject_name}</Descriptions.Item>
<Descriptions.Item label="时长">{lastLearningList?.total_course_minutes}</Descriptions.Item>
</Descriptions>
<Progress percent={lastLearningList?.learning_progress} />
<Descriptions title={lastLearningList?.course_name} layout='horizontal' column={1} >
<Descriptions.Item label="主将人">{lastLearningList?.lecture_teacher}</Descriptions.Item>
<Descriptions.Item label="章节">{lastLearningList?.chapter_name}</Descriptions.Item>
<Descriptions.Item label="主题">{lastLearningList?.subject_name}</Descriptions.Item>
<Descriptions.Item label="时长">{lastLearningList?.total_course_minutes}</Descriptions.Item>
</Descriptions>
<Progress percent={lastLearningList?.learning_progress} />
</Card>
: <Card
bodyStyle={{ padding: 15 }}
bordered={false}
className={styles.studyCard}
title="当前学习"
><div style={{minHeight:'5rem',textAlign:'right',paddingTop:'1rem',fontSize:'15px'}}></div></Card>
}
</Col>
<Col xl={14} lg={14} md={14} sm={14} xs={14}>
<Card

@ -54,11 +54,11 @@ const Login: React.FC = () => {
history.push(redirect || '/');
return;
}
console.log(msg);
console.log('msg..', msg);
// 如果失败去设置用户错误信息
setUserLoginState(msg);
} catch (error) {
const defaultLoginFailureMessage = '登录失败,请重试!';
const defaultLoginFailureMessage = msg?.info;
message.error(defaultLoginFailureMessage);
}
};

@ -37,9 +37,9 @@ export async function outLogin(options?: { [key: string]: any }) {
}
/** 登录接口 POST /api/login/account */
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
return request<API.LoginResult>('/dsideal_yy/login/doLogin?login_type=1', {
method: 'POST',
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
return request<API.LoginResult>('/dsideal_yy/checkLoginStatus', { // /dsideal_yy/login/doLogin?login_type=1
method: 'POST',
requestType: 'form',
data: body,
...(options || {}),

Loading…
Cancel
Save