From 00279f2225a6a96e8754facb501bc27352390c19 Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 8 Jul 2020 19:58:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=8F=91=E5=B8=83=E8=BE=93=E5=87=BA=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/deploy/do/Ext2Index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spug_web/src/pages/deploy/do/Ext2Index.js b/spug_web/src/pages/deploy/do/Ext2Index.js index e034c0a..1ead031 100644 --- a/spug_web/src/pages/deploy/do/Ext2Index.js +++ b/spug_web/src/pages/deploy/do/Ext2Index.js @@ -144,7 +144,7 @@ class Ext1Index extends React.Component { ))} }> - + @@ -164,7 +164,7 @@ class Ext1Index extends React.Component { ))} }> - + ))} From 788d291ab4336ca9157695da825fd14b76f1135d Mon Sep 17 00:00:00 2001 From: zypo Date: Wed, 8 Jul 2020 23:13:03 +0800 Subject: [PATCH 2/3] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/setting/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spug_api/apps/setting/views.py b/spug_api/apps/setting/views.py index 40745be..6c75e11 100644 --- a/spug_api/apps/setting/views.py +++ b/spug_api/apps/setting/views.py @@ -55,14 +55,16 @@ def email_test(request): if error is None: try: if form.port == 465: - server = smtplib.SMTP_SSL(form.server, form.port) + server = smtplib.SMTP_SSL(form.server, form.port, timeout=3) else: - server = smtplib.SMTP(form.server, form.port) + server = smtplib.SMTP(form.server, form.port, timeout=3) server.login(form.username, form.password) - return json_response() + return json_response() + except Exception as e: - error = e.smtp_error.decode('utf-8') + error = f'{e}' return json_response(error=error) + return json_response(error=error) From 2d2d413b93aaf9701eabdffc841afb2eed090ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E4=BC=AF=E6=B4=8B?= Date: Thu, 9 Jul 2020 15:16:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9D=A2=E5=8C=85?= =?UTF-8?q?=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/components/AuthCard.js | 9 ++- spug_web/src/components/AuthDiv.js | 4 +- spug_web/src/components/PageWrapper.js | 75 ++++++++++++++++++++++ spug_web/src/components/index.module.css | 14 ++++ spug_web/src/layout/layout.module.css | 5 +- spug_web/src/pages/config/app/Table.js | 2 +- spug_web/src/pages/config/service/Table.js | 2 +- spug_web/src/pages/config/setting/index.js | 8 ++- 8 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 spug_web/src/components/PageWrapper.js diff --git a/spug_web/src/components/AuthCard.js b/spug_web/src/components/AuthCard.js index 94ed861..5a3d4e6 100644 --- a/spug_web/src/components/AuthCard.js +++ b/spug_web/src/components/AuthCard.js @@ -4,14 +4,13 @@ * Released under the AGPL-3.0 License. */ import React from 'react'; -import {Card} from 'antd'; -import { hasPermission } from 'libs'; +import { hasPermission } from "../libs"; +import PageWrapper from './PageWrapper'; - -export default function AuthCard(props) { +export default function AuthDiv(props) { let disabled = props.disabled === undefined ? false : props.disabled; if (props.auth && !hasPermission(props.auth)) { disabled = true; } - return disabled ? null : {props.children} + return disabled ? null : (props.auth.indexOf('add')===-1?
{props.children}
:
{props.children}
) } diff --git a/spug_web/src/components/AuthDiv.js b/spug_web/src/components/AuthDiv.js index 8d7fbad..5a3d4e6 100644 --- a/spug_web/src/components/AuthDiv.js +++ b/spug_web/src/components/AuthDiv.js @@ -5,12 +5,12 @@ */ import React from 'react'; import { hasPermission } from "../libs"; - +import PageWrapper from './PageWrapper'; export default function AuthDiv(props) { let disabled = props.disabled === undefined ? false : props.disabled; if (props.auth && !hasPermission(props.auth)) { disabled = true; } - return disabled ? null :
{props.children}
+ return disabled ? null : (props.auth.indexOf('add')===-1?
{props.children}
:
{props.children}
) } diff --git a/spug_web/src/components/PageWrapper.js b/spug_web/src/components/PageWrapper.js new file mode 100644 index 0000000..0ddb21b --- /dev/null +++ b/spug_web/src/components/PageWrapper.js @@ -0,0 +1,75 @@ +import React from 'react'; +import { Breadcrumb } from 'antd'; +import menus from '../menus'; +import styles from './index.module.css'; + +export default class extends React.Component { + constructor(props) { + super(props); + this.lastPath = window.location.pathname; + const breadInfo = this.assembleMenu(this.lastPath); + this.state = {breadInfo}; + } + + assembleMenu(currentPath) { + const menu = [] + if (Array.isArray(menu)) { + menus.forEach(item => { + if (!item) return false; + if (item.path === currentPath) { + menu.push({ + title: item.title + }) + } else { + if (Array.isArray(item.child)) { + item.child.forEach(itemChild => { + if (itemChild.path === currentPath) { + menu.push({ + title: item.title + }, { + title: itemChild.title + }) + } + }) + } + } + }) + } + return menu + } + + componentDidUpdate() { + const currentPath = window.location.pathname; + if (this.lastPath !== currentPath) { + const breadInfo = this.assembleMenu(currentPath) + this.setState({breadInfo}); + } + } + + render() { + const { breadcrumbs, children } = this.props; + const { breadInfo } = this.state; + return ( +
+ {(!!breadInfo.length || (breadcrumbs && breadcrumbs.length > 0)) && ( +
+ + { + (breadcrumbs ? breadcrumbs : breadInfo).map(item => { + return ( + + { + item.href ? ({item.title}) : item.title + } + + ) + }) + } + +
+ )} +
{children}
+
+ ) + } +} \ No newline at end of file diff --git a/spug_web/src/components/index.module.css b/spug_web/src/components/index.module.css index 4555710..d773178 100644 --- a/spug_web/src/components/index.module.css +++ b/spug_web/src/components/index.module.css @@ -36,3 +36,17 @@ top: 0; right: 0; } + +.breadWrapper .router { + padding: 24px 24px 0; +} + +.breadStyle { + width: 100%; + height: 54px; + overflow: hidden; + background: #fff; + padding: 16px 32px 0; + border-bottom: 1px solid #e8e8e8; + z-index: 1; +} \ No newline at end of file diff --git a/spug_web/src/layout/layout.module.css b/spug_web/src/layout/layout.module.css index 651b7c4..a218d44 100644 --- a/spug_web/src/layout/layout.module.css +++ b/spug_web/src/layout/layout.module.css @@ -15,10 +15,13 @@ display: flex; flex-direction: column; justify-content: space-between; - padding: 24px 24px 0; overflow-y: scroll; } +.content .router { + padding: 24px 24px 0; +} + .trigger { font-size: 20px; line-height: 64px; diff --git a/spug_web/src/pages/config/app/Table.js b/spug_web/src/pages/config/app/Table.js index d266056..0701893 100644 --- a/spug_web/src/pages/config/app/Table.js +++ b/spug_web/src/pages/config/app/Table.js @@ -41,7 +41,7 @@ class ComTable extends React.Component { store.showRel(info)}>依赖 - 配置 + 配置 ) }]; diff --git a/spug_web/src/pages/config/service/Table.js b/spug_web/src/pages/config/service/Table.js index 05327e7..64ae318 100644 --- a/spug_web/src/pages/config/service/Table.js +++ b/spug_web/src/pages/config/service/Table.js @@ -40,7 +40,7 @@ class ComTable extends React.Component { this.handleDelete(info)}>删除 - 配置 + 配置 ) }]; diff --git a/spug_web/src/pages/config/setting/index.js b/spug_web/src/pages/config/setting/index.js index 7d64c68..b7522ee 100644 --- a/spug_web/src/pages/config/setting/index.js +++ b/spug_web/src/pages/config/setting/index.js @@ -60,10 +60,16 @@ class Index extends React.Component { }) }; + chooseBread() { + const currentPath = window.location.pathname; + if (currentPath.indexOf('src') !== -1) return [{title:'配置中心'}, {title:'服务配置'}, {title:this.props.location.state.title}]; + if (currentPath.indexOf('app') !== -1) return [{title:'配置中心'}, {title:'应用配置'}, {title:this.props.location.state.title}]; + } + render() { const {view} = this.state; return ( - +