张恒

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

......@@ -8,6 +8,10 @@ const webpack = require('webpack')
const MinifyPlugin = require("babel-minify-webpack-plugin");
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
let mainConfig = {
entry: {
main: path.join(__dirname, '../src/main/index.js')
......@@ -52,6 +56,9 @@ let mainConfig = {
new webpack.NoEmitOnErrorsPlugin()
],
resolve: {
alias: {
'config': resolve('config'),
},
extensions: ['.js', '.json', '.node']
},
target: 'electron-main'
......
......@@ -25,18 +25,11 @@ npm run dev
# build命令在不同系统环境中,需要的的不一样,需要自己根据自身环境进行配置
npm run build
# 启动单元测试模块,但是需要注意的是,我没有更新依赖,所以很可能会导致失败
npm test
```
---
这个项目使用了 [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).
这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
# 更新日志
- 2019年8月10日更新:添加各个平台的build脚本,当您直接使用build时,则会打包您当前操作系统对应的安装包,mac需要在macos上才能进行打包,而linux打包win的话,需要wine的支持,否则会失败
- 2019年8月4日更新:修正原webpack配置中没有将config注入的小问题,添加了拦截实例,修改了侧栏,侧栏需要底色的请勿更新,此更新可能会导致侧栏底色无法完全覆盖(待修正),添加axios接口示例,待测。
- 2019年8月1日更新:将node-sass版本更新至最新版本,尝试修正由于nodejs环境是12版导致失败(注意!此次更新可能会导致32位系统或者nodejs版本低于10的用户安装依赖报错)去除路由表中重复路由,解决控制台无端报错问题。
\ No newline at end of file
这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
\ No newline at end of file
......
module.exports = {
NODE_ENV: '"development"',
BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"'
BASE_API: '""'
}
......
......@@ -4,5 +4,6 @@ module.exports = {
},
dev: {
env: require('./dev.env')
}
},
UseStartupChart: true
}
......
......@@ -9,7 +9,7 @@
"build": "node .electron-vue/build.js && electron-builder",
"build:win32": "node .electron-vue/build.js && electron-builder --win --ia32",
"build:win64": "node .electron-vue/build.js && electron-builder --win --x64",
"build:mac": "node .electron-vue/build.js && electron-builder --platform=mac",
"build:mac": "node .electron-vue/build.js && electron-builder --mac",
"build:dir": "node .electron-vue/build.js && electron-builder --dir",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
......
......@@ -8,6 +8,7 @@
/* eslint-disable */
// Install `electron-debug` with `devtron`
require('electron-debug')({ showDevTools: true })
// Install `vue-devtools`
......
'use strict'
import {
app,
BrowserWindow,
Menu
} from 'electron'
import { app } from 'electron'
import '../renderer/store'
import menuconfig from './menu'
import loadindWindow from './services/windowManager'
/**
* Set `__static` path to static files in production
......@@ -16,43 +12,13 @@ if (process.env.NODE_ENV !== 'development') {
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
}
let mainWindow
const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080`
: `file://${__dirname}/index.html`
const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080/static/loader.html` : `file://${__static}/loader.html`
function createWindow () {
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
show: false,
backgroundColor: '#fffff',
titleBarStyle: 'hidden',
webPreferences: {
nodeIntegration: true
}
// 隐藏边框
// frame: false,
})
mainWindow.once('ready-to-show', () => {
mainWindow.show()
})
const menu = Menu.buildFromTemplate(menuconfig)
Menu.setApplicationMenu(menu)
mainWindow.loadURL(winURL)
mainWindow.on('closed', () => {
mainWindow = null
})
function onAppReady () {
loadindWindow(loadingURL)
}
app.on('ready', createWindow)
app.isReady() ? onAppReady() : app.on('ready', onAppReady)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
......@@ -60,11 +26,11 @@ app.on('window-all-closed', () => {
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
// app.on('activate', () => {
// if (mainWindow === null) {
// createWindow()
// }
// })
/**
* Auto Updater
......
import { BrowserWindow, Menu } from 'electron'
import menuconfig from '../config/menu'
const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
function createMainWindow () {
let mainWindow
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
height: 600,
useContentSize: true,
width: 1000,
show: false,
backgroundColor: '#fffff',
titleBarStyle: 'hidden',
webPreferences: {
nodeIntegration: true
}
})
const menu = Menu.buildFromTemplate(menuconfig)
Menu.setApplicationMenu(menu)
mainWindow.loadURL(winURL)
mainWindow.once('ready-to-show', () => {
mainWindow.show()
})
mainWindow.on('closed', () => {
mainWindow = null
})
}
// if(require('config').UseUseStartupChart){
// }
function loadindWindow (loadingURL) {
const loadWindow = new BrowserWindow({
width: 400,
height: 600,
frame: false,
backgroundColor: '#222428'
})
loadWindow.loadURL(loadingURL)
loadWindow.show()
setTimeout(() => {
createMainWindow()
loadWindow.destroy()
}, 2000)
}
export default loadindWindow
......@@ -16,7 +16,7 @@ export default {
message: data.message
}, index => {
if (index === 0) {
let tempfun = async () => {
const tempfun = async () => {
try {
resolve(await fun)
} catch (error) {
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
/* Demo Styles - It's all in the SVG */
html {
height: 100%;
min-height: 100%;
overflow: hidden;
}
html body {
background: #222428;
background-size: 163px;
font: 14px/21px Monaco, sans-serif;
color: #999;
font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
text-size-adjust: 100%;
height: 100%;
min-height: 100%;
}
html body a, html body a:visited {
text-decoration: none;
color: #FF805F;
}
html body h4 {
margin: 0;
color: #666;
}
.scene {
width: 100%;
height: 100%;
-webkit-perspective: 600;
perspective: 600;
display: flex;
align-items: center;
justify-content: center;
}
.scene svg {
width: 240px;
height: 240px;
}
.dc-logo {
position: fixed;
right: 10px;
bottom: 10px;
}
.dc-logo:hover svg {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: arrow-spin 2.5s 0s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
animation: arrow-spin 2.5s 0s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
}
.dc-logo:hover:hover:before {
content: '\2764';
padding: 6px;
font: 10px/1 Monaco, sans-serif;
font-size: 10px;
color: #00fffe;
text-transform: uppercase;
position: absolute;
left: -70px;
top: -30px;
white-space: nowrap;
z-index: 20px;
box-shadow: 0px 0px 4px #222;
background: rgba(0, 0, 0, 0.4);
}
.dc-logo:hover:hover:after {
content: 'Digital Craft';
padding: 6px;
font: 10px/1 Monaco, sans-serif;
font-size: 10px;
color: #6E6F71;
text-transform: uppercase;
position: absolute;
right: 0;
top: -30px;
white-space: nowrap;
z-index: 20px;
box-shadow: 0px 0px 4px #222;
background: rgba(0, 0, 0, 0.4);
background-image: none;
}
@-webkit-keyframes arrow-spin {
50% {
-webkit-transform: rotateY(360deg);
transform: rotateY(360deg);
}
}
@keyframes arrow-spin {
50% {
-webkit-transform: rotateY(360deg);
transform: rotateY(360deg);
}
}
</style>
</head>
<body>
<div class="scene">
<svg
version="1.1"
id="dc-spinner"
xmlns="http://www.w3.org/2000/svg"
x="0px" y="0px"
width:"38"
height:"38"
viewBox="0 0 38 38"
preserveAspectRatio="xMinYMin meet"
>
<text x="13" y="21" font-family="Monaco" font-size="2px" style="letter-spacing:0.6" fill="grey">准备资源中...
<animate
attributeName="opacity"
values="0;1;0" dur="1.8s"
repeatCount="indefinite"/>
</text>
<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
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
C34.797,11.841,28.159,5.203,20,5.203z">
</path>
<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
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
S32.922,27.125,32.922,20C32.922,12.875,27.125,7.078,20,7.078z">
</path>
<path fill="#2AA198" stroke="#2AA198" stroke-width="0.6027" stroke-miterlimit="10" d="M5.203,20
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">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
calcMode="spline"
keySplines="0.4, 0, 0.2, 1"
keyTimes="0;1"
dur="2s"
repeatCount="indefinite" />
</path>
<path fill="#859900" stroke="#859900" stroke-width="0.2027" stroke-miterlimit="10" d="M7.078,20
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
C12.875,32.922,7.078,27.125,7.078,20z">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
dur="1.8s"
repeatCount="indefinite" />
</path>
</svg>
</div>
</body>
</html>