├── .babelrc ├── .editorconfig ├── .env ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── README.md ├── app.js ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── canvas-nest.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── index.js ├── package-lock.json ├── package.json ├── server ├── config │ └── db.js ├── controller │ ├── basicTable.js │ ├── cityTable.js │ ├── orderTable.js │ ├── personnelTable.js │ └── user.js ├── models │ ├── basicTable.js │ ├── cityTable.js │ ├── orderTable.js │ ├── personnelTable.js │ └── user.js ├── router.js └── schema │ ├── basicTable.js │ ├── cityTable.js │ ├── orderTable.js │ ├── personnelTable.js │ └── user.js ├── src ├── App.vue ├── axios │ └── index.js ├── canvas-nest.js ├── components │ ├── Footer │ │ └── Footer.vue │ ├── Header │ │ └── Header.vue │ └── NavLeft │ │ ├── MenuConfig.js │ │ ├── MenuList.vue │ │ └── NavLeft.vue ├── main.js ├── pages │ ├── city │ │ ├── City.vue │ │ ├── CityForm.vue │ │ ├── CityOpenForm.vue │ │ ├── CityTable.vue │ │ └── data.js │ ├── common │ │ └── common.vue │ ├── echarts │ │ ├── Bar.vue │ │ ├── Line.vue │ │ ├── Pie.vue │ │ └── echarttheme.js │ ├── form │ │ ├── login.vue │ │ └── register.vue │ ├── home │ │ ├── Home.vue │ │ └── Index.vue │ ├── login │ │ ├── Login.vue │ │ └── iconfont │ │ │ ├── iconfont.css │ │ │ ├── iconfont.eot │ │ │ ├── iconfont.svg │ │ │ ├── iconfont.ttf │ │ │ └── iconfont.woff │ ├── map │ │ ├── BikeForm.vue │ │ └── BikeMap.vue │ ├── order │ │ ├── Order.vue │ │ ├── OrderEndForm.vue │ │ ├── OrderForm.vue │ │ ├── OrderTable.vue │ │ ├── data.js │ │ └── detail │ │ │ └── Detail.vue │ ├── permission │ │ ├── AutherPermissionForm │ │ │ ├── AutherPermissionForm.vue │ │ │ └── Transfer.vue │ │ ├── CreatPermissonForm │ │ │ └── CreatPermissonForm.vue │ │ ├── Permission.vue │ │ ├── PermissionTable.vue │ │ ├── SetPermissionForm │ │ │ ├── SetPermissionForm.vue │ │ │ └── TreeNodes.vue │ │ └── data.js │ ├── rich │ │ └── Rich.vue │ ├── table │ │ ├── BasicTable.vue │ │ ├── HighTable.vue │ │ └── data.js │ ├── ui │ │ ├── Buttons.vue │ │ ├── Carousel.vue │ │ ├── Gallery.vue │ │ ├── Loadings.vue │ │ ├── Messages.vue │ │ ├── Modals.vue │ │ ├── Notice.vue │ │ ├── Tabs.vue │ │ └── ui.less │ └── user │ │ ├── User.vue │ │ ├── UserForm.vue │ │ ├── UserLoginForm.vue │ │ ├── UserTable.vue │ │ └── data.js ├── router │ └── index.js ├── store │ └── index.js ├── style │ ├── common.less │ ├── default.less │ └── loading.less └── utils │ └── utils.js ├── static ├── .gitkeep ├── bg.jpg ├── bike.jpg ├── carousel-img │ ├── carousel-1.jpg │ ├── carousel-2.jpg │ └── carousel-3.jpg ├── end_point.png ├── gallery │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 2.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── 25.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ └── vue.png ├── logo-ant.svg ├── start_point.png ├── user_location.png ├── vue-index.png └── vue.png ├── stats.json ├── test.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": [ 12 | "transform-vue-jsx", 13 | "transform-runtime", 14 | ["import", { "libraryName": "ant-design-vue", "libraryDirectory": "es", "style": "css" }] 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # your database username 2 | DB_USER=root 3 | # your database 4 | DB_PASSWORD=778899 5 | # Koa is listening to this port 6 | PORT=8889 7 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/essential', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | /*eslint eqeqeq: off*/ 27 | // allow debugger during development 28 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-antd-management 2 | 3 | > 一个基于vue、koa2、mysql、antd的后台管理系统 4 | 5 | [项目在线地址](http://132.232.73.32:3000/#/home/) 后续更新此项目的教程. 6 | 7 | [个人博客](https://gongjs.github.io/) 后续更新此项目的教程. 8 | 9 | ## 安装 10 | 11 | `git clone git@github.com:GongJS/vue-antd-management.git` 12 | 13 | `cd vue-antd-management` 14 | 15 | `npm install` or `yarn` 16 | 17 | - 需要安装`mysql`(作者的版本是5.7),创建一个名为`management`的数据库,同时新建5张表,表的名字和server/schema里面的5个js文件同名,字段保持一致; 18 | - 更改`server/config/db.js`里面的数据库信息,把`mysql://root:XXXX@localhost/management`里面的`XXXX`换成自己的数据库密码; 19 | - 启动 mysql服务 20 | 21 | ## 运行 22 | 23 | `npm run dev` //打包前端代码 24 | `node index.js` //启动koa服务器 25 | 26 | 打开浏览器地址: `localhost:8080` 27 | 28 | > 登录账号: redell 密码:123 29 | 30 | ## License 31 | 32 | [MIT](http://opensource.org/licenses/MIT) 33 | 34 | Copyright (c) 2018 GongJS 35 | 36 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | import Koa from 'koa' 2 | import bodyParser from 'koa-bodyparser' 3 | import router from './server/router' 4 | import serve from 'koa-static' 5 | import path from 'path' 6 | 7 | const app = new Koa() 8 | app.use(bodyParser()) 9 | app.use(async function (ctx, next) { // 如果JWT验证失败,返回验证失败信息 10 | try { 11 | await next() 12 | } catch (err) { 13 | if (err.status === 401) { 14 | ctx.status = 401 15 | ctx.body = { 16 | success: false, 17 | token: null, 18 | info: '没有权限' 19 | } 20 | } else { 21 | throw err 22 | } 23 | } 24 | }) 25 | router(app) 26 | app.use(serve(path.resolve('dist'))) // 将webpack打包好的项目目录作为Koa静态文件服务的目录 27 | app.listen(3000, () => { 28 | console.log('server is running at http://localhost:3000') 29 | }) 30 | 31 | module.exports = app; 32 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | const createLintingRule = () => ({ 12 | test: /\.(js|vue)$/, 13 | loader: 'eslint-loader', 14 | enforce: 'pre', 15 | include: [resolve('src'), resolve('test')], 16 | options: { 17 | formatter: require('eslint-friendly-formatter'), 18 | emitWarning: !config.dev.showEslintErrorsInOverlay 19 | } 20 | }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' 31 | ? config.build.assetsPublicPath 32 | : config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 68 | } 69 | }, 70 | { 71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 72 | loader: 'url-loader', 73 | options: { 74 | limit: 10000, 75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 76 | } 77 | } 78 | ] 79 | }, 80 | node: { 81 | // prevent webpack from injecting useless setImmediate polyfill because Vue 82 | // source contains it (although only uses it if it's native). 83 | setImmediate: false, 84 | // prevent webpack from injecting mocks to Node native modules 85 | // that does not make sense for the client 86 | dgram: 'empty', 87 | fs: 'empty', 88 | net: 'empty', 89 | tls: 'empty', 90 | child_process: 'empty' 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = require('../config/prod.env') 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true, 21 | usePostCSS: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new UglifyJsPlugin({ 36 | uglifyOptions: { 37 | compress: { 38 | warnings: false 39 | } 40 | }, 41 | sourceMap: config.build.productionSourceMap, 42 | parallel: true 43 | }), 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | filename: utils.assetsPath('css/[name].[contenthash].css'), 47 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 51 | allChunks: true, 52 | }), 53 | // Compress extracted CSS. We are using this plugin so that possible 54 | // duplicated CSS from different components can be deduped. 55 | new OptimizeCSSPlugin({ 56 | cssProcessorOptions: config.build.productionSourceMap 57 | ? { safe: true, map: { inline: false } } 58 | : { safe: true } 59 | }), 60 | // generate dist index.html with correct asset hash for caching. 61 | // you can customize output by editing /index.html 62 | // see https://github.com/ampedandwired/html-webpack-plugin 63 | new HtmlWebpackPlugin({ 64 | filename: config.build.index, 65 | template: 'index.html', 66 | inject: true, 67 | minify: { 68 | removeComments: true, 69 | collapseWhitespace: true, 70 | removeAttributeQuotes: true 71 | // more options: 72 | // https://github.com/kangax/html-minifier#options-quick-reference 73 | }, 74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 75 | chunksSortMode: 'dependency' 76 | }), 77 | // keep module.id stable when vendor modules does not change 78 | new webpack.HashedModuleIdsPlugin(), 79 | // enable scope hoisting 80 | new webpack.optimize.ModuleConcatenationPlugin(), 81 | // split vendor js into its own file 82 | new webpack.optimize.CommonsChunkPlugin({ 83 | name: 'vendor', 84 | minChunks (module) { 85 | // any required modules inside node_modules are extracted to vendor 86 | return ( 87 | module.resource && 88 | /\.js$/.test(module.resource) && 89 | module.resource.indexOf( 90 | path.join(__dirname, '../node_modules') 91 | ) === 0 92 | ) 93 | } 94 | }), 95 | // extract webpack runtime and module manifest to its own file in order to 96 | // prevent vendor hash from being updated whenever app bundle is updated 97 | new webpack.optimize.CommonsChunkPlugin({ 98 | name: 'manifest', 99 | minChunks: Infinity 100 | }), 101 | // This instance extracts shared chunks from code splitted chunks and bundles them 102 | // in a separate chunk, similar to the vendor chunk 103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 104 | new webpack.optimize.CommonsChunkPlugin({ 105 | name: 'app', 106 | async: 'vendor-async', 107 | children: true, 108 | minChunks: 3 109 | }), 110 | 111 | // copy custom static assets 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: config.build.assetsSubDirectory, 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | // Paths 10 | assetsSubDirectory: 'static', 11 | assetsPublicPath: '/', 12 | proxyTable: { 13 | '/user': { 14 | target: 'http://localhost:3000', 15 | changeOrigin: true 16 | }, 17 | '/api': { 18 | target: 'http://localhost:3000', 19 | changeOrigin: true 20 | } 21 | }, 22 | // Various Dev Server settings 23 | host: 'localhost', // can be overwritten by process.env.HOST 24 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 25 | autoOpenBrowser: false, 26 | errorOverlay: true, 27 | notifyOnErrors: true, 28 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 29 | 30 | // Use Eslint Loader? 31 | // If true, your code will be linted during bundling and 32 | // linting errors and warnings will be shown in the console. 33 | useEslint: true, 34 | // If true, eslint errors and warnings will also be shown in the error overlay 35 | // in the browser. 36 | showEslintErrorsInOverlay: false, 37 | 38 | /** 39 | * Source Maps 40 | */ 41 | 42 | // https://webpack.js.org/configuration/devtool/#development 43 | devtool: 'cheap-module-eval-source-map', 44 | 45 | // If you have problems debugging vue-files in devtools, 46 | // set this to false - it *may* help 47 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 48 | cacheBusting: true, 49 | 50 | cssSourceMap: true 51 | }, 52 | 53 | build: { 54 | // Template for index.html 55 | index: path.resolve(__dirname, '../dist/index.html'), 56 | 57 | // Paths 58 | assetsRoot: path.resolve(__dirname, '../dist'), 59 | assetsSubDirectory: 'static', 60 | assetsPublicPath: '/', 61 | 62 | /** 63 | * Source Maps 64 | */ 65 | 66 | productionSourceMap: false, 67 | // https://webpack.js.org/configuration/devtool/#production 68 | devtool: '#source-map', 69 | 70 | // Gzip off by default as many popular static hosts such as 71 | // Surge or Netlify already gzip all static assets for you. 72 | // Before setting to `true`, make sure to: 73 | // npm install --save-dev compression-webpack-plugin 74 | productionGzip: true, 75 | productionGzipExtensions: ['js', 'css'], 76 | 77 | // Run the build command with an extra argument to 78 | // View the bundle analyzer report after build finishes: 79 | // `npm run build --report` 80 | // Set to `true` or `false` to always turn it on or off 81 | bundleAnalyzerReport: process.env.npm_config_report 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | antd 7 | 8 | 9 | 47 | 48 |
49 |
50 | 51 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require('babel-core/register')({ 2 | 'presets': [ 3 | ['env', { 4 | 'targets': { 5 | 'node': true 6 | } 7 | }] 8 | ] 9 | }) 10 | require('./app.js') -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "antd", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "redell <382663074@qq.com>", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "lint": "eslint --fix --ext .js,.vue src", 11 | "build": "node build/build.js" 12 | }, 13 | "dependencies": { 14 | "ajv": "^5.5.2", 15 | "ant-design-vue": "^1.0.2", 16 | "axios": "^0.18.0", 17 | "bcryptjs": "^2.4.3", 18 | "canvas-nest.js": "^2.0.2", 19 | "echarts": "^4.1.0", 20 | "jsonp": "^0.2.1", 21 | "koa": "^2.5.2", 22 | "koa-bodyparser": "^4.2.1", 23 | "koa-json": "^2.0.2", 24 | "koa-jwt": "^3.3.2", 25 | "koa-router": "^7.4.0", 26 | "koa-static": "^5.0.0", 27 | "less": "^2.7.3", 28 | "less-loader": "^4.1.0", 29 | "moment": "^2.22.2", 30 | "mysql": "^2.16.0", 31 | "path": "^0.12.7", 32 | "sequelize": "3.28.0", 33 | "sequelize-auto": "^0.4.29", 34 | "vue": "^2.5.2", 35 | "vue-router": "^3.0.1", 36 | "vue2-editor": "^2.6.6", 37 | "vuex": "^3.0.1" 38 | }, 39 | "devDependencies": { 40 | "autoprefixer": "^7.1.2", 41 | "babel-core": "^6.26.3", 42 | "babel-eslint": "^8.2.1", 43 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 44 | "babel-loader": "^7.1.1", 45 | "babel-plugin-import": "^1.8.0", 46 | "babel-plugin-syntax-jsx": "^6.18.0", 47 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", 48 | "babel-plugin-transform-runtime": "^6.22.0", 49 | "babel-plugin-transform-vue-jsx": "^3.5.0", 50 | "babel-preset-env": "^1.3.2", 51 | "babel-preset-stage-2": "^6.22.0", 52 | "babel-register": "^6.26.0", 53 | "chalk": "^2.0.1", 54 | "compression-webpack-plugin": "^1.1.11", 55 | "copy-webpack-plugin": "^4.0.1", 56 | "css-loader": "^0.28.0", 57 | "eslint": "^4.15.0", 58 | "eslint-config-standard": "^10.2.1", 59 | "eslint-friendly-formatter": "^3.0.0", 60 | "eslint-loader": "^1.7.1", 61 | "eslint-plugin-import": "^2.7.0", 62 | "eslint-plugin-node": "^5.2.0", 63 | "eslint-plugin-promise": "^3.4.0", 64 | "eslint-plugin-standard": "^3.0.1", 65 | "eslint-plugin-vue": "^4.0.0", 66 | "extract-text-webpack-plugin": "^3.0.0", 67 | "file-loader": "^1.1.4", 68 | "friendly-errors-webpack-plugin": "^1.6.1", 69 | "html-webpack-plugin": "^2.30.1", 70 | "node-notifier": "^5.1.2", 71 | "optimize-css-assets-webpack-plugin": "^3.2.0", 72 | "ora": "^1.2.0", 73 | "portfinder": "^1.0.13", 74 | "postcss-import": "^11.0.0", 75 | "postcss-loader": "^2.0.8", 76 | "postcss-url": "^7.2.1", 77 | "rimraf": "^2.6.0", 78 | "semver": "^5.3.0", 79 | "shelljs": "^0.7.6", 80 | "uglifyjs-webpack-plugin": "^1.1.1", 81 | "url-loader": "^0.5.8", 82 | "vue-loader": "^13.3.0", 83 | "vue-style-loader": "^3.0.1", 84 | "vue-template-compiler": "^2.5.2", 85 | "webpack": "^3.6.0", 86 | "webpack-bundle-analyzer": "^2.13.1", 87 | "webpack-dev-server": "^2.9.1", 88 | "webpack-merge": "^4.1.0" 89 | }, 90 | "engines": { 91 | "node": ">= 6.0.0", 92 | "npm": ">= 3.0.0" 93 | }, 94 | "browserslist": [ 95 | "> 1%", 96 | "last 2 versions", 97 | "not ie <= 8" 98 | ] 99 | } 100 | -------------------------------------------------------------------------------- /server/config/db.js: -------------------------------------------------------------------------------- 1 | import Sequelize from 'sequelize' 2 | 3 | // 使用url连接的形式进行连接 4 | const Management = new Sequelize('mysql://root:778899@localhost/Management', { 5 | define: { 6 | timestamps: false // 取消Sequelzie自动给数据表加入时间戳(createdAt以及updatedAt) 7 | } 8 | }) 9 | 10 | export default { 11 | Management // 将Management暴露出接口方便Model调用 12 | } 13 | -------------------------------------------------------------------------------- /server/controller/basicTable.js: -------------------------------------------------------------------------------- 1 | import basicTable from '../models/basicTable' 2 | const getBasicTable = async function (ctx, next) { 3 | const data = ctx.request.body 4 | const result = await basicTable.getBasicTable(data) 5 | if (result !== null) { 6 | ctx.response.body = { 7 | success: true, 8 | result: result 9 | } 10 | } else { 11 | ctx.response.body = { 12 | success: false, 13 | data: '获取数据出错' 14 | } 15 | } 16 | } 17 | 18 | const deleteBasicTable = async function (ctx, next) { 19 | const data = ctx.request.body 20 | const result = await basicTable.deleteBasicTable(data) 21 | if (result > 0) { 22 | ctx.response.body = { 23 | success: true, 24 | result: '删除成功' 25 | } 26 | } else { 27 | ctx.response.body = { 28 | success: false, 29 | data: '删除失败' 30 | } 31 | } 32 | } 33 | 34 | export default { 35 | getBasicTable, 36 | deleteBasicTable 37 | } 38 | -------------------------------------------------------------------------------- /server/controller/cityTable.js: -------------------------------------------------------------------------------- 1 | import cityTable from '../models/cityTable' 2 | 3 | const getCityTable = async function (ctx, next) { 4 | const data = ctx.request.body 5 | const result = await cityTable.getCityTable(data) 6 | if (result !== null) { 7 | ctx.response.body = { 8 | success: true, 9 | result: result 10 | } 11 | } else { 12 | ctx.response.body = { 13 | success: false, 14 | data: '获取数据出错' 15 | } 16 | } 17 | } 18 | const searchCityTable = async function (ctx, next) { 19 | const data = ctx.request.body 20 | const result = await cityTable.searchCityTable(data) 21 | if (result !== null) { 22 | ctx.response.body = { 23 | success: true, 24 | result: result 25 | } 26 | } else { 27 | ctx.response.body = { 28 | success: false, 29 | data: '获取数据出错' 30 | } 31 | } 32 | } 33 | 34 | const createCityTable = async function (ctx, next) { 35 | const data = ctx.request.body 36 | const result = await cityTable.createCityTable(data) 37 | if (result !== null) { 38 | ctx.response.body = { 39 | success: true, 40 | result: result 41 | } 42 | } else { 43 | ctx.response.body = { 44 | success: false, 45 | data: '创建数据出错' 46 | } 47 | } 48 | } 49 | 50 | export default { 51 | getCityTable, 52 | searchCityTable, 53 | createCityTable 54 | } 55 | -------------------------------------------------------------------------------- /server/controller/orderTable.js: -------------------------------------------------------------------------------- 1 | import orderTable from '../models/orderTable' 2 | import moment from 'moment' 3 | import 'moment/locale/zh-cn' 4 | moment.locale('zh-cn') 5 | const getOrderTable = async function (ctx, next) { 6 | const data = ctx.request.body 7 | const result = await orderTable.getOrderTable(data) 8 | if (result !== null) { 9 | ctx.response.body = { 10 | success: true, 11 | result: result 12 | } 13 | } else { 14 | ctx.response.body = { 15 | success: false, 16 | data: '获取数据出错' 17 | } 18 | } 19 | } 20 | 21 | const searchOrderTable = async function (ctx, next) { 22 | const data = ctx.request.body 23 | // 如果是开始和结束是同一天的日期,就从当天的0点到24点开始查 24 | if (moment(data.order_time[0]).format('YYYY-MM-DD 00:00:00') == moment(data.order_time[1]).format('YYYY-MM-DD 00:00:00')) { 25 | data.order_time[0] = moment(data.order_time[0]).format('YYYY-MM-DD 00:00:00') 26 | data.order_time[1] = moment(data.order_time[1]).format('YYYY-MM-DD 23:59:59') 27 | } else { 28 | // 设置从每天的0点开始计算 29 | data.order_time[0] = moment(data.order_time[0]).format('YYYY-MM-DD 00:00:00') 30 | data.order_time[1] = moment(data.order_time[1]).format('YYYY-MM-DD 00:00:00') 31 | } 32 | const result = await orderTable.searchOrderTable(data) 33 | if (result !== null) { 34 | ctx.response.body = { 35 | success: true, 36 | result: result 37 | } 38 | } else { 39 | ctx.response.body = { 40 | success: false, 41 | data: '获取数据出错' 42 | } 43 | } 44 | } 45 | 46 | const updateOrderTable = async function (ctx, next) { 47 | const data = ctx.request.body 48 | const end_time = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') 49 | const result = await orderTable.updateOrderTable(data, end_time) 50 | if (result !== null) { 51 | ctx.response.body = { 52 | success: true, 53 | result: result 54 | } 55 | } else { 56 | ctx.response.body = { 57 | success: false, 58 | data: '获取数据出错' 59 | } 60 | } 61 | } 62 | 63 | const searchByIdOrderTable = async function (ctx, next) { 64 | const data = ctx.request.body 65 | const result = await orderTable.searchByIdOrderTable(data) 66 | if (result !== null) { 67 | ctx.response.body = { 68 | success: true, 69 | result: result 70 | } 71 | } else { 72 | ctx.response.body = { 73 | success: false, 74 | data: '获取数据出错' 75 | } 76 | } 77 | } 78 | 79 | export default { 80 | getOrderTable, 81 | searchOrderTable, 82 | updateOrderTable, 83 | searchByIdOrderTable 84 | } 85 | -------------------------------------------------------------------------------- /server/controller/personnelTable.js: -------------------------------------------------------------------------------- 1 | import personnelTable from '../models/personnelTable' 2 | import moment from 'moment' 3 | import 'moment/locale/zh-cn' 4 | moment.locale('zh-cn') 5 | 6 | const getPersonnelTable = async function (ctx, next) { 7 | const data = ctx.request.body 8 | const result = await personnelTable.getPersonnelTable(data) 9 | if (result !== null) { 10 | ctx.response.body = { 11 | success: true, 12 | result: result 13 | } 14 | } else { 15 | ctx.response.body = { 16 | success: false, 17 | data: '获取数据出错' 18 | } 19 | } 20 | } 21 | 22 | const createPersonnelTable = async function (ctx, next) { 23 | const data = ctx.request.body 24 | data.birthday = moment(data.birthday).format('YYYY-MM-DD') 25 | const result = await personnelTable.createPersonnelTable(data) 26 | if (result !== null) { 27 | ctx.response.body = { 28 | success: true, 29 | result: result 30 | } 31 | } else { 32 | ctx.response.body = { 33 | success: false, 34 | data: '创建数据出错' 35 | } 36 | } 37 | } 38 | 39 | const updatePersonnelTable = async function (ctx, next) { 40 | const data = ctx.request.body 41 | const result = await personnelTable.updatePersonnelTable(data) 42 | if (result !== null) { 43 | ctx.response.body = { 44 | success: true, 45 | result: result 46 | } 47 | } else { 48 | ctx.response.body = { 49 | success: false, 50 | result: '更新失败' 51 | } 52 | } 53 | } 54 | 55 | const deletePersonnelTable = async function (ctx, next) { 56 | const data = ctx.request.body 57 | const result = await personnelTable.deletePersonnelTable(data) 58 | if (result > 0) { 59 | ctx.response.body = { 60 | success: true, 61 | result: '删除成功' 62 | } 63 | } else { 64 | ctx.response.body = { 65 | success: false, 66 | data: '删除失败' 67 | } 68 | } 69 | } 70 | 71 | export default { 72 | getPersonnelTable, 73 | createPersonnelTable, 74 | updatePersonnelTable, 75 | deletePersonnelTable 76 | } 77 | -------------------------------------------------------------------------------- /server/controller/user.js: -------------------------------------------------------------------------------- 1 | import user from '../models/user.js' 2 | import jwt from 'jsonwebtoken' 3 | import bcrypt from 'bcryptjs' 4 | 5 | const login = async function (ctx, next) { 6 | const data = ctx.request.body 7 | const userInfo = await user.getUserByName(data.user_name) 8 | if (userInfo != null) { // 如果查无此用户会返回null 9 | if (!bcrypt.compareSync(data.password, userInfo.dataValues.password)) { // 验证密码是否正确 10 | ctx.response.body = { 11 | success: false, // success标志位是方便前端判断返回是正确与否 12 | info: '密码错误!' 13 | } 14 | } else { // 如果密码正确 15 | const userToken = { 16 | name: userInfo.user_name, 17 | id: userInfo.id 18 | } 19 | const secret = 'vue-koa-demo' // 指定密钥,这是之后用来判断token合法性的标志 20 | const token = jwt.sign(userToken, secret)// 签发token 21 | ctx.response.body = { 22 | success: true, 23 | token: token // 返回token 24 | } 25 | } 26 | } else { 27 | ctx.response.body = { 28 | success: false, 29 | info: '用户不存在!' // 如果用户不存在返回用户不存在 30 | } 31 | } 32 | // ctx.response.body = userInfo 33 | } 34 | 35 | export default { 36 | login 37 | } 38 | -------------------------------------------------------------------------------- /server/models/basicTable.js: -------------------------------------------------------------------------------- 1 | import db from '../config/db.js' // 引入user的表结构 2 | const basciTableModel = '../schema/basicTable.js' 3 | const ManagementDb = db.Management // 引入数据- 4 | const basicTable = ManagementDb.import(basciTableModel) // 用sequelize的import方法引入表结构,实例化了basicTable。 5 | const getBasicTable = async function (params) { 6 | const result = await basicTable.findAndCountAll({ 7 | offset: (params.page - 1) * params.pageSize, 8 | limit: params.pageSize 9 | }) // 查找全部的basicTable数据 10 | return result // 返回数据 11 | } 12 | 13 | const deleteBasicTable = async function (params) { 14 | const result = await basicTable.destroy({ 15 | where: { 16 | id: params.id 17 | } 18 | }) // 查找全部的basicTable数据 19 | return result // 返回数据 20 | } 21 | 22 | export default { 23 | getBasicTable, // 导出getbasicTable的方法,将会在controller里调用 24 | deleteBasicTable 25 | } 26 | -------------------------------------------------------------------------------- /server/models/cityTable.js: -------------------------------------------------------------------------------- 1 | import db from '../config/db.js' // 引入user的表结构 2 | const cityTableModel = '../schema/cityTable.js' 3 | const ManagementDb = db.Management // 引入数据- 4 | const cityTable = ManagementDb.import(cityTableModel) // 用sequelize的import方法引入表结构,实例化了cityTable。 5 | 6 | const getCityTable = async function (params) { 7 | const result = await cityTable.findAndCountAll({ 8 | offset: (params.page - 1) * params.pageSize, 9 | limit: params.pageSize 10 | }) // 查找全部的cityTable数据 11 | return result // 返回数据 12 | } 13 | 14 | const searchCityTable = async function (params) { 15 | params.name === '全部' ? params.name = ['天津', '北京', '深圳'] : params.name = [params.name] 16 | params.mode === '全部' ? params.mode = ['停车点', '禁停区'] : params.mode = [params.mode] 17 | params.op_mode === '全部' ? params.op_mode = ['自营', '加盟'] : params.op_mode = [params.op_mode] 18 | params.status === '全部' ? params.status = ['已授权', '未授权'] : params.ostatus = [params.status] 19 | const result = await cityTable.findAndCount({ 20 | where: { 21 | name: { 22 | $in: params.name 23 | }, 24 | mode: { 25 | $in: params.mode 26 | }, 27 | op_mode: { 28 | $in: params.op_mode 29 | }, 30 | status: { 31 | $in: params.status 32 | } 33 | } 34 | }) // 查找全部的cityTable数据 35 | return result // 返回数据 36 | } 37 | 38 | const createCityTable = async function (params) { 39 | const result = await cityTable.create({ 40 | name: params.name, 41 | mode: params.mode, 42 | op_mode: params.op_mode, 43 | franchisee_name: '松果自营', 44 | city_admins: '李四', 45 | open_time: '2018-01-01 12:00:00', 46 | update_time: '2018-01-01 12:00:00', 47 | sys_user_name: '白展堂', 48 | status: '已授权' 49 | }) 50 | return result 51 | } 52 | 53 | export default { 54 | getCityTable, // 导出cityTable的方法,将会在controller里调用 55 | searchCityTable, 56 | createCityTable 57 | } 58 | -------------------------------------------------------------------------------- /server/models/orderTable.js: -------------------------------------------------------------------------------- 1 | import db from '../config/db.js' // 引入user的表结构 2 | const orderTableModel = '../schema/orderTable.js' 3 | const ManagementDb = db.Management // 引入数据 4 | const orderTable = ManagementDb.import(orderTableModel) // 用sequelize的import方法引入表结构,实例化了orderTable。 5 | // 获取全部后台数据 6 | const getOrderTable = async function (params) { 7 | const result = await orderTable.findAndCountAll({ 8 | offset: (params.page - 1) * params.pageSize, 9 | limit: params.pageSize 10 | }) // 查找全部的cityTable数据 11 | return result // 返回数据 12 | } 13 | 14 | // 按设置条件进行查找 15 | const searchOrderTable = async function (params) { 16 | params.city === '全部' ? params.city = ['天津', '北京', '深圳'] : params.city = [params.city] 17 | params.status === '全部' ? params.status = ['进行中', '结束行程'] : params.status = [params.status] 18 | const result = await orderTable.findAndCount({ 19 | where: { 20 | city: { 21 | $in: params.city 22 | }, 23 | status: { 24 | $in: params.status 25 | }, 26 | start_time: { 27 | $between: [params.order_time[0], params.order_time[1]] 28 | } 29 | } 30 | }) // 查找全部的cityTable数据 31 | return result // 返回数据 32 | } 33 | 34 | // 根据订单号进行查找 35 | const searchByIdOrderTable = async function (params) { 36 | const result = await orderTable.findOne({ 37 | where: { 38 | order_sn: params.order_sn 39 | } 40 | }) 41 | return result // 返回数据 42 | } 43 | 44 | // 更新数据 45 | const updateOrderTable = async function (params, end_time) { 46 | const result = await orderTable.update( 47 | { 48 | status: params.status, 49 | end_time: end_time 50 | }, 51 | { 52 | where: { 53 | order_sn: params.order_sn 54 | } 55 | } 56 | ) 57 | return result // 返回数据 58 | } 59 | 60 | export default { 61 | getOrderTable, 62 | searchOrderTable, 63 | searchByIdOrderTable, 64 | updateOrderTable 65 | } 66 | -------------------------------------------------------------------------------- /server/models/personnelTable.js: -------------------------------------------------------------------------------- 1 | import db from '../config/db.js' // 引入user的表结构 2 | const personnelTableModel = '../schema/personnelTable.js' 3 | const ManagementDb = db.Management // 引入数据- 4 | const personnelTable = ManagementDb.import(personnelTableModel) // 用sequelize的import方法引入表结构,实例化了basicTable。 5 | 6 | const getPersonnelTable = async function (params) { 7 | const result = await personnelTable.findAndCountAll({ 8 | offset: (params.page - 1) * params.pageSize, 9 | limit: params.pageSize 10 | }) // 查找全部的basicTable数据 11 | return result // 返回数据 12 | } 13 | 14 | // 新建数据 15 | const createPersonnelTable = async function (params) { 16 | const result = await personnelTable.create({ 17 | username: params.username, 18 | sex: params.sex, 19 | state: params.state, 20 | birthday: params.birthday, 21 | address: params.address 22 | }) 23 | return result 24 | } 25 | // 更新数据 26 | const updatePersonnelTable = async function (params) { 27 | const result = await personnelTable.update( 28 | { 29 | username: params.username, 30 | sex: params.sex, 31 | state: params.state, 32 | birthday: params.birthday, 33 | address: params.address 34 | }, 35 | { 36 | where: { 37 | id: params.id 38 | } 39 | } 40 | ) 41 | return result // 返回数据 42 | } 43 | 44 | const deletePersonnelTable = async function (params) { 45 | const result = await personnelTable.destroy({ 46 | where: { 47 | id: params.id 48 | } 49 | }) 50 | return result // 返回数据 51 | } 52 | 53 | export default { 54 | getPersonnelTable, // 导出getPersonnelTable的方法,将会在controller里调用 55 | deletePersonnelTable, 56 | createPersonnelTable, 57 | updatePersonnelTable 58 | } 59 | -------------------------------------------------------------------------------- /server/models/user.js: -------------------------------------------------------------------------------- 1 | import db from '../config/db.js' // 引入user的表结构 2 | const userModel = '../schema/user.js' 3 | const ManagementDb = db.Management // 引入数据- 4 | const User = ManagementDb.import(userModel) // 用sequelize的import方法引入表结构,实例化了User。 5 | 6 | // 通过id查找 7 | const getUserById = async function (id) { // 注意是async function 而不是function。对于需要等待promise结果的函数都需要async await。 8 | const userInfo = await User.findOne({ // 用await控制异步操作,将返回的Promise对象里的数据返回出来。也就实现了“同步”的写法获取异步IO操作的数据 9 | where: { 10 | id: id 11 | } 12 | }) 13 | return userInfo // 返回数据 14 | } 15 | 16 | // 通过用户名查找 17 | const getUserByName = async function (name) { 18 | const userInfo = await User.findOne({ 19 | where: { 20 | user_name: name 21 | } 22 | }) 23 | return userInfo 24 | } 25 | 26 | export default { 27 | getUserById, // 导出getUserById的方法,将会在controller里调用 28 | getUserByName 29 | } 30 | -------------------------------------------------------------------------------- /server/router.js: -------------------------------------------------------------------------------- 1 | import KoaRouter from 'koa-router' 2 | import UserController from './controller/user.js' 3 | import BasicTableController from './controller/basicTable.js' 4 | import CityTableController from './controller/cityTable.js' 5 | import OrderTableController from './controller/orderTable.js' 6 | import PersonnelController from './controller/personnelTable.js' 7 | import jwt from 'koa-jwt' 8 | const router = KoaRouter() 9 | export default function (app) { 10 | router.post('/user/login/', UserController.login) 11 | router.post('/api/getBasictable', jwt({secret: 'vue-koa-demo'}), BasicTableController.getBasicTable) 12 | router.post('/api/deleteBasictable', jwt({secret: 'vue-koa-demo'}), BasicTableController.deleteBasicTable) 13 | router.post('/api/getCityTable', jwt({secret: 'vue-koa-demo'}), CityTableController.getCityTable) 14 | router.post('/api/searchCityTable', jwt({secret: 'vue-koa-demo'}), CityTableController.searchCityTable) 15 | router.post('/api/createCityTable', jwt({secret: 'vue-koa-demo'}), CityTableController.createCityTable) 16 | router.post('/api/getOrderTable', jwt({secret: 'vue-koa-demo'}), OrderTableController.getOrderTable) 17 | router.post('/api/searchOrderTable', jwt({secret: 'vue-koa-demo'}), OrderTableController.searchOrderTable) 18 | router.post('/api/updateOrderTable', jwt({secret: 'vue-koa-demo'}), OrderTableController.updateOrderTable) 19 | router.post('/api/searchByIdOrderTable', jwt({secret: 'vue-koa-demo'}), OrderTableController.searchByIdOrderTable) 20 | router.post('/api/getPersonnelTable', jwt({secret: 'vue-koa-demo'}), PersonnelController.getPersonnelTable) 21 | router.post('/api/createPersonnelTable', jwt({secret: 'vue-koa-demo'}), PersonnelController.createPersonnelTable) 22 | router.post('/api/updatePersonnelTable', jwt({secret: 'vue-koa-demo'}), PersonnelController.updatePersonnelTable) 23 | router.post('/api/deletePersonnelTable', jwt({secret: 'vue-koa-demo'}), PersonnelController.deletePersonnelTable) 24 | 25 | app.use(router.routes()) 26 | .use(router.allowedMethods()) 27 | } 28 | -------------------------------------------------------------------------------- /server/schema/basicTable.js: -------------------------------------------------------------------------------- 1 | export default function (sequelize, DataTypes) { 2 | return sequelize.define('basicTable', { 3 | id: { 4 | type: DataTypes.INTEGER(11), // 字段类型 5 | allowNull: false, // 是否允许为NULL 6 | primaryKey: true, // 主键 7 | autoIncrement: true // 是否自增 8 | }, 9 | userName: { 10 | type: DataTypes.CHAR(45), // 最大长度为50的字符串 11 | allowNull: false 12 | }, 13 | sex: { 14 | type: DataTypes.INTEGER(11), 15 | allowNull: false 16 | }, 17 | state: { 18 | type: DataTypes.INTEGER(11), 19 | allowNull: false 20 | }, 21 | interest: { 22 | type: DataTypes.INTEGER(11), 23 | allowNull: false 24 | }, 25 | isMarried: { 26 | type: DataTypes.INTEGER(11), 27 | allowNull: false 28 | }, 29 | birthday: { 30 | type: DataTypes.CHAR(45), 31 | allowNull: false 32 | }, 33 | address: { 34 | type: DataTypes.CHAR(128), 35 | allowNull: false 36 | }, 37 | time: { 38 | type: DataTypes.CHAR(45), 39 | allowNull: false 40 | } 41 | }, { 42 | tableName: 'basicTable' // 表名 43 | }) 44 | }; 45 | -------------------------------------------------------------------------------- /server/schema/cityTable.js: -------------------------------------------------------------------------------- 1 | export default function (sequelize, DataTypes) { 2 | return sequelize.define('cityTable', { 3 | id: { 4 | type: DataTypes.INTEGER(11), // 字段类型 5 | allowNull: false, // 是否允许为NULL 6 | primaryKey: true, // 主键 7 | autoIncrement: true // 是否自增 8 | }, 9 | name: { 10 | type: DataTypes.CHAR(45), // 最大长度为50的字符串 11 | allowNull: false 12 | }, 13 | mode: { 14 | type: DataTypes.CHAR(45), 15 | allowNull: false 16 | }, 17 | op_mode: { 18 | type: DataTypes.CHAR(45), 19 | allowNull: false 20 | }, 21 | franchisee_name: { 22 | type: DataTypes.CHAR(45), 23 | allowNull: false 24 | }, 25 | city_admins: { 26 | type: DataTypes.CHAR(45), 27 | allowNull: false 28 | }, 29 | open_time: { 30 | type: DataTypes.CHAR(45), 31 | allowNull: false 32 | }, 33 | update_time: { 34 | type: DataTypes.CHAR(45), 35 | allowNull: false 36 | }, 37 | sys_user_name: { 38 | type: DataTypes.CHAR(45), 39 | allowNull: false 40 | }, 41 | status: { 42 | type: DataTypes.CHAR(45), 43 | allowNull: false 44 | } 45 | }, { 46 | tableName: 'cityTable' // 表名 47 | }) 48 | }; 49 | -------------------------------------------------------------------------------- /server/schema/orderTable.js: -------------------------------------------------------------------------------- 1 | export default function (sequelize, DataTypes) { 2 | return sequelize.define('orderTable', { 3 | id: { 4 | type: DataTypes.INTEGER(11), // 字段类型 5 | allowNull: false, // 是否允许为NULL 6 | primaryKey: true, // 主键 7 | autoIncrement: true // 是否自增 8 | }, 9 | city: { 10 | type: DataTypes.CHAR(45), // 最大长度为45的字符串 11 | allowNull: false 12 | }, 13 | order_sn: { 14 | type: DataTypes.CHAR(45), // 最大长度为45的字符串 15 | allowNull: false 16 | }, 17 | bike_sn: { 18 | type: DataTypes.CHAR(45), // 最大长度为45的字符串 19 | allowNull: false 20 | }, 21 | user_name: { 22 | type: DataTypes.CHAR(45), 23 | allowNull: false 24 | }, 25 | mobile: { 26 | type: DataTypes.CHAR(45), 27 | allowNull: false 28 | }, 29 | distance: { 30 | type: DataTypes.INTEGER(11), 31 | allowNull: false 32 | }, 33 | total_time: { 34 | type: DataTypes.CHAR(45), 35 | allowNull: false 36 | }, 37 | status: { 38 | type: DataTypes.CHAR(45), 39 | allowNull: false 40 | }, 41 | start_time: { 42 | type: DataTypes.DATE(), 43 | allowNull: false 44 | }, 45 | end_time: { 46 | type: DataTypes.CHAR(45), 47 | allowNull: false 48 | }, 49 | total_fee: { 50 | type: DataTypes.CHAR(45), 51 | allowNull: false 52 | } 53 | }, { 54 | tableName: 'orderTable' // 表名 55 | }) 56 | }; 57 | -------------------------------------------------------------------------------- /server/schema/personnelTable.js: -------------------------------------------------------------------------------- 1 | export default function (sequelize, DataTypes) { 2 | return sequelize.define('personnelTable', { 3 | id: { 4 | type: DataTypes.INTEGER(11), // 字段类型 5 | allowNull: false, // 是否允许为NULL 6 | primaryKey: true, // 主键 7 | autoIncrement: true // 是否自增 8 | }, 9 | username: { 10 | type: DataTypes.CHAR(45), // 最大长度为50的字符串 11 | allowNull: false 12 | }, 13 | sex: { 14 | type: DataTypes.CHAR(45), 15 | allowNull: false 16 | }, 17 | state: { 18 | type: DataTypes.CHAR(45), 19 | allowNull: false 20 | }, 21 | interest: { 22 | type: DataTypes.CHAR(45) 23 | }, 24 | isMarried: { 25 | type: DataTypes.CHAR(45) 26 | }, 27 | birthday: { 28 | type: DataTypes.DATE(), 29 | allowNull: false 30 | }, 31 | address: { 32 | type: DataTypes.CHAR(128), 33 | allowNull: false 34 | }, 35 | time: { 36 | type: DataTypes.CHAR(45) 37 | } 38 | }, { 39 | tableName: 'personnelTable' // 表名 40 | }) 41 | }; 42 | -------------------------------------------------------------------------------- /server/schema/user.js: -------------------------------------------------------------------------------- 1 | export default function (sequelize, DataTypes) { 2 | return sequelize.define('user', { 3 | id: { 4 | type: DataTypes.INTEGER(11), // 字段类型 5 | allowNull: false, // 是否允许为NULL 6 | primaryKey: true, // 主键 7 | autoIncrement: true // 是否自增 8 | }, 9 | user_name: { 10 | type: DataTypes.CHAR(50), // 最大长度为50的字符串 11 | allowNull: false 12 | }, 13 | password: { 14 | type: DataTypes.CHAR(32), 15 | allowNull: false 16 | } 17 | }, { 18 | tableName: 'user' // 表名 19 | }) 20 | }; 21 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /src/axios/index.js: -------------------------------------------------------------------------------- 1 | import JsonP from 'jsonp' 2 | import axios from 'axios' 3 | import {message} from 'ant-design-vue' 4 | export default class Axios { 5 | static jsonp (options) { 6 | return new Promise((resolve, reject) => { 7 | JsonP(options.url, { 8 | param: 'callback', 9 | timeout: '5000' 10 | }, function (err, response) { 11 | if (err) throw err 12 | if (response.status === 'success') { 13 | resolve(response) 14 | } else { 15 | reject(response.message) 16 | } 17 | }) 18 | }) 19 | } 20 | 21 | static getData (self, options, params) { 22 | let loading 23 | let axios = self 24 | if (options.isShowLoading !== false) { 25 | loading = document.getElementById('ajaxLoading') 26 | loading.style.display = 'block' 27 | } 28 | return new Promise((resolve, reject) => { 29 | axios[options.method](options.url, params).then(res => { 30 | loading.style.display = 'none' 31 | if (res.status === 200) { 32 | if (res.data.success === true) { 33 | resolve(res.data.result) 34 | } else { 35 | reject(res) 36 | } 37 | } else { 38 | } 39 | }).catch((err) => { 40 | loading.style.display = 'none' 41 | if (err.response.status === 401) { 42 | message.info('获取数据失败,没有权限,请重新登录') 43 | } else { 44 | 45 | } 46 | }) 47 | }) 48 | } 49 | 50 | static requestList (_this, url, params, isMock) { 51 | var data = { 52 | params, 53 | isMock 54 | } 55 | this.ajax({ 56 | url, 57 | data 58 | }).then((res) => { 59 | let list = res.result.item_list.map((item, index) => { 60 | item.key = index 61 | return item 62 | }) 63 | _this.dataSource = list 64 | }) 65 | } 66 | 67 | static ajax (options) { 68 | let loading 69 | if (options.data && options.data.isShowLoading !== false) { 70 | loading = document.getElementById('ajaxLoading') 71 | loading.style.display = 'block' 72 | } 73 | let baseApi = '' 74 | if (options.isMock) { 75 | baseApi = 'https://www.easy-mock.com/mock/5a7278e28d0c633b9c4adbd7/api' 76 | } else { 77 | baseApi = 'https://www.easy-mock.com/mock/5a7278e28d0c633b9c4adbd7/api' 78 | } 79 | return new Promise((resolve, reject) => { 80 | axios({ 81 | url: options.url, 82 | method: 'get', 83 | baseURL: baseApi, 84 | timeout: 5000, 85 | params: (options.data && options.data.params) || '' 86 | }).then((response) => { 87 | if (options.data && options.data.isShowLoading !== false) { 88 | loading = document.getElementById('ajaxLoading') 89 | loading.style.display = 'none' 90 | } 91 | if (response.status === 200) { 92 | let res = response.data 93 | // eslint-disable-next-line 94 | if (res.code == 0) { 95 | resolve(res) 96 | } else { 97 | } 98 | } else { 99 | reject(response.data) 100 | } 101 | }) 102 | }) 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/components/Footer/Footer.vue: -------------------------------------------------------------------------------- 1 | 6 | 16 | 17 | 27 | -------------------------------------------------------------------------------- /src/components/Header/Header.vue: -------------------------------------------------------------------------------- 1 | 43 | 96 | 97 | 164 | -------------------------------------------------------------------------------- /src/components/NavLeft/MenuConfig.js: -------------------------------------------------------------------------------- 1 | const menuList = [ 2 | { 3 | title: '首页', 4 | key: '/home', 5 | path: '/home' 6 | }, 7 | { 8 | title: 'UI', 9 | key: '/ui', 10 | children: [ 11 | { 12 | title: '按钮', 13 | key: '/ui/buttons', 14 | path: '/home/ui/button' 15 | }, 16 | { 17 | title: '弹框', 18 | key: '/ui/modals', 19 | path: '/home/ui/modal' 20 | }, 21 | { 22 | title: 'Loading', 23 | key: '/ui/loadings', 24 | path: '/home/ui/loading' 25 | }, 26 | { 27 | title: '通知提醒', 28 | key: '/ui/notification', 29 | path: '/home/ui/notice' 30 | }, 31 | { 32 | title: '全局Message', 33 | key: '/ui/messages', 34 | path: '/home/ui/message' 35 | }, 36 | { 37 | title: 'Tab页签', 38 | key: '/ui/tabs', 39 | path: '/home/ui/tab' 40 | }, 41 | { 42 | title: '图片画廊', 43 | key: '/ui/gallery', 44 | path: '/home/ui/gallery' 45 | }, 46 | { 47 | title: '轮播图', 48 | key: '/ui/carousel', 49 | path: '/home/ui/carousel' 50 | } 51 | ] 52 | }, 53 | { 54 | title: '表单', 55 | key: '/form', 56 | children: [ 57 | { 58 | title: '登录', 59 | key: '/form/login', 60 | path: '/home/form/login' 61 | }, 62 | { 63 | title: '注册', 64 | key: '/form/reg', 65 | path: '/home/form/register' 66 | } 67 | ] 68 | }, 69 | { 70 | title: '表格', 71 | key: '/table', 72 | children: [ 73 | { 74 | title: '基础表格', 75 | key: '/table/basicTable', 76 | path: '/home/table/basicTable' 77 | }, 78 | { 79 | title: '高级表格', 80 | key: '/table/highTable', 81 | path: '/home/table/hightable' 82 | } 83 | ] 84 | }, 85 | { 86 | title: '富文本', 87 | key: '/rich', 88 | path: '/home/rich' 89 | }, 90 | { 91 | title: '城市管理', 92 | key: '/city', 93 | path: '/home/city' 94 | }, 95 | { 96 | title: '订单管理', 97 | key: '/order', 98 | path: '/home/order/detail' 99 | }, 100 | { 101 | title: '员工管理', 102 | key: '/user', 103 | path: '/home/user' 104 | }, 105 | { 106 | title: '车辆地图', 107 | key: '/bikeMap', 108 | path: '/home/bikeMap' 109 | }, 110 | { 111 | title: '图表', 112 | key: '/charts', 113 | children: [ 114 | { 115 | title: '柱形图', 116 | key: '/charts/bar', 117 | path: '/home/echarts/bar' 118 | }, 119 | { 120 | title: '饼图', 121 | key: '/charts/pie', 122 | path: '/home/echarts/pie' 123 | }, 124 | { 125 | title: '折线图', 126 | key: '/charts/line', 127 | path: '/home/echarts/line' 128 | } 129 | ] 130 | }, 131 | { 132 | title: '权限设置', 133 | key: '/permission', 134 | path: '/home/permission' 135 | } 136 | ] 137 | export default menuList 138 | -------------------------------------------------------------------------------- /src/components/NavLeft/MenuList.vue: -------------------------------------------------------------------------------- 1 | 103 | 104 | 105 | 108 | -------------------------------------------------------------------------------- /src/components/NavLeft/NavLeft.vue: -------------------------------------------------------------------------------- 1 | 10 | 26 | 27 | 44 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import store from './store' 7 | import {message} from 'ant-design-vue' 8 | import axios from 'axios' 9 | Vue.config.productionTip = false 10 | Vue.prototype.$http = axios 11 | 12 | router.beforeEach((to, from, next) => { 13 | const token = sessionStorage.getItem('demo-token') 14 | const el = document.querySelector('#CanvasNest') 15 | if (to.name !== 'Index') { 16 | el.style.display = 'none' 17 | } else { 18 | el.style.display = 'block' 19 | } 20 | if (token !== 'null' && token != null) { 21 | Vue.prototype.$http.defaults.headers.common['Authorization'] = 'Bearer ' + token // 全局设定header的token验证,Bearer后面需要添加个空格 22 | } 23 | if (to.meta.requiresAuth) { 24 | if (store.state.isLogin === true) { 25 | next() 26 | } else { 27 | message.warning('请先登录') 28 | next(false) 29 | } 30 | } else { 31 | next() 32 | } 33 | }) 34 | 35 | /* eslint-disable no-new */ 36 | new Vue({ 37 | el: '#app', 38 | router, 39 | store, 40 | components: { App }, 41 | template: '' 42 | }) 43 | -------------------------------------------------------------------------------- /src/pages/city/City.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 69 | 75 | -------------------------------------------------------------------------------- /src/pages/city/CityForm.vue: -------------------------------------------------------------------------------- 1 | 98 | 104 | -------------------------------------------------------------------------------- /src/pages/city/CityOpenForm.vue: -------------------------------------------------------------------------------- 1 | 137 | 145 | -------------------------------------------------------------------------------- /src/pages/city/CityTable.vue: -------------------------------------------------------------------------------- 1 | 16 | 102 | 103 | 105 | -------------------------------------------------------------------------------- /src/pages/city/data.js: -------------------------------------------------------------------------------- 1 | import Utils from './../../utils/utils' 2 | const columns = [ 3 | { 4 | title: '城市ID', 5 | key: 'id', 6 | dataIndex: 'id' 7 | }, { 8 | title: '城市名称', 9 | key: 'name', 10 | dataIndex: 'name' 11 | }, { 12 | title: '用车模式', 13 | key: 'mode', 14 | dataIndex: 'mode' 15 | }, { 16 | title: '营运模式', 17 | key: 'op_mode', 18 | dataIndex: 'op_mode' 19 | }, { 20 | title: '授权加盟商', 21 | key: 'franchisee_name', 22 | dataIndex: 'franchisee_name' 23 | }, { 24 | title: '城市管理员', 25 | key: 'city_admins', 26 | dataIndex: 'city_admins' 27 | }, { 28 | title: '城市开通时间', 29 | key: 'open_time', 30 | dataIndex: 'open_time', 31 | customRender: Utils.formateDate 32 | }, { 33 | title: '操作时间', 34 | key: 'update_time', 35 | dataIndex: 'update_time', 36 | customRender: Utils.formateDate 37 | }, { 38 | title: '操作人', 39 | key: 'sys_user_name', 40 | dataIndex: 'sys_user_name' 41 | }, { 42 | title: '加盟商授权状态', 43 | key: 'status', 44 | dataIndex: 'status' 45 | } 46 | 47 | ] 48 | export default columns 49 | -------------------------------------------------------------------------------- /src/pages/common/common.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 23 | 24 | 27 | -------------------------------------------------------------------------------- /src/pages/echarts/Bar.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 146 | 147 | 150 | -------------------------------------------------------------------------------- /src/pages/echarts/Line.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 182 | 183 | 186 | -------------------------------------------------------------------------------- /src/pages/echarts/echarttheme.js: -------------------------------------------------------------------------------- 1 | export default { 2 | 'color': [ 3 | '#f9c700', 4 | '#ff5400', 5 | '#6699cc', 6 | '#9cb3c5', 7 | '#e0e6ec', 8 | '#666666', 9 | '#787464', 10 | '#cc7e63', 11 | '#724e58', 12 | '#4b565b' 13 | ], 14 | 'backgroundColor': '#ffffff', 15 | 'textStyle': {}, 16 | 'title': { 17 | 'textStyle': { 18 | 'color': '#cccccc' 19 | }, 20 | 'subtextStyle': { 21 | 'color': '#cccccc' 22 | } 23 | }, 24 | 'line': { 25 | 'itemStyle': { 26 | 'normal': { 27 | 'borderWidth': 1 28 | } 29 | }, 30 | 'lineStyle': { 31 | 'normal': { 32 | 'width': 2 33 | } 34 | }, 35 | 'symbolSize': '10', 36 | 'symbol': 'emptyCircle', 37 | 'smooth': false 38 | }, 39 | 'pie': { 40 | 'itemStyle': { 41 | 'normal': { 42 | 'borderWidth': 0, 43 | 'borderColor': '#ccc' 44 | }, 45 | 'emphasis': { 46 | 'borderWidth': 0, 47 | 'borderColor': '#ccc' 48 | } 49 | } 50 | }, 51 | 'categoryAxis': { 52 | 'axisLine': { 53 | 'show': true, 54 | 'lineStyle': { 55 | 'color': '#f1f3f5' 56 | } 57 | }, 58 | 'axisTick': { 59 | 'show': true, 60 | 'lineStyle': { 61 | 'color': '#f1f3f5' 62 | } 63 | }, 64 | 'axisLabel': { 65 | 'show': true, 66 | 'textStyle': { 67 | 'color': '#999999', 68 | 'fontSize': '14' 69 | } 70 | }, 71 | 'splitLine': { 72 | 'show': true, 73 | 'lineStyle': { 74 | 'color': [ 75 | '#f1f3f5' 76 | ] 77 | } 78 | }, 79 | 'splitArea': { 80 | 'show': false, 81 | 'areaStyle': { 82 | 'color': [ 83 | 'rgba(250,250,250,0.3)', 84 | 'rgba(200,200,200,0.3)' 85 | ] 86 | } 87 | } 88 | }, 89 | 'valueAxis': { 90 | 'axisLine': { 91 | 'show': true, 92 | 'lineStyle': { 93 | 'color': '#f1f3f5' 94 | } 95 | }, 96 | 'axisTick': { 97 | 'show': true, 98 | 'lineStyle': { 99 | 'color': '#f1f3f5' 100 | } 101 | }, 102 | 'axisLabel': { 103 | 'show': true, 104 | 'textStyle': { 105 | 'color': '#999999', 106 | 'fontSize': '14' 107 | } 108 | }, 109 | 'splitLine': { 110 | 'show': true, 111 | 'lineStyle': { 112 | 'color': [ 113 | '#f1f3f5' 114 | ] 115 | } 116 | }, 117 | 'splitArea': { 118 | 'show': false, 119 | 'areaStyle': { 120 | 'color': [ 121 | 'rgba(250,250,250,0.3)', 122 | 'rgba(200,200,200,0.3)' 123 | ] 124 | } 125 | } 126 | }, 127 | 'toolbox': { 128 | 'iconStyle': { 129 | 'normal': { 130 | 'borderColor': '#999999' 131 | }, 132 | 'emphasis': { 133 | 'borderColor': '#666666' 134 | } 135 | } 136 | }, 137 | 'legend': { 138 | 'textStyle': { 139 | 'color': '#333333' 140 | } 141 | }, 142 | 'tooltip': { 143 | 'axisPointer': { 144 | 'lineStyle': { 145 | 'color': '#cccccc', 146 | 'width': 1 147 | }, 148 | 'crossStyle': { 149 | 'color': '#cccccc', 150 | 'width': 1 151 | } 152 | } 153 | }, 154 | 'timeline': { 155 | 'lineStyle': { 156 | 'color': '#293c55', 157 | 'width': 1 158 | }, 159 | 'itemStyle': { 160 | 'normal': { 161 | 'color': '#293c55', 162 | 'borderWidth': 1 163 | }, 164 | 'emphasis': { 165 | 'color': '#a9334c' 166 | } 167 | }, 168 | 'controlStyle': { 169 | 'normal': { 170 | 'color': '#293c55', 171 | 'borderColor': '#293c55', 172 | 'borderWidth': 0.5 173 | }, 174 | 'emphasis': { 175 | 'color': '#293c55', 176 | 'borderColor': '#293c55', 177 | 'borderWidth': 0.5 178 | } 179 | }, 180 | 'checkpointStyle': { 181 | 'color': '#e43c59', 182 | 'borderColor': 'rgba(194,53,49,0.5)' 183 | }, 184 | 'label': { 185 | 'normal': { 186 | 'textStyle': { 187 | 'color': '#293c55' 188 | } 189 | }, 190 | 'emphasis': { 191 | 'textStyle': { 192 | 'color': '#293c55' 193 | } 194 | } 195 | } 196 | }, 197 | 'markPoint': { 198 | 'label': { 199 | 'normal': { 200 | 'textStyle': { 201 | 'color': '#ffffff' 202 | } 203 | }, 204 | 'emphasis': { 205 | 'textStyle': { 206 | 'color': '#ffffff' 207 | } 208 | } 209 | } 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/pages/form/login.vue: -------------------------------------------------------------------------------- 1 | 65 | 76 | -------------------------------------------------------------------------------- /src/pages/home/Home.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 36 | 37 | 56 | -------------------------------------------------------------------------------- /src/pages/home/Index.vue: -------------------------------------------------------------------------------- 1 | 11 | 38 | 39 | 62 | -------------------------------------------------------------------------------- /src/pages/login/iconfont/iconfont.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face {font-family: "iconfont"; 3 | src: url('./iconfont.eot?t=1534476295189'); /* IE9*/ 4 | src: url('./iconfont.eot?t=1534476295189#iefix') format('embedded-opentype'), /* IE6-IE8 */ 5 | url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAUAAAsAAAAAB3AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8eUgeY21hcAAAAYAAAABfAAABnLOQGxVnbHlmAAAB4AAAARYAAAEsAsdmb2hlYWQAAAL4AAAALwAAADYSWAYbaGhlYQAAAygAAAAcAAAAJAfeA4VobXR4AAADRAAAABAAAAAQD+gAAGxvY2EAAANUAAAACgAAAAoAxABsbWF4cAAAA2AAAAAeAAAAIAEQADRuYW1lAAADgAAAAUUAAAJtPlT+fXBvc3QAAATIAAAANQAAAEaPsh0AeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sU4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDg8Y35mxNzwv4EhhrmBoQEozAiSAwAx4w0ReJztkMENgDAIRR+lmsY4QWfwZIwDeXLyrlGBenAIP3kEfgiHD0yAGpuRQW4E12WuhK8s4WdO24tVgqattr337xSSuCgxJf8sM7/W6Me7qac28IxbHUSu+wB9ABSrEmYAeJwlTzFrwlAY/O49SYSCSXxpxEIMiWgQihCN6VSDU+lS0FHN0NpRp3bLrJM/wK1d0y3gXuiP6dahP6CxLzjccXx33PERIzp98Tv+QBfUIEINah/+GDctiBp8pXvW7JulyTJlLF0m6RPPd9uc83y7y9lrUl7P3t/7ZlKpTDYvB84PRGX3id9yIod82d0ehV1PsdGu4dIwLQctDN1BFGOMkdFHJ4wGlnS5Ml0cF3Nx1axHIjChmIGI6k24xT6YBUf8xqv1ehXDE8WbcFVDqVYVQ3UFHoU3C4bDYEpyTIL4nH2WX3UQhT7ktunAlWw1XFXygN0Dmlac9J6jZYWwbNvCT6Y5vWdA7+lgUuof9rWNTEb+AT2ZOXUAAHicY2BkYGAAYqVNj2bF89t8ZeBmYQCB63MS2RH0/0MsDMx+QC4HAxNIFAAmegnXAHicY2BkYGBu+N/AEMPCAAJAkpEBFbAAAEcKAm0EAAAABAAAAAQAAAAD6AAAAAAAAAAuAGwAlgAAeJxjYGRgYGBh0GBgYgABEMkFhAwM/8F8BgAMzAFFAAB4nGWPTU7DMBCFX/oHpBKqqGCH5AViASj9EatuWFRq911036ZOmyqJI8et1ANwHo7ACTgC3IA78EgnmzaWx9+8eWNPANzgBx6O3y33kT1cMjtyDRe4F65TfxBukF+Em2jjVbhF/U3YxzOmwm10YXmD17hi9oR3YQ8dfAjXcI1P4Tr1L+EG+Vu4iTv8CrfQ8erCPuZeV7iNRy/2x1YvnF6p5UHFockikzm/gple75KFrdLqnGtbxCZTg6BfSVOdaVvdU+zXQ+ciFVmTqgmrOkmMyq3Z6tAFG+fyUa8XiR6EJuVYY/62xgKOcQWFJQ6MMUIYZIjK6Og7VWb0r7FDwl57Vj3N53RbFNT/c4UBAvTPXFO6stJ5Ok+BPV8bUnV0K27LnpQ0kV7NSRKyQl7WtlRC6gE2ZVeOEXpc0Yk/KGdI/wAJWm7IAAAAeJxjYGKAAC4G7ICFkYmRmZGFkZWBrTI/Lz2jlCU3MzeRJyszMa8kv1Q3Ob+gkoEBAIsICVkAAAA=') format('woff'), 6 | url('./iconfont.ttf?t=1534476295189') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ 7 | url('./iconfont.svg?t=1534476295189#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family:"iconfont" !important; 12 | font-size:16px; 13 | font-style:normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icon-yonghu:before { content: "\e603"; } 19 | 20 | .icon-mima:before { content: "\e61a"; } 21 | 22 | .icon-jiantou-copy:before { content: "\e632"; } 23 | 24 | -------------------------------------------------------------------------------- /src/pages/login/iconfont/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/src/pages/login/iconfont/iconfont.eot -------------------------------------------------------------------------------- /src/pages/login/iconfont/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by iconfont 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/pages/login/iconfont/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/src/pages/login/iconfont/iconfont.ttf -------------------------------------------------------------------------------- /src/pages/login/iconfont/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/src/pages/login/iconfont/iconfont.woff -------------------------------------------------------------------------------- /src/pages/map/BikeForm.vue: -------------------------------------------------------------------------------- 1 | 71 | 77 | -------------------------------------------------------------------------------- /src/pages/map/BikeMap.vue: -------------------------------------------------------------------------------- 1 | 10 | 146 | 147 | 149 | -------------------------------------------------------------------------------- /src/pages/order/Order.vue: -------------------------------------------------------------------------------- 1 | 19 | 113 | 114 | 116 | -------------------------------------------------------------------------------- /src/pages/order/OrderEndForm.vue: -------------------------------------------------------------------------------- 1 | 110 | -------------------------------------------------------------------------------- /src/pages/order/OrderForm.vue: -------------------------------------------------------------------------------- 1 | 87 | 93 | -------------------------------------------------------------------------------- /src/pages/order/OrderTable.vue: -------------------------------------------------------------------------------- 1 | 17 | 125 | 126 | 128 | -------------------------------------------------------------------------------- /src/pages/order/data.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment' 2 | import 'moment/locale/zh-cn' 3 | moment.locale('zh-cn') 4 | const columns = [ 5 | { 6 | title: '订单编号', 7 | dataIndex: 'order_sn' 8 | }, 9 | { 10 | title: '城市', 11 | dataIndex: 'city' 12 | }, 13 | { 14 | title: '车辆编号', 15 | dataIndex: 'bike_sn' 16 | }, 17 | { 18 | title: '用户名', 19 | dataIndex: 'user_name' 20 | }, 21 | { 22 | title: '手机号', 23 | dataIndex: 'mobile' 24 | }, 25 | { 26 | title: '里程', 27 | dataIndex: 'distance', 28 | customRender (distance) { 29 | return distance / 1000 + 'Km' 30 | } 31 | }, 32 | { 33 | title: '行驶时长', 34 | dataIndex: 'total_time' 35 | }, 36 | { 37 | title: '状态', 38 | dataIndex: 'status' 39 | }, 40 | { 41 | title: '开始时间', 42 | dataIndex: 'start_time', 43 | customRender (dataTime) { 44 | return moment(dataTime).utcOffset(-0).format('YYYY-MM-DD HH:mm:ss') 45 | } 46 | }, 47 | { 48 | title: '结束时间', 49 | dataIndex: 'end_time' 50 | }, 51 | { 52 | title: '订单金额(元)', 53 | dataIndex: 'total_fee' 54 | } 55 | ] 56 | 57 | export default columns 58 | -------------------------------------------------------------------------------- /src/pages/permission/AutherPermissionForm/AutherPermissionForm.vue: -------------------------------------------------------------------------------- 1 | 114 | 117 | -------------------------------------------------------------------------------- /src/pages/permission/AutherPermissionForm/Transfer.vue: -------------------------------------------------------------------------------- 1 | 12 | 58 | -------------------------------------------------------------------------------- /src/pages/permission/CreatPermissonForm/CreatPermissonForm.vue: -------------------------------------------------------------------------------- 1 | 105 | 94 | -------------------------------------------------------------------------------- /src/pages/permission/PermissionTable.vue: -------------------------------------------------------------------------------- 1 | 17 | 75 | 76 | 78 | -------------------------------------------------------------------------------- /src/pages/permission/SetPermissionForm/SetPermissionForm.vue: -------------------------------------------------------------------------------- 1 | 121 | 129 | -------------------------------------------------------------------------------- /src/pages/permission/SetPermissionForm/TreeNodes.vue: -------------------------------------------------------------------------------- 1 | 13 | 54 | -------------------------------------------------------------------------------- /src/pages/permission/data.js: -------------------------------------------------------------------------------- 1 | import Utils from '@/utils/utils' 2 | const columns = [ 3 | { 4 | title: '角色ID', 5 | dataIndex: 'id' 6 | }, { 7 | title: '角色名称', 8 | dataIndex: 'role_name' 9 | }, { 10 | title: '创建时间', 11 | dataIndex: 'create_time', 12 | customRender: Utils.formatTime 13 | }, { 14 | title: '使用状态', 15 | dataIndex: 'status', 16 | customRender (status) { 17 | // eslint-disable-next-line 18 | if (status == 1) { 19 | return '启用' 20 | } else { 21 | return '停用' 22 | } 23 | } 24 | }, { 25 | title: '授权时间', 26 | dataIndex: 'authorize_time', 27 | customRender: Utils.formatTime 28 | }, { 29 | title: '授权人', 30 | dataIndex: 'authorize_user_name' 31 | } 32 | ] 33 | 34 | export default columns 35 | -------------------------------------------------------------------------------- /src/pages/rich/Rich.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 49 | -------------------------------------------------------------------------------- /src/pages/table/BasicTable.vue: -------------------------------------------------------------------------------- 1 | 27 | 157 | 158 | 160 | -------------------------------------------------------------------------------- /src/pages/table/HighTable.vue: -------------------------------------------------------------------------------- 1 | 50 | 128 | 129 | 131 | -------------------------------------------------------------------------------- /src/pages/ui/Buttons.vue: -------------------------------------------------------------------------------- 1 | 44 | 73 | 74 | 77 | -------------------------------------------------------------------------------- /src/pages/ui/Carousel.vue: -------------------------------------------------------------------------------- 1 | 25 | 35 | 36 | 53 | -------------------------------------------------------------------------------- /src/pages/ui/Gallery.vue: -------------------------------------------------------------------------------- 1 | 82 | 119 | 120 | 123 | -------------------------------------------------------------------------------- /src/pages/ui/Loadings.vue: -------------------------------------------------------------------------------- 1 | 49 | 63 | 64 | 67 | -------------------------------------------------------------------------------- /src/pages/ui/Messages.vue: -------------------------------------------------------------------------------- 1 | 12 | 27 | 28 | 31 | -------------------------------------------------------------------------------- /src/pages/ui/Modals.vue: -------------------------------------------------------------------------------- 1 | 53 | 90 | 91 | 94 | -------------------------------------------------------------------------------- /src/pages/ui/Notice.vue: -------------------------------------------------------------------------------- 1 | 17 | 40 | 41 | 44 | -------------------------------------------------------------------------------- /src/pages/ui/Tabs.vue: -------------------------------------------------------------------------------- 1 | 49 | 107 | 108 | 111 | -------------------------------------------------------------------------------- /src/pages/ui/ui.less: -------------------------------------------------------------------------------- 1 | .card-wrap{ 2 | margin-bottom: 10px; 3 | button{ 4 | margin-right: 10px; 5 | } 6 | } 7 | /* modals */ 8 | /* use css to set position of modal */ 9 | .vertical-center-modal { 10 | text-align: center; 11 | white-space: nowrap; 12 | } 13 | 14 | .vertical-center-modal:before { 15 | content: ''; 16 | display: inline-block; 17 | height: 100%; 18 | vertical-align: middle; 19 | width: 0; 20 | } 21 | 22 | .vertical-center-modal .ant-modal { 23 | display: inline-block; 24 | vertical-align: middle; 25 | top: 0; 26 | text-align: left; 27 | } 28 | 29 | /* For demo */ 30 | .ant-carousel .slick-slide { 31 | text-align: center; 32 | height: 160px; 33 | line-height: 160px; 34 | background: #364d79; 35 | overflow: hidden; 36 | } 37 | 38 | .ant-carousel .slick-slide h3 { 39 | color: #fff; 40 | } 41 | .slider-wrap .ant-carousel .slick-slide{ 42 | height: 240px!important; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/pages/user/User.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 128 | 129 | 132 | -------------------------------------------------------------------------------- /src/pages/user/UserLoginForm.vue: -------------------------------------------------------------------------------- 1 | 57 | 60 | -------------------------------------------------------------------------------- /src/pages/user/UserTable.vue: -------------------------------------------------------------------------------- 1 | 17 | 112 | 113 | 115 | -------------------------------------------------------------------------------- /src/pages/user/data.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment' 2 | import 'moment/locale/zh-cn' 3 | moment.locale('zh-cn') 4 | const columns = [{ 5 | title: '用户名', 6 | dataIndex: 'username' 7 | }, { 8 | title: '性别', 9 | dataIndex: 'sex' 10 | }, { 11 | title: '状态', 12 | dataIndex: 'state' 13 | }, { 14 | title: '爱好', 15 | dataIndex: 'interest' 16 | }, { 17 | title: '爱好', 18 | dataIndex: 'isMarried' 19 | }, { 20 | title: '生日', 21 | dataIndex: 'birthday', 22 | customRender (dataTime) { 23 | return moment(dataTime).utcOffset(-0).format('YYYY-MM-DD') 24 | } 25 | }, { 26 | title: '联系地址', 27 | dataIndex: 'address' 28 | }, { 29 | title: '早起时间', 30 | dataIndex: 'time' 31 | } 32 | ] 33 | const dataSource = { 34 | columns 35 | } 36 | export default dataSource 37 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | const Home = resolve => require(['@/pages/home/Home'], resolve) 4 | const Index = resolve => require(['@/pages/home/Index'], resolve) 5 | const Button = resolve => require(['@/pages/ui/Buttons'], resolve) 6 | const Modal = resolve => require(['@/pages/ui/Modals'], resolve) 7 | const Message = resolve => require(['@/pages/ui/Messages'], resolve) 8 | const Notice = resolve => require(['@/pages/ui/Notice'], resolve) 9 | const Loading = resolve => require(['@/pages/ui/Loadings'], resolve) 10 | const Tab = resolve => require(['@/pages/ui/Tabs'], resolve) 11 | const Carousel = resolve => require(['@/pages/ui/Carousel'], resolve) 12 | const Gallery = resolve => require(['@/pages/ui/Gallery'], resolve) 13 | const LoginForm = resolve => require(['@/pages/form/Login'], resolve) 14 | const Register = resolve => require(['@/pages/form/Register'], resolve) 15 | const BasicTable = resolve => require(['@/pages/table/BasicTable'], resolve) 16 | const HighTable = resolve => require(['@/pages/table/HighTable'], resolve) 17 | const City = resolve => require(['@/pages/city/City'], resolve) 18 | const Order = resolve => require(['@/pages/order/Order'], resolve) 19 | const User = resolve => require(['@/pages/user/User'], resolve) 20 | const BikeMap = resolve => require(['@/pages/map/BikeMap'], resolve) 21 | const Rich = resolve => require(['@/pages/rich/Rich'], resolve) 22 | const Bar = resolve => require(['@/pages/echarts/Bar'], resolve) 23 | const Line = resolve => require(['@/pages/echarts/Pie'], resolve) 24 | const Pie = resolve => require(['@/pages/echarts/Line'], resolve) 25 | const Detail = resolve => require(['@/pages/order/detail/Detail'], resolve) 26 | const Common = resolve => require(['@/pages/common/common'], resolve) 27 | const Login = resolve => require(['@/pages/login/Login'], resolve) 28 | const Permission = resolve => require(['@/pages/permission/permission'], resolve) 29 | Vue.use(Router) 30 | 31 | export default new Router({ 32 | routes: [ 33 | { 34 | path: '/', 35 | redirect: '/home', 36 | component: Home, 37 | children: [{ 38 | path: '/home', 39 | name: 'Index', 40 | component: Index 41 | }, 42 | { 43 | path: '/home/ui/button', 44 | name: 'button', 45 | component: Button 46 | }, 47 | { 48 | path: '/home/ui/modal', 49 | name: 'modal', 50 | component: Modal 51 | }, 52 | { 53 | path: '/home/ui/message', 54 | name: 'message', 55 | component: Message 56 | }, 57 | { 58 | path: '/home/ui/notice', 59 | name: 'notice', 60 | component: Notice 61 | }, 62 | { 63 | path: '/home/ui/loading', 64 | name: 'loading', 65 | component: Loading 66 | }, 67 | { 68 | path: '/home/ui/tab', 69 | name: 'tab', 70 | component: Tab 71 | }, 72 | { 73 | path: '/home/ui/carousel', 74 | name: 'carousel', 75 | component: Carousel 76 | }, 77 | { 78 | path: '/home/ui/gallery', 79 | name: 'gallery', 80 | component: Gallery 81 | }, 82 | { 83 | path: '/home/form/login', 84 | name: 'loginForm', 85 | component: LoginForm 86 | }, 87 | { 88 | path: '/home/form/register', 89 | name: 'register', 90 | component: Register 91 | }, 92 | { 93 | path: '/home/table/basicTable', 94 | name: 'basicTable', 95 | component: BasicTable 96 | }, 97 | { 98 | path: '/home/table/highTable', 99 | name: 'highTable', 100 | component: HighTable 101 | }, 102 | { 103 | path: '/home/city', 104 | name: 'city', 105 | component: City, 106 | meta: {requiresAuth: true} 107 | }, 108 | { 109 | path: '/home/order/detail/', 110 | name: 'order', 111 | component: Order, 112 | meta: {requiresAuth: true} 113 | }, 114 | { 115 | path: '/home/user', 116 | name: 'user', 117 | component: User, 118 | meta: {requiresAuth: true} 119 | }, 120 | { 121 | path: '/home/bikeMap', 122 | name: 'bikeMap', 123 | component: BikeMap 124 | }, 125 | { 126 | path: '/home/echarts/bar', 127 | name: 'barEcharts', 128 | component: Bar 129 | }, 130 | { 131 | path: '/home/echarts/line', 132 | name: 'lineEcharts', 133 | component: Line 134 | }, 135 | { 136 | path: '/home/echarts/pie', 137 | name: 'pieEcharts', 138 | component: Pie 139 | }, 140 | { 141 | path: '/home/rich', 142 | name: 'rich', 143 | component: Rich 144 | }, 145 | { 146 | path: '/home/permission', 147 | name: 'permission', 148 | component: Permission, 149 | meta: {requiresAuth: true} 150 | } 151 | ] 152 | }, 153 | { 154 | path: '/common', 155 | component: Common, 156 | children: [{ 157 | path: '/common/order/detail/:id', 158 | name: 'orderDetail', 159 | component: Detail 160 | }] 161 | }, 162 | { 163 | path: '/login', 164 | name: 'login', 165 | component: Login 166 | } 167 | ] 168 | }) 169 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | isLogin: false, 9 | userName: '' 10 | }, 11 | mutations: { 12 | login (state, data) { 13 | state.isLogin = true 14 | state.userName = data 15 | }, 16 | logout (state) { 17 | state.isLogin = false 18 | state.userName = '' 19 | }, 20 | handleEnterRoute (state) { 21 | console.log(111, state.isLogin) 22 | return state.isLogin 23 | } 24 | }, 25 | actions: { 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /src/style/common.less: -------------------------------------------------------------------------------- 1 | @import './default.less'; 2 | @import './loading.less'; 3 | ul,li{ 4 | list-style: none; 5 | } 6 | .clearfix{ 7 | &::after{ 8 | content:' '; 9 | clear:both; 10 | display: block; 11 | visibility: hidden; 12 | } 13 | } 14 | .container{ 15 | .nav-left{ 16 | background-color:#001529; 17 | color: #ffffff; 18 | height: calc(100vh); 19 | } 20 | .main{ 21 | height: calc(100vh); 22 | background-color: @colorL; 23 | overflow: auto; 24 | } 25 | .content{ 26 | position: relative; 27 | padding: 20px; 28 | } 29 | } 30 | 31 | .content-wrap{ 32 | background: #ffffff; 33 | border: 1px solid #e8e8e8; 34 | margin-top: -3px; 35 | .ant-table-wrapper{ 36 | margin-left: -1px; 37 | margin-right: -2px; 38 | } 39 | } 40 | .ant-card{ 41 | button{ 42 | margin-right: 10px; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/style/default.less: -------------------------------------------------------------------------------- 1 | /** 常用色值 **/ 2 | @colorA: #f9c700; 3 | @colorB: #ff5400; 4 | @colorC: #333; 5 | @colorD: #6699cc; 6 | @colorE: #9cb3c5; 7 | @colorF: #e0e6ec; 8 | @colorG: #666; 9 | @colorH: #999; 10 | @colorI: #ccc; 11 | @colorJ: #d7d7d7; 12 | @colorK: #e3e3e3; 13 | @colorL: #f1f3f5; 14 | @colorM: #fff; 15 | @colorN: #e5e5e5; 16 | @colorO: #afafaf; 17 | @colorP: #ff8605; 18 | @colorQ: #f9fbfc; 19 | @colorR: #001529; 20 | @colorS: #002140; 21 | @colorT: #232526; 22 | @colorU: #bebebe; 23 | 24 | /** 常用字体大小 **/ 25 | @fontA: 34px; 26 | @fontB: 22px; 27 | @fontC: 18px; 28 | @fontD: 16px; 29 | @fontE: 14px; 30 | @fontF: 12px; 31 | @fontG: 20px; 32 | -------------------------------------------------------------------------------- /src/style/loading.less: -------------------------------------------------------------------------------- 1 | /** load **/ 2 | .ajax-loading{ 3 | display: none; 4 | .loading{ 5 | position: fixed; 6 | top: 50%; 7 | left: 50%; 8 | transform: translate(-50%,-50%); 9 | padding:0 40px; 10 | height: 80px; 11 | line-height: 80px; 12 | background: rgba(0, 0, 0, 0.75); 13 | border-radius: 6px; 14 | text-align: center; 15 | z-index: 9999; 16 | font-size:@fontD; 17 | color:#fff; 18 | img{ 19 | width: 32px; 20 | vertical-align: middle; 21 | } 22 | span{ 23 | margin-left:12px; 24 | } 25 | } 26 | .overlay{ 27 | position: fixed; 28 | left: 0; 29 | right: 0; 30 | top: 0; 31 | bottom: 0; 32 | z-index: 9998; 33 | background: rgb(255, 255, 255); 34 | opacity: 0.1; 35 | } 36 | } 37 | 38 | /****/ 39 | -------------------------------------------------------------------------------- /src/utils/utils.js: -------------------------------------------------------------------------------- 1 | export default { 2 | formateDate (time) { 3 | if (!time) return '' 4 | let date = new Date(time) 5 | return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/.gitkeep -------------------------------------------------------------------------------- /static/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/bg.jpg -------------------------------------------------------------------------------- /static/bike.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/bike.jpg -------------------------------------------------------------------------------- /static/carousel-img/carousel-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/carousel-img/carousel-1.jpg -------------------------------------------------------------------------------- /static/carousel-img/carousel-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/carousel-img/carousel-2.jpg -------------------------------------------------------------------------------- /static/carousel-img/carousel-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/carousel-img/carousel-3.jpg -------------------------------------------------------------------------------- /static/end_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/end_point.png -------------------------------------------------------------------------------- /static/gallery/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/1.png -------------------------------------------------------------------------------- /static/gallery/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/10.png -------------------------------------------------------------------------------- /static/gallery/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/11.png -------------------------------------------------------------------------------- /static/gallery/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/12.png -------------------------------------------------------------------------------- /static/gallery/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/13.png -------------------------------------------------------------------------------- /static/gallery/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/14.png -------------------------------------------------------------------------------- /static/gallery/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/15.png -------------------------------------------------------------------------------- /static/gallery/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/16.png -------------------------------------------------------------------------------- /static/gallery/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/17.png -------------------------------------------------------------------------------- /static/gallery/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/18.png -------------------------------------------------------------------------------- /static/gallery/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/19.png -------------------------------------------------------------------------------- /static/gallery/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/2.png -------------------------------------------------------------------------------- /static/gallery/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/20.png -------------------------------------------------------------------------------- /static/gallery/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/21.png -------------------------------------------------------------------------------- /static/gallery/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/22.png -------------------------------------------------------------------------------- /static/gallery/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/23.png -------------------------------------------------------------------------------- /static/gallery/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/24.png -------------------------------------------------------------------------------- /static/gallery/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/25.png -------------------------------------------------------------------------------- /static/gallery/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/3.png -------------------------------------------------------------------------------- /static/gallery/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/4.png -------------------------------------------------------------------------------- /static/gallery/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/5.png -------------------------------------------------------------------------------- /static/gallery/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/6.png -------------------------------------------------------------------------------- /static/gallery/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/7.png -------------------------------------------------------------------------------- /static/gallery/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/8.png -------------------------------------------------------------------------------- /static/gallery/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/9.png -------------------------------------------------------------------------------- /static/gallery/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/gallery/vue.png -------------------------------------------------------------------------------- /static/logo-ant.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 28 Copy 5 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 42 | 43 | -------------------------------------------------------------------------------- /static/start_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/start_point.png -------------------------------------------------------------------------------- /static/user_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/user_location.png -------------------------------------------------------------------------------- /static/vue-index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/vue-index.png -------------------------------------------------------------------------------- /static/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/static/vue.png -------------------------------------------------------------------------------- /stats.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GongJS/vue-antd-management/dbd76105a5944fdf083c37629e084d4502a8c074/stats.json -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var mysql = require('mysql'); 2 | var connection = mysql.createConnection({ 3 | host : 'localhost', 4 | user : 'root', 5 | password : '778899', 6 | database : 'management' 7 | }); 8 | 9 | connection.connect(); 10 | 11 | connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) { 12 | if (error) throw error; 13 | console.log('The solution is: ', results[0].solution); 14 | }); 15 | --------------------------------------------------------------------------------