From d25ae98c6841f78348c0f46076c4e6b9f758f050 Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 14 May 2021 21:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=90=AF=E7=B3=BB=E7=BB=9F=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=80=92=E8=AE=A1=E6=97=B6=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 3 +-- src/pages/crontab/logModal.tsx | 8 +++++++- src/utils/http.ts | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index 3f6c3a22..d1091ff5 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -266,10 +266,9 @@ update_qinglong() { fi if [[ $exit_status -eq 0 ]]; then - echo -e "重启青龙面板(后台重启)...\n" cd $dir_root nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf - echo -e "重启面板完成(请5s后刷新页面)..." + echo -e "重启面板完成" pm2 reload all >/dev/null 2>&1 fi } diff --git a/src/pages/crontab/logModal.tsx b/src/pages/crontab/logModal.tsx index 0cd50cdd..9c71265e 100644 --- a/src/pages/crontab/logModal.tsx +++ b/src/pages/crontab/logModal.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Modal, notification, Input, Form } from 'antd'; +import { Modal, message, Input, Form } from 'antd'; import { request } from '@/utils/http'; import config from '@/utils/config'; import { @@ -42,6 +42,12 @@ const CronLogModal = ({ getCronLog(); }, 2000); } + if (log && log.includes('重启面板完成')) { + message.warning({ content: '系统将在5秒后刷新', duration: 5 }); + setTimeout(() => { + window.location.reload(); + }, 5000); + } } }) .finally(() => { diff --git a/src/utils/http.ts b/src/utils/http.ts index b07d9af8..eb1995bb 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -2,14 +2,20 @@ import { extend } from 'umi-request'; import { notification } from 'antd'; import config from './config'; +notification.config({ + duration: 2.5, +}); + const time = Date.now(); const errorHandler = function (error: any) { if (error.response) { const message = error.data ? error.data.message || error.data : error.response.statusText; - if (error.response.status !== 401) { + if (error.response.status !== 401 && error.response.status !== 502) { notification.error({ message }); + } else { + console.log(error.response); } } else { console.log(error.message);