From 40a7626acb3dd5c64052c0d0a220f7fb3e3e104e Mon Sep 17 00:00:00 2001 From: zthxxx Date: Mon, 29 Oct 2018 13:55:36 +0800 Subject: [PATCH] feat: perfect migrate to @vue/cli-service, upgrade vue babel version (#1267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: perfect migrate to @vue/cli-service, upgrade vue babel version 1. update to @vue/cli-service@3.0.5, @babel/core@7.0.0 2. use vue-cli service replace config file in build/ and config/ 3. upgrade vue and babel configuration 4. solve the svg-sprite config problem #980 refs: #932 #1087 #980 #1056 * fix: fix breadcrumb dependency * fix: fix index template and static assets load with vue-cli 3 * fix: fix import driver.js in guide page * refactor(mock): mak mock api compatible with both web-view and webpack server 1. 把 Mockjs 功能移到 server 端中间件,同时也兼容前端直接劫持 XHR 2. dev 环境下默认作为 express 中间件通过 webpack server 提供 mock api 3. prod 构建时,默认在前端用 Mockjs 劫持 XHR benefits: - dev 开发调试时能直接看到 XHR 请求,方便调试网络,能和后端对接联调 - 避开在开发时因为 Mockjs 引起的网络 bug - prod 构建时劫持 XHR,保证本项目的 Github Pages preview 能正常显示 (逻辑和 error-log 一样) - 前后台使用的 mock 是同一份代码,不会增加维护负担 ref: [#562](https://github.com/PanJiaChen/vue-element-admin/issues/562#issuecomment-378116233) * update requires the lowest version of node * add favicon * fix(TreeTable): fix `Array.prototype.concat` on custom-tree-table page --- .babelrc | 17 -- .env | 1 + .env.development | 1 + .env.production | 1 + .gitignore | 2 + babel.config.js | 14 ++ build/build.js | 67 ------- build/check-versions.js | 64 ------ build/logo.png | Bin 6849 -> 0 bytes build/utils.js | 108 ---------- build/vue-loader.conf.js | 5 - build/webpack.base.conf.js | 107 ---------- build/webpack.dev.conf.js | 98 --------- build/webpack.prod.conf.js | 188 ------------------ config/dev.env.js | 5 - config/index.js | 88 -------- config/prod.env.js | 5 - config/sit.env.js | 5 - {src/mock => mock}/article.js | 28 +-- mock/index.js | 50 +++++ {src/mock => mock}/login.js | 15 +- mock/mocks.js | 12 ++ {src/mock => mock}/remoteSearch.js | 8 +- mock/transaction.js | 16 ++ package.json | 61 ++---- public/favicon.ico | Bin 0 -> 67646 bytes index.html => public/index.html | 3 +- .../static}/tinymce4.7.5/langs/zh_CN.js | 0 .../plugins/codesample/css/prism.css | 0 .../plugins/emoticons/img/smiley-cool.gif | Bin .../plugins/emoticons/img/smiley-cry.gif | Bin .../emoticons/img/smiley-embarassed.gif | Bin .../emoticons/img/smiley-foot-in-mouth.gif | Bin .../plugins/emoticons/img/smiley-frown.gif | Bin .../plugins/emoticons/img/smiley-innocent.gif | Bin .../plugins/emoticons/img/smiley-kiss.gif | Bin .../plugins/emoticons/img/smiley-laughing.gif | Bin .../emoticons/img/smiley-money-mouth.gif | Bin .../plugins/emoticons/img/smiley-sealed.gif | Bin .../plugins/emoticons/img/smiley-smile.gif | Bin .../emoticons/img/smiley-surprised.gif | Bin .../emoticons/img/smiley-tongue-out.gif | Bin .../emoticons/img/smiley-undecided.gif | Bin .../plugins/emoticons/img/smiley-wink.gif | Bin .../plugins/emoticons/img/smiley-yell.gif | Bin .../plugins/visualblocks/css/visualblocks.css | 0 .../skins/lightgray/content.inline.min.css | 0 .../skins/lightgray/content.min.css | 0 .../skins/lightgray/fonts/tinymce-mobile.woff | Bin .../skins/lightgray/fonts/tinymce-small.eot | Bin .../skins/lightgray/fonts/tinymce-small.svg | 0 .../skins/lightgray/fonts/tinymce-small.ttf | Bin .../skins/lightgray/fonts/tinymce-small.woff | Bin .../skins/lightgray/fonts/tinymce.eot | Bin .../skins/lightgray/fonts/tinymce.svg | 0 .../skins/lightgray/fonts/tinymce.ttf | Bin .../skins/lightgray/fonts/tinymce.woff | Bin .../skins/lightgray/img/anchor.gif | Bin .../skins/lightgray/img/loader.gif | Bin .../skins/lightgray/img/object.gif | Bin .../skins/lightgray/img/trans.gif | Bin .../tinymce4.7.5/skins/lightgray/skin.min.css | 0 .../skins/lightgray/skin.min.css.map | 0 .../static}/tinymce4.7.5/tinymce.min.js | 0 src/components/TreeTable/index.vue | 2 +- src/main.js | 6 +- src/mock/index.js | 39 ---- src/mock/transaction.js | 23 --- src/utils/request.js | 3 +- src/views/guide/index.vue | 2 +- vue.config.js | 60 ++++++ 71 files changed, 211 insertions(+), 893 deletions(-) delete mode 100644 .babelrc create mode 100644 .env create mode 100644 .env.development create mode 100644 .env.production create mode 100644 babel.config.js delete mode 100644 build/build.js delete mode 100644 build/check-versions.js delete mode 100644 build/logo.png delete mode 100644 build/utils.js delete mode 100644 build/vue-loader.conf.js delete mode 100644 build/webpack.base.conf.js delete mode 100644 build/webpack.dev.conf.js delete mode 100644 build/webpack.prod.conf.js delete mode 100644 config/dev.env.js delete mode 100644 config/index.js delete mode 100644 config/prod.env.js delete mode 100644 config/sit.env.js rename {src/mock => mock}/article.js (81%) create mode 100644 mock/index.js rename {src/mock => mock}/login.js (72%) create mode 100644 mock/mocks.js rename {src/mock => mock}/remoteSearch.js (64%) create mode 100644 mock/transaction.js create mode 100644 public/favicon.ico rename index.html => public/index.html (75%) rename {static => public/static}/tinymce4.7.5/langs/zh_CN.js (100%) rename {static => public/static}/tinymce4.7.5/plugins/codesample/css/prism.css (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif (100%) rename {static => public/static}/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/content.inline.min.css (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/content.min.css (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.svg (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce.svg (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/img/anchor.gif (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/img/loader.gif (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/img/object.gif (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/img/trans.gif (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/skin.min.css (100%) rename {static => public/static}/tinymce4.7.5/skins/lightgray/skin.min.css.map (100%) rename {static => public/static}/tinymce4.7.5/tinymce.min.js (100%) delete mode 100644 src/mock/index.js delete mode 100644 src/mock/transaction.js create mode 100644 vue.config.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 6c0b7f27..00000000 --- a/.babelrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "presets": [ - ["env", { - "modules": false, - "targets": { - "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] - } - }], - "stage-2" - ], - "plugins": ["transform-vue-jsx", "transform-runtime"], - "env": { - "development":{ - "plugins": ["dynamic-import-node"] - } - } -} diff --git a/.env b/.env new file mode 100644 index 00000000..31bc290a --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..1d2d6c9f --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VUE_APP_BASE_API = '/api' diff --git a/.env.production b/.env.production new file mode 100644 index 00000000..1d2d6c9f --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VUE_APP_BASE_API = '/api' diff --git a/.gitignore b/.gitignore index 9322b8a6..887ce1ed 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,7 @@ selenium-debug.log *.ntvs* *.njsproj *.sln +*.local package-lock.json +yarn.lock diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000..6f812f61 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,14 @@ +module.exports = { + presets: [ + ['@vue/app', { modules: 'commonjs' }] + ], + plugins: [], + env: { + test: { + presets: [ + ['@vue/app', { modules: 'commonjs' }] + ], + plugins: ['istanbul'] + } + } +} diff --git a/build/build.js b/build/build.js deleted file mode 100644 index 34c71a55..00000000 --- a/build/build.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict' -require('./check-versions')() - -const ora = require('ora') -const rm = require('rimraf') -const path = require('path') -const chalk = require('chalk') -const webpack = require('webpack') -const config = require('../config') -const webpackConfig = require('./webpack.prod.conf') -var connect = require('connect') -var serveStatic = require('serve-static') - -const spinner = ora( - 'building for ' + process.env.env_config + ' environment...' -) -spinner.start() - -rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { - if (err) throw err - webpack(webpackConfig, (err, stats) => { - spinner.stop() - if (err) throw err - process.stdout.write( - stats.toString({ - colors: true, - modules: false, - children: false, - chunks: false, - chunkModules: false - }) + '\n\n' - ) - - if (stats.hasErrors()) { - console.log(chalk.red(' Build failed with errors.\n')) - process.exit(1) - } - - console.log(chalk.cyan(' Build complete.\n')) - console.log( - chalk.yellow( - ' Tip: built files are meant to be served over an HTTP server.\n' + - " Opening index.html over file:// won't work.\n" - ) - ) - - if (process.env.npm_config_preview) { - const port = 9526 - const host = 'http://localhost:' + port - const basePath = config.build.assetsPublicPath - const app = connect() - - app.use( - basePath, - serveStatic('./dist', { - index: ['index.html', '/'] - }) - ) - - app.listen(port, function() { - console.log( - chalk.green(`> Listening at http://localhost:${port}${basePath}`) - ) - }) - } - }) -}) diff --git a/build/check-versions.js b/build/check-versions.js deleted file mode 100644 index c5c29e90..00000000 --- a/build/check-versions.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict' -const chalk = require('chalk') -const semver = require('semver') -const packageConfig = require('../package.json') -const shell = require('shelljs') - -function exec(cmd) { - return require('child_process') - .execSync(cmd) - .toString() - .trim() -} - -const versionRequirements = [ - { - name: 'node', - currentVersion: semver.clean(process.version), - versionRequirement: packageConfig.engines.node - } -] - -if (shell.which('npm')) { - versionRequirements.push({ - name: 'npm', - currentVersion: exec('npm --version'), - versionRequirement: packageConfig.engines.npm - }) -} - -module.exports = function() { - const warnings = [] - - for (let i = 0; i < versionRequirements.length; i++) { - const mod = versionRequirements[i] - - if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { - warnings.push( - mod.name + - ': ' + - chalk.red(mod.currentVersion) + - ' should be ' + - chalk.green(mod.versionRequirement) - ) - } - } - - if (warnings.length) { - console.log('') - console.log( - chalk.yellow( - 'To use this template, you must update following to modules:' - ) - ) - console.log() - - for (let i = 0; i < warnings.length; i++) { - const warning = warnings[i] - console.log(' ' + warning) - } - - console.log() - process.exit(1) - } -} diff --git a/build/logo.png b/build/logo.png deleted file mode 100644 index f3d2503fc2a44b5053b0837ebea6e87a2d339a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6849 zcmaKRcUV(fvo}bjDT-7nLI_nlK}sT_69H+`qzVWDA|yaU?}j417wLi^B1KB1SLsC& zL0ag7$U(XW5YR7p&Ux?sP$d4lvMt8C^+TcQu4F zQqv!UF!I+kw)c0jhd6+g6oCr9P?7)?!qX1ui*iL{p}sKCAGuJ{{W)0z1pLF|=>h}& zt(2Lr0Z`2ig8<5i%Zk}cO5Fm=LByqGWaS`oqChZdEFmc`0hSb#gg|Aap^{+WKOYcj zHjINK)KDG%&s?Mt4CL(T=?;~U@bU2x_mLKN!#GJuK_CzbNw5SMEJorG!}_5;?R>@1 zSl)jns3WlU7^J%=(hUtfmuUCU&C3%8B5C^f5>W2Cy8jW3#{Od{lF1}|?c61##3dzA zsPlFG;l_FzBK}8>|H_Ru_H#!_7$UH4UKo3lKOA}g1(R&|e@}GINYVzX?q=_WLZCgh z)L|eJMce`D0EIwgRaNETDsr+?vQknSGAi=7H00r`QnI%oQnFxm`G2umXso9l+8*&Q z7WqF|$p49js$mdzo^BXpH#gURy=UO;=IMrYc5?@+sR4y_?d*~0^YP7d+y0{}0)zBM zIKVM(DBvICK#~7N0a+PY6)7;u=dutmNqK3AlsrUU9U`d;msiucB_|8|2kY=(7XA;G zwDA8AR)VCA#JOkxm#6oHNS^YVuOU;8p$N)2{`;oF|rQ?B~K$%rHDxXs+_G zF5|-uqHZvSzq}L;5Kcy_P+x0${33}Ofb6+TX&=y;;PkEOpz%+_bCw_{<&~ zeLV|!bP%l1qxywfVr9Z9JI+++EO^x>ZuCK);=$VIG1`kxK8F2M8AdC$iOe3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{G@Rn&}^Z{+TW}mQeb9=8b<_a`&Cm#n%n~ zU47MvCBsdXFB1+adOO)03+nczfWa#vwk#r{o{dF)QWya9v2nv43Zp3%Ps}($lA02*_g25t;|T{A5snSY?3A zrRQ~(Ygh_ebltHo1VCbJb*eOAr;4cnlXLvI>*$-#AVsGg6B1r7@;g^L zFlJ_th0vxO7;-opU@WAFe;<}?!2q?RBrFK5U{*ai@NLKZ^};Ul}beukveh?TQn;$%9=R+DX07m82gP$=}Uo_%&ngV`}Hyv8g{u z3SWzTGV|cwQuFIs7ZDOqO_fGf8Q`8MwL}eUp>q?4eqCmOTcwQuXtQckPy|4F1on8l zP*h>d+cH#XQf|+6c|S{7SF(Lg>bR~l(0uY?O{OEVlaxa5@e%T&xju=o1`=OD#qc16 zSvyH*my(dcp6~VqR;o(#@m44Lug@~_qw+HA=mS#Z^4reBy8iV?H~I;{LQWk3aKK8$bLRyt$g?- { - const notifier = require('node-notifier') - - return (severity, errors) => { - if (severity !== 'error') return - - const error = errors[0] - const filename = error.file && error.file.split('!').pop() - - notifier.notify({ - title: packageConfig.name, - message: severity + ': ' + error.name, - subtitle: filename || '', - icon: path.join(__dirname, 'logo.png') - }) - } -} diff --git a/build/vue-loader.conf.js b/build/vue-loader.conf.js deleted file mode 100644 index 5496c931..00000000 --- a/build/vue-loader.conf.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -module.exports = { - //You can set the vue-loader configuration by yourself. -} diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js deleted file mode 100644 index 3b946b4b..00000000 --- a/build/webpack.base.conf.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict' -const path = require('path') -const utils = require('./utils') -const config = require('../config') -const { VueLoaderPlugin } = require('vue-loader') -const vueLoaderConfig = require('./vue-loader.conf') - -function resolve(dir) { - return path.join(__dirname, '..', dir) -} - -const createLintingRule = () => ({ - test: /\.(js|vue)$/, - loader: 'eslint-loader', - enforce: 'pre', - include: [resolve('src'), resolve('test')], - options: { - formatter: require('eslint-friendly-formatter'), - emitWarning: !config.dev.showEslintErrorsInOverlay - } -}) - -module.exports = { - context: path.resolve(__dirname, '../'), - entry: { - app: './src/main.js' - }, - output: { - path: config.build.assetsRoot, - filename: '[name].js', - publicPath: - process.env.NODE_ENV === 'production' - ? config.build.assetsPublicPath - : config.dev.assetsPublicPath - }, - resolve: { - extensions: ['.js', '.vue', '.json'], - alias: { - '@': resolve('src') - } - }, - module: { - rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), - { - test: /\.vue$/, - loader: 'vue-loader', - options: vueLoaderConfig - }, - { - test: /\.js$/, - loader: 'babel-loader?cacheDirectory', - include: [ - resolve('src'), - resolve('test'), - resolve('node_modules/webpack-dev-server/client') - ] - }, - { - test: /\.svg$/, - loader: 'svg-sprite-loader', - include: [resolve('src/icons')], - options: { - symbolId: 'icon-[name]' - } - }, - { - test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, - loader: 'url-loader', - exclude: [resolve('src/icons')], - options: { - limit: 10000, - name: utils.assetsPath('img/[name].[hash:7].[ext]') - } - }, - { - test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, - loader: 'url-loader', - options: { - limit: 10000, - name: utils.assetsPath('media/[name].[hash:7].[ext]') - } - }, - { - test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, - loader: 'url-loader', - options: { - limit: 10000, - name: utils.assetsPath('fonts/[name].[hash:7].[ext]') - } - } - ] - }, - plugins: [new VueLoaderPlugin()], - node: { - // prevent webpack from injecting useless setImmediate polyfill because Vue - // source contains it (although only uses it if it's native). - setImmediate: false, - // prevent webpack from injecting mocks to Node native modules - // that does not make sense for the client - dgram: 'empty', - fs: 'empty', - net: 'empty', - tls: 'empty', - child_process: 'empty' - } -} diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js deleted file mode 100644 index 26a5584a..00000000 --- a/build/webpack.dev.conf.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict' -const path = require('path') -const utils = require('./utils') -const webpack = require('webpack') -const config = require('../config') -const merge = require('webpack-merge') -const baseWebpackConfig = require('./webpack.base.conf') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') -const portfinder = require('portfinder') - -function resolve(dir) { - return path.join(__dirname, '..', dir) -} - -const HOST = process.env.HOST -const PORT = process.env.PORT && Number(process.env.PORT) - -const devWebpackConfig = merge(baseWebpackConfig, { - mode: 'development', - module: { - rules: utils.styleLoaders({ - sourceMap: config.dev.cssSourceMap, - usePostCSS: true - }) - }, - // cheap-module-eval-source-map is faster for development - devtool: config.dev.devtool, - - // these devServer options should be customized in /config/index.js - devServer: { - clientLogLevel: 'warning', - historyApiFallback: true, - hot: true, - compress: true, - host: HOST || config.dev.host, - port: PORT || config.dev.port, - open: config.dev.autoOpenBrowser, - overlay: config.dev.errorOverlay - ? { warnings: false, errors: true } - : false, - publicPath: config.dev.assetsPublicPath, - proxy: config.dev.proxyTable, - quiet: true, // necessary for FriendlyErrorsPlugin - watchOptions: { - poll: config.dev.poll - } - }, - plugins: [ - new webpack.DefinePlugin({ - 'process.env': require('../config/dev.env') - }), - new webpack.HotModuleReplacementPlugin(), - // https://github.com/ampedandwired/html-webpack-plugin - new HtmlWebpackPlugin({ - filename: 'index.html', - template: 'index.html', - inject: true, - favicon: resolve('favicon.ico'), - title: 'vue-element-admin', - templateParameters: { - BASE_URL: config.dev.assetsPublicPath + config.dev.assetsSubDirectory, - }, - }), - ] -}) - -module.exports = new Promise((resolve, reject) => { - portfinder.basePort = process.env.PORT || config.dev.port - portfinder.getPort((err, port) => { - if (err) { - reject(err) - } else { - // publish the new Port, necessary for e2e tests - process.env.PORT = port - // add port to devServer config - devWebpackConfig.devServer.port = port - - // Add FriendlyErrorsPlugin - devWebpackConfig.plugins.push( - new FriendlyErrorsPlugin({ - compilationSuccessInfo: { - messages: [ - `Your application is running here: http://${ - devWebpackConfig.devServer.host - }:${port}` - ] - }, - onErrors: config.dev.notifyOnErrors - ? utils.createNotifierCallback() - : undefined - }) - ) - - resolve(devWebpackConfig) - } - }) -}) diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js deleted file mode 100644 index 946a134a..00000000 --- a/build/webpack.prod.conf.js +++ /dev/null @@ -1,188 +0,0 @@ -'use strict' -const path = require('path') -const utils = require('./utils') -const webpack = require('webpack') -const config = require('../config') -const merge = require('webpack-merge') -const baseWebpackConfig = require('./webpack.base.conf') -const CopyWebpackPlugin = require('copy-webpack-plugin') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') - -function resolve(dir) { - return path.join(__dirname, '..', dir) -} - -const env = require('../config/' + process.env.env_config + '.env') - -// For NamedChunksPlugin -const seen = new Set() -const nameLength = 4 - -const webpackConfig = merge(baseWebpackConfig, { - mode: 'production', - module: { - rules: utils.styleLoaders({ - sourceMap: config.build.productionSourceMap, - extract: true, - usePostCSS: true - }) - }, - devtool: config.build.productionSourceMap ? config.build.devtool : false, - output: { - path: config.build.assetsRoot, - filename: utils.assetsPath('js/[name].[chunkhash:8].js'), - chunkFilename: utils.assetsPath('js/[name].[chunkhash:8].js') - }, - plugins: [ - // http://vuejs.github.io/vue-loader/en/workflow/production.html - new webpack.DefinePlugin({ - 'process.env': env - }), - // extract css into its own file - new MiniCssExtractPlugin({ - filename: utils.assetsPath('css/[name].[contenthash:8].css'), - chunkFilename: utils.assetsPath('css/[name].[contenthash:8].css') - }), - // generate dist index.html with correct asset hash for caching. - // you can customize output by editing /index.html - // see https://github.com/ampedandwired/html-webpack-plugin - new HtmlWebpackPlugin({ - filename: config.build.index, - template: 'index.html', - inject: true, - favicon: resolve('favicon.ico'), - title: 'vue-element-admin', - templateParameters: { - BASE_URL: config.build.assetsPublicPath + config.build.assetsSubDirectory, - }, - minify: { - removeComments: true, - collapseWhitespace: true, - removeAttributeQuotes: true - // more options: - // https://github.com/kangax/html-minifier#options-quick-reference - } - // default sort mode uses toposort which cannot handle cyclic deps - // in certain cases, and in webpack 4, chunk order in HTML doesn't - // matter anyway - }), - new ScriptExtHtmlWebpackPlugin({ - //`runtime` must same as runtimeChunk name. default is `runtime` - inline: /runtime\..*\.js$/ - }), - // keep chunk.id stable when chunk has no name - new webpack.NamedChunksPlugin(chunk => { - if (chunk.name) { - return chunk.name - } - const modules = Array.from(chunk.modulesIterable) - if (modules.length > 1) { - const hash = require('hash-sum') - const joinedHash = hash(modules.map(m => m.id).join('_')) - let len = nameLength - while (seen.has(joinedHash.substr(0, len))) len++ - seen.add(joinedHash.substr(0, len)) - return `chunk-${joinedHash.substr(0, len)}` - } else { - return modules[0].id - } - }), - // keep module.id stable when vender modules does not change - new webpack.HashedModuleIdsPlugin(), - // copy custom static assets - new CopyWebpackPlugin([ - { - from: path.resolve(__dirname, '../static'), - to: config.build.assetsSubDirectory, - ignore: ['.*'] - } - ]) - ], - optimization: { - splitChunks: { - chunks: 'all', - cacheGroups: { - libs: { - name: 'chunk-libs', - test: /[\\/]node_modules[\\/]/, - priority: 10, - chunks: 'initial' // 只打包初始时依赖的第三方 - }, - elementUI: { - name: 'chunk-elementUI', // 单独将 elementUI 拆包 - priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app - test: /[\\/]node_modules[\\/]element-ui[\\/]/ - }, - commons: { - name: 'chunk-commons', - test: resolve('src/components'), // 可自定义拓展你的规则 - minChunks: 3, // 最小公用次数 - priority: 5, - reuseExistingChunk: true - } - } - }, - runtimeChunk: 'single', - minimizer: [ - new UglifyJsPlugin({ - uglifyOptions: { - mangle: { - safari10: true - } - }, - sourceMap: config.build.productionSourceMap, - cache: true, - parallel: true - }), - // Compress extracted CSS. We are using this plugin so that possible - // duplicated CSS from different components can be deduped. - new OptimizeCSSAssetsPlugin() - ] - } -}) - -if (config.build.productionGzip) { - const CompressionWebpackPlugin = require('compression-webpack-plugin') - - webpackConfig.plugins.push( - new CompressionWebpackPlugin({ - asset: '[path].gz[query]', - algorithm: 'gzip', - test: new RegExp( - '\\.(' + config.build.productionGzipExtensions.join('|') + ')$' - ), - threshold: 10240, - minRatio: 0.8 - }) - ) -} - -if (config.build.generateAnalyzerReport || config.build.bundleAnalyzerReport) { - const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') - .BundleAnalyzerPlugin - - if (config.build.bundleAnalyzerReport) { - webpackConfig.plugins.push( - new BundleAnalyzerPlugin({ - analyzerPort: 8080, - generateStatsFile: false - }) - ) - } - - if (config.build.generateAnalyzerReport) { - webpackConfig.plugins.push( - new BundleAnalyzerPlugin({ - analyzerMode: 'static', - reportFilename: 'bundle-report.html', - openAnalyzer: false - }) - ) - } -} - -module.exports = webpackConfig diff --git a/config/dev.env.js b/config/dev.env.js deleted file mode 100644 index 68ddea56..00000000 --- a/config/dev.env.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - NODE_ENV: '"development"', - ENV_CONFIG: '"dev"', - BASE_API: '"https://api-dev"' -} diff --git a/config/index.js b/config/index.js deleted file mode 100644 index 599e4a63..00000000 --- a/config/index.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict' -// Template version: 1.2.6 -// see http://vuejs-templates.github.io/webpack for documentation. - -const path = require('path') - -module.exports = { - dev: { - // Paths - assetsSubDirectory: 'static', - assetsPublicPath: '/', - proxyTable: {}, - - // Various Dev Server settings - - // can be overwritten by process.env.HOST - // if you want dev by ip, please set host: '0.0.0.0' - host: 'localhost', - port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined - autoOpenBrowser: true, - errorOverlay: true, - notifyOnErrors: false, - poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- - - // Use Eslint Loader? - // If true, your code will be linted during bundling and - // linting errors and warnings will be shown in the console. - useEslint: true, - // If true, eslint errors and warnings will also be shown in the error overlay - // in the browser. - showEslintErrorsInOverlay: false, - - /** - * Source Maps - */ - - // https://webpack.js.org/configuration/devtool/#development - devtool: 'cheap-source-map', - - // CSS Sourcemaps off by default because relative paths are "buggy" - // with this option, according to the CSS-Loader README - // (https://github.com/webpack/css-loader#sourcemaps) - // In our experience, they generally work as expected, - // just be aware of this issue when enabling this option. - cssSourceMap: false - }, - - build: { - // Template for index.html - index: path.resolve(__dirname, '../dist/index.html'), - - // Paths - assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', - - /** - * You can set by youself according to actual condition - * You will need to set this if you plan to deploy your site under a sub path, - * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/, - * then assetsPublicPath should be set to "/bar/". - * In most cases please use '/' !!! - */ - assetsPublicPath: '/', - - /** - * Source Maps - */ - productionSourceMap: false, - // https://webpack.js.org/configuration/devtool/#production - devtool: 'source-map', - - // Gzip off by default as many popular static hosts such as - // Surge or Netlify already gzip all static assets for you. - // Before setting to `true`, make sure to: - // npm install --save-dev compression-webpack-plugin - productionGzip: false, - productionGzipExtensions: ['js', 'css'], - - // Run the build command with an extra argument to - // View the bundle analyzer report after build finishes: - // `npm run build:prod --report` - // Set to `true` or `false` to always turn it on or off - bundleAnalyzerReport: process.env.npm_config_report || false, - - // `npm run build:prod --generate_report` - generateAnalyzerReport: process.env.npm_config_generate_report || false - } -} diff --git a/config/prod.env.js b/config/prod.env.js deleted file mode 100644 index bfcd6d27..00000000 --- a/config/prod.env.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - NODE_ENV: '"production"', - ENV_CONFIG: '"prod"', - BASE_API: '"https://api-prod"' -} diff --git a/config/sit.env.js b/config/sit.env.js deleted file mode 100644 index 93178e80..00000000 --- a/config/sit.env.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - NODE_ENV: '"production"', - ENV_CONFIG: '"sit"', - BASE_API: '"https://api-sit"' -} diff --git a/src/mock/article.js b/mock/article.js similarity index 81% rename from src/mock/article.js rename to mock/article.js index 45923ddd..72b5f837 100644 --- a/src/mock/article.js +++ b/mock/article.js @@ -1,5 +1,4 @@ import Mock from 'mockjs' -import { param2Obj } from '@/utils' const List = [] const count = 100 @@ -29,8 +28,8 @@ for (let i = 0; i < count; i++) { } export default { - getList: config => { - const { importance, type, title, page = 1, limit = 20, sort } = param2Obj(config.url) + '/article/list': config => { + const { importance, type, title, page = 1, limit = 20, sort } = config.query let mockList = List.filter(item => { if (importance && item.importance !== +importance) return false @@ -50,21 +49,26 @@ export default { items: pageList } }, - getPv: () => ({ - pvData: [{ key: 'PC', pv: 1024 }, { key: 'mobile', pv: 1024 }, { key: 'ios', pv: 1024 }, { key: 'android', pv: 1024 }] - }), - getArticle: (config) => { - const { id } = param2Obj(config.url) + '/article/detail': config => { + const { id } = config.query for (const article of List) { if (article.id === +id) { return article } } }, - createArticle: () => ({ + '/article/pv': { + pvData: [ + { key: 'PC', pv: 1024 }, + { key: 'mobile', pv: 1024 }, + { key: 'ios', pv: 1024 }, + { key: 'android', pv: 1024 } + ] + }, + '/article/create': { data: 'success' - }), - updateArticle: () => ({ + }, + '/article/update': { data: 'success' - }) + } } diff --git a/mock/index.js b/mock/index.js new file mode 100644 index 00000000..f40ac238 --- /dev/null +++ b/mock/index.js @@ -0,0 +1,50 @@ +import Mock from 'mockjs' +import mocks from './mocks' +import { param2Obj } from '../src/utils' + +const MOCK_API_BASE = '/mock' + +export function mockXHR() { + // 修复在使用 MockJS 情况下,设置 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题 + // https://github.com/nuysoft/Mock/issues/300 + Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send + Mock.XHR.prototype.send = function() { + if (this.custom.xhr) { + this.custom.xhr.withCredentials = this.withCredentials || false + } + this.proxy_send(...arguments) + } + + function XHR2ExpressReqWrap(respond) { + return function(options) { + let result = null + if (respond instanceof Function) { + const { body, type, url } = options + // https://expressjs.com/en/4x/api.html#req + result = respond({ + method: type, + body: JSON.parse(body), + query: param2Obj(url) + }) + } else { + result = respond + } + return Mock.mock(result) + } + } + + for (const [route, respond] of Object.entries(mocks)) { + Mock.mock(new RegExp(`${route}`), XHR2ExpressReqWrap(respond)) + } +} + +const responseFake = (route, respond) => ( + { + route: new RegExp(`${MOCK_API_BASE}${route}`), + response(req, res) { + res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond)) + } + } +) + +export default Object.keys(mocks).map(route => responseFake(route, mocks[route])) diff --git a/src/mock/login.js b/mock/login.js similarity index 72% rename from src/mock/login.js rename to mock/login.js index b9694f09..e49f98ce 100644 --- a/src/mock/login.js +++ b/mock/login.js @@ -1,5 +1,3 @@ -import { param2Obj } from '@/utils' - const userMap = { admin: { roles: ['admin'], @@ -18,17 +16,18 @@ const userMap = { } export default { - loginByUsername: config => { - const { username } = JSON.parse(config.body) + '/login/login': config => { + const { username } = config.body return userMap[username] }, - getUserInfo: config => { - const { token } = param2Obj(config.url) + '/login/logout': 'success', + '/user/info': config => { + const { token } = config.query if (userMap[token]) { return userMap[token] } else { return false } - }, - logout: () => 'success' + } } + diff --git a/mock/mocks.js b/mock/mocks.js new file mode 100644 index 00000000..9e551722 --- /dev/null +++ b/mock/mocks.js @@ -0,0 +1,12 @@ +import login from './login' +import article from './article' +import search from './remoteSearch' +import transaction from './transaction' + +export default { + ...login, + ...article, + ...search, + ...transaction +} + diff --git a/src/mock/remoteSearch.js b/mock/remoteSearch.js similarity index 64% rename from src/mock/remoteSearch.js rename to mock/remoteSearch.js index b70f6f7d..bbdc0708 100644 --- a/src/mock/remoteSearch.js +++ b/mock/remoteSearch.js @@ -1,5 +1,4 @@ import Mock from 'mockjs' -import { param2Obj } from '@/utils' const NameList = [] const count = 100 @@ -12,12 +11,11 @@ for (let i = 0; i < count; i++) { NameList.push({ name: 'mockPan' }) export default { - searchUser: config => { - const { name } = param2Obj(config.url) + '/search/user': config => { + const { name } = config.query const mockNameList = NameList.filter(item => { const lowerCaseName = item.name.toLowerCase() - if (name && lowerCaseName.indexOf(name.toLowerCase()) < 0) return false - return true + return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0) }) return { items: mockNameList } } diff --git a/mock/transaction.js b/mock/transaction.js new file mode 100644 index 00000000..61c84f0d --- /dev/null +++ b/mock/transaction.js @@ -0,0 +1,16 @@ +import Mock from 'mockjs' + +const count = 20 + +export default { + '/transaction/list': { + total: count, + [`items|${count}`]: [{ + order_no: '@guid()', + timestamp: +Mock.Random.date('T'), + username: '@name()', + price: '@float(1000, 15000, 0, 2)', + 'status|1': ['success', 'pending'] + }] + } +} diff --git a/package.json b/package.json index d795d163..41929346 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "author": "Pan ", "license": "MIT", "scripts": { - "dev": "cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", - "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js", - "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js", + "dev": "vue-cli-service serve", + "build:prod": "vue-cli-service build", + "build:sit": "vue-cli-service build --mode text", "lint": "eslint --ext .js,.vue src", "test": "npm run lint", "precommit": "lint-staged", @@ -47,9 +47,9 @@ "js-cookie": "2.2.0", "jsonlint": "1.6.3", "jszip": "3.1.5", - "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", + "path-to-regexp": "^2.4.0", "screenfull": "3.3.3", "showdown": "1.8.6", "simplemde": "1.11.2", @@ -64,63 +64,36 @@ "xlsx": "^0.11.16" }, "devDependencies": { + "@babel/core": "7.0.0", + "@babel/register": "7.0.0", + "@vue/babel-helper-vue-jsx-merge-props": "0.1.0", + "@vue/cli-plugin-babel": "^3.0.5", + "@vue/cli-plugin-eslint": "^3.0.5", + "@vue/cli-plugin-unit-mocha": "^3.0.5", + "@vue/cli-service": "^3.0.5", + "@vue/eslint-config-standard": "^3.0.5", + "@vue/test-utils": "^1.0.0-beta.25", "autoprefixer": "8.5.0", - "babel-core": "6.26.3", - "babel-eslint": "8.2.6", - "babel-helper-vue-jsx-merge-props": "2.0.3", - "babel-loader": "7.1.5", - "babel-plugin-dynamic-import-node": "2.0.0", - "babel-plugin-syntax-jsx": "6.18.0", - "babel-plugin-transform-runtime": "6.23.0", - "babel-plugin-transform-vue-jsx": "3.7.0", - "babel-preset-env": "1.7.0", - "babel-preset-stage-2": "6.24.1", - "chalk": "2.4.1", - "copy-webpack-plugin": "4.5.2", - "cross-env": "5.2.0", - "css-loader": "1.0.0", - "eslint": "4.19.1", - "eslint-friendly-formatter": "4.0.1", - "eslint-loader": "2.0.0", - "eslint-plugin-vue": "4.7.1", - "file-loader": "1.1.11", - "friendly-errors-webpack-plugin": "1.7.0", - "hash-sum": "1.0.2", - "html-webpack-plugin": "4.0.0-alpha", + "babel-plugin-istanbul": "^4.1.6", "husky": "0.14.3", "lint-staged": "7.2.2", - "mini-css-extract-plugin": "0.4.1", + "mockjs": "1.0.1-beta3", "node-notifier": "5.2.1", "node-sass": "^4.7.2", "optimize-css-assets-webpack-plugin": "5.0.0", - "ora": "3.0.0", - "path-to-regexp": "2.4.0", - "portfinder": "1.0.13", "postcss-import": "11.1.0", "postcss-loader": "2.1.6", "postcss-url": "7.3.2", - "rimraf": "2.6.2", "sass-loader": "7.0.3", "script-ext-html-webpack-plugin": "2.0.1", "script-loader": "0.7.2", - "semver": "5.5.0", - "serve-static": "1.13.2", "shelljs": "0.8.2", "svg-sprite-loader": "3.8.0", "svgo": "1.0.5", - "uglifyjs-webpack-plugin": "1.2.7", - "url-loader": "1.0.1", - "vue-loader": "15.3.0", - "vue-style-loader": "4.1.2", - "vue-template-compiler": "2.5.17", - "webpack": "4.16.5", - "webpack-bundle-analyzer": "2.13.1", - "webpack-cli": "3.1.0", - "webpack-dev-server": "3.1.5", - "webpack-merge": "4.1.4" + "vue-template-compiler": "2.5.17" }, "engines": { - "node": ">= 6.0.0", + "node": ">=8.9", "npm": ">= 3.0.0" }, "browserslist": [ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000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_@$*;(o3(VL zg5lev6(TeFiAY>HyJ&&6tI-0B%JE#dfRUd^3RoQZeYk+pq*kEl?O~2I$F7qjy2~QN X;@D+E7Ad=S_FbjlW&KY_+xPzm3MBT? literal 0 HcmV?d00001 diff --git a/index.html b/public/index.html similarity index 75% rename from index.html rename to public/index.html index 7a7ecacf..adb0ecc0 100644 --- a/index.html +++ b/public/index.html @@ -5,10 +5,11 @@ + vue-element-admin - +
diff --git a/static/tinymce4.7.5/langs/zh_CN.js b/public/static/tinymce4.7.5/langs/zh_CN.js similarity index 100% rename from static/tinymce4.7.5/langs/zh_CN.js rename to public/static/tinymce4.7.5/langs/zh_CN.js diff --git a/static/tinymce4.7.5/plugins/codesample/css/prism.css b/public/static/tinymce4.7.5/plugins/codesample/css/prism.css similarity index 100% rename from static/tinymce4.7.5/plugins/codesample/css/prism.css rename to public/static/tinymce4.7.5/plugins/codesample/css/prism.css diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif diff --git a/static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif b/public/static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif similarity index 100% rename from static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif rename to public/static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif diff --git a/static/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css b/public/static/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css similarity index 100% rename from static/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css rename to public/static/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css diff --git a/static/tinymce4.7.5/skins/lightgray/content.inline.min.css b/public/static/tinymce4.7.5/skins/lightgray/content.inline.min.css similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/content.inline.min.css rename to public/static/tinymce4.7.5/skins/lightgray/content.inline.min.css diff --git a/static/tinymce4.7.5/skins/lightgray/content.min.css b/public/static/tinymce4.7.5/skins/lightgray/content.min.css similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/content.min.css rename to public/static/tinymce4.7.5/skins/lightgray/content.min.css diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.svg b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.svg similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.svg rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.svg diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.svg b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.svg similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce.svg rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.svg diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf diff --git a/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff b/public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff rename to public/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff diff --git a/static/tinymce4.7.5/skins/lightgray/img/anchor.gif b/public/static/tinymce4.7.5/skins/lightgray/img/anchor.gif similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/img/anchor.gif rename to public/static/tinymce4.7.5/skins/lightgray/img/anchor.gif diff --git a/static/tinymce4.7.5/skins/lightgray/img/loader.gif b/public/static/tinymce4.7.5/skins/lightgray/img/loader.gif similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/img/loader.gif rename to public/static/tinymce4.7.5/skins/lightgray/img/loader.gif diff --git a/static/tinymce4.7.5/skins/lightgray/img/object.gif b/public/static/tinymce4.7.5/skins/lightgray/img/object.gif similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/img/object.gif rename to public/static/tinymce4.7.5/skins/lightgray/img/object.gif diff --git a/static/tinymce4.7.5/skins/lightgray/img/trans.gif b/public/static/tinymce4.7.5/skins/lightgray/img/trans.gif similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/img/trans.gif rename to public/static/tinymce4.7.5/skins/lightgray/img/trans.gif diff --git a/static/tinymce4.7.5/skins/lightgray/skin.min.css b/public/static/tinymce4.7.5/skins/lightgray/skin.min.css similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/skin.min.css rename to public/static/tinymce4.7.5/skins/lightgray/skin.min.css diff --git a/static/tinymce4.7.5/skins/lightgray/skin.min.css.map b/public/static/tinymce4.7.5/skins/lightgray/skin.min.css.map similarity index 100% rename from static/tinymce4.7.5/skins/lightgray/skin.min.css.map rename to public/static/tinymce4.7.5/skins/lightgray/skin.min.css.map diff --git a/static/tinymce4.7.5/tinymce.min.js b/public/static/tinymce4.7.5/tinymce.min.js similarity index 100% rename from static/tinymce4.7.5/tinymce.min.js rename to public/static/tinymce4.7.5/tinymce.min.js diff --git a/src/components/TreeTable/index.vue b/src/components/TreeTable/index.vue index a48765c8..2ae1814c 100644 --- a/src/components/TreeTable/index.vue +++ b/src/components/TreeTable/index.vue @@ -61,7 +61,7 @@ export default { tmp = this.data } const func = this.evalFunc || treeToArray - const args = this.evalArgs ? Array.concat([tmp, this.expandAll], this.evalArgs) : [tmp, this.expandAll] + const args = this.evalArgs ? [].concat([tmp, this.expandAll], this.evalArgs) : [tmp, this.expandAll] return func.apply(null, args) } }, diff --git a/src/main.js b/src/main.js index 1ce709c9..b9b300be 100644 --- a/src/main.js +++ b/src/main.js @@ -17,10 +17,14 @@ import i18n from './lang' // Internationalization import './icons' // icon import './errorLog' // error log import './permission' // permission control -import './mock' // simulation data import * as filters from './filters' // global filters +import { mockXHR } from '../mock' // simulation data + +// mock api in github pages site build +if (process.env.NODE_ENV === 'production') { mockXHR() } + Vue.use(Element, { size: Cookies.get('size') || 'medium', // set element-ui default size i18n: (key, value) => i18n.t(key, value) diff --git a/src/mock/index.js b/src/mock/index.js deleted file mode 100644 index 3e00e918..00000000 --- a/src/mock/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import Mock from 'mockjs' -import loginAPI from './login' -import articleAPI from './article' -import remoteSearchAPI from './remoteSearch' -import transactionAPI from './transaction' - -// 修复在使用 MockJS 情况下,设置 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题 -// https://github.com/nuysoft/Mock/issues/300 -Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send -Mock.XHR.prototype.send = function() { - if (this.custom.xhr) { - this.custom.xhr.withCredentials = this.withCredentials || false - } - this.proxy_send(...arguments) -} - -// Mock.setup({ -// timeout: '350-600' -// }) - -// 登录相关 -Mock.mock(/\/login\/login/, 'post', loginAPI.loginByUsername) -Mock.mock(/\/login\/logout/, 'post', loginAPI.logout) -Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getUserInfo) - -// 文章相关 -Mock.mock(/\/article\/list/, 'get', articleAPI.getList) -Mock.mock(/\/article\/detail/, 'get', articleAPI.getArticle) -Mock.mock(/\/article\/pv/, 'get', articleAPI.getPv) -Mock.mock(/\/article\/create/, 'post', articleAPI.createArticle) -Mock.mock(/\/article\/update/, 'post', articleAPI.updateArticle) - -// 搜索相关 -Mock.mock(/\/search\/user/, 'get', remoteSearchAPI.searchUser) - -// 账单相关 -Mock.mock(/\/transaction\/list/, 'get', transactionAPI.getList) - -export default Mock diff --git a/src/mock/transaction.js b/src/mock/transaction.js deleted file mode 100644 index a17517e4..00000000 --- a/src/mock/transaction.js +++ /dev/null @@ -1,23 +0,0 @@ -import Mock from 'mockjs' - -const List = [] -const count = 20 - -for (let i = 0; i < count; i++) { - List.push(Mock.mock({ - order_no: '@guid()', - timestamp: +Mock.Random.date('T'), - username: '@name()', - price: '@float(1000, 15000, 0, 2)', - 'status|1': ['success', 'pending'] - })) -} - -export default { - getList: () => { - return { - total: List.length, - items: List - } - } -} diff --git a/src/utils/request.js b/src/utils/request.js index 50f9ecec..47237685 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -5,7 +5,8 @@ import { getToken } from '@/utils/auth' // create an axios instance const service = axios.create({ - baseURL: process.env.BASE_API, // api 的 base_url + baseURL: process.env.VUE_APP_BASE_API, // api 的 base_url + withCredentials: true, // 跨域请求时发送 cookies timeout: 5000 // request timeout }) diff --git a/src/views/guide/index.vue b/src/views/guide/index.vue index c30c52cf..49502aef 100644 --- a/src/views/guide/index.vue +++ b/src/views/guide/index.vue @@ -10,7 +10,7 @@