From f8a9c0785f2a0542efc91bc9c7ad3ad4008218ba Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 19 May 2022 17:56:42 +0800 Subject: [PATCH] update issue --- public/index.html | 1 + src/AppConfig.js | 2 +- .../Component/NoticeModal/SystemNotice.jsx | 13 ++-- src/forge/Server/data.jsx | 76 ++++++++++--------- src/forge/Server/index.scss | 5 +- src/modules/tpm/TPMIndexHOC.js | 1 + 6 files changed, 56 insertions(+), 42 deletions(-) diff --git a/public/index.html b/public/index.html index 9489fe42..bb947662 100755 --- a/public/index.html +++ b/public/index.html @@ -7,6 +7,7 @@ + diff --git a/src/AppConfig.js b/src/AppConfig.js index b4107e46..cd3aca3d 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index c95a8030..78619f18 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -11,7 +11,7 @@ function SystemNotice({showNotice,system_notification,history,login,hideSystemNo useEffect(()=>{ - if(system_notification && !system_notification.is_read && showNotice && login){ + if((system_notification && !system_notification.is_read) && showNotice && login){ setVisible(true); } },[system_notification,login]) @@ -22,11 +22,12 @@ function SystemNotice({showNotice,system_notification,history,login,hideSystemNo axios.post(url,{ system_notification_id:system_notification.id }).then(result=>{ - if(result){ - setVisible(false); - hideSystemNotice(); - } - }).catch(error=>{}) + setVisible(false); + hideSystemNotice(); + }).catch(error=>{ + setVisible(false); + hideSystemNotice(); + }) }else{ setVisible(false); hideSystemNotice(); diff --git a/src/forge/Server/data.jsx b/src/forge/Server/data.jsx index 4b1430c4..5bf540cd 100644 --- a/src/forge/Server/data.jsx +++ b/src/forge/Server/data.jsx @@ -69,13 +69,23 @@ function Data(props){ } function handleDownExcel(task_id){ - const oa = document.createElement('a'); - oa.href = `/api/traces/${owner}/${projectsId}/task_pdf.json?task_id=${task_id}`; - oa.setAttribute('target', '_blank'); - oa.setAttribute("download","report.pdf"); - document.body.appendChild(oa); - oa.click(); - document.body.removeChild(oa); + setSpining(true); + const url = `/api/traces/${owner}/${projectsId}/task_pdf.json?task_id=${task_id}`; + // window.open(`/api/traces/${owner}/${projectsId}/task_pdf.json?task_id=${task_id}`); + const x = new XMLHttpRequest(); + x.open('GET', url, true) + x.responseType = 'blob'; + x.onload = (e) => { + // 会创建一个 DOMString,其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。 + const url = window.URL.createObjectURL(x.response) + const a = document.createElement('a') + a.href = url; + a.download = "report.pdf"; + a.click(); + setSpining(false); + } + x.send(); + console.log("spining"); } return( @@ -105,7 +115,7 @@ function Data(props){ 分支名称 检测状态 检测时间 - 操作 + { isManager && 操作 } { dataSource.map((e,key)=>{ @@ -128,33 +138,31 @@ function Data(props){ } {e.detect_startdate} - - { + { + isManager && + - { isManager && ( - e.detect_status ==="detecting" ? - 重新扫描 - : - repeatCheck(e.project_id,e.branch_tag)}>重新扫描 - ) - } - { - (e.detect_status ==="fail" || e.detect_status ==="detecting") ? - 查看 - : - 查看 - } - { - isManager && ( - (e.detect_status ==="fail" || e.detect_status ==="detecting") ? - 下载报告 - : - handleDownExcel(e.task_id)}>下载报告 - ) - } - - } - + { + e.detect_status ==="detecting" ? + 重新扫描 + : + repeatCheck(e.project_id,e.branch_tag)}>重新扫描 + } + {/* { + (e.detect_status ==="fail" || e.detect_status ==="detecting") ? + 查看 + : + 查看 + } */} + { + (e.detect_status ==="fail" || e.detect_status ==="detecting") ? + 下载报告 + : + handleDownExcel(e.task_id)}>下载报告 + } + + + } {false && } diff --git a/src/forge/Server/index.scss b/src/forge/Server/index.scss index 62aa00cc..a0de01e4 100644 --- a/src/forge/Server/index.scss +++ b/src/forge/Server/index.scss @@ -307,7 +307,10 @@ white-space: nowrap; text-overflow: ellipsis; } - &>span:nth-child(3),&>span:nth-child(4){ + &>span:nth-child(3){ + flex:1; + } + &>span:nth-child(4){ width: 16%; } &>span:last-child{ diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index b675fb35..1fdf5f2a 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -226,6 +226,7 @@ export function TPMIndexHOC(WrappedComponent) { this.setState({ showNotice:false }) + this.getAppdatausr(); } showCompeleteDialog=()=>{