切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
umbrella22
2020-06-22 13:02:29 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
210a2f7742e8e0fe77cf0806c21ae4e789584ff5
210a2f77
1 个父辈
b46246ce
升级ipc,升级到electron9.x,替换node-sass为sass,去除无用依赖
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
70 行增加
和
64 行删除
config/index.js
package-lock.json
package.json
src/main/services/checkupdate.js
src/main/services/downloadFile.js
src/main/services/ipcMain.js
src/renderer/components/LandingPage.vue
src/renderer/components/Tinymce/components/EditorImage.vue
src/renderer/components/title/index.vue
src/renderer/layout/components/Navbar.vue
src/renderer/layout/components/Sidebar/SidebarItem.vue
src/renderer/main.js
src/renderer/utils/ipcRenderer.js
src/renderer/views/login/index.vue
config/index.js
查看文件 @
210a2f7
...
...
@@ -9,7 +9,7 @@ module.exports = {
chineseLog
:
false
,
port
:
9080
},
UseStartupChart
:
tru
e
,
UseStartupChart
:
fals
e
,
IsUseSysTitle
:
true
,
DllFolder
:
''
,
BuiltInServerPort
:
25565
...
...
package-lock.json
0 → 100644
查看文件 @
210a2f7
此文件的差异太大,无法显示。
package.json
查看文件 @
210a2f7
...
...
@@ -80,34 +80,32 @@
"js-cookie"
:
"^2.2.1"
,
"nprogress"
:
"^0.2.0"
,
"vue"
:
"^2.6.11"
,
"vue-electron"
:
"^1.0.6"
,
"vue-router"
:
"^3.3.2"
,
"vuex"
:
"^3.4.0"
,
"vuex-electron"
:
"^1.0.3"
"vuex"
:
"^3.4.0"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.10.
2
"
,
"@babel/core"
:
"^7.10.
3
"
,
"@babel/plugin-proposal-class-properties"
:
"^7.10.1"
,
"@babel/plugin-proposal-decorators"
:
"^7.10.
1
"
,
"@babel/plugin-proposal-decorators"
:
"^7.10.
3
"
,
"@babel/plugin-proposal-do-expressions"
:
"^7.10.1"
,
"@babel/plugin-proposal-export-default-from"
:
"^7.10.1"
,
"@babel/plugin-proposal-export-namespace-from"
:
"^7.10.1"
,
"@babel/plugin-proposal-function-bind"
:
"^7.10.1"
,
"@babel/plugin-proposal-function-sent"
:
"^7.10.1"
,
"@babel/plugin-proposal-json-strings"
:
"^7.10.1"
,
"@babel/plugin-proposal-logical-assignment-operators"
:
"^7.10.
1
"
,
"@babel/plugin-proposal-logical-assignment-operators"
:
"^7.10.
3
"
,
"@babel/plugin-proposal-nullish-coalescing-operator"
:
"^7.10.1"
,
"@babel/plugin-proposal-numeric-separator"
:
"^7.10.1"
,
"@babel/plugin-proposal-optional-chaining"
:
"^7.10.
1
"
,
"@babel/plugin-proposal-optional-chaining"
:
"^7.10.
3
"
,
"@babel/plugin-proposal-pipeline-operator"
:
"^7.10.1"
,
"@babel/plugin-proposal-throw-expressions"
:
"^7.10.1"
,
"@babel/plugin-syntax-dynamic-import"
:
"^7.8.3"
,
"@babel/plugin-syntax-import-meta"
:
"^7.10.1"
,
"@babel/plugin-transform-runtime"
:
"^7.10.
1
"
,
"@babel/plugin-transform-runtime"
:
"^7.10.
3
"
,
"@babel/polyfill"
:
"^7.10.1"
,
"@babel/preset-env"
:
"^7.10.
2
"
,
"@babel/register"
:
"^7.10.
1
"
,
"@babel/runtime"
:
"^7.10.
2
"
,
"@babel/preset-env"
:
"^7.10.
3
"
,
"@babel/register"
:
"^7.10.
3
"
,
"@babel/runtime"
:
"^7.10.
3
"
,
"ajv"
:
"^6.12.2"
,
"babel-eslint"
:
"^9.0.0"
,
"babel-loader"
:
"^8.1.0"
,
...
...
@@ -119,7 +117,7 @@
"cross-env"
:
"^7.0.2"
,
"css-loader"
:
"^3.5.3"
,
"del"
:
"^5.1.0"
,
"electron"
:
"^8.3.
0
"
,
"electron"
:
"^8.3.
3
"
,
"electron-builder"
:
"^22.6.1"
,
"electron-devtools-installer"
:
"^3.0.0"
,
"eslint"
:
"^6.8.0"
,
...
...
@@ -137,13 +135,13 @@
"mini-css-extract-plugin"
:
"0.9.0"
,
"multispinner"
:
"^0.2.1"
,
"node-loader"
:
"^0.6.0"
,
"node-sass"
:
"^4.14.1"
,
"portfinder"
:
"^1.0.26"
,
"sass"
:
"^1.26.8"
,
"sass-loader"
:
"^8.0.2"
,
"split2"
:
"^3.1.1"
,
"style-loader"
:
"^1.2.1"
,
"svg-sprite-loader"
:
"^4.3.0"
,
"terser-webpack-plugin"
:
"^3.0.
3
"
,
"terser-webpack-plugin"
:
"^3.0.
6
"
,
"through2-filter"
:
"^3.0.0"
,
"url-loader"
:
"^4.1.0"
,
"vue-html-loader"
:
"^1.2.4"
,
...
...
@@ -151,7 +149,7 @@
"vue-style-loader"
:
"^4.1.2"
,
"vue-template-compiler"
:
"^2.6.11"
,
"webpack"
:
"^4.43.0"
,
"webpack-cli"
:
"^3.3.1
1
"
,
"webpack-cli"
:
"^3.3.1
2
"
,
"webpack-dev-server"
:
"^3.11.0"
,
"webpack-hot-middleware"
:
"^2.25.0"
,
"webpack-merge"
:
"^4.2.2"
...
...
src/main/services/checkupdate.js
查看文件 @
210a2f7
...
...
@@ -54,13 +54,13 @@ export default {
Message
(
mainWindow
,
4
)
})
// 执行自动更新检查
ipcMain
.
on
(
'check-update'
,
()
=>
{
ipcMain
.
handle
(
'check-update'
,
()
=>
{
autoUpdater
.
checkForUpdates
().
catch
(
err
=>
{
console
.
log
(
'网络连接问题'
,
err
)
})
})
// 渲染进程执行更新操作
ipcMain
.
on
(
'confirm-update'
,
()
=>
{
ipcMain
.
handle
(
'confirm-update'
,
()
=>
{
autoUpdater
.
quitAndInstall
()
})
}
...
...
src/main/services/downloadFile.js
查看文件 @
210a2f7
...
...
@@ -21,9 +21,8 @@ if (os.platform().includes('win32')) {
}
export
default
{
download
(
mainWindow
)
{
ipcMain
.
on
(
'start-download'
,
(
event
,
msg
)
=>
{
ipcMain
.
handle
(
'start-download'
,
(
event
,
msg
)
=>
{
mainWindow
.
webContents
.
downloadURL
(
msg
.
downloadUrL
||
defaultDownloadUrL
)
event
.
reply
(
'confirm-download'
,
true
)
mainWindow
.
webContents
.
session
.
on
(
'will-download'
,
(
event
,
item
,
webContents
)
=>
{
// 将文件保存在系统的下载目录
const
filePath
=
path
.
join
(
app
.
getPath
(
'downloads'
),
item
.
getFilename
())
...
...
src/main/services/ipcMain.js
查看文件 @
210a2f7
...
...
@@ -4,13 +4,13 @@ import { winURL } from '../config/StaticPath'
export
default
{
Mainfunc
(
mainWindow
,
IsUseSysTitle
)
{
ipcMain
.
handle
(
'IsUseSysTitle'
,
()
=>
{
ipcMain
.
handle
(
'IsUseSysTitle'
,
async
()
=>
{
return
IsUseSysTitle
})
ipcMain
.
handle
(
'windows-mini'
,
()
=>
{
mainWindow
.
minimize
()
})
ipcMain
.
handle
(
'window-max'
,
()
=>
{
ipcMain
.
handle
(
'window-max'
,
async
()
=>
{
if
(
mainWindow
.
isMaximized
())
{
mainWindow
.
restore
()
return
{
status
:
false
}
...
...
@@ -41,6 +41,7 @@ export default {
ipcMain
.
handle
(
'statr-server'
,
async
()
=>
{
try
{
const
serveStatus
=
await
Server
.
StatrServer
()
console
.
log
(
serveStatus
)
return
serveStatus
}
catch
(
error
)
{
dialog
.
showErrorBox
(
...
...
@@ -60,7 +61,7 @@ export default {
)
}
})
ipcMain
.
on
(
'open-win'
,
(
event
,
arg
)
=>
{
ipcMain
.
handle
(
'open-win'
,
(
event
,
arg
)
=>
{
const
ChildWin
=
new
BrowserWindow
({
height
:
595
,
useContentSize
:
true
,
...
...
src/renderer/components/LandingPage.vue
查看文件 @
210a2f7
...
...
@@ -96,8 +96,7 @@ export default {
});
},
StopServer() {
this.$ipcApi.send("stop-server");
this.$ipcApi.on("confirm-stop", (event, arg) => {
this.$ipcApi.send("stop-server").then(res => {
this.$message({
type: "success",
message: "已关闭"
...
...
@@ -105,33 +104,28 @@ export default {
});
},
StartServer() {
this.$ipcApi.send("statr-server");
this.$ipcApi.on("confirm-start", (event, arg) => {
console.log(arg);
this.$ipcApi.send("statr-server").then(res => {
if (res) {
this.$message({
type: "success",
message: arg
message: res
});
}
});
},
// 获取electron方法
open() {
console.log(this.$electron);
},
open() {},
CheckUpdate(data) {
switch (data) {
case "one":
const dialog = this.$electron.remote.dialog;
this.$ipcApi.send("check-update");
console.log("启动检查");
this.$ipcApi.on("UpdateMsg", (event, data) => {
console.log(data);
switch (data.state) {
this.$ipcApi.send("check-update").then(res => {
switch (res.state) {
case -1:
const msgdata = {
title: data.msg
title: "发生错误",
message: res.msg
};
api.MessageBox(dialog, msgdata
);
this.$ipcApi.send("open-errorbox"
);
break;
case 0:
this.$message("正在检查更新");
...
...
@@ -147,7 +141,7 @@ export default {
this.$message({ type: "success", message: "无新版本" });
break;
case 3:
this.percentage =
data
.msg.percent.toFixed(1);
this.percentage =
res
.msg.percent.toFixed(1);
break;
case 4:
this.progressStaus = "success";
...
...
@@ -163,14 +157,13 @@ export default {
break;
}
});
console.log("启动检查");
console.log(data);
break;
case "two":
console.log(111);
this.$ipcApi.send("start-download");
this.$ipcApi.on("confirm-download", (event, arg) => {
if (arg) {
this.$ipcApi.send("start-download").then(() => {
this.dialogVisible = true;
}
});
this.$ipcApi.on("download-progress", (event, arg) => {
this.percentage = Number(arg);
...
...
@@ -199,7 +192,7 @@ export default {
this.$alert("更新下载完成!", "提示", {
confirmButtonText: "确定",
callback: action => {
this.$electron.shell.open
Item
(this.filePath);
this.$electron.shell.open
Path
(this.filePath);
}
});
});
...
...
@@ -214,7 +207,7 @@ export default {
}
},
destroyed() {
console.log("销毁了哦")
console.log("销毁了哦")
;
this.$ipcApi.remove("confirm-message");
this.$ipcApi.remove("download-done");
this.$ipcApi.remove("download-paused");
...
...
src/renderer/components/Tinymce/components/EditorImage.vue
查看文件 @
210a2f7
...
...
@@ -102,7 +102,7 @@ export default {
<style lang="scss" scoped>
.editor-slide-upload {
margin-bottom: 20px;
/deep/
.el-upload--picture-card {
::v-deep
.el-upload--picture-card {
width: 100%;
}
}
...
...
src/renderer/components/title/index.vue
查看文件 @
210a2f7
...
...
@@ -35,11 +35,9 @@ export default {
components: {},
created() {
this.$ipcApi.send("IsUseSysTitle");
this.$ipcApi.on(
"CisUseSysTitle",
(event, arg) => (this.IsUseSysTitle = arg)
);
this.$ipcApi.send("IsUseSysTitle").then(res => {
this.IsUseSysTitle = res;
});
},
mounted() {},
...
...
@@ -49,8 +47,9 @@ export default {
this.$ipcApi.send("windows-mini");
},
MixOrReduction() {
this.$ipcApi.send("window-max");
this.$ipcApi.on("window-confirm", (event, arg) => (this.mix = arg));
this.$ipcApi.send("window-max").then(res=>{
this.mix = res.status
})
},
Close() {
this.$ipcApi.send("window-close");
...
...
src/renderer/layout/components/Navbar.vue
查看文件 @
210a2f7
...
...
@@ -128,7 +128,7 @@ export default {
width: 30px;
height: 30px;
margin-right: 10px;
/deep/
img {
::v-deep
img {
width: 100%;
height: 100%;
border-radius: 50%;
...
...
@@ -144,7 +144,7 @@ export default {
padding-right: 20px;
border-right: 1px solid #cccccc;
}
.select-right
/deep/
.el-dropdown > span {
.select-right
::v-deep
.el-dropdown > span {
font-size: 6px;
}
.select-right {
...
...
@@ -152,7 +152,7 @@ export default {
color: #333333;
font-weight: 400;
}
/deep/
.el-dropdown-selfdefine {
::v-deep
.el-dropdown-selfdefine {
display: flex;
align-items: center;
}
...
...
src/renderer/layout/components/Sidebar/SidebarItem.vue
查看文件 @
210a2f7
...
...
@@ -129,12 +129,12 @@ export default {
</script>
<style lang="scss" scoped>
.menu-wrapper {
/deep/
.el-menu-item,
::v-deep
.el-menu-item,
.el-submenu__title {
height: 46px;
line-height: 46px;
}
/deep/
.el-menu-item {
::v-deep
.el-menu-item {
padding: 0 20px 0 12px;
}
}
...
...
src/renderer/main.js
查看文件 @
210a2f7
...
...
@@ -13,7 +13,6 @@ import './icons'
import
'@/styles/index.scss'
if
(
!
process
.
env
.
IS_WEB
)
{
Vue
.
use
(
require
(
'vue-electron'
))
if
(
!
require
(
'../../config'
).
IsUseSysTitle
)
{
require
(
'@/styles/custom-title.scss'
)
}
...
...
src/renderer/utils/ipcRenderer.js
0 → 100644
查看文件 @
210a2f7
import
{
ipcRenderer
}
from
'electron'
export
default
{
send
(
name
,
data
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
ipcRenderer
.
invoke
(
name
,
data
).
then
(
res
=>
{
resolve
(
res
)
})
})
},
on
(
name
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
ipcRenderer
.
on
(
name
,
(
event
,
args
)
=>
{
resolve
(
args
)
})
})
}
}
src/renderer/views/login/index.vue
查看文件 @
210a2f7
...
...
@@ -133,7 +133,7 @@ $light_gray: #eee;
left: 0;
background-image: url("https://i.loli.net/2019/10/18/buDT4YS6zUMfHst.jpg");
background-position: center;
/deep/
.el-input {
::v-deep
.el-input {
display: inline-block;
height: 47px;
width: 85%;
...
...
@@ -151,7 +151,7 @@ $light_gray: #eee;
}
}
}
/deep/
.el-form-item {
::v-deep
.el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
...
...
请
注册
或
登录
后发表评论