Skip to content

Commit d99c329

Browse files
committed
同步代码,完善 token认证部分。下次版本完成系统设置三元关系
1 parent 7be493b commit d99c329

File tree

192 files changed

+752
-17797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+752
-17797
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
["env", { "modules": false }],
44
"stage-2"
55
],
6-
"plugins": ["transform-runtime"],
7-
"comments": false
6+
"plugins": ["transform-runtime"]
87
}

README.md

Lines changed: 22 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,39 @@
1-
# vue-element-admin #1
2-
.
3-
[![vue](https://img.shields.io/badge/vue-2.4.2-brightgreen.svg)](https://github.com/vuejs/vue)
4-
[![element-ui](https://img.shields.io/badge/element--ui-1.4.2-brightgreen.svg)](https://github.com/ElemeFE/element)
5-
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
6-
[![GitHub release](https://img.shields.io/github/release/PanJiaChen/vue-element-admin.svg)]()
1+
# vueAdmin-template
72

3+
> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint
84
9-
[线上地址](http://panjiachen.github.io/vue-element-admin)
5+
**Live demo:** http://panjiachen.github.io/vueAdmin-template
106

11-
[English Document](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md)
7+
[中文文档](https://github.com/PanJiaChen/vueAdmin-template/blob/master/README-zh.md)
128

13-
[wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
9+
## Build Setup
1410

15-
[donate](https://github.com/PanJiaChen/vue-element-admin#donate)
11+
``` bash
1612

17-
**本项目的定位是后台集成方案,不适合当基础模板来开发。**
18-
- 模板建议使用: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)  
19-
- 桌面端: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
13+
# Clone project
14+
git clone https://github.com/PanJiaChen/vueAdmin-template.git
2015

16+
# Install dependencies
17+
npm install
2118

19+
# serve with hot reload at localhost:9528
20+
npm run dev
2221

23-
**注意:该项目目前使用element-ui@1.4.2版本,所以最低兼容 Vue 2.3.0**
22+
# build for production with minification
23+
npm run build
2424

25-
## 前言
26-
> 这半年来一直在用vue写管理后台,目前后台已经有百来个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios由webpack2打包。由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在此项目基础上改造开发时请移除mock文件。
27-
28-
29-
写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目:
30-
31-
- [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
32-
- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
33-
- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
34-
- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
35-
- [手摸手,带你用vue撸后台 系列四(vueAdmin 一个极简的后台基础模板)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
36-
- [手摸手,带你封装一个vue component](https://segmentfault.com/a/1190000009090836)
37-
38-
相应需求,开了一个qq群 `591724180` 方便大家交流
39-
40-
或者可以加入该 **[圈子](https://jianshiapp.com/circles/1209)** 讨论问题
41-
42-
**如有问题请先看上述文章和Wiki,若不能满足,欢迎 issue 和 pr**
43-
44-
**该项目并不是一个脚手架,更倾向于是一个集成解决方案**
45-
46-
**该项目不支持低版本游览器(如ie),有需求请自行添加polyfill [详情](https://github.com/PanJiaChen/vue-element-admin/wiki#babel-polyfill)**
47-
48-
49-
## 功能
50-
- 登录/注销
51-
- 权限验证
52-
- 侧边栏
53-
- 面包屑
54-
- 富文本编辑器
55-
- Markdown编辑器
56-
- JSON编辑器
57-
- 列表拖拽
58-
- plitPane
59-
- Dropzone
60-
- Sticky
61-
- CountTo
62-
- echarts图表
63-
- 401,404错误页面
64-
- 错误日志
65-
- 导出excel
66-
- zip
67-
- 前端可视化excel
68-
- table example
69-
- 动态table example
70-
- 拖拽table example
71-
- 内联编辑table example
72-
- form example
73-
- 多环境发布
74-
- dashboard
75-
- 二次登录
76-
- 动态侧边栏(支持多级路由)
77-
- mock数据
78-
- cache tabs example
79-
- screenfull
80-
- markdown2html
81-
- views-tab
82-
- clipboard
83-
84-
85-
## 开发
86-
```bash
87-
# 克隆项目
88-
git clone https://github.com/PanJiaChen/vue-element-admin.git
89-
90-
# 安装依赖
91-
npm install
92-
   //or # 建议不要用cnpm  安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
93-
npm install --registry=https://registry.npm.taobao.org
94-
95-
# 本地开发 开启服务
96-
npm run dev
25+
# build for production and view the bundle analyzer report
26+
npm run build --report
9727
```
98-
浏览器访问 http://localhost:9527
99-
100-
## 发布
101-
```bash
102-
# 发布测试环境 带webpack ananalyzer
103-
npm run build:sit-preview
104-
105-
# 构建生成环境
106-
npm run build:prod
107-
```
108-
109-
## 目录结构
110-
```shell
111-
├── build // 构建相关  
112-
├── config // 配置相关
113-
├── src // 源代码
114-
│   ├── api // 所有请求
115-
│   ├── assets // 主题 字体等静态资源
116-
│   ├── components // 全局公用组件
117-
│   ├── directive // 全局指令
118-
│   ├── filtres // 全局filter
119-
│   ├── mock // mock数据
120-
│   ├── router // 路由
121-
│   ├── store // 全局store管理
122-
│   ├── styles // 全局样式
123-
│   ├── utils // 全局公用方法
124-
│   ├── view // view
125-
│   ├── App.vue // 入口页面
126-
│   └── main.js // 入口 加载组件 初始化等
127-
├── static // 第三方不打包资源
128-
│   └── Tinymce // 富文本
129-
├── .babelrc // babel-loader 配置
130-
├── eslintrc.js // eslint 配置项
131-
├── .gitignore // git 忽略项
132-
├── favicon.ico // favicon图标
133-
├── index.html // html模板
134-
└── package.json // package.json
135-
136-
```
137-
138-
## Changelog
139-
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
140-
141-
## Donate
142-
If you find this project useful, you can buy me a cup of coffee
143-
![donate](https://panjiachen.github.io/donate/donation.png)
144-
145-
## 状态管理
146-
后台只有user和app配置相关状态使用vuex存在全局,其它数据都由每个业务页面自己管理。
147-
148-
149-
## 效果图
150-
151-
#### 两步验证登录 支持微信和qq
152-
153-
![两步验证 here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/2login.gif)
154-
155-
#### 真正的动态换肤
15628

157-
![真正的动态换肤](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/theme.gif)<br />
29+
## Demo
30+
![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
15831

159-
#### tabs
32+
## Related Project
33+
[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
16034

161-
![tabs](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/tabs.gif)<br />
35+
[electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
16236

16337

164-
165-
#### 可收起侧边栏
166-
167-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/leftmenu.gif)
168-
169-
#### table拖拽排序
170-
171-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/order.gif)
172-
173-
174-
#### 动态table
175-
176-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/dynamictable.gif)
177-
178-
179-
#### 上传裁剪头像
180-
181-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/uploadAvatar.gif)
182-
183-
184-
#### 错误统计
185-
186-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/errorlog.gif)
187-
188-
189-
#### 富文本(整合七牛 打水印等个性化功能)
190-
191-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/editor.gif)
192-
193-
#### 封装table组件
194-
195-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/table.gif)
196-
197-
#### 图表
198-
199-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/echarts.gif)
200-
201-
202-
#### 导出excel
203-
204-
![enter image description here](https://github.com/PanJiaChen/vue-element-admin/blob/master/gifs/excel.png)
205-
206-
207-
## [查看更多demo](http://panjiachen.github.io/vue-element-admin)
208-
20938
## License
210-
211-
MIT
39+
[MIT](https://github.com/PanJiaChen/vueAdmin-template/blob/master/LICENSE) license.

build/build.js

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
1-
require('./check-versions')();
2-
var server = require('pushstate-server');
3-
var opn = require('opn')
1+
require('./check-versions')()
2+
3+
process.env.NODE_ENV = 'production'
4+
45
var ora = require('ora')
56
var rm = require('rimraf')
67
var path = require('path')
78
var chalk = require('chalk')
8-
var webpack = require('webpack');
9-
var config = require('../config');
10-
var webpackConfig = require('./webpack.prod.conf');
9+
var webpack = require('webpack')
10+
var config = require('../config')
11+
var webpackConfig = require('./webpack.prod.conf')
1112

12-
console.log(process.env.NODE_ENV)
13-
14-
var spinner = ora('building for ' + process.env.NODE_ENV + '...')
13+
var spinner = ora('building for production...')
1514
spinner.start()
1615

17-
1816
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17+
if (err) throw err
18+
webpack(webpackConfig, function (err, stats) {
19+
spinner.stop()
1920
if (err) throw err
20-
webpack(webpackConfig, function (err, stats) {
21-
spinner.stop()
22-
if (err) throw err
23-
process.stdout.write(stats.toString({
24-
colors: true,
25-
modules: false,
26-
children: false,
27-
chunks: false,
28-
chunkModules: false
29-
}) + '\n\n')
21+
process.stdout.write(stats.toString({
22+
colors: true,
23+
modules: false,
24+
children: false,
25+
chunks: false,
26+
chunkModules: false
27+
}) + '\n\n')
3028

31-
console.log(chalk.cyan(' Build complete.\n'))
32-
if(process.env.npm_config_preview){
33-
server.start({
34-
port: 9528,
35-
directory: './dist',
36-
file: '/index.html'
37-
});
38-
console.log('> Listening at ' + 'http://localhost:9528' + '\n')
39-
}
40-
})
29+
console.log(chalk.cyan(' Build complete.\n'))
30+
console.log(chalk.yellow(
31+
' Tip: built files are meant to be served over an HTTP server.\n' +
32+
' Opening index.html over file:// won\'t work.\n'
33+
))
34+
})
4135
})

build/check-versions.js

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
var chalk = require('chalk')
22
var semver = require('semver')
33
var packageConfig = require('../package.json')
4-
5-
function exec(cmd) {
6-
return require('child_process').execSync(cmd).toString().trim()
4+
var shell = require('shelljs')
5+
function exec (cmd) {
6+
return require('child_process').execSync(cmd).toString().trim()
77
}
88

99
var versionRequirements = [
10-
{
11-
name: 'node',
12-
currentVersion: semver.clean(process.version),
13-
versionRequirement: packageConfig.engines.node
14-
},
15-
{
16-
name: 'npm',
17-
currentVersion: exec('npm --version'),
18-
versionRequirement: packageConfig.engines.npm
19-
}
10+
{
11+
name: 'node',
12+
currentVersion: semver.clean(process.version),
13+
versionRequirement: packageConfig.engines.node
14+
},
2015
]
2116

17+
if (shell.which('npm')) {
18+
versionRequirements.push({
19+
name: 'npm',
20+
currentVersion: exec('npm --version'),
21+
versionRequirement: packageConfig.engines.npm
22+
})
23+
}
24+
2225
module.exports = function () {
23-
var warnings = []
24-
for (var i = 0; i < versionRequirements.length; i++) {
25-
var mod = versionRequirements[i]
26-
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
27-
warnings.push(mod.name + ': ' +
28-
chalk.red(mod.currentVersion) + ' should be ' +
29-
chalk.green(mod.versionRequirement)
30-
)
31-
}
26+
var warnings = []
27+
for (var i = 0; i < versionRequirements.length; i++) {
28+
var mod = versionRequirements[i]
29+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30+
warnings.push(mod.name + ': ' +
31+
chalk.red(mod.currentVersion) + ' should be ' +
32+
chalk.green(mod.versionRequirement)
33+
)
3234
}
35+
}
3336

34-
if (warnings.length) {
35-
console.log('')
36-
console.log(chalk.yellow('To use this template, you must update following to modules:'))
37-
console.log()
38-
for (var i = 0; i < warnings.length; i++) {
39-
var warning = warnings[i]
40-
console.log(' ' + warning)
41-
}
42-
console.log()
43-
process.exit(1)
37+
if (warnings.length) {
38+
console.log('')
39+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
40+
console.log()
41+
for (var i = 0; i < warnings.length; i++) {
42+
var warning = warnings[i]
43+
console.log(' ' + warning)
4444
}
45+
console.log()
46+
process.exit(1)
47+
}
4548
}

0 commit comments

Comments
 (0)