Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
quicker
提交
63545a72
quicker
项目概览
gitcode_dev
/
quicker
上一次同步 大约 2 年
通知
6
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
quicker
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
63545a72
编写于
12月 21, 2021
作者:
郭
郭维嘉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加dick图标
上级
5c334c66
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
158 addition
and
59 deletion
+158
-59
.electron-vue/dev-runner.js
.electron-vue/dev-runner.js
+1
-1
package.json
package.json
+3
-3
src/main/browsers/main.js
src/main/browsers/main.js
+2
-2
src/main/dock.js
src/main/dock.js
+94
-0
src/main/index.js
src/main/index.js
+58
-53
未找到文件。
.electron-vue/dev-runner.js
浏览文件 @
63545a72
...
...
@@ -64,7 +64,7 @@ function startRenderer () {
{
contentBase
:
path
.
join
(
__dirname
,
'
../
'
),
disableHostCheck
:
true
,
host
:
'
quicker.csdn.net
'
,
host
:
'
127.0.0.1
'
,
quiet
:
true
,
hot
:
true
,
before
(
app
,
ctx
)
{
...
...
package.json
浏览文件 @
63545a72
{
"name"
:
"
rubick2
"
,
"version"
:
"0.0.1
2
"
,
"author"
:
"
muwoo <2424880409@qq.com>
"
,
"name"
:
"
Quicker
"
,
"version"
:
"0.0.1"
,
"author"
:
"
libai
"
,
"description"
:
"An electron-vue project"
,
"license"
:
null
,
"main"
:
"./dist/electron/main.js"
,
...
...
src/main/browsers/main.js
浏览文件 @
63545a72
...
...
@@ -11,7 +11,7 @@ module.exports = () => {
let
createWindow
=
opts
=>
{
const
winURL
=
process
.
env
.
NODE_ENV
===
"
development
"
?
`http://
quicker.csdn.net
:5501`
?
`http://
127.0.0.1
:5501`
:
`file://
${
__dirname
}
/index.html`
;
win
=
new
BrowserWindow
({
...
...
@@ -55,7 +55,7 @@ module.exports = () => {
win
=
undefined
;
});
win
.
on
(
"
blur
"
,
()
=>
{
win
.
hide
();
//
win.hide();
});
};
...
...
src/main/dock.js
0 → 100644
浏览文件 @
63545a72
import
{
dialog
,
Menu
,
Tray
,
app
,
shell
}
from
"
electron
"
;
import
path
from
"
path
"
;
import
pkg
from
"
../../package.json
"
;
import
os
from
"
os
"
;
import
{
commonConst
}
from
"
./common/utils
"
;
function
createDock
(
window
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
icon
;
if
(
commonConst
.
macOS
())
{
icon
=
"
./rocket.png
"
;
}
else
if
(
commonConst
.
windows
())
{
icon
=
parseInt
(
os
.
release
())
<
10
?
"
./icon@2x.png
"
:
"
./icon.ico
"
;
}
else
{
icon
=
"
icon@2x.png
"
;
}
const
appIcon
=
path
.
join
(
__static
,
icon
);
const
dockMenu
=
Menu
.
buildFromTemplate
([
{
label
:
"
注册
"
,
click
()
{
shell
.
openExternal
(
"
https://passport.csdn.net/newlogin?code=mobile
"
);
}
},
{
label
:
"
帮助文档
"
,
click
:
()
=>
{
process
.
nextTick
(()
=>
{
shell
.
openExternal
(
"
https://yre5673znb.feishu.cn/docs/doccnMnLv3iZ3epFvjXprnPum3b
"
);
});
}
},
{
label
:
"
意见反馈
"
,
click
:
()
=>
{
process
.
nextTick
(()
=>
{
shell
.
openExternal
(
"
https://www.wenjuan.com/s/UZBZJvmzhg/
"
);
});
}
},
{
type
:
"
separator
"
},
{
label
:
"
显示窗口
"
,
accelerator
:
"
Alt+R
"
,
click
()
{
window
.
show
();
}
},
{
label
:
"
偏好设置
"
,
click
()
{
window
.
show
();
window
.
webContents
.
send
(
"
tray-setting
"
);
}
},
{
label
:
"
关于
"
,
click
()
{
dialog
.
showMessageBox
({
title
:
"
Quicker
"
,
message
:
"
即刻
"
,
detail
:
`Version:
${
pkg
.
version
}
\nAuthor: libai`
});
}
},
{
type
:
"
separator
"
},
{
label
:
"
重启
"
,
click
()
{
app
.
relaunch
();
app
.
quit
();
}
},
{
role
:
"
quit
"
,
label
:
"
退出
"
}
]);
// appIcon.on("click", () => {
// appIcon.popUpContextMenu(contextMenu);
// });
// appIcon.setContextMenu(contextMenu);
// resolve(appIcon);
app
.
dock
.
setMenu
(
dockMenu
);
app
.
dock
.
setIcon
(
appIcon
);
resolve
(
app
);
});
}
export
default
createDock
;
src/main/index.js
浏览文件 @
63545a72
import
{
app
,
globalShortcut
}
from
'
electron
'
import
init
from
'
./common/common
'
import
{
autoUpdate
}
from
'
./common/autoUpdate
'
import
createTray
from
'
./tray
'
import
{
commonConst
}
from
'
./common/utils
'
import
pkg
from
'
../../package.json
'
import
Store
from
'
electron-store
'
;
import
{
app
,
globalShortcut
}
from
"
electron
"
;
import
init
from
"
./common/common
"
;
import
{
autoUpdate
}
from
"
./common/autoUpdate
"
;
import
createTray
from
"
./tray
"
;
import
createDock
from
"
./dock
"
;
import
{
commonConst
}
from
"
./common/utils
"
;
import
pkg
from
"
../../package.json
"
;
import
Store
from
"
electron-store
"
;
Store
.
initRenderer
()
Store
.
initRenderer
()
;
const
{
main
}
=
require
(
"
./browsers
"
)()
const
{
main
}
=
require
(
"
./browsers
"
)()
;
if
(
commonConst
.
production
())
{
global
.
__static
=
require
(
'
path
'
).
join
(
__dirname
,
'
/static
'
).
replace
(
/
\\
/g
,
'
\\\\
'
)
global
.
__static
=
require
(
"
path
"
)
.
join
(
__dirname
,
"
/static
"
)
.
replace
(
/
\\
/g
,
"
\\\\
"
);
}
// to fix https://github.com/electron/electron/issues/18397
app
.
allowRendererProcessReuse
=
false
app
.
allowRendererProcessReuse
=
false
;
class
initApp
{
launchApp
()
{
const
gotTheLock
=
app
.
requestSingleInstanceLock
()
const
gotTheLock
=
app
.
requestSingleInstanceLock
()
;
if
(
!
gotTheLock
)
{
app
.
quit
()
app
.
quit
()
;
}
else
{
this
.
beforeReady
()
this
.
onReady
()
this
.
onRunning
()
this
.
onQuit
()
this
.
beforeReady
()
;
this
.
onReady
()
;
this
.
onRunning
()
;
this
.
onQuit
()
;
}
}
createWindow
()
{
main
.
init
()
init
(
main
.
getWindow
())
main
.
init
()
;
init
(
main
.
getWindow
())
;
}
beforeReady
()
{
// 系统托盘
if
(
commonConst
.
macOS
())
{
if
(
commonConst
.
production
()
&&
!
app
.
isInApplicationsFolder
())
{
app
.
moveToApplicationsFolder
()
app
.
moveToApplicationsFolder
()
;
}
else
{
app
.
dock
.
hide
()
//
app.dock.hide()
}
}
else
{
app
.
disableHardwareAcceleration
()
app
.
moveToApplicationsFolder
();
app
.
disableHardwareAcceleration
();
}
}
onReady
()
{
const
readyFunction
=
()
=>
{
this
.
createWindow
()
createTray
(
main
.
getWindow
())
autoUpdate
()
}
this
.
createWindow
();
createTray
(
main
.
getWindow
());
createDock
();
autoUpdate
();
};
if
(
!
app
.
isReady
())
{
app
.
on
(
'
ready
'
,
readyFunction
)
app
.
on
(
"
ready
"
,
readyFunction
);
}
else
{
readyFunction
()
readyFunction
()
;
}
}
onRunning
()
{
app
.
on
(
'
second-instance
'
,
(
event
,
commandLine
,
workingDirectory
)
=>
{
app
.
on
(
"
second-instance
"
,
(
event
,
commandLine
,
workingDirectory
)
=>
{
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
const
win
=
main
.
getWindow
()
const
win
=
main
.
getWindow
()
;
if
(
win
)
{
if
(
win
.
isMinimized
())
{
win
.
restore
()
win
.
restore
()
;
}
win
.
focus
()
win
.
focus
()
;
}
})
app
.
on
(
'
activate
'
,
()
=>
{
})
;
app
.
on
(
"
activate
"
,
()
=>
{
if
(
!
main
.
getWindow
())
{
this
.
createWindow
()
this
.
createWindow
()
;
}
})
})
;
if
(
commonConst
.
windows
())
{
app
.
setAppUserModelId
(
pkg
.
build
.
appId
)
app
.
setAppUserModelId
(
pkg
.
build
.
appId
)
;
}
}
onQuit
()
{
app
.
on
(
'
window-all-closed
'
,
()
=>
{
if
(
process
.
platform
!==
'
darwin
'
)
{
app
.
quit
()
app
.
on
(
"
window-all-closed
"
,
()
=>
{
if
(
process
.
platform
!==
"
darwin
"
)
{
app
.
quit
()
;
}
})
})
;
app
.
on
(
'
will-quit
'
,
()
=>
{
globalShortcut
.
unregisterAll
()
})
app
.
on
(
"
will-quit
"
,
()
=>
{
globalShortcut
.
unregisterAll
()
;
})
;
// Exit cleanly on request from parent process in development mode.
if
(
commonConst
.
dev
())
{
if
(
process
.
platform
===
'
win32
'
)
{
process
.
on
(
'
message
'
,
data
=>
{
if
(
data
===
'
graceful-exit
'
)
{
app
.
quit
()
if
(
process
.
platform
===
"
win32
"
)
{
process
.
on
(
"
message
"
,
data
=>
{
if
(
data
===
"
graceful-exit
"
)
{
app
.
quit
()
;
}
})
})
;
}
else
{
process
.
on
(
'
SIGTERM
'
,
()
=>
{
app
.
quit
()
})
process
.
on
(
"
SIGTERM
"
,
()
=>
{
app
.
quit
()
;
})
;
}
}
}
}
(
new
initApp
()).
launchApp
()
new
initApp
().
launchApp
();
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录