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
7fe1a2fc
Commit
7fe1a2fc
authored
Nov 25, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:sub win
parent
ea03f072
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
78 deletions
+24
-78
main.ts
src/main/main.ts
+8
-56
util.ts
src/main/util.ts
+3
-6
head.jsx
src/renderer/components/head.jsx
+10
-5
login.jsx
src/renderer/console/login.jsx
+2
-3
site.jsx
src/renderer/console/site.jsx
+1
-8
No files found.
src/main/main.ts
View file @
7fe1a2fc
...
...
@@ -15,7 +15,6 @@ import { autoUpdater } from 'electron-updater';
import
log
from
'electron-log'
;
import
MenuBuilder
from
'./menu'
;
import
{
resolveHtmlPath
}
from
'./util'
;
const
{
resolve
}
=
require
(
'path'
);
class
AppUpdater
{
constructor
()
{
...
...
@@ -28,37 +27,16 @@ class AppUpdater {
let
mainWindow
:
BrowserWindow
|
null
=
null
;
let
win
:
BrowserWindow
|
null
=
null
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
function
urls
(
per
:
any
)
{
let
opts
=
require
(
'url'
).
format
({
protocol
:
'file:'
,
slashes
:
true
,
pathname
:
resolve
(
__dirname
,
'assets'
,
'index.html'
),
})
// win.resize(size2Width(), size2Height())
// if (isDev) {
// opts = `http://localhost:1212`
// }
console
.
log
(
'opts: '
,
opts
);
return
opts
+
per
}
const
winURL
=
process
.
env
.
NODE_ENV
!==
'development'
?
`http://localhost:1212`
:
`file://
${
path
.
resolve
(
__dirname
,
'../renderer/'
)}
`
ipcMain
.
on
(
'resize-site'
,
(
event
)
=>
{
ipcMain
.
on
(
'createNewWindow-site'
,
(
event
,
arg
)
=>
{
if
(
win
)
{
win
.
loadFile
(
'index.html/site'
);
win
.
focus
();
return
;
}
});
ipcMain
.
on
(
'createNewWindow'
,
()
=>
{
win
=
new
BrowserWindow
({
width
:
546
,
height
:
425
,
height
:
298
,
minWidth
:
100
,
minHeight
:
100
,
frame
:
true
,
...
...
@@ -71,19 +49,8 @@ ipcMain.on('createNewWindow', () => {
},
// parent: win, //win是主窗口
});
// win.loadURL(path.join('file:', __dirname, 'new.html')); //new.html是新开窗口的渲染进程
// win.loadURL(winURL);
win
.
loadURL
(
resolveHtmlPath
(
`index.html#/site`
));
// win.loadFile(resolveHtmlPath('/index.html'), {
// hash: 'site',
// });
// win.loadURL(process.resourcesPath)
win
.
webContents
.
openDevTools
()
// win.loadFile(path.join(__dirname));
// win.loadFile('./index.html', {
// hash: 'site',
// });
isDev
&&
win
.
webContents
.
openDevTools
();
win
.
on
(
'closed'
,
()
=>
{
win
=
null
;
});
...
...
@@ -94,6 +61,8 @@ ipcMain.on('resize-home', (event) => {
mainWindow
.
setContentSize
(
350
,
425
);
// mainWindow.setResizable(true);
mainWindow
.
setMaximizable
(
false
);
// mainWindow.setFrame(false);
// mainWindow.center();
}
});
...
...
@@ -157,23 +126,6 @@ const createWindow = async () => {
},
});
// win = new BrowserWindow({
// show: true,
// width: 546,
// height: 425,
// minWidth: 100,
// minHeight: 100,
// icon: getAssetPath('icon.png'),
// frame: true,
// resizable: false,
// webPreferences: {
// sandbox: false,
// nodeIntegration: true,
// contextIsolation: false,
// webSecurity: false,
// },
// });
mainWindow
.
loadURL
(
resolveHtmlPath
(
'index.html'
));
mainWindow
.
on
(
'ready-to-show'
,
()
=>
{
...
...
src/main/util.ts
View file @
7fe1a2fc
/* eslint import/prefer-default-export: off */
import
{
URL
}
from
'url'
;
import
path
from
'path'
;
const
{
resolve
}
=
require
(
'path'
);
export
function
resolveHtmlPath
(
htmlFileName
:
string
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
...
...
@@ -11,10 +10,8 @@ export function resolveHtmlPath(htmlFileName: string) {
let
goPath
=
url
.
href
.
replace
(
'%23'
,
'#'
)
return
goPath
;
}
else
{
let
dd
=
`file://
${
path
.
resolve
(
__dirname
,
'../renderer/'
,
htmlFileName
)}
`
let
ff
=
dd
.
replace
(
/
\\
/g
,
'/'
)
return
ff
;
let
openPath
=
`file://
${
path
.
resolve
(
__dirname
,
'../renderer/'
,
htmlFileName
)}
`
let
src
=
openPath
.
replace
(
/
\\
/g
,
'/'
)
return
src
;
}
}
src/renderer/components/head.jsx
View file @
7fe1a2fc
import
React
,
{
useState
}
from
'react'
;
import
{
shell
}
from
'electron'
;
//js
import
public
from
'commons/public'
;
...
...
@@ -108,6 +109,11 @@ export default (props) => {
switch
(
e
)
{
case
'1'
:
return
;
case
'4'
:
shell
.
openExternal
(
'https://www.cloudam.cn/v2/console/cloude-dashboard'
);
return
;
case
'5'
:
setOpen
(
true
);
return
;
...
...
@@ -196,9 +202,8 @@ export default (props) => {
className=
{
classes
.
siteText
}
sx=
{
{
margin
:
'8px 0px 6px 0px'
}
}
onClick=
{
()
=>
{
// navigate('/site');
// electron.ipcRenderer.send('resize-site');
electron
.
ipcRenderer
.
send
(
'createNewWindow'
);
electron
.
ipcRenderer
.
send
(
'createNewWindow-site'
);
localStorage
.
setItem
(
'site_init'
,
'1'
);
}
}
>
云盘设置
...
...
@@ -206,8 +211,8 @@ export default (props) => {
<
Grid
className=
{
classes
.
siteText
}
onClick=
{
()
=>
{
// navigate('/
site');
electron
.
ipcRenderer
.
send
(
'resize-site
'
);
electron
.
ipcRenderer
.
send
(
'createNewWindow-
site'
);
localStorage
.
setItem
(
'site_init'
,
'2
'
);
}
}
>
偏好设置
...
...
src/renderer/console/login.jsx
View file @
7fe1a2fc
...
...
@@ -111,6 +111,7 @@ export default (props) => {
localStorage
.
removeItem
(
Constants
.
USER_INFO_TOKEN_KEY
);
localStorage
.
removeItem
(
Constants
.
RAYSYNC_ADDR_TOKEN_KEY
);
localStorage
.
removeItem
(
Constants
.
CURRENT_REGION_SELECT_KEY
);
localStorage
.
removeItem
(
'site_init'
);
});
};
...
...
@@ -230,9 +231,7 @@ export default (props) => {
root
:
classes
.
rootButton
,
}
}
onClick=
{
()
=>
{
electron
.
ipcRenderer
.
send
(
'createNewWindow'
);
// login();
login
();
// navigate('/test');
// electron.ipcRenderer.send('resize-init');
}
}
...
...
src/renderer/console/site.jsx
View file @
7fe1a2fc
...
...
@@ -40,20 +40,13 @@ const useStyles = makeStyles()((theme) => {
paddingLeft
:
'20px'
,
cursor
:
'pointer'
,
},
// rootButton: {
// backgroundColor: '#1370FF',
// boxShadow: 'none !important',
// color: '#ffffff',
// '&:hover': { backgroundColor: '#0055D9', transform: 'inherit' },
// },
};
});
export
default
(
props
)
=>
{
const
{
classes
}
=
useStyles
();
const
{
render
,
navigate
}
=
public
();
const
[
check
,
setChecked
]
=
useState
(
'1'
);
const
[
check
,
setChecked
]
=
useState
(
localStorage
.
getItem
(
'site_init'
));
return
(
<
Grid
className=
{
classes
.
siteBody
}
>
...
...
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