Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
netdisc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rocosen
netdisc
Commits
77e4f4c6
Commit
77e4f4c6
authored
Dec 07, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:消息告警
parent
256c0c57
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
202 additions
and
59 deletions
+202
-59
alert_error.svg
src/commons/assets/img/alert_error.svg
+16
-0
alert_success.svg
src/commons/assets/img/alert_success.svg
+16
-0
alert_warning.svg
src/commons/assets/img/alert_warning.svg
+16
-0
index.jsx
src/commons/public/index.jsx
+0
-53
index.tsx
src/commons/public/index.tsx
+133
-0
getAllDrive.ts
src/commons/utils/getAllDrive.ts
+2
-0
util.ts
src/main/util.ts
+0
-1
mount.jsx
src/renderer/components/mount.jsx
+14
-4
login.jsx
src/renderer/console/login.jsx
+5
-1
No files found.
src/commons/assets/img/alert_error.svg
0 → 100644
View file @
77e4f4c6
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<title>
alert-circle-outline
</title>
<g
id=
"云平台视觉规范"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"Feedback-反馈"
transform=
"translate(-379.000000, -636.000000)"
fill=
"#FF4E4E"
fill-rule=
"nonzero"
>
<g
id=
"编组"
transform=
"translate(355.000000, 394.000000)"
>
<g
id=
"编组-4备份-7"
transform=
"translate(0.000000, 225.000000)"
>
<g
id=
"alert-circle-outline"
transform=
"translate(24.000000, 17.000000)"
>
<path
d=
"M7.2,10.4 L8.8,10.4 L8.8,12 L7.2,12 L7.2,10.4 M7.2,4 L8.8,4 L8.8,8.8 L7.2,8.8 L7.2,4 M8,-3.55271368e-16 C3.576,-3.55271368e-16 0,3.6 0,8 C0,10.1217319 0.842854723,12.1565632 2.34314575,13.6568542 C3.84343678,15.1571453 5.87826808,16 8,16 C12.418278,16 16,12.418278 16,8 C16,5.87826808 15.1571453,3.84343678 13.6568542,2.34314575 C12.1565632,0.842854723 10.1217319,-3.55271368e-16 8,-3.55271368e-16 M8,14.4 C4.4653776,14.4 1.6,11.5346224 1.6,8 C1.6,4.4653776 4.4653776,1.6 8,1.6 C9.69738553,1.6 11.3252506,2.27428378 12.5254834,3.4745166 C13.7257162,4.67474942 14.4,6.30261447 14.4,8 C14.4,11.5346224 11.5346224,14.4 8,14.4 Z"
id=
"形状"
></path>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
src/commons/assets/img/alert_success.svg
0 → 100644
View file @
77e4f4c6
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<title>
check-circle-outline
</title>
<g
id=
"云平台视觉规范"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"Feedback-反馈"
transform=
"translate(-379.000000, -561.000000)"
fill=
"#0DD09B"
fill-rule=
"nonzero"
>
<g
id=
"编组"
transform=
"translate(355.000000, 394.000000)"
>
<g
id=
"编组-4备份-5"
transform=
"translate(0.000000, 150.000000)"
>
<g
id=
"check-circle-outline"
transform=
"translate(24.000000, 17.000000)"
>
<path
d=
"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 M8,14.4 C4.472,14.4 1.6,11.528 1.6,8 C1.6,4.472 4.472,1.6 8,1.6 C11.528,1.6 14.4,4.472 14.4,8 C14.4,11.528 11.528,14.4 8,14.4 M11.672,4.464 L6.4,9.736 L4.328,7.672 L3.2,8.8 L6.4,12 L12.8,5.6 L11.672,4.464 Z"
id=
"形状"
></path>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
src/commons/assets/img/alert_warning.svg
0 → 100644
View file @
77e4f4c6
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"18px"
height=
"15px"
viewBox=
"0 0 18 15"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<title>
alert-outline
</title>
<g
id=
"云平台视觉规范"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"Feedback-反馈"
transform=
"translate(-379.000000, -486.000000)"
fill=
"#FFB919"
fill-rule=
"nonzero"
>
<g
id=
"编组"
transform=
"translate(355.000000, 394.000000)"
>
<g
id=
"编组-4备份-8"
transform=
"translate(0.000000, 75.000000)"
>
<g
id=
"alert-outline"
transform=
"translate(24.000000, 17.000000)"
>
<path
d=
"M9,0 L0,15 L18,15 M9,3.15789474 L15.1609091,13.4210526 L2.83909091,13.4210526 M8.18181818,6.31578947 L8.18181818,9.47368421 L9.81818182,9.47368421 L9.81818182,6.31578947 M8.18181818,11.0526316 L8.18181818,12.6315789 L9.81818182,12.6315789 L9.81818182,11.0526316"
id=
"形状"
></path>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
src/commons/public/index.jsx
deleted
100644 → 0
View file @
256c0c57
import
React
,
{
useState
}
from
'react'
;
import
Snackbar
from
'@mui/material/Snackbar'
;
import
{
SnackbarContent
}
from
'@mui/material'
;
import
Button
from
'@mui/material/Button'
;
import
IconButton
from
'@mui/material/IconButton'
;
import
CloseIcon
from
'@mui/icons-material/Close'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
()
=>
{
const
navigate
=
useNavigate
();
const
[
onloading
,
setOnloading
]
=
useState
(
false
);
const
[
messages
,
setMessages
]
=
useState
({
message
:
''
,
messagetype
:
''
,
});
const
handleClose
=
(
e
)
=>
{
console
.
log
(
'e: '
,
e
);
};
const
action
=
(
<
React
.
Fragment
>
<
IconButton
size=
"small"
aria
-
label=
"close"
color=
"inherit"
onClick=
{
handleClose
}
>
<
CloseIcon
fontSize=
"small"
/>
</
IconButton
>
</
React
.
Fragment
>
);
const
render
=
(
dom
)
=>
{
return
(
<
React
.
Fragment
>
{
dom
}
<
Snackbar
anchorOrigin=
{
{
vertical
:
'top'
,
horizontal
:
'center'
,
}
}
open=
{
messages
[
'message'
]
?
true
:
false
}
onClose=
{
handleClose
}
message=
"I love snacks"
key=
{
messages
[
'message'
]
}
action=
{
action
}
/>
</
React
.
Fragment
>
);
};
return
{
render
,
navigate
,
setMessages
,
setOnloading
};
};
src/commons/public/index.tsx
0 → 100644
View file @
77e4f4c6
import
React
,
{
useState
}
from
'react'
;
import
{
SnackbarContent
,
Snackbar
,
Grid
}
from
'@mui/material'
;
import
CloseIcon
from
'@mui/icons-material/Close'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
makeStyles
}
from
'tss-react/mui'
;
import
alert_error
from
'../assets/img/alert_error.svg'
;
import
alert_success
from
'../assets/img/alert_success.svg'
;
import
alert_warning
from
'../assets/img/alert_warning.svg'
;
const
useStyles
=
makeStyles
()((
_theme
)
=>
{
return
{
body
:
{
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
},
message
:
{
width
:
'100%'
,
fontSize
:
'14px'
,
},
text_warning
:
{
color
:
'#FFB919'
,
fontSize
:
'14px'
,
},
text_error
:
{
color
:
'#FF4E4E'
,
fontSize
:
'14px'
,
},
text_success
:
{
color
:
'#02AB83'
,
},
body_warning
:
{
background
:
'#FFF6E2'
,
boxShadow
:
'none'
,
},
body_error
:
{
background
:
'#FFEDED'
,
boxShadow
:
'none'
,
},
body_success
:
{
background
:
'#D9FFEE'
,
boxShadow
:
'none'
,
},
};
});
const
variantIcon
=
{
success
:
alert_success
,
warning
:
alert_warning
,
error
:
alert_error
,
};
export
default
()
=>
{
const
{
classes
}
=
useStyles
();
const
navigate
=
useNavigate
();
const
[
onloading
,
setOnloading
]
=
useState
(
false
);
const
[
messages
,
setMessages
]
=
useState
<
{
message
:
string
;
messagetype
:
'success'
|
'warning'
|
'error'
;
}
>
({
message
:
''
,
messagetype
:
'success'
,
});
const
Icon
=
variantIcon
[
messages
.
messagetype
];
const
handleClose
=
(
_e
:
any
)
=>
{
setMessages
(()
=>
{
return
{
message
:
''
,
messagetype
:
'success'
,
};
});
};
const
render
=
(
dom
:
any
)
=>
{
return
(
<
React
.
Fragment
>
{
dom
}
<
Snackbar
anchorOrigin=
{
{
vertical
:
'top'
,
horizontal
:
'center'
,
}
}
sx=
{
{
maxWidth
:
'380px'
,
margin
:
'0 auto'
}
}
autoHideDuration=
{
3000
}
open=
{
messages
[
'message'
]
?
true
:
false
}
onClose=
{
handleClose
}
key=
{
messages
[
'message'
]
}
>
<
SnackbarContent
message=
{
<
Grid
className=
{
classes
.
body
}
>
<
Grid
sx=
{
{
display
:
'flex'
,
alignItems
:
'center'
,
}
}
>
<
img
src=
{
Icon
}
style=
{
{
marginRight
:
'10px'
}
}
/>
<
Grid
className=
{
classes
[
`text_${messages.messagetype}`
]
}
>
{
messages
[
'message'
]
}
</
Grid
>
</
Grid
>
<
CloseIcon
fontSize=
"small"
className=
{
classes
[
`text_${messages.messagetype}`
]
}
/>
</
Grid
>
}
classes=
{
{
root
:
classes
[
`body_${messages.messagetype}`
],
message
:
classes
.
message
,
}
}
/>
</
Snackbar
>
</
React
.
Fragment
>
);
};
return
{
render
,
navigate
,
setMessages
,
setOnloading
};
};
src/commons/utils/getAllDrive.ts
View file @
77e4f4c6
...
...
@@ -11,12 +11,14 @@ const cmdOrder = {
getOneDriveName
:
(
drive
:
string
)
=>
`wmic logicaldisk where name="
${
drive
}
:" get volumename`
,
};
const
isMac
=
process
.
platform
===
'darwin'
;
/**
* 获取电脑中所有盘符及其名称
* @returns 电脑中所有盘符及其名称
*/
export
default
async
function
getAllDrive
():
Promise
<
string
[]
>
{
if
(
isMac
)
return
[];
let
result
:
string
[]
=
[];
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
// 获取电脑中所有盘符
...
...
src/main/util.ts
View file @
77e4f4c6
...
...
@@ -16,7 +16,6 @@ export function resolveHtmlPath(htmlFileName: string) {
htmlFileName
)}
`
;
let
src
=
openPath
.
replace
(
/
\\
/g
,
'/'
);
console
.
log
(
'src: '
,
src
);
return
src
;
}
}
src/renderer/components/mount.jsx
View file @
77e4f4c6
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
use
Effect
,
use
State
}
from
'react'
;
//js
import
public
from
'commons/public'
;
...
...
@@ -15,6 +15,14 @@ import FolderOpenIcon from '@mui/icons-material/FolderOpen';
import
MenuItem
from
'@mui/material/MenuItem'
;
import
file
from
'../../commons/assets/img/file.svg'
;
import
getAllDrive
from
'../../commons/utils/getAllDrive'
;
import
{
UNSAFE_DataRouterStateContext
}
from
'react-router-dom'
;
const
{
ipcRenderer
}
=
require
(
'electron'
);
const
electron
=
window
.
require
(
'electron'
);
const
{
dialog
}
=
require
(
'electron'
);
console
.
log
(
'dialog: '
,
dialog
);
console
.
log
(
'ipcRenderer: '
,
ipcRenderer
);
console
.
log
(
'electron: '
,
electron
);
const
useStyles
=
makeStyles
()((
theme
)
=>
{
return
{
...
...
@@ -86,12 +94,14 @@ const currencies = [
export
default
(
props
)
=>
{
const
{
classes
}
=
useStyles
();
const
{
render
,
navigate
}
=
public
();
const
[
mountValue
,
setMountValue
]
=
useState
(
'localDisk'
);
const
[
currency
,
setCurrency
]
=
useState
(
'EUR'
);
const
[
change
,
setChange
]
=
useState
(
false
);
useEffect
(()
=>
{
console
.
log
(
dialog
,
'1111111111'
);
},
[]);
const
handleChange
=
(
event
)
=>
{
setChange
(
true
);
event
.
stopPropagation
();
...
...
@@ -204,7 +214,7 @@ export default (props) => {
}
}
onClick=
{
(
event
)
=>
{
event
.
stopPropagation
();
console
.
log
(
'222222222'
);
dialog
.
showOpenDialog
(
);
}
}
>
更改
...
...
src/renderer/console/login.jsx
View file @
77e4f4c6
...
...
@@ -58,7 +58,7 @@ const useStyles = makeStyles()((theme) => {
export
default
(
props
)
=>
{
const
{
classes
}
=
useStyles
();
const
{
render
,
navigate
}
=
public
();
const
{
render
,
navigate
,
setMessages
}
=
public
();
const
[
username
,
setUsername
]
=
useState
(
''
);
const
[
usernameError
,
setUsernameError
]
=
useState
(
false
);
...
...
@@ -112,6 +112,10 @@ export default (props) => {
getUserData
();
})
.
catch
(
function
(
error
)
{
setMessages
({
message
:
error
.
response
.
data
.
message
,
messagetype
:
'error'
,
});
localStorage
.
removeItem
(
Constants
.
TOKEN_KEY
);
localStorage
.
removeItem
(
Constants
.
USER_INFO_TOKEN_KEY
);
localStorage
.
removeItem
(
Constants
.
RAYSYNC_ADDR_TOKEN_KEY
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment