切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
张恒
2020-04-30 15:12:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
82b55f15e64ea3b8d68c4f21d8df2cda56d79a42
82b55f15
1 个父辈
0109f74a
更新依赖,添加关闭内置服务端方法
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
51 行增加
和
10 行删除
README.md
package-lock.json
package.json
src/main/server/index.js
src/main/services/ipcMain.js
src/renderer/components/LandingPage.vue
README.md
查看文件 @
82b55f1
...
...
@@ -42,6 +42,7 @@ npm config edit
这是花裤衩大大原本的
[
地址
](
https://github.com/PanJiaChen/electron-vue-admin
)
# 更新日志
-
2020年04月30日:添加内置服务端关闭方法,进一步简化登录流程;多窗口文档已就绪,服务端说明尚未补充。
-
2020年04月29日:添加了路由多窗口示例,修复web打包,提升依赖;文档还未就绪
-
2020年02月09日:添加
[
中文在线文档
](
https://umbrella22.github.io/electron-vue-template-doc/
)
,
[
国内访问地址
](
https://zh-sky.gitee.io/electron-vue-template-doc/
)
-
剔除win打包依赖,因为太大了,将它放到码云的额外仓库中,
[
地址
](
https://gitee.com/Zh-Sky/HardToDownloadLib
)
...
...
package-lock.json
查看文件 @
82b55f1
此文件的差异被折叠,
点击展开。
package.json
查看文件 @
82b55f1
...
...
@@ -86,7 +86,7 @@
"vuex-electron"
:
"^1.0.3"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.9.
0
"
,
"@babel/core"
:
"^7.9.
6
"
,
"@babel/plugin-proposal-class-properties"
:
"^7.8.3"
,
"@babel/plugin-proposal-decorators"
:
"^7.8.3"
,
"@babel/plugin-proposal-do-expressions"
:
"^7.8.3"
,
...
...
@@ -103,11 +103,11 @@
"@babel/plugin-proposal-throw-expressions"
:
"^7.8.3"
,
"@babel/plugin-syntax-dynamic-import"
:
"^7.8.3"
,
"@babel/plugin-syntax-import-meta"
:
"^7.8.3"
,
"@babel/plugin-transform-runtime"
:
"^7.9.
0
"
,
"@babel/plugin-transform-runtime"
:
"^7.9.
6
"
,
"@babel/polyfill"
:
"^7.8.7"
,
"@babel/preset-env"
:
"^7.9.
5
"
,
"@babel/preset-env"
:
"^7.9.
6
"
,
"@babel/register"
:
"^7.9.0"
,
"@babel/runtime"
:
"^7.9.
2
"
,
"@babel/runtime"
:
"^7.9.
6
"
,
"ajv"
:
"^6.12.2"
,
"babel-eslint"
:
"^9.0.0"
,
"babel-loader"
:
"^8.1.0"
,
...
...
@@ -119,7 +119,7 @@
"css-loader"
:
"^3.5.3"
,
"del"
:
"^5.1.0"
,
"electron"
:
"^8.2.4"
,
"electron-builder"
:
"^22.
5.1
"
,
"electron-builder"
:
"^22.
6.0
"
,
"electron-devtools-installer"
:
"^3.0.0"
,
"eslint"
:
"^6.8.0"
,
"eslint-config-standard"
:
"^14.1.1"
,
...
...
src/main/server/index.js
查看文件 @
82b55f1
...
...
@@ -3,12 +3,13 @@ import app from './server'
import
http
from
'http'
import
config
from
'@config'
const
port
=
config
.
BuiltInServerPort
var
server
=
null
app
.
set
(
'port'
,
port
)
export
default
{
StatrServer
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
server
=
http
.
createServer
(
app
)
server
=
http
.
createServer
(
app
)
server
.
listen
(
port
)
server
.
on
(
'error'
,
(
error
)
=>
{
switch
(
error
.
code
)
{
...
...
@@ -26,5 +27,19 @@ export default {
resolve
(
'服务端运行中'
)
})
})
},
StopServer
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
server
)
if
(
server
)
{
server
.
close
()
server
.
on
(
'close'
,
()
=>
{
server
=
null
resolve
(
1
)
})
}
else
{
reject
(
'服务端尚未开启'
)
}
})
}
}
...
...
src/main/services/ipcMain.js
查看文件 @
82b55f1
...
...
@@ -50,6 +50,16 @@ export default {
)
})
})
ipcMain
.
on
(
'stop-server'
,
(
event
,
arg
)
=>
{
Server
.
StopServer
().
then
(
res
=>
{
event
.
reply
(
'confirm-stop'
,
res
)
}).
catch
(
err
=>
{
dialog
.
showErrorBox
(
'错误'
,
err
)
})
})
ipcMain
.
on
(
'open-win'
,
(
event
,
arg
)
=>
{
const
ChildWin
=
new
BrowserWindow
({
height
:
595
,
...
...
src/renderer/components/LandingPage.vue
查看文件 @
82b55f1
...
...
@@ -17,7 +17,7 @@
<div class="right-side">
<div class="doc">
<div class="title alt">您可以点击的按钮</div>
<div class="title alt">您可以点击的按钮
测试功能
</div>
<el-button type="primary" round @click="open()">控制台打印</el-button>
<el-button type="primary" round @click="setdata">写入数据</el-button>
<el-button type="primary" round @click="getdata">读取数据</el-button>
...
...
@@ -27,7 +27,10 @@
<div class="doc">
<el-button type="primary" round @click="CheckUpdate('two')">检查更新(第二种方法)</el-button>
<el-button type="primary" round @click="StartServer">启动内置服务端</el-button>
<el-button type="primary" round @click="StopServer">关闭内置服务端</el-button>
<el-button type="primary" round @click="getMessage">查看消息</el-button>
</div>
<div class="doc">
<el-button type="primary" round @click="openNewWin">打开新窗口</el-button>
</div>
</div>
...
...
@@ -82,10 +85,10 @@ export default {
console.log(__lib);
},
methods: {
openNewWin(){
openNewWin()
{
let data = {
url:
'/form/index'
}
url:
"/form/index"
}
;
this.$ipcApi.send("open-win", data);
},
getMessage() {
...
...
@@ -95,6 +98,15 @@ export default {
});
});
},
StopServer() {
this.$ipcApi.send("stop-server");
this.$ipcApi.on("confirm-stop", (event, arg) => {
this.$message({
type: "success",
message: "已关闭"
});
});
},
StartServer() {
this.$ipcApi.send("statr-server");
this.$ipcApi.on("confirm-start", (event, arg) => {
...
...
@@ -255,9 +267,12 @@ export default {
}
},
destroyed() {
console.log("销毁了哦")
this.$ipcApi.remove("confirm-message");
this.$ipcApi.remove("download-done");
this.$ipcApi.remove("download-paused");
this.$ipcApi.remove("confirm-stop");
this.$ipcApi.remove("confirm-start");
this.$ipcApi.remove("confirm-download");
this.$ipcApi.remove("download-progress");
this.$ipcApi.remove("download-error");
...
...
请
注册
或
登录
后发表评论