umbrella22

合并冲突

......@@ -23,7 +23,7 @@ else if (process.env.BUILD_TARGET === 'web') web()
else build()
function clean () {
del.sync(['build/*', '!build/icons','!build/lib','!build/lib/electron-build.*', '!build/icons/icon.*'])
del.sync(['dist/electron/*','build/*', '!build/icons','!build/lib','!build/lib/electron-build.*', '!build/icons/icon.*'])
console.log(`\n${doneLog}clear done`)
process.exit()
}
......
......@@ -21,7 +21,7 @@ let hotMiddleware
function logStats(proc, data) {
let log = ''
log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`)
log += chalk.yellow.bold(`┏ ${proc} ${config.dev.chineseLog ? '编译过程' : 'Process'} ${new Array((19 - proc.length) + 1).join('-')}`)
log += '\n\n'
if (typeof data === 'object') {
......@@ -38,6 +38,7 @@ function logStats(proc, data) {
log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'
console.log(log)
}
function removeJunk(chunk) {
if (config.dev.removeElectronJunk) {
// Example: 2018-08-10 22:48:42.866 Electron[90311:4883863] *** WARNING: Textured window <AtomNSWindow: 0x7fb75f68a770>
......@@ -76,7 +77,9 @@ function startRenderer() {
compiler.hooks.compilation.tap('compilation', compilation => {
compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => {
hotMiddleware.publish({ action: 'reload' })
hotMiddleware.publish({
action: 'reload'
})
cb()
})
})
......@@ -86,17 +89,16 @@ function startRenderer() {
})
const server = new WebpackDevServer(
compiler,
{
contentBase: path.join(__dirname, '../'),
quiet: true,
before(app, ctx) {
app.use(hotMiddleware)
ctx.middleware.waitUntilValid(() => {
resolve()
})
}
compiler, {
contentBase: path.join(__dirname, '../'),
quiet: true,
before(app, ctx) {
app.use(hotMiddleware)
ctx.middleware.waitUntilValid(() => {
resolve()
})
}
}
)
process.env.PORT = port
......@@ -114,8 +116,10 @@ function startMain() {
const compiler = webpack(mainConfig)
compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
logStats('Main', chalk.white.bold('compiling...'))
hotMiddleware.publish({ action: 'compiling' })
logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`))
hotMiddleware.publish({
action: 'compiling'
})
done()
})
......@@ -125,7 +129,7 @@ function startMain() {
return
}
logStats('Main', stats)
logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, stats)
if (electronProcess && electronProcess.kill) {
manualRestart = true
......@@ -179,7 +183,7 @@ function electronLog(data, color) {
})
if (/[0-9A-z]+/.test(log)) {
console.log(
chalk[color].bold('┏ Electron -------------------') +
chalk[color].bold(`┏ ${config.dev.chineseLog ? '主程序日志' : 'Electron'} -------------------`) +
'\n\n' +
log +
chalk[color].bold('┗ ----------------------------') +
......@@ -205,11 +209,12 @@ function greeting() {
space: false
})
} else console.log(chalk.yellow.bold('\n electron-vue'))
console.log(chalk.blue(' getting ready...') + '\n')
console.log(chalk.blue(`${config.dev.chineseLog ? ' 准备启动...' : ' getting ready...'}`) + '\n')
}
async function init() {
greeting()
try {
await startRenderer()
await startMain()
......@@ -217,6 +222,7 @@ async function init() {
} catch (error) {
console.error(error)
}
}
init()
init()
\ No newline at end of file
......
......@@ -2,12 +2,13 @@
process.env.BABEL_ENV = 'main'
const os = require('os')
const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')
const MinifyPlugin = require("babel-minify-webpack-plugin");
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HappyPack = require('happypack')
const HappyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length })
function resolve(dir) {
return path.join(__dirname, '..', dir)
......@@ -35,7 +36,7 @@ let mainConfig = {
// },
{
test: /\.js$/,
use: 'babel-loader',
use: 'happypack/loader?id=MainHappyBabel',
exclude: /node_modules/
},
{
......@@ -55,9 +56,16 @@ let mainConfig = {
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
// new CleanWebpackPlugin({
// cleanOnceBeforeBuildPatterns: resolve('dist/electron')
// })
new HappyPack({
id: "MainHappyBabel",
loaders: [{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}],
threadPool: HappyThreadPool
})
],
resolve: {
alias: {
......
......@@ -2,6 +2,7 @@
process.env.BABEL_ENV = 'renderer'
const os = require('os')
const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')
......@@ -12,7 +13,10 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader')
const HappyPack = require('happypack')
const HappyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length })
function resolve(dir) {
return path.join(__dirname, '..', dir)
......@@ -24,7 +28,7 @@ function resolve(dir) {
* that provide pure *.vue files that need compiling
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
*/
let whiteListedModules = ['vue',"element-ui"]
let whiteListedModules = ['vue', "element-ui"]
let rendererConfig = {
devtool: '#cheap-module-eval-source-map',
......@@ -69,7 +73,7 @@ let rendererConfig = {
},
{
test: /\.js$/,
use: 'babel-loader',
use: 'happypack/loader?id=HappyRendererBabel',
exclude: /node_modules/
},
{
......@@ -104,6 +108,7 @@ let rendererConfig = {
use: {
loader: 'url-loader',
query: {
esModule: false,
limit: 10000,
name: 'imgs/[name]--[folder].[ext]'
}
......@@ -113,6 +118,7 @@ let rendererConfig = {
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
esModule: false,
limit: 10000,
name: 'media/[name]--[folder].[ext]'
}
......@@ -122,6 +128,7 @@ let rendererConfig = {
use: {
loader: 'url-loader',
query: {
esModule: false,
limit: 10000,
name: 'fonts/[name]--[folder].[ext]'
}
......@@ -164,7 +171,18 @@ let rendererConfig = {
nodeModules: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
new webpack.NoEmitOnErrorsPlugin(),
new HardSourceWebpackPlugin(),
new HappyPack({
id: 'HappyRendererBabel',
loaders: [{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}],
threadPool: HappyThreadPool
}),
],
output: {
filename: '[name].js',
......@@ -187,7 +205,8 @@ let rendererConfig = {
if (process.env.NODE_ENV !== 'production') {
rendererConfig.plugins.push(
new webpack.DefinePlugin({
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`,
'__lib': `"${path.join(__dirname, `../${config.DllFolder}`).replace(/\\/g, '\\\\')}"`
})
)
}
......
......@@ -42,6 +42,9 @@ npm config edit
这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
# 更新日志
- 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)
- 2020年02月06日更新:激进分支更新至8.0.0.
- 2020年01月09日更新:例行更新依赖,在dev中加入了端口监听检测,如果9080端口被占用就会自动向后开启一个端口号并使用,同时在config/index.js的dev中加入了端口设置,可以快捷设置端口号而不用去更改webpack的配置了。
- 2019年12月18日更新:我在build文件夹内添加了windows的打包依赖,在打包爆错的话,可以尝试使用/build/lib内的压缩包,记得看使用说明哦~
- 2019年11月22日更新:得益于群里老哥的提醒,通过修改系统环境变量得到了通过yarn下载electron失败的问题,具体操作如下:用户环境变量中新增两个个变量,一个是变量名为`ELECTRON_MIRROR`,变量值为`https://npm.taobao.org/mirrors/electron/`,另一个是变量名为`registry`,变量值为`https://registry.npm.taobao.org/`,然后系统变量中同样也加上这两个值,完成之后,删除node_module文件夹。然后执行yarn install,如果还是提示未安装,那就去electron文件夹内执行一次yarn install,就好了。这样的话,不仅仅只是yarn更快了,electron的rebuild也会加速很多。所以推荐使用yarn。
......
module.exports = {
NODE_ENV: '"development"',
BASE_API: '""'
BASE_API: '"http://127.0.0.1:25565"'
}
......
......@@ -6,8 +6,11 @@ module.exports = {
dev: {
env: require('./dev.env'),
removeElectronJunk: true,
chineseLog: false,
port: 9080
},
UseStartupChart: true,
IsUseSysTitle: true
IsUseSysTitle: true,
DllFolder: '',
BuiltInServerPort: 25565
}
......
module.exports = {
NODE_ENV: '"production"',
BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"'
BASE_API: '"http://127.0.0.1:25565"'
}
......
此文件的差异太大,无法显示。
......@@ -6,12 +6,12 @@
"license": "MIT",
"main": "./dist/electron/main.js",
"scripts": {
"dev": "node .electron-vue/dev-runner.js",
"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 --mac",
"build:dir": "node .electron-vue/build.js && electron-builder --dir",
"dev": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/dev-runner.js",
"build": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/build.js && electron-builder",
"build:win32": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --ia32",
"build:win64": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --x64",
"build:mac": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --mac",
"build:dir": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && 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",
"pack": "npm run pack:main && npm run pack:renderer",
......@@ -20,6 +20,7 @@
"update:serve": "node server/index.js"
},
"build": {
"extraFiles": [],
"publish": [
{
"provider": "generic",
......@@ -69,88 +70,89 @@
}
},
"dependencies": {
"axios": "^0.19.1",
"date-fns": "^2.9.0",
"electron-updater": "^4.2.0",
"element-ui": "^2.13.0",
"fs-extra": "^8.1.0",
"axios": "^0.19.2",
"date-fns": "^2.12.0",
"electron-updater": "^4.2.5",
"element-ui": "^2.13.1",
"express": "^4.17.1",
"fs-extra": "^9.0.0",
"js-cookie": "^2.2.1",
"nedb": "^1.8.0",
"nprogress": "^0.2.0",
"vue": "^2.6.11",
"vue-electron": "^1.0.6",
"vue-router": "^3.1.3",
"vuex": "^3.1.2",
"vue-router": "^3.1.6",
"vuex": "^3.1.3",
"vuex-electron": "^1.0.3"
},
"devDependencies": {
"@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-decorators": "^7.7.4",
"@babel/plugin-proposal-do-expressions": "^7.7.4",
"@babel/plugin-proposal-export-default-from": "^7.7.4",
"@babel/plugin-proposal-export-namespace-from": "^7.7.4",
"@babel/plugin-proposal-function-bind": "^7.7.4",
"@babel/plugin-proposal-function-sent": "^7.7.4",
"@babel/plugin-proposal-json-strings": "^7.7.4",
"@babel/plugin-proposal-logical-assignment-operators": "^7.7.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-proposal-numeric-separator": "^7.7.4",
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
"@babel/plugin-proposal-pipeline-operator": "^7.7.4",
"@babel/plugin-proposal-throw-expressions": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-syntax-import-meta": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.6",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.7.6",
"ajv": "^6.10.2",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-do-expressions": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-function-bind": "^7.8.3",
"@babel/plugin-proposal-function-sent": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-proposal-logical-assignment-operators": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-numeric-separator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-proposal-pipeline-operator": "^7.8.3",
"@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/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.5",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"ajv": "^6.12.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.6",
"babel-loader": "^8.1.0",
"babel-minify-webpack-plugin": "^0.3.1",
"cfonts": "^2.4.8",
"chalk": "^3.0.0",
"clean-webpack-plugin": "^3.0.0",
"cfonts": "^2.8.1",
"chalk": "^4.0.0",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^6.0.3",
"css-loader": "^3.4.1",
"cross-env": "^7.0.2",
"css-loader": "^3.5.2",
"del": "^5.1.0",
"electron": "^7.1.8",
"electron-builder": "^21.2.0",
"electron-devtools-installer": "^2.2.4",
"electron": "^8.2.2",
"electron-builder": "^22.4.1",
"electron-devtools-installer": "^3.0.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard": "^14.1.1",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^3.0.3",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-import": "^2.19.1",
"eslint-loader": "^3.0.4",
"eslint-plugin-html": "^6.0.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"express": "^4.17.1",
"file-loader": "^5.0.2",
"file-loader": "^6.0.0",
"happypack": "^5.0.1",
"hard-source-webpack-plugin": "^0.13.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "0.9.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.13.0",
"node-sass": "^4.13.1",
"portfinder": "^1.0.25",
"sass-loader": "^8.0.0",
"sass-loader": "^8.0.2",
"split2": "^3.1.1",
"style-loader": "^1.1.2",
"svg-sprite-loader": "^4.1.6",
"terser-webpack-plugin": "^2.3.1",
"style-loader": "^1.1.3",
"svg-sprite-loader": "^4.2.5",
"terser-webpack-plugin": "^2.3.5",
"through2-filter": "^3.0.0",
"url-loader": "^3.0.0",
"url-loader": "^4.1.0",
"vue-html-loader": "^1.2.4",
"vue-loader": "^15.8.3",
"vue-loader": "^15.9.1",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2"
}
......
var express = require('express')
const express = require('express')
const path = require('path')
var app = express()
const app = express()
app.use(express.static(path.join(__dirname, './client')))
var server = app.listen(25565, function () {
var host = server.address().address
var port = server.address().port
const server = app.listen(25565, function () {
const host = server.address().address
const port = server.address().port
console.log('服务启动', host, port)
})
......
......@@ -16,6 +16,7 @@
<% if (!process.browser) { %>
<script>
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
if (process.env.NODE_ENV !== 'development') window.__lib = require('path').join(__dirname,'..','..','..','..',`${require('../config/index.js').DllFolder}`).replace(/\\/g, '\\\\')
</script>
<% } %>
......
/* eslint-disable prefer-promise-reject-errors */
import app from './server'
import http from 'http'
import config from '@config'
const port = config.BuiltInServerPort
app.set('port', port)
export default {
StatrServer () {
return new Promise((resolve, reject) => {
const server = http.createServer(app)
server.listen(port)
server.on('error', (error) => {
switch (error.code) {
case 'EACCES':
reject('权限不足内置服务器启动失败,请使用管理员权限运行。')
break
case 'EADDRINUSE':
reject('内置服务器端口已被占用,请检查。')
break
default:
reject(error)
}
})
server.on('listening', () => {
resolve('服务端运行中')
})
})
}
}
import express from 'express'
const app = express()
app.get('/message', (req, res) => {
res.send('这是来自node服务端的信息')
})
app.post('/message', (req, res) => {
if (req) {
res.send(req + '--来自node')
}
})
export default app
import { autoUpdater } from 'electron-updater'
import { ipcMain } from 'electron'
/**
* -1 检查更新失败 0 正在检查更新 1 检测到新版本,准备下载 2 未检测到新版本 3 下载中 4 下载暂停 5 下载暂停恢复 6 下载完成 7 下载失败 8 取消下载
* */
* -1 检查更新失败 0 正在检查更新 1 检测到新版本,准备下载 2 未检测到新版本 3 下载中 4 下载完成
**/
function Message (mainWindow, type, data) {
const senddata = {
state: type,
......
......@@ -21,7 +21,7 @@ if (os.platform().includes('win32')) {
}
export default {
download (mainWindow) {
ipcMain.on('satrt-download', (event, msg) => {
ipcMain.on('start-download', (event, msg) => {
mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL)
event.reply('confirm-download', true)
mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
......
import { ipcMain, dialog } from 'electron'
import Server from '../server/index'
export default {
Mainfunc (mainWindow, IsUseSysTitle) {
ipcMain.on('IsUseSysTitle', (event) => {
......@@ -37,5 +38,15 @@ export default {
arg.message
)
})
ipcMain.on('statr-server', (event, arg) => {
Server.StatrServer().then(res => {
event.reply('confirm-start', res)
}).catch(err => {
dialog.showErrorBox(
'错误',
err
)
})
})
}
}
......
......@@ -21,7 +21,7 @@ const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:${
var loadWindow = null
var mainWindow = null
function createMainWindow() {
function createMainWindow () {
/**
* Initial window options
*/
......@@ -83,7 +83,7 @@ function createMainWindow() {
})
}
function loadindWindow() {
function loadindWindow () {
loadWindow = new BrowserWindow({
width: 400,
height: 600,
......@@ -100,13 +100,13 @@ function loadindWindow() {
setTimeout(() => {
createMainWindow()
}, 2000)
loadWindow.on('closed', () => {
loadWindow = null
})
}
function initWindow() {
function initWindow () {
if (config.UseStartupChart) {
return loadindWindow()
} else {
......
<template>
<div id="app">
<c-header></c-header>
<router-view></router-view>
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</div>
</template>
......
......@@ -22,3 +22,10 @@ export function logout () {
method: 'post'
})
}
export function message () {
return request({
url: '/message',
method: 'get'
})
}
......
......@@ -26,6 +26,8 @@
</div>
<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="getMessage">查看消息</el-button>
</div>
</div>
</main>
......@@ -52,6 +54,7 @@
<script>
import SystemInformation from "./LandingPage/SystemInformation";
import ipcApi from "../utils/ipcRenderer";
import { message } from "@/api/login";
export default {
name: "landing-page",
components: { SystemInformation },
......@@ -61,7 +64,7 @@ export default {
name: "yyy",
age: "12"
},
logo: require("@/assets/logo.png").default,
logo: require("@/assets/logo.png"),
textarray: [],
percentage: 0,
colors: [
......@@ -75,8 +78,27 @@ export default {
progressStaus: null,
filePath: ""
}),
created() {},
created() {
console.log(__lib);
},
methods: {
getMessage() {
message().then(res => {
this.$alert(res.data, "提示", {
confirmButtonText: "确定"
});
});
},
StartServer() {
ipcApi.send("statr-server");
ipcApi.on("confirm-start", (event, arg) => {
console.log(arg);
this.$message({
type: "success",
message: arg
});
});
},
// 获取electron方法
open() {
console.log(this.$electron);
......@@ -179,7 +201,7 @@ export default {
break;
case "two":
console.log(111);
ipcApi.send("satrt-download");
ipcApi.send("start-download");
ipcApi.on("confirm-download", (event, arg) => {
if (arg) {
this.dialogVisible = true;
......@@ -249,7 +271,6 @@ body {
}
#wrapper {
background-color: #d1d1d1ab;
padding: 60px 80px;
}
......
......@@ -26,6 +26,10 @@
<div class="name">所运行的系统:</div>
<div class="value">{{ platform }}</div>
</div>
<div class="item">
<div class="name">所运行的系统:</div>
<div class="value">{{ arch }}位</div>
</div>
</div>
</div>
</template>
......@@ -39,6 +43,7 @@
node: process.versions.node,
path: this.$route.path,
platform: require('os').platform(),
arch:require('os').arch(),
vue: require('vue/package.json').version
}
},
......
......@@ -15,10 +15,10 @@
:show-file-list="true"
:on-remove="handleRemove"
:on-success="handleSuccess"
:before-upload="beforeUpload"
:on-error="handleError"
:data="picPostData"
class="editor-slide-upload"
action="https://up-z2.qiniup.com/"
action="https://jsonplaceholder.typicode.com/post/"
list-type="picture-card"
:limit="5"
>
......@@ -92,42 +92,8 @@ export default {
}
}
},
beforeUpload(file) {
// const _self = this;
// const _URL = window.URL || window.webkitURL;
// const fileName = file.uid;
// this.listObj[fileName] = {};
// return new Promise((resolve, reject) => {
// let Sync = async () => {
// try {
// let picKey = await checkPic(file, this.fileList.length, 1);
// if (picKey) {
// let token = await this.getRequest(
// "/qiniu/serveGetQiniuUpToken?key=" + picKey
// );
// console.log("picKey---", picKey, token);
// this.picPostData = token;
// const img = new Image();
// img.src = _URL.createObjectURL(file);
// img.onload = function() {
// _self.listObj[fileName] = {
// hasSuccess: false,
// uid: file.uid,
// width: this.width,
// height: this.height
// };
// };
// resolve(true);
// } else {
// reject(false);
// this.listObj = {};
// }
// } catch (error) {
// reject(false);
// }
// };
// Sync();
// });
handleError(err){
this.alert(err)
}
}
};
......
......@@ -8,7 +8,7 @@
<!-- 菜单栏位置 -->
<div></div>
<!-- 中间标题位置 -->
<div style="-webkit-app-region: drag;" class="title">标题文字</div>
<div style="-webkit-app-region: drag;" class="title"></div>
<div class="controls-container">
<div class="windows-icon-bg" @click="Mini">
<svg-icon icon-class="mini" class-name="icon-size"></svg-icon>
......@@ -60,7 +60,7 @@ export default {
width: 100%;
height: 30px;
line-height: 30px;
background-color: rgba(60, 60, 60, 0.6);
background-color: #ffffff;
display: flex;
-webkit-app-region: drag;
position: fixed;
......@@ -69,6 +69,9 @@ export default {
.title {
text-align: center;
}
.logo{
margin-left: 20px;
}
.controls-container {
display: flex;
flex-grow: 0;
......@@ -88,7 +91,7 @@ export default {
color: rgba(129, 129, 129, 0.6);
.icon-size {
width: 12px;
height: 12px;
height: 15px;
}
}
.windows-icon-bg:hover {
......
......@@ -55,7 +55,7 @@ export default {
},
data: () => ({
time: "",
userImage: require("@/assets/user.png").default
userImage: require("@/assets/user.png")
}),
mounted() {
this.set_time();
......@@ -74,7 +74,7 @@ export default {
message: "退出成功",
type: "success"
});
location.reload(); // 为了重新实例化vue-router对象 避免bug
this.$router.push('/login')
});
},
set_time() {
......
<template>
<div v-if="!item.hidden&&item.children" class="menu-wrapper" :class="collapse?``:`active-menu-wrapper`">
<div
v-if="!item.hidden&&item.children"
class="menu-wrapper"
:class="collapse?``:`active-menu-wrapper`"
>
<div v-if="item.onlyShowfirst">
<router-link
v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow"
......@@ -124,29 +128,14 @@ export default {
};
</script>
<style lang="scss" scoped>
@import "@/styles/color.scss";
.menu-wrapper {
/deep/ .el-menu-item,
.el-submenu__title {
height: 46px;
line-height: 46px;
}
/deep/ a {
background-color: #ffc248;
}
/deep/ .el-menu-item:hover {
color: #ffffff !important;
}
/deep/ .el-menu-item.is-active {
background-color: $Theme-color !important;
}
/deep/ .el-menu-item {
padding: 0 20px 0 12px;
}
}
.active-menu-wrapper {
/deep/ .el-menu-item.is-active {
margin-left: 8px;
}
}
</style>
\ No newline at end of file
......
......@@ -4,10 +4,7 @@
mode="vertical"
:show-timeout="200"
:default-active="$route.path"
background-color="#ffffff"
text-color="#666666"
:collapse="isCollapse"
active-text-color="#ffffff"
>
<Logo :collapse="isCollapse" />
<sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path" :collapse="isCollapse"></sidebar-item>
......
......@@ -41,6 +41,7 @@ export default {
}
.sidebar-logo-container {
box-shadow: 2px 0 6px rgba(0,21,41,.15);
position: relative;
width: 100%;
height: 61px;
......@@ -75,6 +76,7 @@ export default {
.collapse {
.sidebar-logo {
margin-right: 0px !important;
margin-left: 0px !important;
}
}
</style>
\ No newline at end of file
......
......@@ -14,6 +14,8 @@ import './error'
import './icons'
import '@/styles/index.scss'
if (!require('../../config').IsUseSysTitle) require('@/styles/custom-title.scss')
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.use(ElementUI)
......
/* eslint-disable no-tabs */
import router from './router'
import store from './store'
import NProgress from 'nprogress' // Progress 进度条
import 'nprogress/nprogress.css'// Progress 进度条样式
import { Message } from 'element-ui'
const whiteList = ['/login'] // 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start()
if (store.getters.token) {
if (to.path === '/login') {
next({ path: '/' })
NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
} else {
if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => { // 拉取用户信息
......@@ -31,11 +27,8 @@ router.beforeEach((to, from, next) => {
next()
} else {
next('/login')
NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done() // 结束Progress
})
router.afterEach(() => {})
......
const template = {
state: {},
mutations: {},
actions: {}
}
export default template
/* eslint-disable prefer-promise-reject-errors */
import { login, logout, getInfo } from '@/api/login'
// import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
......@@ -37,6 +37,7 @@ const user = {
// }).catch(error => {
// reject(error)
// })
setToken('admin')
commit('SET_TOKEN', 'admin')
resolve()
})
......
$Theme-color:#651FFF;
\ No newline at end of file
// 降低消息高度
// 当启用自定义标题时使用
.el-message {
top: 50px !important;
}
.el-notification {
top: 38px !important;
}
\ No newline at end of file
@import './color.scss';
//to reset element-ui default css
.el-upload {
input[type="file"] {
......@@ -30,20 +29,3 @@
}
}
// 降低消息高度
// 当启用自定义标题时使用
// .el-message {
// top: 50px !important;
// }
// .el-notification {
// top: 38px !important;
// }
// 设置当选中时,popr的背景色被设置为白色的尴尬场景
.el-menu--vertical{
/deep/.el-menu--popup{
/deep/ .el-menu-item.is-active{
background-color: $Theme-color !important;
}
}
}
\ No newline at end of file
......
......@@ -3,7 +3,6 @@
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './color.scss';
body {
-moz-osx-font-smoothing: grayscale;
......
......@@ -12,7 +12,7 @@
.horizontal-collapse-transition {
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
}
transition: width .28s;
width: 256px !important;
height: 100%;
......@@ -29,7 +29,7 @@
}
.svg-icon {
margin-right: 16px;
margin-left: 14px;
}
.el-menu {
......@@ -40,16 +40,16 @@
.hideSidebar {
.sidebar-container {
width: 36px !important;
width: 60px !important;
}
.navbar-header-fixed {
width: calc(100% - 36px);
width: calc(100% - 60px);
;
}
.main-container {
margin-left: 36px;
margin-left: 60px;
}
.submenu-title-noDropdown {
......@@ -83,10 +83,6 @@
.sidebar-container .nest-menu .el-submenu>.el-submenu__title,
.sidebar-container .el-submenu .el-menu-item {
min-width: 180px !important;
&:hover {
background-color: $Theme-color !important;
}
}
.el-menu--collapse .el-menu .el-submenu {
......
......@@ -2,4 +2,3 @@
$menuBg:#ffffff;
$subMenuBg:#1f2d3d;
$menuHover:#001528;
$Theme-color:#651FFF;
......
......@@ -9,7 +9,7 @@
</div>
<div class="bullshit">
<div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告</div>
<div class="bullshit__info">您似乎进到了一个次元世界,请点击以下按钮返回主页或者发送错误报告</div>
<a href="/" class="bullshit__return-home">返回首页</a>
</div>
</div>
......
- iohook<br/>地址是:https://github.com/wilix-team/iohook 文档地址:https://wilix-team.github.io/iohook/ <br/>该库功能为全局监听键盘和鼠标事件,因为是由c++去实现的,所以可能需要rebuild。具体使用请看文档
-
\ No newline at end of file