Skip to content

Commit 678be5a

Browse files
committed
Merge branch 'develop' #4
# Conflicts: # laravel/readme/1. 2018-11-16-RESTFull API 风格开发.md
2 parents 9b9658d + c770917 commit 678be5a

File tree

179 files changed

+3711
-1913
lines changed

Some content is hidden

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

179 files changed

+3711
-1913
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Laravel Vue admin 管理系统
99

1010
### 主要技术栈
1111

12-
- 后端框架: Laravel 5.5.x
12+
- 后端框架: Laravel 6.x
1313
- 前端 MVVM 框架: Vue 2.6.10
1414
- 前端构建: Vue-cli
1515
- 路由: Vue-Router 3.x
1616
- 数据交互: Axios
1717
- 代码风格检测: Eslint
1818
- UI框架: Element-UI 2.7.2
19-
- Laravel 的运行环境要求 PHP5.6 以上。
19+
- Laravel 的运行环境要求 PHP7.2 以上。
2020

2121
## 案例演示
2222

admin/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ENV = 'development'
33

44
# base api
5-
VUE_APP_BASE_API = 'http://127.0.0.1:8000'
5+
VUE_APP_BASE_API = 'http://127.0.0.1:5200'
66

77
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
88
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.

admin/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@
1919
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0"
2020
},
2121
"dependencies": {
22-
"axios": ">=0.18.1",
23-
"echarts": "^4.2.1",
22+
"axios": "^0.19.2",
23+
"echarts": "^4.8.0",
2424
"element-ui": "2.7.2",
2525
"js-cookie": "2.2.0",
26-
"layui-src": "^2.5.4",
27-
"mavon-editor": "^2.7.5",
26+
"layui-src": "^2.5.5",
27+
"mavon-editor": "^2.9.0",
2828
"normalize.css": "7.0.0",
2929
"nprogress": "0.2.0",
3030
"path-to-regexp": "2.4.0",
3131
"vue": "2.6.10",
32-
"vue-clipboard2": "^0.3.0",
32+
"vue-clipboard2": "^0.3.1",
3333
"vue-router": "3.0.6",
3434
"vuex": "3.1.0",
35-
"xlsx": "^0.14.3"
35+
"xlsx": "^0.14.5"
3636
},
3737
"devDependencies": {
3838
"@babel/core": "7.0.0",
3939
"@babel/register": "7.0.0",
4040
"@vue/cli-plugin-babel": "3.6.0",
41-
"@vue/cli-plugin-eslint": "^3.9.1",
41+
"@vue/cli-plugin-eslint": "^3.12.1",
4242
"@vue/cli-plugin-unit-jest": "3.6.3",
4343
"@vue/cli-service": "3.6.0",
4444
"@vue/test-utils": "1.0.0-beta.29",
45-
"autoprefixer": "^9.5.1",
45+
"autoprefixer": "^9.8.0",
4646
"babel-core": "7.0.0-bridge.0",
4747
"babel-eslint": "10.0.1",
4848
"babel-jest": "23.6.0",
@@ -52,9 +52,9 @@
5252
"eslint-plugin-vue": "5.2.2",
5353
"html-webpack-plugin": "3.2.0",
5454
"mockjs": "1.0.1-beta3",
55-
"node-sass": "^4.9.0",
55+
"node-sass": "^4.14.1",
5656
"runjs": "^4.3.2",
57-
"sass-loader": "^7.1.0",
57+
"sass-loader": "^7.3.1",
5858
"script-ext-html-webpack-plugin": "2.1.3",
5959
"script-loader": "0.7.2",
6060
"serve-static": "^1.13.2",

admin/src/components/common/navBar.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
<el-col :xs="6" :sm="6" :md="4" :lg="4" :xl="4">
66
<div class="grid-content">
77
<el-menu-item index="1">
8-
<router-link :to="{name: 'index'}">公交-首页</router-link>
8+
<router-link :to="{name: 'bus'}">首页</router-link>
9+
</el-menu-item>
10+
</div>
11+
</el-col>
12+
<el-col :xs="6" :sm="6" :md="4" :lg="4" :xl="4">
13+
<div class="grid-content">
14+
<el-menu-item index="1">
15+
<router-link :to="{name: 'md'}">Markdown</router-link>
916
</el-menu-item>
1017
</div>
1118
</el-col>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<footer class="footer">
3+
<a href="http://www.beian.miit.gov.cn/" target="_blank">苏ICP备19019285号-1</a>
4+
<a href="https://www.guke1.com/#/">© guke1.com</a>
5+
<span class="copy-right">版权所有</span>
6+
</footer>
7+
</template>
8+
9+
<script>
10+
export default {
11+
name: 'Footer',
12+
data() {
13+
return {
14+
activeIndex: ''
15+
}
16+
}
17+
}
18+
</script>
19+
20+
<style scoped>
21+
.footer {
22+
background-color: #9caebf;
23+
color: #fff;
24+
text-align: center;
25+
margin-top: 30px;
26+
position: fixed;
27+
left: 0;
28+
bottom: 0;
29+
width: 100%;
30+
height: 50px;
31+
z-index: 9999;
32+
}
33+
.footer > a {
34+
color: white;
35+
margin: 0 10px 0 0;
36+
text-align: center;
37+
display: inline-block;
38+
}
39+
a:hover {
40+
color: #6289ad;
41+
}
42+
43+
.grid-content a{
44+
display: block;
45+
}
46+
ul > li > a{
47+
display: block;
48+
}
49+
</style>

admin/src/layout/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { default as Navbar } from './Navbar'
22
export { default as Sidebar } from './Sidebar'
33
export { default as AppMain } from './AppMain'
4+
export { default as Footer } from './Footer'

admin/src/permission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import getPageTitle from '@/utils/get-page-title'
99
NProgress.configure({ showSpinner: false }) // NProgress Configuration
1010

1111
// 不重定向白名单
12-
const whiteList = ['/login', '/index', '/line', '/home', '/404', '/', '', '/echarts', '/md', '/out', '/excel', '/upload']
12+
const whiteList = ['/login', '/index', '/bus', '/line', '/home', '/404', '/', '', '/echarts', '/md', '/out', '/excel', '/upload']
1313
router.beforeEach(async(to, from, next) => {
1414
// start progress bar
1515
NProgress.start()

admin/src/router/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ export const asyncRoutes = [...routeAdmin, ...routeSuper, ...routeTest]
212212

213213
// 基础路由
214214
const routeBase = [
215-
{ path: '/', name: 'index', component: () => import('@/views/home/index'), hidden: true },
215+
{ path: '/', name: 'bus', component: () => import('@/views/home/index'), hidden: true },
216+
{ path: '/bus', name: 'bus', component: () => import('@/views/home/index'), hidden: true },
216217
{ path: '/line', name: 'line', component: () => import('@/views/home/line'), hidden: true },
217218
{ path: '/home', component: () => import('@/views/home/home'), hidden: true },
218219
{ path: '/md', name: 'md', component: () => import('@/views/markdown/index'), hidden: true },

admin/src/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22

3-
title: 'Laravel-vue-admin 后台管理系统',
3+
title: '个人技术分享',
44

55
/**
66
* @type {boolean} true | false

admin/src/views/api_excel/index.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,21 @@ export default {
342342
})
343343
},
344344
initWebSocket() { // 初始化 weosocket
345+
const that = this
345346
if ('WebSocket' in window) {
346347
const url = process.env.VUE_APP_WEBSOCKET + '?action=api_excel&token=' + getToken() + '&page=' + this.currentpage + '&perPage=' + this.perpage
347348
this.websock = new WebSocket(url)
348349
this.websock.onmessage = this.onmessage
349350
this.websock.onopen = this.onopen
350351
this.websock.onerror = this.onerror
351352
this.websock.onclose = this.close
353+
354+
setInterval(function() {
355+
if (that.websock && that.websock.readyState === that.websock.OPEN) {
356+
// console.log('inSend')
357+
that.send('{"page":1}')
358+
}
359+
}, 5000)
352360
} else {
353361
this.fetchData()
354362
// 浏览器不支持 WebSocket,使用 ajax 轮询
@@ -359,34 +367,36 @@ export default {
359367
// const actions = { 'id': '7' }
360368
// const rs = this.send(JSON.stringify(actions))
361369
// console.log(rs)
370+
setTimeout(() => {
371+
this.reload = false
372+
this.reload_name = '刷新'
373+
}, 800)
362374
},
363375
onerror() {
364376
// 连接建立失败, 发送 http 请求获取数据
365377
// this.initWebSocket()
366378
this.fetchData()
367379
},
368380
onmessage(e) { // 数据接收
369-
// console.log(e.data)
370381
const data = JSON.parse(e.data)
371-
// this.list[2].rate = parseInt(data.data.rate)
372-
// console.log(this.list[2].rate)
373-
// console.log(data)
374-
// websocket 返回的数据
375-
this.list = data.data.data
376-
this.listLoading = false
377-
this.total = data.data.total
378-
this.url = data.data.appUrl
379-
// console.log('type', Object.prototype.toString.call(this.list))
380-
setTimeout(() => {
381-
this.reload = false
382-
this.reload_name = '刷新'
383-
}, 800)
382+
// console.log(data.data)
383+
if (data && data.data) {
384+
// this.list[2].rate = parseInt(data.data.rate)
385+
// console.log(this.list[2].rate)
386+
// console.log(data)
387+
// websocket 返回的数据
388+
this.list = data.data.data
389+
this.listLoading = false
390+
this.total = data.data.total
391+
this.url = data.data.appUrl
392+
// console.log('type', Object.prototype.toString.call(this.list))
393+
}
384394
},
385395
send(Data) {
386396
this.websock.send(Data)
387397
},
388398
close() { // 关闭
389-
// console.log('断开连接')
399+
console.log('断开连接')
390400
},
391401
download(index, row) {
392402
window.location.href = this.url + row.finish_url

admin/src/views/article/add.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,20 @@
3838
</template>
3939

4040
<script>
41+
// import with ES6
42+
// import mavonEditor from 'mavon-editor'
43+
import { mavonEditor } from 'mavon-editor'
44+
// markdown-it对象:md.s_markdown, md => mavonEditor 实例
45+
import 'mavon-editor/dist/css/index.css'
46+
import { getToken } from '@/utils/auth'
47+
4148
import { postAdd, axios } from '@/api/article'
4249
import { getList } from '@/api/category'
4350
4451
export default {
52+
components: {
53+
mavonEditor
54+
},
4555
data() {
4656
return {
4757
item: '',
@@ -136,9 +146,9 @@ export default {
136146
imgAdd(pos, $file) {
137147
// 第一步.将图片上传到服务器.
138148
var formdata = new FormData()
139-
formdata.append('image', $file)
149+
formdata.append('file', $file)
140150
axios({
141-
url: 'http://localhost/',
151+
url: process.env.VUE_APP_BASE_API + '/api/upload?token=' + getToken(),
142152
method: 'post',
143153
data: formdata,
144154
headers: { 'Content-Type': 'multipart/form-data' }

admin/src/views/article/edit.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,20 @@
3838
</template>
3939

4040
<script>
41+
// import with ES6
42+
// import mavonEditor from 'mavon-editor'
43+
import { mavonEditor } from 'mavon-editor'
44+
// markdown-it对象:md.s_markdown, md => mavonEditor 实例
45+
import 'mavon-editor/dist/css/index.css'
46+
import { getToken } from '@/utils/auth'
47+
4148
import { axios, edit, postEdit } from '@/api/article'
4249
import { getList } from '@/api/category'
4350
4451
export default {
52+
components: {
53+
mavonEditor
54+
},
4555
data() {
4656
return {
4757
item: '',
@@ -154,9 +164,9 @@ export default {
154164
imgAdd(pos, $file) {
155165
// 第一步.将图片上传到服务器.
156166
var formdata = new FormData()
157-
formdata.append('image', $file)
167+
formdata.append('file', $file)
158168
axios({
159-
url: 'http://localhost/',
169+
url: process.env.VUE_APP_BASE_API + '/api/upload?token=' + getToken(),
160170
method: 'post',
161171
data: formdata,
162172
headers: { 'Content-Type': 'multipart/form-data' }

0 commit comments

Comments
 (0)