forked from Gitlink/forgeplus-react
模拟结果视频查看
This commit is contained in:
parent
dd153730bb
commit
4dbad9644c
File diff suppressed because it is too large
Load Diff
|
|
@ -159,4 +159,13 @@ export function generateVirtualliveRoomkey(params) {
|
|||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 比赛管理-比赛回放
|
||||
export function matchReplay(data) {
|
||||
return fetch({
|
||||
url: '/api/match/match_replay',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
|
@ -10,6 +10,6 @@ export default (props)=>{
|
|||
const { competitionId } = match.params;
|
||||
|
||||
return(
|
||||
competitionId=="qz2022"? <Qz2022 {...props} />: competitionId=="JQTJ" ? <Jqtj {...props}/>: <Ccks {...props} />
|
||||
competitionId=="qz2022"? <Qz2022 {...props} />: (competitionId=="JQTJ" || competitionId=="jqtj") ? <Jqtj {...props}/>: <Ccks {...props} />
|
||||
)
|
||||
}
|
||||
|
|
@ -49,6 +49,8 @@ function Introduce({ form, match, history, current_user }) {
|
|||
// 刷新页面
|
||||
const [reload, setReload] = useState(undefined);
|
||||
const [uploadLoading, setUploadLoading] = useState(false);
|
||||
const [simulateIndex, setSimulateIndex] = useState(undefined);
|
||||
const [simulateUploading, setSimulateUploading] = useState(false);
|
||||
const helper = useCallback(
|
||||
(label, name, rules, widget, extra) => (
|
||||
<Form.Item label={label} extra={extra} colon={false}>
|
||||
|
|
@ -120,13 +122,14 @@ function Introduce({ form, match, history, current_user }) {
|
|||
|
||||
// 算法模拟
|
||||
function algorithmSimulation(index){
|
||||
setSimulateIndex(index);
|
||||
setSimulateUploading(true);
|
||||
chgMatchStatus({
|
||||
id: user_id+"",
|
||||
user_name: current_user.username,
|
||||
index,
|
||||
sign: encryptionuserId(user_id)
|
||||
}).then(res=>{
|
||||
console.log('res', res);
|
||||
if(res && res.code ==="000"){
|
||||
generateVirtualliveRoomkey({
|
||||
id: user_id+"",
|
||||
|
|
@ -135,9 +138,13 @@ function Introduce({ form, match, history, current_user }) {
|
|||
sign: encryptionuserId(user_id),
|
||||
type: "play"
|
||||
}).then(response=>{
|
||||
console.log('response', response);
|
||||
if(response && response.code ==="000"){
|
||||
setTimeout(() => { window.open(response.result.live_url);})
|
||||
}
|
||||
setSimulateUploading(false);
|
||||
})
|
||||
}else{
|
||||
setSimulateUploading(false);
|
||||
message.error(res.msg);
|
||||
}
|
||||
})
|
||||
|
|
@ -170,7 +177,7 @@ function Introduce({ form, match, history, current_user }) {
|
|||
<div className="mb30 jqtjButs">
|
||||
<Button className="jqtjBut mr13" onClick={()=>{setVisible(item.index)}}>查看规则</Button>
|
||||
<Button className="jqtjBut mr13" onClick={()=>{setVisibleRefer(item.index)}}>{item.algorithm ? '重新提交' : '作品提交'}</Button>
|
||||
{item.algorithm && <Button className="jqtjBut mr13" onClick={()=>{algorithmSimulation(item.index)}}>算法模拟</Button>}
|
||||
{item.algorithm && <Button className="jqtjBut mr13" onClick={()=>{algorithmSimulation(item.index)}} loading={(simulateIndex === item.index) && simulateUploading}>{(simulateIndex === item.index) && simulateUploading ? '' : '算法模拟'}</Button>}
|
||||
{item.simulated && <Button className="jqtjBut" onClick={()=>{history.push(`/competition/${competitionId}/refer/record/${item.index}`)}}>模拟结果</Button>}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState, useEffect, Fragment } from "react";
|
||||
import { Button, Modal, Table, Tag } from 'antd';
|
||||
import { simulatedMatchList, gradeDetailSimulate, encryptionuserId, generateVirtualliveRoomkey } from '../api';
|
||||
import { simulatedMatchList, gradeDetailSimulate, encryptionuserId, generateVirtualliveRoomkey, matchReplay } from '../api';
|
||||
import moment from "moment";
|
||||
import ColumnGroup from "antd/lib/table/ColumnGroup.js";
|
||||
import Column from "antd/lib/table/Column.js";
|
||||
|
|
@ -134,7 +134,7 @@ function Introduce(props) {
|
|||
dataIndex: 'status',
|
||||
key: 2,
|
||||
render: (text, record, index) => {
|
||||
return text === 'finished' ? <Tag color="#87d068">已完成</Tag> : <Tag color="#f50">未完成</Tag>
|
||||
return text === 'finished' ? <Tag color="#87d068">已完成</Tag> : text === "running" ? <Tag color="volcano">运行中</Tag> : <Tag color="#f50">未完成</Tag>
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -150,8 +150,8 @@ function Introduce(props) {
|
|||
align: 'center',
|
||||
render: (text, record, index) => {
|
||||
return <Fragment>
|
||||
<Button onClick={()=>{gradeDetail(text)}}>查看详情</Button>
|
||||
<Button className="ml20">模拟回放</Button>
|
||||
<Button onClick={()=>{gradeDetail(text)}} disabled={record.status !== "finished"}>查看详情</Button>
|
||||
<Button className="ml20" onClick={()=>{analogPlayback(text)}}>模拟回放</Button>
|
||||
</Fragment>
|
||||
}
|
||||
},
|
||||
|
|
@ -244,6 +244,18 @@ function Introduce(props) {
|
|||
return `${h}:${m}:${s}`
|
||||
}
|
||||
|
||||
// 模拟回放点击函数
|
||||
function analogPlayback(id){
|
||||
matchReplay({
|
||||
index: repoId,
|
||||
user_id: user_id+"",
|
||||
match_id: id,
|
||||
sign: encryptionuserId(user_id)
|
||||
}).then(res=>{
|
||||
console.log('res', res);
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="refer_bg recordListBox">
|
||||
<div className="qz_main recordList">
|
||||
|
|
@ -256,9 +268,6 @@ function Introduce(props) {
|
|||
<Button onClick={()=>{history.goBack()}} style={{width: '53px', padding: '0'}}>返回</Button>
|
||||
</div>
|
||||
</div>
|
||||
<video controls="controls">
|
||||
<source src="http://192.168.11.198:5003/live?keychain=p89nujc62qym0xb&pin=304251&token=gkvyduijb52da6d8931b60be0067df554d4ebf63&match_id=63ef4920b34859000919fee6&type=play" type="video/mp4"/>
|
||||
</video>
|
||||
<Table dataSource={recordList} columns={columns} pagination={false}></Table>
|
||||
</div>
|
||||
{/* 模拟记录详情弹框 */}
|
||||
|
|
|
|||
Loading…
Reference in New Issue