-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 32a6f62
Showing
101 changed files
with
6,094 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"presets": [ | ||
["env", { "modules": false }], | ||
"stage-2" | ||
], | ||
"plugins": [ | ||
// "transform-runtime" | ||
], | ||
"comments": false, | ||
"env": { | ||
"test": { | ||
"presets": ["env", "stage-2"], | ||
"plugins": [ "istanbul" ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/*.js | ||
config/*.js | ||
src/assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = { | ||
root: true, | ||
parser: 'babel-eslint', //解析器,这里我们使用babel-eslint | ||
parserOptions: { | ||
sourceType: 'module' //类型为module,因为代码使用了使用了ECMAScript模块 | ||
}, | ||
env: { | ||
browser: true, //预定义的全局变量,这里是浏览器环境\ | ||
commonjs: true, | ||
node: true, | ||
es6: true | ||
}, | ||
// /~https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style | ||
// extends: 'standard', //扩展,可以通过字符串或者一个数组来扩展规则 | ||
// required to lint *.vue files | ||
plugins: [ | ||
'html' //插件,此插件用于识别文件中的js代码,没有MIME类型标识没有script标签也可以识别到,因此拿来识别.vue文件中的js代码 | ||
], | ||
// check if imports actually resolve | ||
'settings': { | ||
'import/resolver': { | ||
'webpack': { | ||
'config': 'build/webpack.base.conf.js' | ||
} | ||
} | ||
}, | ||
// add your custom rules here | ||
'rules': { | ||
//这里写自定义规则 | ||
"no-const-assign": "warn", | ||
"no-this-before-super": "warn", | ||
"no-undef": "warn", | ||
"no-unreachable": "warn", | ||
"no-unused-vars": "warn", | ||
"constructor-super": "warn", | ||
"valid-typeof": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
node_modules/ | ||
dist/ | ||
npm-debug.log* | ||
BEFORE_USE.md | ||
codeDesign/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// /~https://github.com/michael-ciniawsky/postcss-load-config | ||
|
||
module.exports = { | ||
"plugins": { | ||
// to edit target browsers: use "browserlist" field in package.json | ||
"autoprefixer": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Vue + ElementUI 后台管理系统框架 | ||
|
||
>本框架为后台管理类系统解决方案,其中包含很多后台管理中的必备功能。当前版本仅供学习交流,框架中vue及webpack版本会随时更新,尽量采用平滑升级策略,修改部分全局或打包配置完成,如果更改过大,版本号将自动增加,并提供之前版本的release,所以如果注重稳定的话,请在生产环境中谨慎使用。 | ||
## **功能列表** | ||
- 登录登出 | ||
- 菜单异步加载 | ||
- 页面详细权限控制 | ||
- 多语言支持 | ||
- 布局切换 | ||
- 高德地图集成 | ||
- Echarts集成 | ||
- 错误页面 | ||
- mock数据 | ||
- 页面加载进度条 | ||
- 级联选择示例 | ||
|
||
## **项目使用** | ||
``` bash | ||
# 安装项目依赖 | ||
npm install | ||
|
||
# 开启本地服务,默认为localhost:9000 | ||
npm run dev | ||
|
||
# 项目打包,构建生产环境 | ||
npm run build | ||
|
||
# 打包过程中想查看具体报告则可以通过以下命令实现 | ||
npm run build --report | ||
``` | ||
|
||
|
||
## **项目结构** | ||
本项目的开发代码目录结构如下,在编码时请按照规则放置代码 | ||
|
||
``` bash | ||
./root | ||
├── ... | ||
│ ├── mock/ // 模拟请求 | ||
├── src | ||
│ ├── components | ||
│ │ ├── platformCom // 平台通用组件 | ||
│ │ │ ├── ... | ||
│ │ │ ├── install.js // 平台组件全局注册 | ||
│ │ ├── customCom // 项目组件 | ||
│ │ │ ├── global/ // 项目全局组件 | ||
│ │ │ │ ├── ... | ||
│ │ │ │ ├── install.js // 项目全局组件安装 | ||
│ │ │ ├── locale/ // 项目局部组件 | ||
│ ├── lang // 国际化文件 | ||
│ │ ├── en.js | ||
│ │ ├── zh-cn.js | ||
│ │ ├── ... | ||
│ ├── page // 项目页面 | ||
│ │ ├── ... // 页面名称 | ||
│ │ │ ├── *.vue // vue文件 | ||
│ │ │ ├── ... | ||
│ ├── resources // 静态资源 | ||
│ │ ├── ... | ||
│ ├── util // 通用工具 | ||
│ │ ├── http.js // ajax全局设置 | ||
│ │ ├── i18n.js // 国际化全局设置 | ||
│ │ ├── amap.js // 高德地图注册 | ||
│ │ ├── ... | ||
│ ├── store // vuex状态管理 | ||
│ │ ├── modules/ // vuex的modules | ||
│ │ ├── state.js | ||
│ │ ├── getter.js | ||
│ │ ├── mutations.js | ||
│ │ ├── actions.js | ||
│ │ ├── store.js | ||
│ ├── router | ||
│ │ ├── asyncRouter.js // 异步路由表 | ||
│ │ ├── directAccess.js // 直接访问路由表(预留) | ||
│ │ ├── index.js // vue-router路由配置 | ||
│ ├── index.html // 单文件入口渲染模板 | ||
│ ├── index.vue // 首页vue | ||
│ ├── main.js // webpack入口文件 | ||
├── ... | ||
``` | ||
|
||
|
||
|
||
## **更新计划** | ||
- ~~修复 多语言在单文件组件中无法切换的BUG~~ | ||
- ~~高德地图及echarts组件化~~ | ||
|
||
~~当前加载方式属于一次性注册,可以进一步组件化。~~ | ||
- 文件目录优化 | ||
|
||
当前组件目录可能过于冗余,以后可能会进行合并。或者增加分支,把真正的源放到另外的分支中,本分支只面向大众一般情况。 | ||
- 更好的组件加载方式 | ||
|
||
当前异步组件加载方式看着很别扭,同时会有过多的script和style标签,需要后续优化。 | ||
- 完善打包策略 | ||
|
||
当前打包策略并不完善。理想中的策略应该是所有第三方组件打包在一起,业务与首页分离,即最后应该是vendor(lib)、home/index、page(相同业务或相同菜单在一起)。 | ||
- 界面UI重新定制,形成完整的主题。 | ||
- 完全的优雅的主题切换方式 | ||
|
||
当前其实并没有完成主题切换方式,只是更改了布局。当前CSS写法方面在面对主题切换时遇到很大的问题,初步想法是不在 `.vue` 文件中编写css,把所有的css提到单独文件中,以便管理。主题切换则采用加载固定CSS文件的方式。这里会继续写一个博客。 | ||
|
||
- ElementUI v3.0更新,更新前会发布release版本 | ||
- 消息推送 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
require('./check-versions')() | ||
|
||
process.env.NODE_ENV = 'production' | ||
|
||
const ora = require('ora') | ||
const rm = require('rimraf') | ||
const path = require('path') | ||
const chalk = require('chalk') | ||
const webpack = require('webpack') | ||
const config = require('../config') | ||
const webpackConfig = require('./webpack.prod.conf') | ||
|
||
const spinner = ora('building for production...') | ||
spinner.start() | ||
|
||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { | ||
if (err) throw err | ||
webpack(webpackConfig, function(err, stats) { | ||
spinner.stop() | ||
if (err) throw err | ||
process.stdout.write(stats.toString({ | ||
colors: true, | ||
modules: false, | ||
children: false, | ||
chunks: false, | ||
chunkModules: false | ||
}) + '\n\n') | ||
|
||
if (stats.hasErrors()) { | ||
console.log(chalk.red(' Build failed with errors.\n')) | ||
process.exit(1) | ||
} | ||
|
||
console.log(chalk.cyan(' Build complete.\n')) | ||
console.log(chalk.yellow( | ||
' Tip: built files are meant to be served over an HTTP server.\n' + | ||
' Opening index.html over file:// won\'t work.\n' | ||
)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict' | ||
const chalk = require('chalk') | ||
const semver = require('semver') | ||
const packageConfig = require('../package.json') | ||
const shell = require('shelljs') | ||
|
||
function exec(cmd) { | ||
return require('child_process').execSync(cmd).toString().trim() | ||
} | ||
|
||
const versionRequirements = [{ | ||
name: 'node', | ||
currentVersion: semver.clean(process.version), | ||
versionRequirement: packageConfig.engines.node | ||
}] | ||
|
||
if (shell.which('npm')) { | ||
versionRequirements.push({ | ||
name: 'npm', | ||
currentVersion: exec('npm --version'), | ||
versionRequirement: packageConfig.engines.npm | ||
}) | ||
} | ||
|
||
module.exports = function() { | ||
const warnings = [] | ||
for (let i = 0; i < versionRequirements.length; i++) { | ||
const mod = versionRequirements[i] | ||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { | ||
warnings.push(mod.name + ': ' + | ||
chalk.red(mod.currentVersion) + ' should be ' + | ||
chalk.green(mod.versionRequirement) | ||
) | ||
} | ||
} | ||
|
||
if (warnings.length) { | ||
console.log('') | ||
console.log(chalk.yellow('To use this template, you must update following to modules:')) | ||
console.log() | ||
for (let i = 0; i < warnings.length; i++) { | ||
const warning = warnings[i] | ||
console.log(' ' + warning) | ||
} | ||
console.log() | ||
process.exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable */ | ||
'use strict' | ||
require('eventsource-polyfill') | ||
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') | ||
|
||
hotClient.subscribe(function(event) { | ||
if (event.action === 'reload') { | ||
window.location.reload() | ||
} | ||
}) |
Oops, something went wrong.