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
c6f0cf48
Commit
c6f0cf48
authored
Dec 02, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:bug
parent
cab3f3ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
22 deletions
+20
-22
Axios.js
src/commons/axios/Axios.js
+5
-0
main.ts
src/main/main.ts
+7
-2
login.jsx
src/renderer/console/login.jsx
+8
-20
No files found.
src/commons/axios/Axios.js
View file @
c6f0cf48
...
...
@@ -5,6 +5,8 @@ import qs from 'qs';
import
API
from
'../../commons/utils/api_manager'
;
import
{
Constants
}
from
'../../commons/utils/constants'
;
import
axios
from
'axios'
;
const
{
ipcRenderer
}
=
require
(
'electron'
);
const
electron
=
window
.
require
(
'electron'
);
class
Axios
{
static
async
request
({
url
=
''
,
...
...
@@ -36,6 +38,7 @@ class Axios {
}
catch
(
error
)
{
if
(
error
.
response
.
data
.
errorCode
===
'100003'
)
{
let
reLoad
=
await
Axios
.
request_reLoad
();
console
.
log
(
'reLoad: '
,
reLoad
);
if
(
reLoad
[
'access_token'
])
{
localStorage
.
setItem
(
Constants
.
TOKEN_KEY
,
...
...
@@ -79,9 +82,11 @@ class Axios {
},
})
.
then
(
function
(
response
)
{
console
.
log
(
'response: '
,
response
);
resolve
(
response
.
data
);
})
.
catch
(
function
(
error
)
{
electron
.
ipcRenderer
.
send
(
'openLogin-windown'
);
reject
(
error
);
});
});
...
...
src/main/main.ts
View file @
c6f0cf48
...
...
@@ -24,7 +24,7 @@ class AppUpdater {
autoUpdater
.
checkForUpdatesAndNotify
();
}
}
let
tray
:
Tray
|
null
=
null
;
let
tray
:
Tray
|
null
=
null
;
let
mainWindow
:
BrowserWindow
|
null
=
null
;
let
siteWindown
:
BrowserWindow
|
null
=
null
;
let
homeWindown
:
BrowserWindow
|
null
=
null
;
...
...
@@ -149,6 +149,11 @@ ipcMain.on('openAtLogin-false', () => {
});
});
ipcMain
.
on
(
'openLogin-windown'
,
()
=>
{
mainWindow
?.
show
();
mainWindow
?.
focus
();
});
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
const
sourceMapSupport
=
require
(
'source-map-support'
);
sourceMapSupport
.
install
();
...
...
@@ -224,7 +229,7 @@ const createWindow = async () => {
if
(
process
.
env
.
START_MINIMIZED
)
{
mainWindow
.
minimize
();
}
else
{
mainWindow
.
show
();
mainWindow
.
hide
();
// mainWindow.webContents.openDevTools();
}
});
...
...
src/renderer/console/login.jsx
View file @
c6f0cf48
...
...
@@ -64,18 +64,14 @@ export default (props) => {
const
[
usernameError
,
setUsernameError
]
=
useState
(
false
);
const
[
password
,
setPassword
]
=
useState
(
''
);
const
[
passwordError
,
setPasswordError
]
=
useState
(
false
);
const
[
checked
,
setChecked
]
=
useState
(
localStorage
.
getItem
(
'stay'
)
&&
localStorage
.
getItem
(
'stay'
)
===
'1'
?
true
:
false
);
useEffect
(()
=>
{
if
(
localStorage
.
getItem
(
Constants
.
TOKEN_KEY
)
&&
localStorage
.
getItem
(
'stay'
)
===
'1'
localStorage
.
getItem
(
Constants
.
TOKEN_KEY
)
)
{
getUserData
();
}
else
{
electron
.
ipcRenderer
.
send
(
'openLogin-windown'
);
}
if
(
!
localStorage
.
getItem
(
'Preferences'
))
{
localStorage
.
setItem
(
...
...
@@ -83,18 +79,8 @@ export default (props) => {
JSON
.
stringify
({
selfStart
:
true
})
);
}
if
(
!
localStorage
.
getItem
(
'stay'
))
{
setChecked
(
true
)
localStorage
.
setItem
(
'stay'
,
'1'
);
}
},
[]);
const
handleChange
=
(
event
)
=>
{
setChecked
(
event
.
target
.
checked
);
localStorage
.
setItem
(
'stay'
,
event
.
target
.
checked
?
'1'
:
'2'
);
};
const
login
=
async
()
=>
{
if
(
username
.
length
===
0
)
{
setUsernameError
(
true
);
...
...
@@ -145,6 +131,8 @@ export default (props) => {
);
navigate
(
'/home'
);
electron
.
ipcRenderer
.
send
(
'resize-home'
);
}
else
{
electron
.
ipcRenderer
.
send
(
'openLogin-windown'
);
}
};
...
...
@@ -217,12 +205,12 @@ export default (props) => {
sx=
{
{
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'
space-between
'
,
justifyContent
:
'
flex-end
'
,
width
:
'100%'
,
marginBottom
:
'20px'
,
}
}
>
<
FormControlLabel
{
/*
<FormControlLabel
classes={{
label: classes.label2,
}}
...
...
@@ -230,7 +218,7 @@ export default (props) => {
<Checkbox checked={checked} onChange={handleChange} />
}
label="记住登录状态"
/>
/>
*/
}
<
Grid
sx=
{
{
fontSize
:
'14px'
,
...
...
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