张恒

合并分支

正在显示 58 个修改的文件 包含 1121 行增加541 行删除
...@@ -5,7 +5,6 @@ process.env.NODE_ENV = 'production' ...@@ -5,7 +5,6 @@ process.env.NODE_ENV = 'production'
5 const { say } = require('cfonts') 5 const { say } = require('cfonts')
6 const chalk = require('chalk') 6 const chalk = require('chalk')
7 const del = require('del') 7 const del = require('del')
8 -const { spawn } = require('child_process')
9 const webpack = require('webpack') 8 const webpack = require('webpack')
10 const Multispinner = require('multispinner') 9 const Multispinner = require('multispinner')
11 10
...@@ -24,8 +23,8 @@ else if (process.env.BUILD_TARGET === 'web') web() ...@@ -24,8 +23,8 @@ else if (process.env.BUILD_TARGET === 'web') web()
24 else build() 23 else build()
25 24
26 function clean () { 25 function clean () {
27 - 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.*'])
28 - console.log(`\n${doneLog}\n`) 27 + console.log(`\n${doneLog}clear done`)
29 process.exit() 28 process.exit()
30 } 29 }
31 30
...@@ -117,8 +116,8 @@ function greeting () { ...@@ -117,8 +116,8 @@ function greeting () {
117 const cols = process.stdout.columns 116 const cols = process.stdout.columns
118 let text = '' 117 let text = ''
119 118
120 - if (cols > 85) text = 'lets-build' 119 + if (cols > 85) text = `let's-build`
121 - else if (cols > 60) text = 'lets-|build' 120 + else if (cols > 60) text = `let's-|build`
122 else text = false 121 else text = false
123 122
124 if (text && !isCI) { 123 if (text && !isCI) {
...@@ -127,6 +126,6 @@ function greeting () { ...@@ -127,6 +126,6 @@ function greeting () {
127 font: 'simple3d', 126 font: 'simple3d',
128 space: false 127 space: false
129 }) 128 })
130 - } else console.log(chalk.yellow.bold('\n lets-build')) 129 + } else console.log(chalk.yellow.bold(`\n let's-build`))
131 console.log() 130 console.log()
132 } 131 }
...\ No newline at end of file ...\ No newline at end of file
......
1 -const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
2 -
3 -hotClient.subscribe(event => {
4 - /**
5 - * Reload browser when HTMLWebpackPlugin emits a new index.html
6 - *
7 - * Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
8 - * https://github.com/SimulatedGREG/electron-vue/issues/437
9 - * https://github.com/jantimon/html-webpack-plugin/issues/680
10 - */
11 - // if (event.action === 'reload') {
12 - // window.location.reload()
13 - // }
14 -
15 - /**
16 - * Notify `mainWindow` when `main` process is compiling,
17 - * giving notice for an expected reload of the `electron` process
18 - */
19 - if (event.action === 'compiling') {
20 - document.body.innerHTML += `
21 - <style>
22 - #dev-client {
23 - background: #4fc08d;
24 - border-radius: 4px;
25 - bottom: 20px;
26 - box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
27 - color: #fff;
28 - font-family: 'Source Sans Pro', sans-serif;
29 - left: 20px;
30 - padding: 8px 12px;
31 - position: absolute;
32 - }
33 - </style>
34 -
35 - <div id="dev-client">
36 - Compiling Main Process...
37 - </div>
38 - `
39 - }
40 -})
...@@ -9,6 +9,7 @@ const config = require('../config') ...@@ -9,6 +9,7 @@ const config = require('../config')
9 const webpack = require('webpack') 9 const webpack = require('webpack')
10 const WebpackDevServer = require('webpack-dev-server') 10 const WebpackDevServer = require('webpack-dev-server')
11 const webpackHotMiddleware = require('webpack-hot-middleware') 11 const webpackHotMiddleware = require('webpack-hot-middleware')
12 +const Portfinder = require("portfinder")
12 13
13 const mainConfig = require('./webpack.main.config') 14 const mainConfig = require('./webpack.main.config')
14 const rendererConfig = require('./webpack.renderer.config') 15 const rendererConfig = require('./webpack.renderer.config')
...@@ -20,7 +21,7 @@ let hotMiddleware ...@@ -20,7 +21,7 @@ let hotMiddleware
20 function logStats(proc, data) { 21 function logStats(proc, data) {
21 let log = '' 22 let log = ''
22 23
23 - 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('-')}`)
24 log += '\n\n' 25 log += '\n\n'
25 26
26 if (typeof data === 'object') { 27 if (typeof data === 'object') {
...@@ -61,9 +62,13 @@ function removeJunk(chunk) { ...@@ -61,9 +62,13 @@ function removeJunk(chunk) {
61 } 62 }
62 63
63 function startRenderer() { 64 function startRenderer() {
64 - return new Promise((resolve) => { 65 + return new Promise((resolve, reject) => {
65 - rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)
66 rendererConfig.mode = 'development' 66 rendererConfig.mode = 'development'
67 + Portfinder.basePort = config.dev.port || 9080
68 + Portfinder.getPort((err, port) => {
69 + if (err) {
70 + reject("PortError:" + err)
71 + } else {
67 const compiler = webpack(rendererConfig) 72 const compiler = webpack(rendererConfig)
68 hotMiddleware = webpackHotMiddleware(compiler, { 73 hotMiddleware = webpackHotMiddleware(compiler, {
69 log: false, 74 log: false,
...@@ -72,7 +77,9 @@ function startRenderer() { ...@@ -72,7 +77,9 @@ function startRenderer() {
72 77
73 compiler.hooks.compilation.tap('compilation', compilation => { 78 compiler.hooks.compilation.tap('compilation', compilation => {
74 compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => { 79 compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => {
75 - hotMiddleware.publish({ action: 'reload' }) 80 + hotMiddleware.publish({
81 + action: 'reload'
82 + })
76 cb() 83 cb()
77 }) 84 })
78 }) 85 })
...@@ -82,8 +89,7 @@ function startRenderer() { ...@@ -82,8 +89,7 @@ function startRenderer() {
82 }) 89 })
83 90
84 const server = new WebpackDevServer( 91 const server = new WebpackDevServer(
85 - compiler, 92 + compiler, {
86 - {
87 contentBase: path.join(__dirname, '../'), 93 contentBase: path.join(__dirname, '../'),
88 quiet: true, 94 quiet: true,
89 before(app, ctx) { 95 before(app, ctx) {
...@@ -95,19 +101,25 @@ function startRenderer() { ...@@ -95,19 +101,25 @@ function startRenderer() {
95 } 101 }
96 ) 102 )
97 103
98 - server.listen(9080) 104 + process.env.PORT = port
105 + server.listen(port)
106 +
107 + }
108 + })
109 +
99 }) 110 })
100 } 111 }
101 112
102 function startMain() { 113 function startMain() {
103 return new Promise((resolve) => { 114 return new Promise((resolve) => {
104 - mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)
105 mainConfig.mode = 'development' 115 mainConfig.mode = 'development'
106 const compiler = webpack(mainConfig) 116 const compiler = webpack(mainConfig)
107 117
108 compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { 118 compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
109 - logStats('Main', chalk.white.bold('compiling...')) 119 + logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`))
110 - hotMiddleware.publish({ action: 'compiling' }) 120 + hotMiddleware.publish({
121 + action: 'compiling'
122 + })
111 done() 123 done()
112 }) 124 })
113 125
...@@ -117,7 +129,7 @@ function startMain() { ...@@ -117,7 +129,7 @@ function startMain() {
117 return 129 return
118 } 130 }
119 131
120 - logStats('Main', stats) 132 + logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, stats)
121 133
122 if (electronProcess && electronProcess.kill) { 134 if (electronProcess && electronProcess.kill) {
123 manualRestart = true 135 manualRestart = true
...@@ -163,6 +175,7 @@ function startElectron() { ...@@ -163,6 +175,7 @@ function startElectron() {
163 } 175 }
164 176
165 function electronLog(data, color) { 177 function electronLog(data, color) {
178 + if (data) {
166 let log = '' 179 let log = ''
167 data = data.toString().split(/\r?\n/) 180 data = data.toString().split(/\r?\n/)
168 data.forEach(line => { 181 data.forEach(line => {
...@@ -170,13 +183,15 @@ function electronLog(data, color) { ...@@ -170,13 +183,15 @@ function electronLog(data, color) {
170 }) 183 })
171 if (/[0-9A-z]+/.test(log)) { 184 if (/[0-9A-z]+/.test(log)) {
172 console.log( 185 console.log(
173 - chalk[color].bold('┏ Electron -------------------') + 186 + chalk[color].bold(`┏ ${config.dev.chineseLog ? '主程序日志' : 'Electron'} -------------------`) +
174 '\n\n' + 187 '\n\n' +
175 log + 188 log +
176 chalk[color].bold('┗ ----------------------------') + 189 chalk[color].bold('┗ ----------------------------') +
177 '\n' 190 '\n'
178 ) 191 )
179 } 192 }
193 + }
194 +
180 } 195 }
181 196
182 function greeting() { 197 function greeting() {
...@@ -194,19 +209,20 @@ function greeting() { ...@@ -194,19 +209,20 @@ function greeting() {
194 space: false 209 space: false
195 }) 210 })
196 } else console.log(chalk.yellow.bold('\n electron-vue')) 211 } else console.log(chalk.yellow.bold('\n electron-vue'))
197 - console.log(chalk.blue(' getting ready......') + '\n') 212 + console.log(chalk.blue(`${config.dev.chineseLog ? ' 准备启动...' : ' getting ready...'}`) + '\n')
198 } 213 }
199 214
200 -function init() { 215 +async function init() {
201 greeting() 216 greeting()
202 217
203 - Promise.all([startRenderer(), startMain()]) 218 + try {
204 - .then(() => { 219 + await startRenderer()
205 - startElectron() 220 + await startMain()
206 - }) 221 + await startElectron()
207 - .catch(err => { 222 + } catch (error) {
208 - console.error(err) 223 + console.error(error)
209 - }) 224 + }
225 +
210 } 226 }
211 227
212 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 BabiliWebpackPlugin = require('babili-webpack-plugin') 10 +const HappyPack = require('happypack')
10 -const { CleanWebpackPlugin } = require('clean-webpack-plugin') 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,13 +56,22 @@ let mainConfig = { ...@@ -55,13 +56,22 @@ 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",
61 + loaders: [{
62 + loader: 'babel-loader',
63 + options: {
64 + cacheDirectory: true
65 + }
66 + }],
67 + threadPool: HappyThreadPool
60 }) 68 })
61 ], 69 ],
62 resolve: { 70 resolve: {
63 - 71 + alias: {
64 - extensions: ['.js', '.json', '.node'] 72 + '@config': resolve('config'),
73 + },
74 + extensions: ['.tsx', '.ts', '.js', '.json', '.node']
65 }, 75 },
66 target: 'electron-main' 76 target: 'electron-main'
67 } 77 }
...@@ -82,7 +92,7 @@ if (process.env.NODE_ENV !== 'production') { ...@@ -82,7 +92,7 @@ if (process.env.NODE_ENV !== 'production') {
82 */ 92 */
83 if (process.env.NODE_ENV === 'production') { 93 if (process.env.NODE_ENV === 'production') {
84 mainConfig.plugins.push( 94 mainConfig.plugins.push(
85 - new BabiliWebpackPlugin(), 95 + new MinifyPlugin(),
86 new webpack.DefinePlugin({ 96 new webpack.DefinePlugin({
87 'process.env.NODE_ENV': '"production"' 97 'process.env.NODE_ENV': '"production"'
88 }) 98 })
......
...@@ -2,17 +2,21 @@ ...@@ -2,17 +2,21 @@
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')
8 const config = require('../config') 9 const config = require('../config')
9 10
10 -const BabiliWebpackPlugin = require('babili-webpack-plugin') 11 +const MinifyPlugin = require("babel-minify-webpack-plugin");
11 const CopyWebpackPlugin = require('copy-webpack-plugin') 12 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,8 +108,8 @@ let rendererConfig = { ...@@ -104,8 +108,8 @@ let rendererConfig = {
104 use: { 108 use: {
105 loader: 'url-loader', 109 loader: 'url-loader',
106 query: { 110 query: {
107 - limit: 10000,
108 esModule: false, 111 esModule: false,
112 + limit: 10000,
109 name: 'imgs/[name]--[folder].[ext]' 113 name: 'imgs/[name]--[folder].[ext]'
110 } 114 }
111 }, 115 },
...@@ -114,8 +118,8 @@ let rendererConfig = { ...@@ -114,8 +118,8 @@ let rendererConfig = {
114 test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 118 test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
115 loader: 'url-loader', 119 loader: 'url-loader',
116 options: { 120 options: {
117 - limit: 10000,
118 esModule: false, 121 esModule: false,
122 + limit: 10000,
119 name: 'media/[name]--[folder].[ext]' 123 name: 'media/[name]--[folder].[ext]'
120 } 124 }
121 }, 125 },
...@@ -124,8 +128,8 @@ let rendererConfig = { ...@@ -124,8 +128,8 @@ let rendererConfig = {
124 use: { 128 use: {
125 loader: 'url-loader', 129 loader: 'url-loader',
126 query: { 130 query: {
127 - limit: 10000,
128 esModule: false, 131 esModule: false,
132 + limit: 10000,
129 name: 'fonts/[name]--[folder].[ext]' 133 name: 'fonts/[name]--[folder].[ext]'
130 } 134 }
131 } 135 }
...@@ -167,7 +171,18 @@ let rendererConfig = { ...@@ -167,7 +171,18 @@ let rendererConfig = {
167 nodeModules: false 171 nodeModules: false
168 }), 172 }),
169 new webpack.HotModuleReplacementPlugin(), 173 new webpack.HotModuleReplacementPlugin(),
170 - 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 + }),
171 ], 186 ],
172 output: { 187 output: {
173 filename: '[name].js', 188 filename: '[name].js',
...@@ -190,7 +205,8 @@ let rendererConfig = { ...@@ -190,7 +205,8 @@ let rendererConfig = {
190 if (process.env.NODE_ENV !== 'production') { 205 if (process.env.NODE_ENV !== 'production') {
191 rendererConfig.plugins.push( 206 rendererConfig.plugins.push(
192 new webpack.DefinePlugin({ 207 new webpack.DefinePlugin({
193 - '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"` 208 + '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`,
209 + '__lib': `"${path.join(__dirname, `../${config.DllFolder}`).replace(/\\/g, '\\\\')}"`
194 }) 210 })
195 ) 211 )
196 } 212 }
...@@ -202,7 +218,7 @@ if (process.env.NODE_ENV === 'production') { ...@@ -202,7 +218,7 @@ if (process.env.NODE_ENV === 'production') {
202 rendererConfig.devtool = '' 218 rendererConfig.devtool = ''
203 219
204 rendererConfig.plugins.push( 220 rendererConfig.plugins.push(
205 - new BabiliWebpackPlugin(), 221 + new MinifyPlugin(),
206 new CopyWebpackPlugin([ 222 new CopyWebpackPlugin([
207 { 223 {
208 from: path.join(__dirname, '../static'), 224 from: path.join(__dirname, '../static'),
......
...@@ -5,7 +5,7 @@ process.env.BABEL_ENV = 'web' ...@@ -5,7 +5,7 @@ process.env.BABEL_ENV = 'web'
5 const path = require('path') 5 const path = require('path')
6 const webpack = require('webpack') 6 const webpack = require('webpack')
7 7
8 -const BabiliWebpackPlugin = require('babili-webpack-plugin') 8 +const MinifyPlugin = require("babel-minify-webpack-plugin");
9 const CopyWebpackPlugin = require('copy-webpack-plugin') 9 const CopyWebpackPlugin = require('copy-webpack-plugin')
10 const MiniCssExtractPlugin = require('mini-css-extract-plugin') 10 const MiniCssExtractPlugin = require('mini-css-extract-plugin')
11 const HtmlWebpackPlugin = require('html-webpack-plugin') 11 const HtmlWebpackPlugin = require('html-webpack-plugin')
...@@ -144,7 +144,7 @@ if (process.env.NODE_ENV === 'production') { ...@@ -144,7 +144,7 @@ if (process.env.NODE_ENV === 'production') {
144 webConfig.devtool = '' 144 webConfig.devtool = ''
145 145
146 webConfig.plugins.push( 146 webConfig.plugins.push(
147 - new BabiliWebpackPlugin(), 147 + new MinifyPlugin(),
148 new CopyWebpackPlugin([ 148 new CopyWebpackPlugin([
149 { 149 {
150 from: path.join(__dirname, '../static'), 150 from: path.join(__dirname, '../static'),
......
1 module.exports = { 1 module.exports = {
2 NODE_ENV: '"development"', 2 NODE_ENV: '"development"',
3 - BASE_API: '""' 3 + BASE_API: '"http://127.0.0.1:25565"'
4 } 4 }
......
1 module.exports = { 1 module.exports = {
2 build: { 2 build: {
3 - env: require('./prod.env') 3 + env: require('./prod.env'),
4 + DisableF12: true
4 }, 5 },
5 dev: { 6 dev: {
6 env: require('./dev.env'), 7 env: require('./dev.env'),
7 - removeElectronJunk: true 8 + removeElectronJunk: true,
8 - } 9 + chineseLog: false,
10 + port: 9080
11 + },
12 + UseStartupChart: true,
13 + IsUseSysTitle: true,
14 + DllFolder: '',
15 + BuiltInServerPort: 25565
9 } 16 }
......
1 module.exports = { 1 module.exports = {
2 NODE_ENV: '"production"', 2 NODE_ENV: '"production"',
3 - BASE_API: '""' 3 + BASE_API: '"http://127.0.0.1:25565"'
4 } 4 }
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
62 "dependencies": { 62 "dependencies": {
63 "axios": "^0.19.2", 63 "axios": "^0.19.2",
64 "date-fns": "^2.12.0", 64 "date-fns": "^2.12.0",
65 + "electron-updater": "^4.2.5",
65 "element-ui": "^2.13.0", 66 "element-ui": "^2.13.0",
67 + "express": "^4.17.1",
66 "js-cookie": "^2.2.1", 68 "js-cookie": "^2.2.1",
67 "nedb": "^1.8.0", 69 "nedb": "^1.8.0",
68 "nprogress": "^0.2.0", 70 "nprogress": "^0.2.0",
...@@ -78,6 +80,7 @@ ...@@ -78,6 +80,7 @@
78 "babel-core": "^6.26.3", 80 "babel-core": "^6.26.3",
79 "babel-eslint": "^8.2.3", 81 "babel-eslint": "^8.2.3",
80 "babel-loader": "^7.1.5", 82 "babel-loader": "^7.1.5",
83 + "babel-minify-webpack-plugin": "^0.3.1",
81 "babel-plugin-dynamic-import-webpack": "^1.1.0", 84 "babel-plugin-dynamic-import-webpack": "^1.1.0",
82 "babel-plugin-istanbul": "^5.2.0", 85 "babel-plugin-istanbul": "^5.2.0",
83 "babel-plugin-transform-runtime": "^6.23.0", 86 "babel-plugin-transform-runtime": "^6.23.0",
...@@ -108,6 +111,8 @@ ...@@ -108,6 +111,8 @@
108 "eslint-plugin-promise": "^3.8.0", 111 "eslint-plugin-promise": "^3.8.0",
109 "eslint-plugin-standard": "^3.1.0", 112 "eslint-plugin-standard": "^3.1.0",
110 "file-loader": "^6.0.0", 113 "file-loader": "^6.0.0",
114 + "happypack": "^5.0.1",
115 + "hard-source-webpack-plugin": "^0.13.1",
111 "html-webpack-plugin": "^3.2.0", 116 "html-webpack-plugin": "^3.2.0",
112 "inject-loader": "^4.0.1", 117 "inject-loader": "^4.0.1",
113 "karma": "^2.0.2", 118 "karma": "^2.0.2",
...@@ -123,6 +128,7 @@ ...@@ -123,6 +128,7 @@
123 "multispinner": "^0.2.1", 128 "multispinner": "^0.2.1",
124 "node-loader": "^0.6.0", 129 "node-loader": "^0.6.0",
125 "node-sass": "^4.13.1", 130 "node-sass": "^4.13.1",
131 + "portfinder": "^1.0.25",
126 "require-dir": "^1.2.0", 132 "require-dir": "^1.2.0",
127 "sass-loader": "^8.0.2", 133 "sass-loader": "^8.0.2",
128 "spectron": "^3.8.0", 134 "spectron": "^3.8.0",
......
...@@ -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
......
1 +import { globalShortcut } from 'electron'
2 +import config from '@config'
3 +
4 +export default {
5 + Disablef12 () {
6 + if (process.env.NODE_ENV === 'production' && config.DisableF12) {
7 + globalShortcut.register('f12', () => {
8 + console.log('用户试图启动控制台')
9 + })
10 + }
11 + }
12 +}
1 // 这里是定义菜单的地方,详情请查看 https://electronjs.org/docs/api/menu 1 // 这里是定义菜单的地方,详情请查看 https://electronjs.org/docs/api/menu
2 const { dialog } = require('electron') 2 const { dialog } = require('electron')
3 -const menu = [{ 3 +const os = require('os')
4 - label: '文档操作', 4 +const version = require('../../../package.json').version
5 - submenu: [{ 5 +const menu = [
6 - label: '撤销', 6 + {
7 - accelerator: 'CmdOrCtrl+Z',
8 - role: 'undo'
9 - }, {
10 - label: '复制',
11 - accelerator: 'CmdOrCtrl+C',
12 - role: 'copy'
13 - }]
14 -},
15 -{
16 label: '设置', 7 label: '设置',
17 submenu: [{ 8 submenu: [{
18 label: '快速重启', 9 label: '快速重启',
...@@ -23,22 +14,24 @@ const menu = [{ ...@@ -23,22 +14,24 @@ const menu = [{
23 accelerator: 'CmdOrCtrl+F4', 14 accelerator: 'CmdOrCtrl+F4',
24 role: 'close' 15 role: 'close'
25 }] 16 }]
26 -}, { 17 + }, {
27 label: '帮助', 18 label: '帮助',
28 submenu: [{ 19 submenu: [{
29 - label: '切换到开发者模式',
30 - accelerator: 'CmdOrCtrl+I',
31 - role: 'toggledevtools'
32 - }, {
33 label: '关于', 20 label: '关于',
34 role: 'about', 21 role: 'about',
35 click: function () { 22 click: function () {
23 + info()
24 + }
25 + }]
26 + }]
27 +function info () {
36 dialog.showMessageBox({ 28 dialog.showMessageBox({
37 title: '关于', 29 title: '关于',
38 type: 'info', 30 type: 'info',
39 - message: '存放显示这个的信息是在,src/main/menu.js中,请自行修改' 31 + message: 'electron-Vue框架',
32 + detail: `版本信息:${version}\n引擎版本:${process.versions.v8}\n当前系统:${os.type()} ${os.arch()} ${os.release()}`,
33 + noLink: true,
34 + buttons: ['查看github', '确定']
40 }) 35 })
41 - } 36 +}
42 - }]
43 -}]
44 export default menu 37 export default menu
......
1 -/**
2 - * This file is used specifically and only for development. It installs
3 - * `electron-debug` & `vue-devtools`. There shouldn't be any need to
4 - * modify this file, but it can be used to extend your development
5 - * environment.
6 - */
7 -
8 -/* eslint-disable */
9 -
10 -// Install `electron-debug` with `devtron`
11 -require('electron-debug')({ showDevTools: true })
12 -
13 -// Install `vue-devtools`
14 -require('electron').app.on('ready', () => {
15 - let installExtension = require('electron-devtools-installer')
16 - installExtension.default(installExtension.VUEJS_DEVTOOLS)
17 - .then(() => {})
18 - .catch(err => {
19 - console.log('Unable to install `vue-devtools`: \n', err)
20 - })
21 -})
22 -
23 -// Require `main` process to boot app
24 -require('./index')
...\ No newline at end of file ...\ No newline at end of file
1 'use strict' 1 'use strict'
2 2
3 -import { 3 +import { app } from 'electron'
4 - app, 4 +import initWindow from './services/windowManager'
5 - BrowserWindow, 5 +import DisableButton from './config/DisableButton'
6 - Menu
7 -} from 'electron'
8 -import menuconfig from './menu'
9 6
10 -/** 7 +function onAppReady () {
11 - * Set `__static` path to static files in production 8 + initWindow()
12 - * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html 9 + DisableButton.Disablef12()
13 - */
14 -if (process.env.NODE_ENV !== 'development') {
15 - global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
16 } 10 }
17 11
18 -let mainWindow 12 +app.isReady() ? onAppReady() : app.on('ready', onAppReady)
19 -const winURL = process.env.NODE_ENV === 'development'
20 - ? `http://localhost:9080`
21 - : `file://${__dirname}/index.html`
22 -
23 -function createWindow () {
24 - /**
25 - * Initial window options
26 - */
27 - mainWindow = new BrowserWindow({
28 - height: 563,
29 - useContentSize: true,
30 - width: 1000,
31 - show: false,
32 - backgroundColor: '#fffff',
33 - titleBarStyle: 'hidden',
34 - webPreferences: {
35 - nodeIntegration: true,
36 - webSecurity: false,
37 - experimentalFeatures: true
38 - }
39 - // 隐藏边框
40 - // frame: false,
41 - })
42 -
43 - mainWindow.once('ready-to-show', () => {
44 - mainWindow.show()
45 - })
46 -
47 - const menu = Menu.buildFromTemplate(menuconfig)
48 - Menu.setApplicationMenu(menu)
49 - mainWindow.loadURL(winURL)
50 -
51 - mainWindow.on('closed', () => {
52 - mainWindow = null
53 - })
54 -}
55 -
56 -app.on('ready', createWindow)
57 13
58 app.on('window-all-closed', () => { 14 app.on('window-all-closed', () => {
59 if (process.platform !== 'darwin') { 15 if (process.platform !== 'darwin') {
60 app.quit() 16 app.quit()
61 } 17 }
62 }) 18 })
63 - 19 +app.on('browser-window-created', () => {
64 -app.on('activate', () => { 20 + console.log('window-created')
65 - if (mainWindow === null) {
66 - createWindow()
67 - }
68 -})
69 -
70 -/**
71 - * Auto Updater
72 - *
73 - * Uncomment the following code below and install `electron-updater` to
74 - * support auto updating. Code Signing with a valid certificate is required.
75 - * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
76 - */
77 -
78 -/*
79 -import { autoUpdater } from 'electron-updater'
80 -
81 -autoUpdater.on('update-downloaded', () => {
82 - autoUpdater.quitAndInstall()
83 -})
84 -
85 -app.on('ready', () => {
86 - if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
87 }) 21 })
88 - */
......
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 +}
1 +import express from 'express'
2 +const app = express()
3 +
4 +app.get('/message', (req, res) => {
5 + res.send('这是来自node服务端的信息')
6 +})
7 +
8 +app.post('/message', (req, res) => {
9 + if (req) {
10 + res.send(req + '--来自node')
11 + }
12 +})
13 +
14 +export default app
1 +import { autoUpdater } from 'electron-updater'
2 +import { ipcMain } from 'electron'
3 +/**
4 + * -1 检查更新失败 0 正在检查更新 1 检测到新版本,准备下载 2 未检测到新版本 3 下载中 4 下载完成
5 + **/
6 +function Message (mainWindow, type, data) {
7 + const senddata = {
8 + state: type,
9 + msg: data
10 + }
11 + mainWindow.webContents.send('UpdateMsg', senddata)
12 +}
13 +
14 +export default {
15 + Update (mainWindow) {
16 + // 设置地址要和package中的一样
17 + autoUpdater.setFeedURL('http://127.0.0.1:25565/')
18 +
19 + // 当更新发生错误的时候触发。
20 + autoUpdater.on('error', (err) => {
21 + console.log('更新出现错误')
22 + console.log(err.message)
23 + if (err.message.includes('sha512 checksum mismatch')) {
24 + Message(mainWindow, -1, 'sha512校验失败')
25 + }
26 + })
27 +
28 + // 当开始检查更新的时候触发
29 + autoUpdater.on('checking-for-update', (event, arg) => {
30 + console.log('开始检查更新')
31 + Message(mainWindow, 0)
32 + })
33 +
34 + // 发现可更新数据时
35 + autoUpdater.on('update-available', (event, arg) => {
36 + console.log('有更新')
37 + Message(mainWindow, 1)
38 + })
39 +
40 + // 没有可更新数据时
41 + autoUpdater.on('update-not-available', (event, arg) => {
42 + console.log('没有更新')
43 + Message(mainWindow, 2)
44 + })
45 +
46 + // 下载监听
47 + autoUpdater.on('download-progress', (progressObj) => {
48 + Message(mainWindow, 3, progressObj)
49 + })
50 +
51 + // 下载完成
52 + autoUpdater.on('update-downloaded', () => {
53 + console.log('下载完成')
54 + Message(mainWindow, 4)
55 + })
56 + // 执行自动更新检查
57 + ipcMain.on('check-update', () => {
58 + autoUpdater.checkForUpdates().catch(err => {
59 + console.log('网络连接问题', err)
60 + })
61 + })
62 + // 渲染进程执行更新操作
63 + ipcMain.on('confirm-update', () => {
64 + autoUpdater.quitAndInstall()
65 + })
66 + }
67 +}
1 +/* eslint-disable no-case-declarations */
2 +import { app, ipcMain, dialog } from 'electron'
3 +import path from 'path'
4 +import os from 'os'
5 +// 版本以package.json为基准。
6 +const version = require('../../../package.json').version
7 +// 您的下载地址
8 +const baseUrl = 'http://127.0.0.1:25565/'
9 +var Sysarch = null
10 +var defaultDownloadUrL = null
11 +// 识别操作系统位数D
12 +os.arch().includes('64') ? Sysarch = 'win64' : Sysarch = 'win32'
13 +// 识别操作系统
14 +// linux自己修改后缀名哦,我没有linux就没有测试了
15 +if (os.platform().includes('win32')) {
16 + defaultDownloadUrL = baseUrl + `electron_${version}_${Sysarch}.exe?${new Date().getTime()}`
17 +} else if (os.platform().includes('linux')) {
18 + defaultDownloadUrL = baseUrl + `electron_${version}_${Sysarch}?${new Date().getTime()}`
19 +} else {
20 + defaultDownloadUrL = baseUrl + `electron_${version}_mac.dmg?${new Date().getTime()}`
21 +}
22 +export default {
23 + download (mainWindow) {
24 + ipcMain.on('start-download', (event, msg) => {
25 + mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL)
26 + event.reply('confirm-download', true)
27 + mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
28 + // 将文件保存在系统的下载目录
29 + const filePath = path.join(app.getPath('downloads'), item.getFilename())
30 + // 自动保存
31 + item.setSavePath(filePath)
32 + // 下载进度
33 + item.on('updated', (event, state) => {
34 + switch (state) {
35 + case 'progressing':
36 + mainWindow.webContents.send('download-progress', (item.getReceivedBytes() / item.getTotalBytes() * 100).toFixed(0))
37 + break
38 + case 'interrupted ':
39 + mainWindow.webContents.send('download-paused', true)
40 + break
41 + default:
42 +
43 + break
44 + }
45 + })
46 + // 下载完成或失败
47 + item.once('done', (event, state) => {
48 + switch (state) {
49 + case 'completed':
50 + const data = {
51 + filePath
52 + }
53 + mainWindow.webContents.send('download-done', data)
54 + break
55 + case 'interrupted':
56 + mainWindow.webContents.send('download-error', true)
57 + dialog.showErrorBox('下载出错', '由于网络或其他未知原因导致客户端下载出错,请前往官网进行重新安装')
58 + break
59 + default:
60 + break
61 + }
62 + })
63 + })
64 + })
65 + }
66 +}
1 +import { ipcMain, dialog } from 'electron'
2 +import Server from '../server/index'
3 +export default {
4 + Mainfunc (mainWindow, IsUseSysTitle) {
5 + ipcMain.on('IsUseSysTitle', (event) => {
6 + const data = IsUseSysTitle
7 + event.reply('CisUseSysTitle', data)
8 + })
9 + ipcMain.on('windows-mini', () => {
10 + mainWindow.minimize()
11 + })
12 + ipcMain.on('window-max', (event) => {
13 + if (mainWindow.isMaximized()) {
14 + event.reply('window-confirm', false)
15 + mainWindow.restore()
16 + } else {
17 + event.reply('window-confirm', true)
18 + mainWindow.maximize()
19 + }
20 + })
21 + ipcMain.on('window-close', () => {
22 + mainWindow.close()
23 + })
24 + ipcMain.on('open-messagebox', (event, arg) => {
25 + dialog.showMessageBox(mainWindow, {
26 + type: arg.type || 'info',
27 + title: arg.title || '',
28 + buttons: arg.buttons || [],
29 + message: arg.message || '',
30 + noLink: arg.noLink || true
31 + }).then(res => {
32 + event.reply('confirm-message', res)
33 + })
34 + })
35 + ipcMain.on('open-errorbox', (event, arg) => {
36 + dialog.showErrorBox(
37 + arg.title,
38 + arg.message
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 + })
51 + }
52 +}
1 +import { BrowserWindow, Menu } from 'electron'
2 +import menuconfig from '../config/menu'
3 +import config from '@config'
4 +import setIpc from './ipcMain'
5 +import electronDevtoolsInstaller, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
6 +import upload from './checkupdate'
7 +import DownloadUpdate from './downloadFile'
8 +import path from 'path'
9 +
10 +/**
11 + * Set `__static` path to static files in production
12 + * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
13 + */
14 +// 这个瓜皮全局变量只能在单个js中生效,而并不是整个主进程中
15 +if (process.env.NODE_ENV !== 'development') {
16 + global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
17 +}
18 +// 将文件地址挪到这里
19 +const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:${process.env.PORT}` : `file://${__dirname}/index.html`
20 +const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:${process.env.PORT}/static/loader.html` : `file://${__static}/loader.html`
21 +var loadWindow = null
22 +var mainWindow = null
23 +
24 +function createMainWindow () {
25 + /**
26 + * Initial window options
27 + */
28 + mainWindow = new BrowserWindow({
29 + height: 800,
30 + useContentSize: true,
31 + width: 1700,
32 + minWidth: 1366,
33 + show: false,
34 + frame: config.IsUseSysTitle,
35 + titleBarStyle: 'hidden',
36 + webPreferences: {
37 + nodeIntegration: true,
38 + webSecurity: false,
39 + // 如果是开发模式可以使用devTools
40 + devTools: process.env.NODE_ENV === 'development',
41 + // 在macos中启用橡皮动画
42 + scrollBounce: process.platform === 'darwin'
43 + }
44 + })
45 + // 这里设置只有开发环境才注入显示开发者模式
46 + if (process.env.NODE_ENV === 'development') {
47 + menuconfig.push({
48 + label: '开发者设置',
49 + submenu: [{
50 + label: '切换到开发者模式',
51 + accelerator: 'CmdOrCtrl+I',
52 + role: 'toggledevtools'
53 + }]
54 + })
55 + }
56 + // 载入菜单
57 + const menu = Menu.buildFromTemplate(menuconfig)
58 + Menu.setApplicationMenu(menu)
59 + mainWindow.loadURL(winURL)
60 +
61 + setIpc.Mainfunc(mainWindow, config.IsUseSysTitle)
62 + upload.Update(mainWindow)
63 + DownloadUpdate.download(mainWindow)
64 +
65 + if (process.env.NODE_ENV === 'development') {
66 + mainWindow.webContents.once('dom-ready', () => {
67 + mainWindow.show()
68 + electronDevtoolsInstaller(VUEJS_DEVTOOLS)
69 + .then((name) => console.log(`installed: ${name}`))
70 + .catch(err => console.log('Unable to install `vue-devtools`: \n', err))
71 + loadWindow.destroy()
72 + })
73 + mainWindow.webContents.openDevTools(true)
74 + } else {
75 + mainWindow.webContents.once('dom-ready', () => {
76 + mainWindow.show()
77 + loadWindow.destroy()
78 + })
79 + }
80 +
81 + mainWindow.on('closed', () => {
82 + mainWindow = null
83 + })
84 +}
85 +
86 +function loadindWindow () {
87 + loadWindow = new BrowserWindow({
88 + width: 400,
89 + height: 600,
90 + frame: false,
91 + backgroundColor: '#222',
92 + transparent: true,
93 + webPreferences: { experimentalFeatures: true }
94 + })
95 +
96 + loadWindow.loadURL(loadingURL)
97 +
98 + loadWindow.show()
99 +
100 + setTimeout(() => {
101 + createMainWindow()
102 + }, 2000)
103 +
104 + loadWindow.on('closed', () => {
105 + loadWindow = null
106 + })
107 +}
108 +
109 +function initWindow () {
110 + if (config.UseStartupChart) {
111 + return loadindWindow()
112 + } else {
113 + return createMainWindow()
114 + }
115 +}
116 +export default initWindow
1 <template> 1 <template>
2 <div id="app"> 2 <div id="app">
3 + <c-header></c-header>
4 + <transition name="fade" mode="out-in">
3 <router-view></router-view> 5 <router-view></router-view>
6 + </transition>
4 </div> 7 </div>
5 </template> 8 </template>
6 9
7 <script> 10 <script>
8 - export default { 11 +import CHeader from "./components/title";
9 - 12 +export default {
10 - } 13 + components: { CHeader }
14 +};
11 </script> 15 </script>
12 16
13 <style> 17 <style>
14 - /* CSS */ 18 +/* CSS */
15 </style> 19 </style>
......
...@@ -22,3 +22,10 @@ export function logout () { ...@@ -22,3 +22,10 @@ export function logout () {
22 method: 'post' 22 method: 'post'
23 }) 23 })
24 } 24 }
25 +
26 +export function message () {
27 + return request({
28 + url: '/message',
29 + method: 'get'
30 + })
31 +}
......
1 <template> 1 <template>
2 <div id="wrapper"> 2 <div id="wrapper">
3 - <img id="logo" src="~@/assets/logo.png" alt="electron-vue" /> 3 + <img id="logo" :src="logo" alt="electron-vue" />
4 <main> 4 <main>
5 <div class="left-side"> 5 <div class="left-side">
6 <span class="title">欢迎进入本框架</span> 6 <span class="title">欢迎进入本框架</span>
...@@ -22,15 +22,39 @@ ...@@ -22,15 +22,39 @@
22 <el-button type="primary" round @click="setdata">写入数据</el-button> 22 <el-button type="primary" round @click="setdata">写入数据</el-button>
23 <el-button type="primary" round @click="getdata">读取数据</el-button> 23 <el-button type="primary" round @click="getdata">读取数据</el-button>
24 <el-button type="primary" round @click="deledata">清除所有数据</el-button> 24 <el-button type="primary" round @click="deledata">清除所有数据</el-button>
25 + <el-button type="primary" round @click="CheckUpdate('one')">检查更新</el-button>
26 + </div>
27 + <div class="doc">
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>
25 </div> 31 </div>
26 </div> 32 </div>
27 </main> 33 </main>
34 + <el-dialog
35 + title="进度"
36 + :visible.sync="dialogVisible"
37 + :before-close="handleClose"
38 + center
39 + width="14%"
40 + top="45vh"
41 + >
42 + <div class="conten">
43 + <el-progress
44 + type="dashboard"
45 + :percentage="percentage"
46 + :color="colors"
47 + :status="progressStaus"
48 + ></el-progress>
49 + </div>
50 + </el-dialog>
28 </div> 51 </div>
29 </template> 52 </template>
30 53
31 <script> 54 <script>
32 import SystemInformation from "./LandingPage/SystemInformation"; 55 import SystemInformation from "./LandingPage/SystemInformation";
33 -import api from "../tools/dialog"; 56 +import ipcApi from "../utils/ipcRenderer";
57 +import { message } from "@/api/login";
34 export default { 58 export default {
35 name: "landing-page", 59 name: "landing-page",
36 components: { SystemInformation }, 60 components: { SystemInformation },
...@@ -40,12 +64,44 @@ export default { ...@@ -40,12 +64,44 @@ export default {
40 name: "yyy", 64 name: "yyy",
41 age: "12" 65 age: "12"
42 }, 66 },
43 - textarray: [] 67 + logo: require("@/assets/logo.png"),
68 + textarray: [],
69 + percentage: 0,
70 + colors: [
71 + { color: "#f56c6c", percentage: 20 },
72 + { color: "#e6a23c", percentage: 40 },
73 + { color: "#6f7ad3", percentage: 60 },
74 + { color: "#1989fa", percentage: 80 },
75 + { color: "#5cb87a", percentage: 100 }
76 + ],
77 + dialogVisible: false,
78 + progressStaus: null,
79 + filePath: ""
44 }), 80 }),
81 + created() {
82 + console.log(__lib);
83 + },
45 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 + },
46 // 获取electron方法 102 // 获取electron方法
47 open() { 103 open() {
48 - console.log(this.$store); 104 + console.log(this.$electron);
49 }, 105 },
50 // 设置数据库的数据 106 // 设置数据库的数据
51 setdata() { 107 setdata() {
...@@ -67,28 +123,138 @@ export default { ...@@ -67,28 +123,138 @@ export default {
67 }, 123 },
68 // 清空数据库的数据 124 // 清空数据库的数据
69 deledata() { 125 deledata() {
70 - // dialog为electron实例,data则是显示需要的参数,fun是需要执行的函数,此选项不是为必选的 126 + // data则是显示需要的参数
71 - const dialog = this.$electron.remote.dialog;
72 const data = { 127 const data = {
73 title: "清除数据", 128 title: "清除数据",
74 - buttons: ["OK", "Cancel"], 129 + buttons: ["确定了!", "才不要,我手滑了"],
130 + noLink: true,
75 message: "此操作会清空本地数据库中的所有数据,是否继续?" 131 message: "此操作会清空本地数据库中的所有数据,是否继续?"
76 }; 132 };
77 - const fun = this.$db.deleall({ name: "yyy" }); 133 + ipcApi.send("open-messagebox", data);
78 - api.MessageBox(dialog, data, fun).then(res => { 134 + ipcApi.on("confirm-message", (event, arg) => {
135 + console.log(arg);
136 + if (arg.response === 0) {
137 + this.$db.deleall({ name: "yyy" }).then(res => {
138 + console.log(res);
139 + if (res !== 0) {
79 this.getdata(); 140 this.getdata();
80 this.$message({ 141 this.$message({
81 - showClose: true,
82 message: "成功删除" + res + "条", 142 message: "成功删除" + res + "条",
83 type: "success" 143 type: "success"
84 }); 144 });
145 + } else {
146 + let errormsg = {
147 + title: "错误",
148 + message: "已经没有数据可以被删除!"
149 + };
150 + ipcApi.send("open-errorbox", errormsg);
151 + }
152 + });
153 + }
85 }); 154 });
86 - // const data = {
87 - // title:'发生致命错误',
88 - // message:'?'
89 - // }
90 - // api.ErrorMessageBox(dialog,data)
91 }, 155 },
156 + CheckUpdate(data) {
157 + switch (data) {
158 + case "one":
159 + const dialog = this.$electron.remote.dialog;
160 + ipcApi.send("check-update");
161 + console.log("启动检查");
162 + ipcApi.on("UpdateMsg", (event, data) => {
163 + console.log(data);
164 + switch (data.state) {
165 + case -1:
166 + const msgdata = {
167 + title: data.msg
168 + };
169 + api.MessageBox(dialog, msgdata);
170 + break;
171 + case 0:
172 + this.$message("正在检查更新");
173 + break;
174 + case 1:
175 + this.$message({
176 + type: "success",
177 + message: "已检查到新版本,开始下载"
178 + });
179 + this.dialogVisible = true;
180 + break;
181 + case 2:
182 + this.$message({ type: "success", message: "无新版本" });
183 + break;
184 + case 3:
185 + this.percentage = data.msg.percent.toFixed(1);
186 + break;
187 + case 4:
188 + this.progressStaus = "success";
189 + this.$alert("更新下载完成!", "提示", {
190 + confirmButtonText: "确定",
191 + callback: action => {
192 + ipcApi.send("confirm-update");
193 + }
194 + });
195 + break;
196 +
197 + default:
198 + break;
199 + }
200 + });
201 + break;
202 + case "two":
203 + console.log(111);
204 + ipcApi.send("start-download");
205 + ipcApi.on("confirm-download", (event, arg) => {
206 + if (arg) {
207 + this.dialogVisible = true;
208 + }
209 + });
210 + ipcApi.on("download-progress", (event, arg) => {
211 + this.percentage = Number(arg);
212 + });
213 + ipcApi.on("download-error", (event, arg) => {
214 + if (arg) {
215 + this.progressStaus = "exception";
216 + this.percentage = 40;
217 + this.colors = "#d81e06";
218 + }
219 + });
220 + ipcApi.on("download-paused", (event, arg) => {
221 + if (arg) {
222 + this.progressStaus = "warning";
223 + this.$alert("下载由于未知原因被中断!", "提示", {
224 + confirmButtonText: "重试",
225 + callback: action => {
226 + ipcApi.send("satrt-download");
227 + }
228 + });
229 + }
230 + });
231 + ipcApi.on("download-done", (event, age) => {
232 + this.filePath = age.filePath;
233 + this.progressStaus = "success";
234 + this.$alert("更新下载完成!", "提示", {
235 + confirmButtonText: "确定",
236 + callback: action => {
237 + this.$electron.shell.openItem(this.filePath);
238 + }
239 + });
240 + });
241 + break;
242 +
243 + default:
244 + break;
245 + }
246 + },
247 + handleClose() {
248 + this.dialogVisible = false;
249 + }
250 + },
251 + destroyed() {
252 + ipcApi.remove("confirm-message");
253 + ipcApi.remove("download-done");
254 + ipcApi.remove("download-paused");
255 + ipcApi.remove("confirm-download");
256 + ipcApi.remove("download-progress");
257 + ipcApi.remove("download-error");
92 } 258 }
93 }; 259 };
94 </script> 260 </script>
...@@ -105,8 +271,6 @@ body { ...@@ -105,8 +271,6 @@ body {
105 } 271 }
106 272
107 #wrapper { 273 #wrapper {
108 - background-color: #d1d1d1ab;
109 - height: 93vh;
110 padding: 60px 80px; 274 padding: 60px 80px;
111 } 275 }
112 276
...@@ -147,9 +311,14 @@ main > div { ...@@ -147,9 +311,14 @@ main > div {
147 font-size: 18px; 311 font-size: 18px;
148 margin-bottom: 10px; 312 margin-bottom: 10px;
149 } 313 }
150 - 314 +.doc {
315 + margin-bottom: 20px;
316 +}
151 .doc p { 317 .doc p {
152 color: black; 318 color: black;
153 margin-bottom: 10px; 319 margin-bottom: 10px;
154 } 320 }
321 +.conten {
322 + text-align: center;
323 +}
155 </style> 324 </style>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -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 >
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
31 </template> 31 </template>
32 32
33 <script> 33 <script>
34 -// import { getToken } from 'api/qiniu' 34 +
35 -import { checkPic } from "@util/picUtil.js";
36 35
37 export default { 36 export default {
38 name: "EditorSlideUpload", 37 name: "EditorSlideUpload",
...@@ -93,42 +92,8 @@ export default { ...@@ -93,42 +92,8 @@ export default {
93 } 92 }
94 } 93 }
95 }, 94 },
96 - beforeUpload(file) { 95 + handleError(err){
97 - const _self = this; 96 + this.alert(err)
98 - const _URL = window.URL || window.webkitURL;
99 - const fileName = file.uid;
100 - this.listObj[fileName] = {};
101 - return new Promise((resolve, reject) => {
102 - let Sync = async () => {
103 - try {
104 - let picKey = await checkPic(file, this.fileList.length, 1);
105 - if (picKey) {
106 - let token = await this.getRequest(
107 - "/qiniu/serveGetQiniuUpToken?key=" + picKey
108 - );
109 - console.log("picKey---", picKey, token);
110 - this.picPostData = token;
111 - const img = new Image();
112 - img.src = _URL.createObjectURL(file);
113 - img.onload = function() {
114 - _self.listObj[fileName] = {
115 - hasSuccess: false,
116 - uid: file.uid,
117 - width: this.width,
118 - height: this.height
119 - };
120 - };
121 - resolve(true);
122 - } else {
123 - reject(false);
124 - this.listObj = {};
125 - }
126 - } catch (error) {
127 - reject(false);
128 - }
129 - };
130 - Sync();
131 - });
132 } 97 }
133 } 98 }
134 }; 99 };
......
1 +<!-- -->
2 +<template>
3 + <div class="window-title" v-if="!IsUseSysTitle&&isMac">
4 + <!-- 软件logo预留位置 -->
5 + <div style="-webkit-app-region: drag;" class="logo">
6 + <svg-icon icon-class="electron-logo"></svg-icon>
7 + </div>
8 + <!-- 菜单栏位置 -->
9 + <div></div>
10 + <!-- 中间标题位置 -->
11 + <div style="-webkit-app-region: drag;" class="title"></div>
12 + <div class="controls-container">
13 + <div class="windows-icon-bg" @click="Mini">
14 + <svg-icon icon-class="mini" class-name="icon-size"></svg-icon>
15 + </div>
16 + <div class="windows-icon-bg" @click="MixOrReduction">
17 + <svg-icon v-if="mix" icon-class="reduction" class-name="icon-size"></svg-icon>
18 + <svg-icon v-else icon-class="mix" class-name="icon-size"></svg-icon>
19 + </div>
20 + <div class="windows-icon-bg close-icon" @click="Close">
21 + <svg-icon icon-class="close" class-name="icon-size"></svg-icon>
22 + </div>
23 + </div>
24 + </div>
25 +</template>
26 +
27 +<script>
28 +import ipcApi from "@/utils/ipcRenderer";
29 +export default {
30 + data: () => ({
31 + mix: false,
32 + IsUseSysTitle: false,
33 + isMac:process.platform !== 'darwin'
34 + }),
35 +
36 + components: {},
37 + created() {
38 + ipcApi.send("IsUseSysTitle");
39 + ipcApi.on("CisUseSysTitle", (event, arg) => (this.IsUseSysTitle = arg));
40 + },
41 +
42 + mounted() {},
43 +
44 + methods: {
45 + Mini() {
46 + ipcApi.send("windows-mini");
47 + },
48 + MixOrReduction() {
49 + ipcApi.send("window-max");
50 + ipcApi.on("window-confirm", (event, arg) => (this.mix = arg));
51 + },
52 + Close() {
53 + ipcApi.send("window-close");
54 + }
55 + }
56 +};
57 +</script>
58 +<style rel='stylesheet/scss' lang='scss' scoped>
59 +.window-title {
60 + width: 100%;
61 + height: 30px;
62 + line-height: 30px;
63 + background-color: #ffffff;
64 + display: flex;
65 + -webkit-app-region: drag;
66 + position: fixed;
67 + top: 0;
68 + z-index: 99999;
69 + .title {
70 + text-align: center;
71 + }
72 + .logo{
73 + margin-left: 20px;
74 + }
75 + .controls-container {
76 + display: flex;
77 + flex-grow: 0;
78 + flex-shrink: 0;
79 + text-align: center;
80 + position: relative;
81 + z-index: 3000;
82 + -webkit-app-region: no-drag;
83 + height: 100%;
84 + width: 138px;
85 + margin-left: auto;
86 + .windows-icon-bg {
87 + display: inline-block;
88 + -webkit-app-region: no-drag;
89 + height: 100%;
90 + width: 33.34%;
91 + color: rgba(129, 129, 129, 0.6);
92 + .icon-size {
93 + width: 12px;
94 + height: 15px;
95 + }
96 + }
97 + .windows-icon-bg:hover {
98 + background-color: rgba(182, 182, 182, 0.2);
99 + color: #333;
100 + }
101 + .close-icon:hover {
102 + background-color: rgba(232, 17, 35, 0.9);
103 + color: #fff;
104 + }
105 + }
106 +}
107 +</style>
...\ No newline at end of file ...\ No newline at end of file
1 +import Vue from 'vue'
2 +
3 +Vue.config.errorHandler = function (err, vm, info) {
4 + Vue.nextTick(() => {
5 + if (process.env.NODE_ENV === 'development') {
6 + console.group('%c >>>>>> 错误信息 >>>>>>', 'color:red')
7 + console.log(`%c ${info}`, 'color:blue')
8 + console.groupEnd()
9 + console.group('%c >>>>>> 发生错误的Vue 实例对象 >>>>>>', 'color:green')
10 + console.log(vm)
11 + console.groupEnd()
12 + console.group('%c >>>>>> 发生错误的原因及位置 >>>>>>', 'color:red')
13 + console.error(err)
14 + console.groupEnd()
15 + }
16 + })
17 +}
1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width='11' height='11' viewBox='0 0 11 11' class="icon" xmlns='http://www.w3.org/2000/svg'><path d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z'/></svg>
...\ No newline at end of file ...\ No newline at end of file
1 -<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1577517047047" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6202" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085z m0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334z m0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333z m0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z" p-id="6203"></path></svg>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1577518173588" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6318" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085z m0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334z m0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333z m0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z" p-id="6319"></path></svg>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width='11' height='11' viewBox='0 0 11 11' class='icon' xmlns='http://www.w3.org/2000/svg'><path d='M11 4.399V5.5H0V4.399h11z'/></svg>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width='11' height='11' viewBox='0 0 11 11' class='icon' xmlns='http://www.w3.org/2000/svg'><path d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z'/></svg>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width='11' height='11' viewBox='0 0 11 11' class="icon" xmlns='http://www.w3.org/2000/svg'><path d='M11 8.798H8.798V11H0V2.202h2.202V0H11v8.798zm-3.298-5.5h-6.6v6.6h6.6v-6.6zM9.9 1.1H3.298v1.101h5.5v5.5h1.1v-6.6z'/></svg>
...\ No newline at end of file ...\ No newline at end of file
...@@ -62,6 +62,7 @@ export default { ...@@ -62,6 +62,7 @@ export default {
62 this.timer = setInterval(() => { 62 this.timer = setInterval(() => {
63 this.set_time(); 63 this.set_time();
64 }, 60000); 64 }, 60000);
65 + console.log(this.userImage)
65 }, 66 },
66 methods: { 67 methods: {
67 toggleSideBar() { 68 toggleSideBar() {
...@@ -73,11 +74,11 @@ export default { ...@@ -73,11 +74,11 @@ export default {
73 message: "退出成功", 74 message: "退出成功",
74 type: "success" 75 type: "success"
75 }); 76 });
76 - location.reload(); // 为了重新实例化vue-router对象 避免bug 77 + this.$router.push('/login')
77 }); 78 });
78 }, 79 },
79 set_time() { 80 set_time() {
80 - this.time = format(new Date(), "YYYY/MM/DD HH:mm"); 81 + this.time = format(new Date(), "yyyy/MM/dd HH:mm");
81 } 82 }
82 }, 83 },
83 computed: { 84 computed: {
......
1 <template> 1 <template>
2 - <div v-if="!item.hidden&&item.children" class="menu-wrapper"> 2 + <div
3 - 3 + v-if="!item.hidden&&item.children"
4 + class="menu-wrapper"
5 + :class="collapse?``:`active-menu-wrapper`"
6 + >
4 <div v-if="item.onlyShowfirst"> 7 <div v-if="item.onlyShowfirst">
5 <router-link 8 <router-link
6 v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow" 9 v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow"
...@@ -88,6 +91,10 @@ export default { ...@@ -88,6 +91,10 @@ export default {
88 basePath: { 91 basePath: {
89 type: String, 92 type: String,
90 default: "" 93 default: ""
94 + },
95 + collapse: {
96 + type: Boolean,
97 + required: true
91 } 98 }
92 }, 99 },
93 data() { 100 data() {
...@@ -111,8 +118,7 @@ export default { ...@@ -111,8 +118,7 @@ export default {
111 return false; 118 return false;
112 }, 119 },
113 resolvePath(...paths) { 120 resolvePath(...paths) {
114 - return this.basePath + "/" +paths[0] 121 + return this.basePath + "/" + paths[0];
115 - // return path.resolve(this.basePath, ...paths);
116 }, 122 },
117 OneShowingChild(children) { 123 OneShowingChild(children) {
118 this.onlyOneChild = children; 124 this.onlyOneChild = children;
...@@ -122,20 +128,12 @@ export default { ...@@ -122,20 +128,12 @@ export default {
122 }; 128 };
123 </script> 129 </script>
124 <style lang="scss" scoped> 130 <style lang="scss" scoped>
125 -@import "@/styles/color.scss";
126 .menu-wrapper { 131 .menu-wrapper {
127 /deep/ .el-menu-item, 132 /deep/ .el-menu-item,
128 .el-submenu__title { 133 .el-submenu__title {
129 height: 46px; 134 height: 46px;
130 line-height: 46px; 135 line-height: 46px;
131 } 136 }
132 - /deep/ a {
133 - background-color: #ffc248;
134 - }
135 - /deep/ .el-menu-item.is-active {
136 - margin-left: 8px;
137 - background-color: $Theme-color !important;
138 - }
139 /deep/ .el-menu-item { 137 /deep/ .el-menu-item {
140 padding: 0 20px 0 12px; 138 padding: 0 20px 0 12px;
141 } 139 }
......
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
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"></sidebar-item> 10 + <sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path" :collapse="isCollapse"></sidebar-item>
14 </el-menu> 11 </el-menu>
15 </scroll-bar> 12 </scroll-bar>
16 </template> 13 </template>
......
...@@ -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
......
1 <template> 1 <template>
2 - <div class="app-wrapper" :class="classObj"> 2 + <div class="app-wrapper" :class="IsUseSysTitle?'UseSysTitle':'NoUseSysTitle'">
3 + <div :class="classObj">
3 <navbar></navbar> 4 <navbar></navbar>
4 <div class="container-set"> 5 <div class="container-set">
5 - <sidebar class="sidebar-container"></sidebar> 6 + <sidebar class="sidebar-container" :class="IsUseSysTitle?'UseSysTitle':'NoUseSysTitle'"></sidebar>
6 <div class="main-container"> 7 <div class="main-container">
7 <app-main></app-main> 8 <app-main></app-main>
8 </div> 9 </div>
9 </div> 10 </div>
10 </div> 11 </div>
12 + </div>
11 </template> 13 </template>
12 14
13 <script> 15 <script>
...@@ -22,6 +24,9 @@ export default { ...@@ -22,6 +24,9 @@ export default {
22 Navbar 24 Navbar
23 }, 25 },
24 mixins: [ResizeMixin], 26 mixins: [ResizeMixin],
27 + data: () => ({
28 + IsUseSysTitle: require("./../../../config").IsUseSysTitle
29 + }),
25 computed: { 30 computed: {
26 sidebar() { 31 sidebar() {
27 return this.$store.state.app.sidebar; 32 return this.$store.state.app.sidebar;
...@@ -51,4 +56,10 @@ export default { ...@@ -51,4 +56,10 @@ export default {
51 padding-top: 62px; 56 padding-top: 62px;
52 } 57 }
53 } 58 }
59 +.UseSysTitle{
60 + top:0px;
61 +}
62 +.NoUseSysTitle{
63 + top:38px
64 +}
54 </style> 65 </style>
......
...@@ -9,10 +9,13 @@ import db from './api/operationalData' ...@@ -9,10 +9,13 @@ import db from './api/operationalData'
9 import ElementUI from 'element-ui' 9 import ElementUI from 'element-ui'
10 import 'element-ui/lib/theme-chalk/index.css' 10 import 'element-ui/lib/theme-chalk/index.css'
11 import './permission' 11 import './permission'
12 - 12 +// 日志
13 +import './error'
13 import './icons' 14 import './icons'
14 import '@/styles/index.scss' 15 import '@/styles/index.scss'
15 16
17 +if (!require('../../config').IsUseSysTitle) require('@/styles/custom-title.scss')
18 +
16 if (!process.env.IS_WEB) Vue.use(require('vue-electron')) 19 if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
17 20
18 Vue.use(ElementUI) 21 Vue.use(ElementUI)
...@@ -21,9 +24,11 @@ Vue.prototype.$db = db ...@@ -21,9 +24,11 @@ Vue.prototype.$db = db
21 24
22 Vue.config.productionTip = false 25 Vue.config.productionTip = false
23 /* eslint-disable no-new */ 26 /* eslint-disable no-new */
24 -new Vue({ 27 +const vue = new Vue({
25 components: { App }, 28 components: { App },
26 router, 29 router,
27 store, 30 store,
28 template: '<App/>' 31 template: '<App/>'
29 }).$mount('#app') 32 }).$mount('#app')
33 +
34 +export default vue
......
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 -})
......
1 -import Layout from '../layout' 1 +import Layout from '@/layout'
2 const Login = () => import('@/views/login') 2 const Login = () => import('@/views/login')
3 const Notfound = () => import('@/views/404') 3 const Notfound = () => import('@/views/404')
4 /** 4 /**
...@@ -44,12 +44,19 @@ export default [ ...@@ -44,12 +44,19 @@ export default [
44 { 44 {
45 path: '/form', 45 path: '/form',
46 component: Layout, 46 component: Layout,
47 + meta: { title: '表单', icon: 'form' },
47 children: [ 48 children: [
48 { 49 {
49 path: 'index', 50 path: 'index',
50 name: 'Form', 51 name: 'Form',
51 component: () => import('@/views/form/index'), 52 component: () => import('@/views/form/index'),
52 meta: { title: '表单', icon: 'form' } 53 meta: { title: '表单', icon: 'form' }
54 + },
55 + {
56 + path: 'index2',
57 + name: 'Form2',
58 + component: () => import('@/views/form/index'),
59 + meta: { title: '表单2', icon: 'form' }
53 } 60 }
54 ] 61 ]
55 }, 62 },
......
1 +/**
2 + * 在这里则是state.文件名.状态名
3 + */
1 const getters = { 4 const getters = {
2 sidebar: state => state.app.sidebar, 5 sidebar: state => state.app.sidebar,
3 device: state => state.app.device, 6 device: state => state.app.device,
......
1 +
2 +const template = {
3 + state: {},
4 +
5 + mutations: {},
6 +
7 + actions: {}
8 +}
9 +
10 +export default template
1 -$Theme-color:#651FFF;
...\ No newline at end of file ...\ No newline at end of file
...@@ -43,119 +43,3 @@ ...@@ -43,119 +43,3 @@
43 margin-top: 10px; 43 margin-top: 10px;
44 } 44 }
45 45
46 -// 卡片上面的图标和标题样式
47 -.info-set {
48 - display: flex;
49 - margin-bottom: 16px;
50 - line-height: 22px;
51 -
52 - .info-icon {
53 - width: 8px;
54 - height: 22px;
55 - background: rgba(58, 127, 159, 1);
56 - border-radius: 4px;
57 - margin-right: 12px;
58 - }
59 -
60 - .info-title {
61 - font-size: 16px;
62 - font-weight: bold;
63 - color: rgba(51, 51, 51, 1);
64 - }
65 -}
66 -
67 -// 顶部的单选样式
68 -.top-order {
69 - flex: 1;
70 -
71 - .order-group {
72 - height: 38px;
73 - display: flex;
74 - align-items: center;
75 - background-color: #3a7f9f;
76 - width: 346px;
77 - justify-content: center;
78 - border-radius: 2px;
79 - }
80 -
81 - .order-group /deep/ .el-radio-group /deep/ .el-radio__input.is-checked .el-radio__inner {
82 - border-color: #f2b931;
83 - background: #f2b931;
84 - }
85 -
86 - .order-group /deep/ .el-radio-group /deep/ .el-radio__input.is-checked+.el-radio__label {
87 - color: #f2b931;
88 - }
89 -
90 - .order-group /deep/ .el-radio__inner {
91 - border: 1px solid #dcdfe6;
92 - border-radius: 100%;
93 - width: 14px;
94 - height: 14px;
95 - position: relative;
96 - cursor: pointer;
97 - display: inline-block;
98 - box-sizing: border-box;
99 - background-color: #3a7f9f;
100 - }
101 -
102 - .order-group /deep/ .el-radio {
103 - color: #fff;
104 - }
105 -}
106 -
107 -// 活动页顶部按钮
108 -.top-active /deep/ .el-button {
109 - background-color: #3a7f9f;
110 - color: #fff;
111 - height: 38px;
112 -}
113 -
114 -.top-active /deep/ .el-button:active {
115 - background-color: #2c637c;
116 -}
117 -
118 -// 表格添加阴影
119 -.table-control {
120 - box-shadow: none;
121 -}
122 -
123 -// 表格选中颜色样式
124 -.table-control /deep/ .el-checkbox__input.is-checked .el-checkbox__inner {
125 - background-color: #3a7f9f;
126 -}
127 -
128 -.table-control /deep/ .el-checkbox__input.is-indeterminate .el-checkbox__inner {
129 - background-color: #3a7f9f;
130 -}
131 -
132 -// 底部修改,保存,取消按钮的样式修改
133 -.bottom-button {
134 - width: 100%;
135 - display: flex;
136 - justify-content: flex-end;
137 -}
138 -
139 -.bottom-button /deep/ .el-button--primary {
140 - background-color: #3a7f9f;
141 - border-color: #3a7f9f;
142 - height: 38px;
143 -}
144 -
145 -.bottom-button /deep/ .el-button--primary:active {
146 - background-color: #255368;
147 - border-color: #255368;
148 -}
149 -
150 -.bottom-button /deep/ .el-button--default {
151 - height: 38px;
152 - color: #3a7f9f;
153 -}
154 -
155 -.bottom-button /deep/ .el-button--default:hover {
156 - background-color: rgba(58, 127, 159, 0.2);
157 -}
158 -
159 -.bottom-button /deep/ .el-button--default:active {
160 - background-color: rgba(43, 94, 117, 0.3);
161 -}
......
1 + // 降低消息高度
2 + // 当启用自定义标题时使用
3 + .el-message {
4 + top: 50px !important;
5 + }
6 +
7 + .el-notification {
8 + top: 38px !important;
9 + }
...\ No newline at end of file ...\ No newline at end of file
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"] {
5 display: none !important; 4 display: none !important;
6 } 5 }
7 -} 6 + }
8 7
9 -.el-upload__input { 8 + .el-upload__input {
10 display: none; 9 display: none;
11 -} 10 + }
12 11
13 -//暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461 12 + //暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461
14 -.el-dialog { 13 + .el-dialog {
15 transform: none; 14 transform: none;
16 left: 0; 15 left: 0;
17 position: relative; 16 position: relative;
18 margin: 0 auto; 17 margin: 0 auto;
19 -} 18 + }
20 19
21 -//element ui upload 20 + //element ui upload
22 -.upload-container { 21 + .upload-container {
23 .el-upload { 22 .el-upload {
24 width: 100%; 23 width: 100%;
24 +
25 .el-upload-dragger { 25 .el-upload-dragger {
26 width: 100%; 26 width: 100%;
27 height: 200px; 27 height: 200px;
28 } 28 }
29 } 29 }
30 -}
31 -// 设置当选中时,popr的背景色被设置为白色的尴尬场景
32 -.el-menu--vertical{
33 - /deep/.el-menu--popup{
34 - /deep/ .el-menu-item.is-active{
35 - background-color: $Theme-color !important;
36 - }
37 } 30 }
38 -}
...\ No newline at end of file ...\ No newline at end of file
31 +
......
...@@ -3,17 +3,22 @@ ...@@ -3,17 +3,22 @@
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;
10 -webkit-font-smoothing: antialiased; 9 -webkit-font-smoothing: antialiased;
11 text-rendering: optimizeLegibility; 10 text-rendering: optimizeLegibility;
12 font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; 11 font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
12 + margin: 0;
13 + padding: 0;
13 } 14 }
14 15
15 html { 16 html {
16 box-sizing: border-box; 17 box-sizing: border-box;
18 +
19 + ::-webkit-scrollbar {
20 + display: none;
21 + }
17 } 22 }
18 23
19 *, 24 *,
...@@ -22,7 +27,7 @@ html { ...@@ -22,7 +27,7 @@ html {
22 box-sizing: inherit; 27 box-sizing: inherit;
23 } 28 }
24 29
25 -div:focus{ 30 +div:focus {
26 outline: none; 31 outline: none;
27 } 32 }
28 33
...@@ -51,7 +56,7 @@ a:hover { ...@@ -51,7 +56,7 @@ a:hover {
51 } 56 }
52 57
53 //main-container全局样式 58 //main-container全局样式
54 -.app-main{ 59 +.app-main {
55 min-height: 100% 60 min-height: 100%
56 } 61 }
57 62
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
18 height: 100%; 18 height: 100%;
19 position: fixed; 19 position: fixed;
20 font-size: 0px; 20 font-size: 0px;
21 - top: 0;
22 bottom: 0; 21 bottom: 0;
23 left: 0; 22 left: 0;
24 z-index: 1001; 23 z-index: 1001;
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
30 } 29 }
31 30
32 .svg-icon { 31 .svg-icon {
33 - margin-right: 16px; 32 + margin-left: 14px;
34 } 33 }
35 34
36 .el-menu { 35 .el-menu {
...@@ -41,16 +40,16 @@ ...@@ -41,16 +40,16 @@
41 40
42 .hideSidebar { 41 .hideSidebar {
43 .sidebar-container { 42 .sidebar-container {
44 - width: 36px !important; 43 + width: 60px !important;
45 } 44 }
46 45
47 .navbar-header-fixed { 46 .navbar-header-fixed {
48 - width: calc(100% - 36px); 47 + width: calc(100% - 60px);
49 ; 48 ;
50 } 49 }
51 50
52 .main-container { 51 .main-container {
53 - margin-left: 36px; 52 + margin-left: 60px;
54 } 53 }
55 54
56 .submenu-title-noDropdown { 55 .submenu-title-noDropdown {
...@@ -84,11 +83,6 @@ ...@@ -84,11 +83,6 @@
84 .sidebar-container .nest-menu .el-submenu>.el-submenu__title, 83 .sidebar-container .nest-menu .el-submenu>.el-submenu__title,
85 .sidebar-container .el-submenu .el-menu-item { 84 .sidebar-container .el-submenu .el-menu-item {
86 min-width: 180px !important; 85 min-width: 180px !important;
87 - background-color: $Theme-color !important;
88 -
89 - &:hover {
90 - background-color: $Theme-color !important;
91 - }
92 } 86 }
93 87
94 .el-menu--collapse .el-menu .el-submenu { 88 .el-menu--collapse .el-menu .el-submenu {
......
...@@ -2,4 +2,3 @@ ...@@ -2,4 +2,3 @@
2 $menuBg:#ffffff; 2 $menuBg:#ffffff;
3 $subMenuBg:#1f2d3d; 3 $subMenuBg:#1f2d3d;
4 $menuHover:#001528; 4 $menuHover:#001528;
5 -$Theme-color:#651FFF;
......
1 -export default {
2 - /**
3 - * @export
4 - * @param {Array} data
5 - * @param {Object} dialog
6 - * @param {function} fun
7 - * @returns
8 - * @feature 消息弹窗通用函数
9 - */
10 - MessageBox (dialog, data, fun) {
11 - return new Promise((resolve, reject) => {
12 - dialog.showMessageBox({
13 - type: 'info',
14 - title: data.title,
15 - buttons: data.buttons,
16 - message: data.message
17 - }, index => {
18 - if (index === 0) {
19 - let tempfun = async () => {
20 - try {
21 - resolve(await fun)
22 - } catch (error) {
23 - reject(error)
24 - }
25 - }
26 - tempfun()
27 - }
28 - })
29 - })
30 - },
31 - /**
32 - * @export
33 - * @param {Array} data
34 - * @param {Object} dialog
35 - * @returns
36 - * @feature 错误消息弹窗
37 - */
38 - ErrorMessageBox (dialog, data) {
39 - return dialog.showErrorBox(
40 - data.title,
41 - data.message
42 - )
43 - }
44 -}
1 +/**
2 + * @export
3 + * @Author: Sky
4 + * @Date: 2019-09-29 20:23:16
5 + * @Last Modified by: Sky
6 + * @Last Modified time: 2019-09-29 21:01:24
7 + * @param {Object} option
8 + * @returns
9 + * @feature 对于普通的通知只需要加入传入title,body;而对于需要图标的还需要传入icon,当然它也接受一个图片链接,当用户点击通知之后,会返回一个true
10 + * 由于是一个promise,请使用then接受
11 + **/
12 +
13 +export default {
14 + DesktopMsg (option) {
15 + const msgfunc = new window.Notification(option.title, option)
16 + return new Promise((resolve) => {
17 + msgfunc.onclick = () => {
18 + resolve(true)
19 + }
20 + })
21 + }
22 +}
1 +import $electron from 'electron'
2 +
3 +export default {
4 + send (data, arg, cb) {
5 + $electron.ipcRenderer.send(data, arg, (event, arg) => cb(event, arg))
6 + },
7 + on (data, arg, cb) {
8 + $electron.ipcRenderer.on(data, arg, (event, arg) => cb(event, arg))
9 + },
10 + remove (data) {
11 + $electron.ipcRenderer.removeAllListeners(data)
12 + }
13 +}
...@@ -9,9 +9,7 @@ ...@@ -9,9 +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">版权所有<a class="link-type" href="https://wallstreetcn.com" target='_blank'>华尔街见闻</a></div> 12 + <div class="bullshit__info">您似乎进到了一个次元世界,请点击以下按钮返回主页或者发送错误报告</div>
13 - <div class="bullshit__headline">{{ message }}</div>
14 - <div class="bullshit__info">请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告</div>
15 <a href="/" class="bullshit__return-home">返回首页</a> 13 <a href="/" class="bullshit__return-home">返回首页</a>
16 </div> 14 </div>
17 </div> 15 </div>
...@@ -28,11 +26,6 @@ export default { ...@@ -28,11 +26,6 @@ export default {
28 img_404, 26 img_404,
29 img_404_cloud 27 img_404_cloud
30 } 28 }
31 - },
32 - computed: {
33 - message() {
34 - return '特朗普说这个页面你不能进......'
35 - }
36 } 29 }
37 } 30 }
38 </script> 31 </script>
......
1 <template> 1 <template>
2 <div class="app-container"> 2 <div class="app-container">
3 <el-form ref="form" :model="form" label-width="120px"> 3 <el-form ref="form" :model="form" label-width="120px">
4 - <el-form-item label="Activity name"> 4 + <el-form-item label="活动名称">
5 <el-input v-model="form.name"></el-input> 5 <el-input v-model="form.name"></el-input>
6 </el-form-item> 6 </el-form-item>
7 - <el-form-item label="Activity zone"> 7 + <el-form-item label="活动地点">
8 - <el-select v-model="form.region" placeholder="please select your zone"> 8 + <el-select v-model="form.region" placeholder="请选择活动地点">
9 - <el-option label="Zone one" value="shanghai"></el-option> 9 + <el-option label="上海" value="上海"></el-option>
10 - <el-option label="Zone two" value="beijing"></el-option> 10 + <el-option label="北京" value="北京"></el-option>
11 </el-select> 11 </el-select>
12 </el-form-item> 12 </el-form-item>
13 - <el-form-item label="Activity time"> 13 + <el-form-item label="活动时间">
14 <el-col :span="11"> 14 <el-col :span="11">
15 - <el-date-picker type="date" placeholder="Pick a date" v-model="form.date1" style="width: 100%;"></el-date-picker> 15 + <el-date-picker type="date" placeholder="选择时间" v-model="form.date1" style="width: 100%;"></el-date-picker>
16 </el-col> 16 </el-col>
17 <el-col class="line" :span="2">-</el-col> 17 <el-col class="line" :span="2">-</el-col>
18 <el-col :span="11"> 18 <el-col :span="11">
19 - <el-time-picker type="fixed-time" placeholder="Pick a time" v-model="form.date2" style="width: 100%;"></el-time-picker> 19 + <el-time-picker
20 + type="fixed-time"
21 + placeholder="选择时间"
22 + v-model="form.date2"
23 + style="width: 100%;"
24 + ></el-time-picker>
20 </el-col> 25 </el-col>
21 </el-form-item> 26 </el-form-item>
22 - <el-form-item label="Instant delivery"> 27 + <el-form-item label="即时交付">
23 <el-switch v-model="form.delivery"></el-switch> 28 <el-switch v-model="form.delivery"></el-switch>
24 </el-form-item> 29 </el-form-item>
25 - <el-form-item label="Activity type"> 30 + <el-form-item label="额外选项">
26 <el-checkbox-group v-model="form.type"> 31 <el-checkbox-group v-model="form.type">
27 - <el-checkbox label="Online activities" name="type"></el-checkbox> 32 + <el-checkbox label="在线活动" name="type"></el-checkbox>
28 - <el-checkbox label="Promotion activities" name="type"></el-checkbox> 33 + <el-checkbox label="促销活动" name="type"></el-checkbox>
29 - <el-checkbox label="Offline activities" name="type"></el-checkbox> 34 + <el-checkbox label="线下活动" name="type"></el-checkbox>
30 - <el-checkbox label="Simple brand exposure" name="type"></el-checkbox> 35 + <el-checkbox label="发布会活动" name="type"></el-checkbox>
31 </el-checkbox-group> 36 </el-checkbox-group>
32 </el-form-item> 37 </el-form-item>
33 - <el-form-item label="Resources"> 38 + <el-form-item label="资源选项">
34 <el-radio-group v-model="form.resource"> 39 <el-radio-group v-model="form.resource">
35 - <el-radio label="Sponsor"></el-radio> 40 + <el-radio label="需要赞助商"></el-radio>
36 - <el-radio label="Venue"></el-radio> 41 + <el-radio label="不需要赞助商"></el-radio>
37 </el-radio-group> 42 </el-radio-group>
38 </el-form-item> 43 </el-form-item>
39 - <el-form-item label="Activity form"> 44 + <el-form-item label="活动详情">
40 - <el-input type="textarea" v-model="form.desc"></el-input> 45 + <tinymce v-model="form.desc" :height="300" />
41 </el-form-item> 46 </el-form-item>
42 <el-form-item> 47 <el-form-item>
43 <el-button type="primary" @click="onSubmit">Create</el-button> 48 <el-button type="primary" @click="onSubmit">Create</el-button>
...@@ -48,37 +53,39 @@ ...@@ -48,37 +53,39 @@
48 </template> 53 </template>
49 54
50 <script> 55 <script>
56 +import Tinymce from "@/components/Tinymce";
51 export default { 57 export default {
58 + components: { Tinymce },
52 data() { 59 data() {
53 return { 60 return {
54 form: { 61 form: {
55 - name: '', 62 + name: "",
56 - region: '', 63 + region: "",
57 - date1: '', 64 + date1: "",
58 - date2: '', 65 + date2: "",
59 delivery: false, 66 delivery: false,
60 type: [], 67 type: [],
61 - resource: '', 68 + resource: "",
62 - desc: '' 69 + desc: ""
63 - }
64 } 70 }
71 + };
65 }, 72 },
66 methods: { 73 methods: {
67 onSubmit() { 74 onSubmit() {
68 - this.$message('submit!') 75 + this.$message("submit!");
69 }, 76 },
70 onCancel() { 77 onCancel() {
71 this.$message({ 78 this.$message({
72 - message: 'cancel!', 79 + message: "cancel!",
73 - type: 'warning' 80 + type: "warning"
74 - }) 81 + });
75 } 82 }
76 } 83 }
77 -} 84 +};
78 </script> 85 </script>
79 86
80 <style scoped> 87 <style scoped>
81 -.line{ 88 +.line {
82 text-align: center; 89 text-align: center;
83 } 90 }
84 </style> 91 </style>
......
1 +<!doctype html>
2 +<html>
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title></title>
7 +
8 + <style>
9 + html {
10 + height: 100%;
11 + min-height: 100%;
12 + overflow: hidden;
13 + }
14 +
15 + html body {
16 + background-size: 163px;
17 + font: 14px/21px Monaco, sans-serif;
18 + color: #999;
19 + -webkit-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 + margin: 0px;
27 + }
28 +
29 + html body h4 {
30 + margin: 0;
31 + }
32 +
33 + .scene {
34 + display: flex;
35 + justify-content: center;
36 + align-items: center;
37 + height: 100%;
38 + background: #222;
39 + position: relative;
40 + }
41 +
42 + .loader {
43 + position: relative;
44 + width: 15em;
45 + height: 15em;
46 + background: linear-gradient(-225deg, #ff3cac 0%, #562b7c 52%, #2b86c5 100%);
47 + border-radius: 50%;
48 + animation: spin 0.5s linear infinite;
49 + }
50 +
51 + span {
52 + position: absolute;
53 + width: 100%;
54 + height: 100%;
55 + border-radius: inherit;
56 + background: inherit;
57 + }
58 +
59 + span:nth-child(1) {
60 + filter: blur(5px);
61 + }
62 +
63 + span:nth-child(2) {
64 + filter: blur(10px);
65 + }
66 +
67 + span:nth-child(3) {
68 + filter: blur(25px);
69 + }
70 +
71 + span:nth-child(4) {
72 + filter: blur(50px);
73 + }
74 +
75 + span::after {
76 + position: absolute;
77 + content: "";
78 + top: 10px;
79 + left: 10px;
80 + right: 10px;
81 + bottom: 10px;
82 + background: #222;
83 + border-radius: inherit;
84 + }
85 +
86 + .text {
87 + position: absolute;
88 + opacity: 0;
89 + animation: breath 3s ease-in-out infinite;
90 + }
91 +
92 + @keyframes breath {
93 + from {
94 + opacity: 0.05;
95 + }
96 +
97 + 50% {
98 + opacity: 1;
99 + }
100 +
101 + to {
102 + opacity: 0.05;
103 + }
104 + }
105 +
106 + @keyframes spin {
107 + to {
108 + transform: rotate(1turn);
109 + }
110 + }
111 + </style>
112 +</head>
113 +
114 +<body>
115 + <div class="scene">
116 + <div class="loader">
117 + <span></span>
118 + <span></span>
119 + <span></span>
120 + <span></span>
121 + </div>
122 + <div class="text">正在准备资源中...</div>
123 + </div>
124 +
125 +</body>
126 +
127 +</html>
...\ No newline at end of file ...\ No newline at end of file