代码溯源系统维护+游客状态不可访问服务tab

This commit is contained in:
谢思 2022-08-15 11:19:07 +08:00
parent b8357b4246
commit 57e6ad16e8
5 changed files with 34 additions and 11 deletions

View File

@ -25,7 +25,7 @@ if (isDev) {
} }
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' : window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
} }
window._debugType = debugType; window._debugType = debugType;
export function initAxiosInterceptors(props) { export function initAxiosInterceptors(props) {

BIN
src/forge/Images/img1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -9,7 +9,9 @@ function Main(props){
const { current_user , resetUserInfo, projectDetail, showNotification } = props; const { current_user , resetUserInfo, projectDetail, showNotification } = props;
useEffect(()=>{ useEffect(()=>{
if(current_user){ if(current_user && !current_user.login){
props.history.push(`/login?go_page=/${owner}/${projectsId}/server`);
}else{
setHas_trace_user(current_user.has_trace_user); setHas_trace_user(current_user.has_trace_user);
} }
},[current_user]) },[current_user])

View File

@ -3,7 +3,7 @@ import DataEmpty from './dataEmpty';
import DetectionModal from './detectionModal'; import DetectionModal from './detectionModal';
import { Table, Spin, message } from 'antd'; import { Table, Spin, message } from 'antd';
import axios from 'axios'; import axios from 'axios';
import img from '../Images/img1.png';
function Data(props) { function Data(props) {
const [detectionVisible, setDetectionVisible] = useState(false); const [detectionVisible, setDetectionVisible] = useState(false);
@ -16,6 +16,7 @@ function Data(props) {
const [lookResultUrl, setLookResultUrl] = useState(undefined); const [lookResultUrl, setLookResultUrl] = useState(undefined);
const [openResultTaskId, setOpenResultTaskId] = useState(undefined); const [openResultTaskId, setOpenResultTaskId] = useState(undefined);
const [viewBase, setViewBase] = useState('https://cjntest.trustie.net/'); const [viewBase, setViewBase] = useState('https://cjntest.trustie.net/');
const [operateTime, setOperateTime] = useState(undefined);
const { owner, projectsId } = props.match.params; const { owner, projectsId } = props.match.params;
const { isManager, projectDetail, history } = props; const { isManager, projectDetail, history } = props;
@ -37,6 +38,9 @@ function Data(props) {
} }
}).then(result => { }).then(result => {
if (result) { if (result) {
if(result.data.message === "系统维护中"){
setOperateTime(result.data.data.operate_time);
}
if (Array.isArray(result.data.data)) { if (Array.isArray(result.data.data)) {
setDataSource(result.data.data); setDataSource(result.data.data);
setRelayCount(result.data.left_tasks_count); setRelayCount(result.data.left_tasks_count);
@ -59,12 +63,14 @@ function Data(props) {
} }
useEffect(() => { useEffect(() => {
if(projectDetail && projectDetail.forked_from_project_id){ if(projectDetail){
if(projectDetail.forked_from_project_id){
history.go(-1); history.go(-1);
}else{ }else{
setSpining(true); setSpining(true);
Init(); Init();
} }
}
}, [projectDetail]) }, [projectDetail])
useEffect(() => { useEffect(() => {
@ -162,12 +168,17 @@ function Data(props) {
/> />
<div className="servertitle"> <div className="servertitle">
<span className="systitle">重晴鸟代码溯源系统</span> <span className="systitle">重晴鸟代码溯源系统</span>
{isManager && <a className="btnhover" onClick={createCheck}>新建分析</a>} {!operateTime && isManager && <a className="btnhover" onClick={createCheck}>新建分析</a>}
</div> </div>
<Spin spinning={spining}> <Spin spinning={spining}>
<div style={{ minHeight: "400px" }}> <div style={{ minHeight: "400px" }}>
{operateTime && <div className='operateBox mt25'>
<img src={img} alt='' width={130}/>
<div className='font-20 mt20 mb5'>系统维护中</div>
<div className='font-17'><span className='timeBox'>{operateTime}小时后</span>代码溯源系统将恢复正常访问给您带来不便敬请谅解!</div>
</div>}
{ {
dataSource && dataSource.length > 0 && !operateTime && dataSource && dataSource.length > 0 &&
<div> <div>
<ul className="dataUl"> <ul className="dataUl">
<li className="dataUlhead"> <li className="dataUlhead">
@ -237,7 +248,7 @@ function Data(props) {
</div> </div>
} }
{ {
(dataSource === null || (dataSource && dataSource.length === 0)) && !operateTime && (dataSource === null || (dataSource && dataSource.length === 0)) &&
<DataEmpty /> <DataEmpty />
} }
</div> </div>

View File

@ -452,3 +452,13 @@
} }
} }
} }
.operateBox{
color: #333;
text-align: center;
background-color:#fafcff;
border-radius:4px 4px 0px 0px;
padding: 50px 0 80px;
.timeBox{
color: rgba(70, 106, 255, 1)
}
}