张恒

添加启动图,拆分main文件夹中的文件

...@@ -8,6 +8,10 @@ const webpack = require('webpack') ...@@ -8,6 +8,10 @@ const webpack = require('webpack')
8 8
9 const MinifyPlugin = require("babel-minify-webpack-plugin"); 9 const MinifyPlugin = require("babel-minify-webpack-plugin");
10 10
11 +function resolve(dir) {
12 + return path.join(__dirname, '..', dir)
13 +}
14 +
11 let mainConfig = { 15 let mainConfig = {
12 entry: { 16 entry: {
13 main: path.join(__dirname, '../src/main/index.js') 17 main: path.join(__dirname, '../src/main/index.js')
...@@ -52,6 +56,9 @@ let mainConfig = { ...@@ -52,6 +56,9 @@ let mainConfig = {
52 new webpack.NoEmitOnErrorsPlugin() 56 new webpack.NoEmitOnErrorsPlugin()
53 ], 57 ],
54 resolve: { 58 resolve: {
59 + alias: {
60 + 'config': resolve('config'),
61 + },
55 extensions: ['.js', '.json', '.node'] 62 extensions: ['.js', '.json', '.node']
56 }, 63 },
57 target: 'electron-main' 64 target: 'electron-main'
......
...@@ -25,18 +25,11 @@ npm run dev ...@@ -25,18 +25,11 @@ npm run dev
25 # build命令在不同系统环境中,需要的的不一样,需要自己根据自身环境进行配置 25 # build命令在不同系统环境中,需要的的不一样,需要自己根据自身环境进行配置
26 npm run build 26 npm run build
27 27
28 -# 启动单元测试模块,但是需要注意的是,我没有更新依赖,所以很可能会导致失败
29 -npm test
30 -
31 28
32 ``` 29 ```
33 30
31 +
34 --- 32 ---
35 33
36 这个项目使用了 [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). 文档你们可以在这里看到: [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html). 34 这个项目使用了 [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). 文档你们可以在这里看到: [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
37 -这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
38 -
39 -# 更新日志
40 -- 2019年8月10日更新:添加各个平台的build脚本,当您直接使用build时,则会打包您当前操作系统对应的安装包,mac需要在macos上才能进行打包,而linux打包win的话,需要wine的支持,否则会失败
41 -- 2019年8月4日更新:修正原webpack配置中没有将config注入的小问题,添加了拦截实例,修改了侧栏,侧栏需要底色的请勿更新,此更新可能会导致侧栏底色无法完全覆盖(待修正),添加axios接口示例,待测。
42 -- 2019年8月1日更新:将node-sass版本更新至最新版本,尝试修正由于nodejs环境是12版导致失败(注意!此次更新可能会导致32位系统或者nodejs版本低于10的用户安装依赖报错)去除路由表中重复路由,解决控制台无端报错问题。
...\ No newline at end of file ...\ No newline at end of file
35 +这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
...\ No newline at end of file ...\ No newline at end of file
......
1 module.exports = { 1 module.exports = {
2 NODE_ENV: '"development"', 2 NODE_ENV: '"development"',
3 - BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"' 3 + BASE_API: '""'
4 } 4 }
......
...@@ -4,5 +4,6 @@ module.exports = { ...@@ -4,5 +4,6 @@ module.exports = {
4 }, 4 },
5 dev: { 5 dev: {
6 env: require('./dev.env') 6 env: require('./dev.env')
7 - } 7 + },
8 + UseStartupChart: true
8 } 9 }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 "build": "node .electron-vue/build.js && electron-builder", 9 "build": "node .electron-vue/build.js && electron-builder",
10 "build:win32": "node .electron-vue/build.js && electron-builder --win --ia32", 10 "build:win32": "node .electron-vue/build.js && electron-builder --win --ia32",
11 "build:win64": "node .electron-vue/build.js && electron-builder --win --x64", 11 "build:win64": "node .electron-vue/build.js && electron-builder --win --x64",
12 - "build:mac": "node .electron-vue/build.js && electron-builder --platform=mac", 12 + "build:mac": "node .electron-vue/build.js && electron-builder --mac",
13 "build:dir": "node .electron-vue/build.js && electron-builder --dir", 13 "build:dir": "node .electron-vue/build.js && electron-builder --dir",
14 "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", 14 "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
15 "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js", 15 "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
8 /* eslint-disable */ 8 /* eslint-disable */
9 9
10 // Install `electron-debug` with `devtron` 10 // Install `electron-debug` with `devtron`
11 +
11 require('electron-debug')({ showDevTools: true }) 12 require('electron-debug')({ showDevTools: true })
12 13
13 // Install `vue-devtools` 14 // Install `vue-devtools`
......
1 'use strict' 1 'use strict'
2 2
3 -import { 3 +import { app } from 'electron'
4 - app,
5 - BrowserWindow,
6 - Menu
7 -} from 'electron'
8 import '../renderer/store' 4 import '../renderer/store'
9 -import menuconfig from './menu' 5 +import loadindWindow from './services/windowManager'
10 6
11 /** 7 /**
12 * Set `__static` path to static files in production 8 * Set `__static` path to static files in production
...@@ -16,43 +12,13 @@ if (process.env.NODE_ENV !== 'development') { ...@@ -16,43 +12,13 @@ if (process.env.NODE_ENV !== 'development') {
16 global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') 12 global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
17 } 13 }
18 14
19 -let mainWindow 15 +const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080/static/loader.html` : `file://${__static}/loader.html`
20 -const winURL = process.env.NODE_ENV === 'development'
21 - ? `http://localhost:9080`
22 - : `file://${__dirname}/index.html`
23 16
24 -function createWindow () { 17 +function onAppReady () {
25 - /** 18 + loadindWindow(loadingURL)
26 - * Initial window options
27 - */
28 - mainWindow = new BrowserWindow({
29 - height: 563,
30 - useContentSize: true,
31 - width: 1000,
32 - show: false,
33 - backgroundColor: '#fffff',
34 - titleBarStyle: 'hidden',
35 - webPreferences: {
36 - nodeIntegration: true
37 - }
38 - // 隐藏边框
39 - // frame: false,
40 - })
41 -
42 - mainWindow.once('ready-to-show', () => {
43 - mainWindow.show()
44 - })
45 -
46 - const menu = Menu.buildFromTemplate(menuconfig)
47 - Menu.setApplicationMenu(menu)
48 - mainWindow.loadURL(winURL)
49 -
50 - mainWindow.on('closed', () => {
51 - mainWindow = null
52 - })
53 } 19 }
54 20
55 -app.on('ready', createWindow) 21 +app.isReady() ? onAppReady() : app.on('ready', onAppReady)
56 22
57 app.on('window-all-closed', () => { 23 app.on('window-all-closed', () => {
58 if (process.platform !== 'darwin') { 24 if (process.platform !== 'darwin') {
...@@ -60,11 +26,11 @@ app.on('window-all-closed', () => { ...@@ -60,11 +26,11 @@ app.on('window-all-closed', () => {
60 } 26 }
61 }) 27 })
62 28
63 -app.on('activate', () => { 29 +// app.on('activate', () => {
64 - if (mainWindow === null) { 30 +// if (mainWindow === null) {
65 - createWindow() 31 +// createWindow()
66 - } 32 +// }
67 -}) 33 +// })
68 34
69 /** 35 /**
70 * Auto Updater 36 * Auto Updater
......
1 +import { BrowserWindow, Menu } from 'electron'
2 +import menuconfig from '../config/menu'
3 +
4 +const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
5 +
6 +function createMainWindow () {
7 + let mainWindow
8 + /**
9 + * Initial window options
10 + */
11 + mainWindow = new BrowserWindow({
12 + height: 600,
13 + useContentSize: true,
14 + width: 1000,
15 + show: false,
16 + backgroundColor: '#fffff',
17 + titleBarStyle: 'hidden',
18 + webPreferences: {
19 + nodeIntegration: true
20 + }
21 + })
22 +
23 + const menu = Menu.buildFromTemplate(menuconfig)
24 + Menu.setApplicationMenu(menu)
25 + mainWindow.loadURL(winURL)
26 +
27 + mainWindow.once('ready-to-show', () => {
28 + mainWindow.show()
29 + })
30 +
31 + mainWindow.on('closed', () => {
32 + mainWindow = null
33 + })
34 +}
35 +// if(require('config').UseUseStartupChart){
36 +
37 +// }
38 +function loadindWindow (loadingURL) {
39 + const loadWindow = new BrowserWindow({
40 + width: 400,
41 + height: 600,
42 + frame: false,
43 + backgroundColor: '#222428'
44 + })
45 +
46 + loadWindow.loadURL(loadingURL)
47 +
48 + loadWindow.show()
49 +
50 + setTimeout(() => {
51 + createMainWindow()
52 + loadWindow.destroy()
53 + }, 2000)
54 +}
55 +
56 +export default loadindWindow
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
16 message: data.message 16 message: data.message
17 }, index => { 17 }, index => {
18 if (index === 0) { 18 if (index === 0) {
19 - let tempfun = async () => { 19 + const tempfun = async () => {
20 try { 20 try {
21 resolve(await fun) 21 resolve(await fun)
22 } catch (error) { 22 } catch (error) {
......
1 +<!doctype html>
2 +<html>
3 +<head>
4 +<meta charset="utf-8">
5 +<title></title>
6 +
7 +<style>
8 +/* Demo Styles - It's all in the SVG */
9 +html {
10 + height: 100%;
11 + min-height: 100%;
12 + overflow: hidden;
13 +}
14 +html body {
15 + background: #222428;
16 + background-size: 163px;
17 + font: 14px/21px Monaco, sans-serif;
18 + color: #999;
19 + font-smoothing: antialiased;
20 + -webkit-text-size-adjust: 100%;
21 + -moz-text-size-adjust: 100%;
22 + -ms-text-size-adjust: 100%;
23 + text-size-adjust: 100%;
24 + height: 100%;
25 + min-height: 100%;
26 +}
27 +html body a, html body a:visited {
28 + text-decoration: none;
29 + color: #FF805F;
30 +}
31 +html body h4 {
32 + margin: 0;
33 + color: #666;
34 +}
35 +
36 +.scene {
37 + width: 100%;
38 + height: 100%;
39 + -webkit-perspective: 600;
40 + perspective: 600;
41 + display: flex;
42 + align-items: center;
43 + justify-content: center;
44 +}
45 +.scene svg {
46 + width: 240px;
47 + height: 240px;
48 +}
49 +
50 +.dc-logo {
51 + position: fixed;
52 + right: 10px;
53 + bottom: 10px;
54 +}
55 +
56 +.dc-logo:hover svg {
57 + -webkit-transform-origin: 50% 50%;
58 + transform-origin: 50% 50%;
59 + -webkit-animation: arrow-spin 2.5s 0s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
60 + animation: arrow-spin 2.5s 0s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
61 +}
62 +.dc-logo:hover:hover:before {
63 + content: '\2764';
64 + padding: 6px;
65 + font: 10px/1 Monaco, sans-serif;
66 + font-size: 10px;
67 + color: #00fffe;
68 + text-transform: uppercase;
69 + position: absolute;
70 + left: -70px;
71 + top: -30px;
72 + white-space: nowrap;
73 + z-index: 20px;
74 + box-shadow: 0px 0px 4px #222;
75 + background: rgba(0, 0, 0, 0.4);
76 +}
77 +.dc-logo:hover:hover:after {
78 + content: 'Digital Craft';
79 + padding: 6px;
80 + font: 10px/1 Monaco, sans-serif;
81 + font-size: 10px;
82 + color: #6E6F71;
83 + text-transform: uppercase;
84 + position: absolute;
85 + right: 0;
86 + top: -30px;
87 + white-space: nowrap;
88 + z-index: 20px;
89 + box-shadow: 0px 0px 4px #222;
90 + background: rgba(0, 0, 0, 0.4);
91 + background-image: none;
92 +}
93 +
94 +@-webkit-keyframes arrow-spin {
95 + 50% {
96 + -webkit-transform: rotateY(360deg);
97 + transform: rotateY(360deg);
98 + }
99 +}
100 +
101 +@keyframes arrow-spin {
102 + 50% {
103 + -webkit-transform: rotateY(360deg);
104 + transform: rotateY(360deg);
105 + }
106 +}
107 +</style>
108 +</head>
109 +<body>
110 +<div class="scene">
111 + <svg
112 + version="1.1"
113 + id="dc-spinner"
114 + xmlns="http://www.w3.org/2000/svg"
115 + x="0px" y="0px"
116 + width:"38"
117 + height:"38"
118 + viewBox="0 0 38 38"
119 + preserveAspectRatio="xMinYMin meet"
120 + >
121 + <text x="13" y="21" font-family="Monaco" font-size="2px" style="letter-spacing:0.6" fill="grey">准备资源中...
122 + <animate
123 + attributeName="opacity"
124 + values="0;1;0" dur="1.8s"
125 + repeatCount="indefinite"/>
126 + </text>
127 + <path fill="#373a42" d="M20,35c-8.271,0-15-6.729-15-15S11.729,5,20,5s15,6.729,15,15S28.271,35,20,35z M20,5.203
128 + C11.841,5.203,5.203,11.841,5.203,20c0,8.159,6.638,14.797,14.797,14.797S34.797,28.159,34.797,20
129 + C34.797,11.841,28.159,5.203,20,5.203z">
130 + </path>
131 +
132 + <path fill="#373a42" d="M20,33.125c-7.237,0-13.125-5.888-13.125-13.125S12.763,6.875,20,6.875S33.125,12.763,33.125,20
133 + S27.237,33.125,20,33.125z M20,7.078C12.875,7.078,7.078,12.875,7.078,20c0,7.125,5.797,12.922,12.922,12.922
134 + S32.922,27.125,32.922,20C32.922,12.875,27.125,7.078,20,7.078z">
135 + </path>
136 +
137 + <path fill="#2AA198" stroke="#2AA198" stroke-width="0.6027" stroke-miterlimit="10" d="M5.203,20
138 + c0-8.159,6.638-14.797,14.797-14.797V5C11.729,5,5,11.729,5,20s6.729,15,15,15v-0.203C11.841,34.797,5.203,28.159,5.203,20z">
139 + <animateTransform
140 + attributeName="transform"
141 + type="rotate"
142 + from="0 20 20"
143 + to="360 20 20"
144 + calcMode="spline"
145 + keySplines="0.4, 0, 0.2, 1"
146 + keyTimes="0;1"
147 + dur="2s"
148 + repeatCount="indefinite" />
149 + </path>
150 +
151 + <path fill="#859900" stroke="#859900" stroke-width="0.2027" stroke-miterlimit="10" d="M7.078,20
152 + c0-7.125,5.797-12.922,12.922-12.922V6.875C12.763,6.875,6.875,12.763,6.875,20S12.763,33.125,20,33.125v-0.203
153 + C12.875,32.922,7.078,27.125,7.078,20z">
154 + <animateTransform
155 + attributeName="transform"
156 + type="rotate"
157 + from="0 20 20"
158 + to="360 20 20"
159 + dur="1.8s"
160 + repeatCount="indefinite" />
161 + </path>
162 + </svg>
163 +</div>
164 +
165 +</body>
166 +</html>