Skip to content

Commit 2016736

Browse files
committed
kai.fantasy: 项目暂时提交,暂时无后端交互,有空在把测试报文加上
0 parents  commit 2016736

File tree

230 files changed

+8728
-0
lines changed

Some content is hidden

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

230 files changed

+8728
-0
lines changed

.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }],
4+
"stage-2"
5+
],
6+
"plugins": ["transform-runtime"],
7+
"comments": false,
8+
"env": {
9+
"test": {
10+
"presets": ["env", "stage-2"],
11+
"plugins": [ "istanbul" ]
12+
}
13+
}
14+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
.idea

.postcssrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// https://github.com/michael-ciniawsky/postcss-load-config
2+
3+
module.exports = {
4+
"plugins": {
5+
// to edit target browsers: use "browserlist" field in package.json
6+
"autoprefixer": {}
7+
}
8+
}

README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# vue-admin-manager
2+
3+
> 后端研发一枚,公司没有web端开发,逐步需要做运维,运营的页面,想要快速开展工作,
4+
5+
> 就去了解了下目前比较火的,react vue angular,对比之后,感觉目前vue是最合适的,
6+
7+
> 去官网熟悉了一下,写了几个demo,就开始做这个后台,借鉴很多github上的优秀作品,自己也
8+
9+
> 输出一下,也方便自己回顾
10+
11+
# 简介
12+
13+
项目为SPA,前后端分离,前端使用vue-cli构建,认证使用JWT,后端数据库为mongodb,后端提供
14+
15+
restful接口,统计功能非常方便,在前端封装好aggregate,mapReduce,条件,
16+
17+
类似于前端组装好查询条件,后端直接吐对应的结果。
18+
19+
## Build Setup
20+
21+
``` bash
22+
# install dependencies
23+
npm install
24+
25+
# serve with hot reload at localhost:8080
26+
npm run dev
27+
28+
# build for production with minification
29+
npm run build
30+
31+
# build for production and view the bundle analyzer report
32+
npm run build --report
33+
```
34+
35+
## 目录结构
36+
```shell
37+
├── build // 构建相关  
38+
├── config // 配置相关
39+
├── src // 源代码
40+
│   ├── api // 所有请求
41+
│   ├── assets // 主题 字体等静态资源
42+
│   ├── components // 全局公用组件(及页面)
43+
│   ├── config // 配置项
44+
│   ├── directive // 全局指令
45+
│   ├── filtres // 全局filter
46+
│   ├── router // 路由
47+
│   ├── store // 全局store管理
48+
│   ├── styles // 全局样式
49+
│   ├── utils // 全局公用方法
50+
│   ├── App.vue // 入口页面
51+
│   └── main.js // 入口 加载组件 初始化等
52+
├── static // 第三方不打包资源
53+
├── .babelrc // babel-loader 配置
54+
├── .editorconfig // 代码风格文件,前提是要你的编辑器支持
55+
├── .gitignore // 用于Git配置不需要加入版本管理的文件
56+
├── .postcssrc.js // autoprefixer的配置文件
57+
└── package.json // 项目依赖管理
58+
59+
```
60+
61+
## 技术栈
62+
63+
- axios
64+
- element-ui
65+
- moment 日期处理
66+
- vue2X、vue-router、vuex
67+
68+
### 工具集
69+
70+
- vue-core-image-upload
71+
- vue-datasource
72+
- vue-echarts-v3
73+
- vue-quill-editor
74+
- vue-simplemde
75+
- vue-video-player
76+
77+
### UI方案
78+
79+
#### UI
80+
81+
- element-ui
82+
- bootstrap(AdminLTE)
83+
84+
#### 扩展图标
85+
86+
- font-awesome
87+
- ionicons
88+
89+
### TODO
90+
91+
- [x] 已完成 折叠导航栏
92+
93+
- [x] 已完成 登录获取用户昵称
94+
95+
- [x] 已完成 统计图标抽取
96+
97+
- [x] 已完成 接入阿里云OSS,STS(临时认证服务)
98+
99+
- [x] 已完成 支持视频播放
100+
101+
- [] vuex状态管理
102+
103+
- [] Dashboard中的echart图标,组件化重构
104+
105+
- [] 404页面组件(目前空白),考虑使用自己博客上的腾讯公益
106+
107+
- [] 401页面组件
108+
109+
- [] 响应式,支持手机
110+
111+
112+
### 备注
113+
114+
#### 不可折叠的导航栏主题
115+
116+
BluSidebar.vue
117+
118+
Header.vue
119+
120+
Home.vue
121+
122+
App-default.vue
123+
124+
main-default.js
125+
126+
router/index.js
127+
128+
129+
- [个人博客](https://fantasykai.cc)

build/build.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require('./check-versions')()
2+
3+
process.env.NODE_ENV = 'production'
4+
5+
var ora = require('ora')
6+
var rm = require('rimraf')
7+
var path = require('path')
8+
var chalk = require('chalk')
9+
var webpack = require('webpack')
10+
var config = require('../config')
11+
var webpackConfig = require('./webpack.prod.conf')
12+
13+
var spinner = ora('building for production...')
14+
spinner.start()
15+
16+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17+
if (err) throw err
18+
webpack(webpackConfig, function (err, stats) {
19+
spinner.stop()
20+
if (err) throw err
21+
process.stdout.write(stats.toString({
22+
colors: true,
23+
modules: false,
24+
children: false,
25+
chunks: false,
26+
chunkModules: false
27+
}) + '\n\n')
28+
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+
})
35+
})

