Skip to content

Commit

Permalink
第二个版本
Browse files Browse the repository at this point in the history
  • Loading branch information
wmhello committed Jun 3, 2019
0 parents commit 33be248
Show file tree
Hide file tree
Showing 435 changed files with 22,209 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@

.DS_Store
.idea
.vscode

20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018 wmhello(qq:871228582)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

136 changes: 136 additions & 0 deletions README.md
@@ -0,0 +1,136 @@
## 写在前面
2018年的春节假期,受朋友的鼓励和内心的指引,对近两年所学到的知识进行了系统的沉淀和总结。
从多个项目中提取关键点、抛弃了的业务部分,对底层的功能进行了各类优化和抽象,写成本项目。
## 1、 当前版本介绍
### 1.1 版本说明
> 当前版本laravel_template_with_vue (2.0)
### 1.2 改进说明
#### 后端:
> 1. 调整xlsx文件的处理插件为fast-excel
> 2. 数据表部分字段的调整,取消permissions中不常用的method和route_match字段,修改users表中的role字段为roles, roles表中的permission为permissions,使数据表更加规范化
> 3. 代码层面,资源控制器的功能复用,让代码更简洁和实用,父类Controller中编写好了数据的增删改查和数据表的导入和导出功能,用户可以根据TempController的方式来编写相关代码,可以参考OrderController(订单控制),开箱即用,节省业务的编写时间
> 4. 完善日志管理的API
#### 前端:
> 1. 前端element ui 更新到了2.7.2版本,请参照开发
> 2. 集成了同时打开多个页面的功能,多标签功能
> 3. 集成了全屏操作的功能
> 4. 增加了日志管理功能
> 5. 增加了前端开发示列,商品订单管理,代码层面利用mixin功能优化书写
#### ToDo:
> 1. 集成swagger到后端,进行API文档的编写
> 2. 前端增加用户多角色动态切换功能
> 3. 利用laravel广播功能,编写IM示列
> 4. 系统增加成员管理功能、增加成员注册和使用第三方用户登录的功能
## 2、系统概述
项目依托laravel5.5与vue.js,采用了主流的前后端分离方式来构建,作为程序的起点,你可以在此基础上进行自身业务的扩展。
后端(backend目录)负责OAuth认证、用户授权、第三方用户登录验证和提供API,在此基础上集成了跨域和excel文件的操作等基础功能,使用者只需专注于业务api的开发即可。
前端(frontend目录)负责页面的显示和前端用户权限的控制。项目已经引入了element UI框架,并已经对用户登录认证、路由、权限等基础功能进行了处理。
前端用户的权限不但可以控制系统的导航菜单,而且可以控制到页面按钮、表格等内容的显示。使用者只需要专注于业务界面的开发即可。
本项目使用广泛,已经在本人的多个项目中商用。
> 第三方登录测试时,可以先进入系统创建一个用户,然后用github登录后绑定刚刚创建的新用户,之后就可以使用github来自动登录了
## 3、项目演示与截图
> 演示网站(http://front.ynxpyz.cn)
> 管理员用户名和密码(871228582@qq.com/123456)
> 普通用户用户名和密码(786270744@qq.com/123456)
### 项目截图


#### 管理员面板
![管理员面板](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-admin-dashboard.png)

#### 普通用户面板[注意观察系统日志和左侧导航菜单]
![普通用户面板](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-user-dashboard.png)

#### 修改个人信息
![修改个人信息](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-modify-info.png)

#### 全屏幕操作
![全屏幕操作](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-full-screen.png)

#### 用户管理
![用户管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-user-list.png)

#### 用户添加
![用户添加](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-user-add.png)

#### 用户数据导出
![用户数据导出](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-user-download.png)

#### 角色管理
![角色管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-role-manger.png)

#### 角色功能设置
![角色功能设置](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-role-set-feature.png)

#### 功能管理
![功能管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-permission-manger.png)

#### 功能组管理
![功能组管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-permission-group.png)

#### 添加新功能
![添加新功能](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-permission-feature.png)

#### 系统日志管理
![系统日志管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-log-manger.png)

#### 管理日志的管理
![工作日志的管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-log-work.png)

#### 管理员界面下的订单管理
![管理员界面下的订单管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-orders-manger.png)

#### 普通用户下的订单管理
![普通用户下的订单管理](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/v2-orders-user.png)

## 4、技术文档
### [1、后端快速部署](back.md)
### [2、前端快速部署](front.md)
### [3、关键知识点讲述](knowledge.md)
### [4、业务开发](developer.md)
### [5、系统视频与在线辅导](vedio.md)
### [6、升级版的前端项目](adv.md)

## 5、技术支持
> 欢迎大家来光临我的博客,主要专注于laravel与vue.js的应用
[博客](https://wmhello.github.io)

> 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
> 或者您可以 "follow" 一下,我会不断完善该项目
> 开发环境 windows 7 Chrome 63 PHP 7.1.7
> 如有问题请直接在 Issues 中提,或者您发现问题并有非常好的解决方案,欢迎 PR 👍
> __部署和使用中如果有疑问,可以到项目交流群进行讨论:106822531(QQ)或者关注公众号(computer_life)学习相关基础知识
> ![QQ群二维码](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/qq_qrcode.jpg)
> ![全栈开发公众号](https://github.com/wmhello/laravel_template_with_vue/blob/master/Screenshots/gzh.jpg)

## 6、打赏
如果我的付出能够帮助到你,我也乐于接受你的帮助,小小的赞赏是我们持续进步的动力。

![支付宝支付](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/pay1.jpg)
![微信支付](https://github.com/wmhello/laravel_template_with_vue/raw/master/Screenshots/wx.jpg)

## 7、致谢
站在巨人之上,我们才能走得更远。项目中使用和借鉴了以下开源框架的实现方法 一并致谢
>- [laravel](https://laravel.com/)
>- [后端excel插件](https://github.com/rap2hpoutre/fast-excel)
>- [后端跨域](https://github.com/barryvdh/laravel-cors)
>- [API接口文档书写](http://apidocjs.com/)
>- [vue.js](https://cn.vuejs.org/index.html)
>- [element ui](http://element.eleme.io/#/zh-CN)
>- [vue-router](https://router.vuejs.org/)
>- [vuex](https://vuex.vuejs.org/)
>- [前端构架 vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
# License

[MIT](https://github.com/wmhello/laravel_template_with_vue/blob/master/LICENSE)
Binary file added Screenshots/QQ.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/apidoc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/blog.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/dashboard-user.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/dashboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/dishboard-user.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/gzh.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/pay1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/permission-feature.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/permission-group.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/permission-manger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/qq_qrcode.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/role-manger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/role-set-feature.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/session-admin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/session-user.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/user-add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/user-download.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/user-list.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-admin-dashboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-full-screen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-log-manger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-log-work.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-modify-info.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-orders-manger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/v2-orders-user.png
Binary file added Screenshots/v2-permission-feature.png
Binary file added Screenshots/v2-permission-group.png
Binary file added Screenshots/v2-permission-manger.png
Binary file added Screenshots/v2-role-add.png
Binary file added Screenshots/v2-role-manger.png
Binary file added Screenshots/v2-role-set-feature.png
Binary file added Screenshots/v2-user-add.png
Binary file added Screenshots/v2-user-dashboard.png
Binary file added Screenshots/v2-user-download.png
Binary file added Screenshots/v2-user-list.png
Binary file added Screenshots/v2-user.png
Binary file added Screenshots/weixin1.png
Binary file added Screenshots/wx.jpg
15 changes: 15 additions & 0 deletions adv.md
@@ -0,0 +1,15 @@
## 获取升级版的前端项目
> 除了开源的前端项目之外,你也可以通过打赏赞助(超过100元)来获取升级版的前端项目,同时也将获得作者1个小时的技术支持(根据你的需求进行的在线讲解)
> 微信:xpyzwm
### 前端项目新增功能
>1、更高级的权限控制,可以根据后端接口返回的数据动态的配置和调整权限,解决前后端分离模式下的前端开发中的权限控制难点。
>2、可以同时打开多个业务页面,页面之间可以根据需要随时切换
>3、提供全屏显示功能
>4、提供中英文、多语言切换功能
>5、提供管理员多个角色切换功能
66 changes: 66 additions & 0 deletions back.md
@@ -0,0 +1,66 @@
## 1、安装依赖
`composer install`

## 2、复制配置文件,进行数据库配置
`cp .env.example .env`

## 3、生成项目所需的数据表
`php artisan migrate`

## 4、使用OAuth认证,生成passport的密钥
`php artisan passport:key --force`

`php artisan passport:install --force`

## 5、复制第4步生成的密钥到.env文件中,填写为PERSONAL_CLIENT_SECRET和PASSPORT_CLIENT_SECRET的参数
PERSONAL_CLIENT_ID=1

PERSONAL_CLIENT_SECRET=

PASSPORT_CLIENT_ID=2

PASSPORT_CLIENT_SECRET=

## 6、生成用户数据和各种结构数据
`php artisan db:seed`

用户名和密码在database\seeds\UsersTableSeeder.php文件中明文标记

## 7、配置域名(back.test 或者其他名称)指向后端目录下的public目录(backend/public/),并在本地hosts文件中添加记录
`127.0.0.1 back.test`

**此步骤是OAuth认证所必须,请务必设置,否则无法登录**

## 8、第三方登录
>此步骤配置较复杂 由于需要认证的关系 暂时只有提供github的第三方登录配置
> 其它类似 更多的配置 可以通过qq群来讨论 此步骤只影响第三方登录
> 不影响其它功能使用 不配置则只是无法使用第三方登录
1. 配置文件修改BROADCAST_DRIVER为pusher
~~~
BROADCAST_DRIVER=pusher
~~~
2.[Pusher官网](https://pusher.com/)注册应用程序,然后填写下列信息
~~~
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=
~~~
3. 修改前端frontend目录下的config文件夹下的prod.env.js文件内容
~~~
MIX_PUSHER_APP_KEY: '"XXXXXXXXX"', // 后端PUSHER_APP_KEY
MIX_PUSHER_APP_CLUSTER: '"ap1"', // 后端PUSHER_APP_CLUSTER
~~~
4. 编译前端
~~~
npm run build
~~~

## 查看API文档地址
假设后端的域名为back.test 则文档地址为http://back.test/apidoc/

## 编译API文档
由于文档使用了apidoc 请使用前预先安装apidoc

编译命令为apidoc -i ./ -o public/apidoc/
35 changes: 35 additions & 0 deletions backend/.env.example
@@ -0,0 +1,35 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
5 changes: 5 additions & 0 deletions backend/.gitattributes
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
12 changes: 12 additions & 0 deletions backend/.gitignore
@@ -0,0 +1,12 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
42 changes: 42 additions & 0 deletions backend/app/Console/Kernel.php
@@ -0,0 +1,42 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
38 changes: 38 additions & 0 deletions backend/app/Events/DataOperation.php
@@ -0,0 +1,38 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class DataOperation
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*
* @return void
*/
public $info;
public function __construct($info)
{
//
$this->info = $info;
}

/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}

0 comments on commit 33be248

Please sign in to comment.