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