build/check-versions.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var chalk = require('chalk')
2+
var semver = require('semver')
3+
var packageConfig = require('../package.json')
4+
var shell = require('shelljs')
5+
function exec (cmd) {
6+
return require('child_process').execSync(cmd).toString().trim()
7+
}
8+
9+
var versionRequirements = [
10+
{
11+
name: 'node',
12+
currentVersion: semver.clean(process.version),
13+
versionRequirement: packageConfig.engines.node
14+
},
15+
]
16+
17+
if (shell.which('npm')) {
18+
versionRequirements.push({
19+
name: 'npm',
20+
currentVersion: exec('npm --version'),
21+
versionRequirement: packageConfig.engines.npm
22+
})
23+
}
24+
25+
module.exports = function () {
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+
)
34+
}
35+
}
36+
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)
44+
}
45+
console.log()
46+
process.exit(1)
47+
}
48+
}

build/dev-client.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
require('eventsource-polyfill')
3+
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4+
5+
hotClient.subscribe(function (event) {
6+
if (event.action === 'reload') {
7+
window.location.reload()
8+
}
9+
})

build/dev-server.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//检查NodeJS和npm的版本
2+
require('./check-versions')()
3+
4+
// 获取配置
5+
var config = require('../config')
6+
7+
// 如果Node的环境变量中没有设置当前的环境(NODE_ENV),则使用config中的配置作为当前的环境
8+
if (!process.env.NODE_ENV) {
9+
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
10+
}
11+
12+
// 一个可以调用默认软件打开网址、图片、文件等内容的插件
13+
// 这里用它来调用默认浏览器打开dev-server监听的端口,例如:localhost:8080
14+
var opn = require('opn')
15+
var path = require('path')
16+
var express = require('express')
17+
var webpack = require('webpack')
18+
19+
// 一个express中间件,用于将http请求代理到其他服务器
20+
// 例:localhost:8080/api/xxx --> localhost:3000/api/xxx
21+
// 这里使用该插件可以将前端开发中涉及到的请求代理到API服务器上,方便与服务器对接
22+
var proxyMiddleware = require('http-proxy-middleware')
23+
var webpackConfig = require('./webpack.dev.conf')
24+
25+
var port = process.env.PORT || config.dev.port
26+
// automatically open browser, if not set will be false
27+
var autoOpenBrowser = !!config.dev.autoOpenBrowser
28+
// Define HTTP proxies to your custom API backend
29+
// https://github.com/chimurai/http-proxy-middleware
30+
var proxyTable = config.dev.proxyTable
31+
32+
var app = express()
33+
var compiler = webpack(webpackConfig)
34+
35+
var devMiddleware = require('webpack-dev-middleware')(compiler, {
36+
publicPath: webpackConfig.output.publicPath,
37+
quiet: true
38+
})
39+
40+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
41+
log: () => {
42+
}
43+
})
44+
// force page reload when html-webpack-plugin template changes
45+
compiler.plugin('compilation', function (compilation) {
46+
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
47+
hotMiddleware.publish({action: 'reload'})
48+
cb()
49+
})
50+
})
51+
52+
// proxy api requests
53+
Object.keys(proxyTable).forEach(function (context) {
54+
var options = proxyTable[context]
55+
if (typeof options === 'string') {
56+
options = {target: options}
57+
}
58+
app.use(proxyMiddleware(options.filter || context, options))
59+
})
60+
61+
// handle fallback for HTML5 history API
62+
app.use(require('connect-history-api-fallback')())
63+
64+
// serve webpack bundle output
65+
app.use(devMiddleware)
66+
67+
// enable hot-reload and state-preserving
68+
// compilation error display
69+
app.use(hotMiddleware)
70+
71+
// serve pure static assets
72+
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
73+
app.use(staticPath, express.static('./static'))
74+
75+
var uri = 'http://localhost:' + port
76+
77+
var _resolve
78+
var readyPromise = new Promise(resolve => {
79+
_resolve = resolve
80+
})
81+
82+
console.log('> Starting dev server...')
83+
devMiddleware.waitUntilValid(() => {
84+
console.log('> Listening at ' + uri + '\n')
85+
// when env is testing, don't need open it
86+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
87+
opn(uri)
88+
}
89+
_resolve()
90+
})
91+
92+
var server = app.listen(port)
93+
94+
module.exports = {
95+
ready: readyPromise,
96+
close: () => {
97+
server.close()
98+
}
99+
}

0 commit comments

Comments
 (0)