README.md 10.3 KB
Newer Older
Mr.奇淼('s avatar
Mr.奇淼( 已提交
1 2 3 4 5 6 7

<div align=center>
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
</div>
<div align=center>
<img src="https://img.shields.io/badge/golang-1.12-blue"/>
<img src="https://img.shields.io/badge/gin-1.4.0-lightBlue"/>
8 9
<img src="https://img.shields.io/badge/vue-2.6.10-brightgreen"/>
<img src="https://img.shields.io/badge/element--ui-2.12.0-green"/>
Mr.奇淼('s avatar
Mr.奇淼( 已提交
10 11 12
<img src="https://img.shields.io/badge/gorm-1.9.10-red"/>
</div>

13
English | [简体中文](./README-zh_CN.md)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
14

15
# Project Guidelines
16
[Online Documentation](http://doc.henrongyi.top/)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
17

18
- Web UI Framework:[element-ui](https://github.com/ElemeFE/element)  
R
rainyan 已提交
19
- Server Framework:[gin](https://github.com/gin-gonic/gin) 
Mr.奇淼('s avatar
Mr.奇淼( 已提交
20

21
## 1. Basic Introduction
22 23 24

### 1.1 Project Introduction

25 26 27
[Online Demo](http://qmplus.henrongyi.top/)
> Gin-vue-admin is a full-stack (frontend and backend separation) framework designed for management system. 
> It integrates multiple functions, such as JWT authentication, dynamic routing, dynamic menu, casbin authentication, form generator, code generator, etc. So that you can focus more time on your business Requirements.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
28

29 30 31 32 33 34 35 36
### 1.2 Version list

master: 2.0 dev code

[gin-vue-adminv 1.0 stable](https://github.com/piexlmax/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0 is kept up to date and maintained)

[gin-vue-adminv 2.0 dev](https://github.com/piexlmax/gin-vue-admin) (v2.0 is no longer compatible with v1.0)

37
## 2. Getting started
Mr.奇淼('s avatar
Mr.奇淼( 已提交
38
```
39 40 41 42 43
- node version > v8.6.0
- golang version >= v1.11
- IDE recommendation: Goland
- After you clone the project, use the scripts in directory db to create your own database.
- We recommend you to apply for your own cloud service in QINIU. Replace the public key, private key, warehouse name and default url address with your own, so as not to mess up the test database.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
44 45
```

R
rainyan 已提交
46
### 2.1 Web
Mr.奇淼('s avatar
Mr.奇淼( 已提交
47

48 49 50
```bash
# clone the project
git clone https://github.com/piexlmax/gin-vue-admin.git
Mr.奇淼('s avatar
Mr.奇淼( 已提交
51

52 53
# enter the project directory
cd web
Mr.奇淼('s avatar
Mr.奇淼( 已提交
54

55 56
# install dependency
npm install
Mr.奇淼('s avatar
Mr.奇淼( 已提交
57

58
# develop
Mr.奇淼('s avatar
Mr.奇淼( 已提交
59
npm run serve
60
```
Mr.奇淼('s avatar
Mr.奇淼( 已提交
61

R
rainyan 已提交
62
### 2.2 Server
Mr.奇淼('s avatar
Mr.奇淼( 已提交
63

64 65
```bash
# using go.mod
Mr.奇淼('s avatar
Mr.奇淼( 已提交
66

67 68
# install go modules
go list (go mod tidy)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
69

70 71 72
# build the server
go build
```
Mr.奇淼('s avatar
Mr.奇淼( 已提交
73

74
### 2.3 API docs auto-generation using swagger
Mr.奇淼('s avatar
Mr.奇淼( 已提交
75

R
rainyan 已提交
76
#### 2.3.1 install swagger 
S
sun_song_1203 已提交
77

R
rainyan 已提交
78
##### (1) Using VPN or outside mainland China
79 80 81
````
go get -u github.com/swaggo/swag/cmd/swag
````
Mr.奇淼('s avatar
Mr.奇淼( 已提交
82

R
rainyan 已提交
83
##### (2) In mainland China 
R
rainyan 已提交
84
In mainland China, access to go.org/x is prohibited,we recommend `gopm`
85 86 87
````bash
# install gopm
go get -v -u github.com/gpmgo/gopm
Mr.奇淼('s avatar
Mr.奇淼( 已提交
88

89 90
# get swag
gopm get -g -v github.com/swaggo/swag/cmd/swag
Mr.奇淼('s avatar
Mr.奇淼( 已提交
91

92 93 94
# cd GOPATH/src/github.com/swaggo/swag/cmd/swag
go install
````
Mr.奇淼('s avatar
Mr.奇淼( 已提交
95

96
#### 2.3.2 API docs generation
Mr.奇淼('s avatar
Mr.奇淼( 已提交
97

98 99 100 101 102
````
cd server
swag init
````
After executing the above command,`docs` will show in `server/`,then open your browser, jump into `http://localhost:8888/swagger/index.html` to see the swagger APIs.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
103

R
rainyan 已提交
104
### 2.4 Docker image
Mr.奇淼('s avatar
Mr.奇淼( 已提交
105

106 107 108 109
Thanks [@chenlinzhong](https://github.com/chenlinzhong) for providing docker image.
```  
# start docker
docker run -itd --net=host --name=go_container shareclz/go_node /bin/bash;
Mr.奇淼('s avatar
Mr.奇淼( 已提交
110

111 112 113
# come into docker 
docker exec -it go_container /bin/bash;
git clone https://github.com/piexlmax/gin-vue-admin.git /data1/www/htdocs/go/admin;
Mr.奇淼('s avatar
Mr.奇淼( 已提交
114

115 116 117 118
# run web
cd /data1/www/htdocs/go/admin/QMPlusVuePage;
cnpm i ;
npm run serve;
Mr.奇淼('s avatar
Mr.奇淼( 已提交
119

120 121
# update db config
vi /data1/www/htdocs/go/admin/QMPlusServer/static/dbconfig/config.json;
Mr.奇淼('s avatar
Mr.奇淼( 已提交
122

123 124 125 126
# run server
cd /data1/www/htdocs/go/admin/QMPlusServer;z
go run main.go;
```
Mr.奇淼('s avatar
Mr.奇淼( 已提交
127

R
rainyan 已提交
128
## 3. Technical selection
Mr.奇淼('s avatar
Mr.奇淼( 已提交
129

130 131
- Frontend: using `Element-UI` based on vue,to code the page.
- Backend: using `Gin` to quickly build basic RESTful API. `Gin` is a web framework written in Go (Golang).
132
- DB: `MySql`(5.6.44),using `gorm` to implement data manipulation, added support for SQLite databases.
133 134 135
- Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
- API: using Swagger to auto generate APIs docs。
- Config: using `fsnotify` and `viper` to implement `yaml` config file。
G
Granty1 已提交
136
- Log: using `go-logging` record logs。
S
sun_song_1203 已提交
137

R
rainyan 已提交
138
## 4. Project layout
S
sun_song_1203 已提交
139

140
```
141
    ├─server  	     (backend)
142 143 144 145 146 147 148 149 150 151 152
    │  ├─api            (API entrance)
    │  ├─config         (config file)
    │  ├─core  	        (core code)
    │  ├─db             (db scripts)
    │  ├─docs  	        (swagger APIs docs)
    │  ├─global         (global objet)
    │  ├─initialiaze    (initialiazation)
    │  ├─middleware     (middle ware)
    │  ├─model          (model and services)
    │  ├─resource       (resources, such as static pages, templates)
    │  ├─router         (routers)
153
    │  └─utils	        (common utilities)
154
    └─web            (frontend)
155 156 157 158 159 160 161 162 163 164
        ├─public        (deploy templates)
        └─src           (source code)
            ├─api       (frontend APIs)
            ├─assets	(static files)
            ├─components(components)
            ├─router	(frontend routers)
            ├─store     (vuex state management)
            ├─style     (common styles)
            ├─utils     (frontend common utilitie)
            └─view      (pages)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
165

166
```
Mr.奇淼('s avatar
Mr.奇淼( 已提交
167

168 169 170 171 172 173 174 175 176 177 178 179
## 5. Features

- Authority management: Authority management based on `jwt` and `casbin`. 
- File upload & download: File upload operation based on Qiniu Cloud (In order to make it easier for everyone to test, I have provided various important tokens of my Qiniu test number, and I urge you not to make things a mess).
- Pagination Encapsulation:The frontend uses mixins to encapsulate paging, and the paging method can call mixins
- User management: The system administrator assigns user roles and role permissions.
- Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
- Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
- API management: Different users can call different API permissions.
- Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function).
- Rich text editor: Embed MarkDown editor function.
- Conditional search: Add an example of conditional search.
180 181
- Restful example: refer to customer management function and apidcustomer group.

182 183 184 185 186 187 188 189
```
fontend code file: src\view\superAdmin\api\api.vue 
backend code file: model\dnModel\api.go 
```
- Multi-login restriction: Change `userMultipoint` to true in `system` in `config.yaml` (You need to configure redis and redis parameters yourself. During the test period, please report in time if there is a bug).
- Upload file by chunk:Provides examples of file upload and large file upload by chunk.
- Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
- Code generator: Providing backend with basic logic and simple curd code generator.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
190

191
## 6. To-do list
Mr.奇淼('s avatar
Mr.奇淼( 已提交
192

193 194 195 196
- [ ] upload & export Excel
- [ ] e-chart
- [ ] workflow, task transfer function
- [ ] frontend independent mode, mock
Mr.奇淼('s avatar
Mr.奇淼( 已提交
197

198
## 7. Changelog
Mr.奇淼('s avatar
Mr.奇淼( 已提交
199

200 201 202 203 204 205 206 207 208
|  Date   | Log  |
|  :---:  | --- |
|2020/01/07| Added data resource function to Role, added the return of data resource association, the demo code was synchronized, and the multi-point login interception has been turned on, which may prevent being crowded out by others |
|2020/01/13| Added configuration management function. This function is not published to the test environment. The test environment will not be published until the protection mechanism and the service restart mechanism are released. Please clone and import the sql scripts into your own database |
|2020/02/21| Modified `casbin` custom authentication method to fully support `/:params and?Query=` interface modes in RESTful API |
|2020/03/17| Added verification code function with [@dchest/captcha](https://github.com/dchest/captcha) |
|2020/03/30| Code generator implementation, form generator implementation with[@form-generator](https://github.com/JakHuang/form-generator)  |
|2020/04/01| Add frontend history tab function, add (modify) condition query example, and change the frontend background to white. (If you don't need this feature, you can change `background` in `&.el-main` to shield background color of `HistoryComponent`, which is located at line 260 of the code `web/src/view/layout/index.vue`) |
|2020/04/04| Starting version 2.x, standardize the project documentation, reconstructing the log function, and adding English comments to all methods |
Mr.奇淼('s avatar
Mr.奇淼( 已提交
209

210
## 8. Team blog
Mr.奇淼('s avatar
Mr.奇淼( 已提交
211

212 213 214 215
> https://blog.henrongyi.top
>
>
There are video courses about frontend framework in our blo. If you think the project is helpful to you, you can add my personal WeChat:shouzi_1994,your comments is welcomed。
Mr.奇淼('s avatar
Mr.奇淼( 已提交
216

217
## 9. Video courses
Mr.奇淼('s avatar
Mr.奇淼( 已提交
218

219
### 9.1 Development environment course
Mr.奇淼('s avatar
Mr.奇淼( 已提交
220

221
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/    (coming soon)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
222
    
223
### 9.2 Template course
Mr.奇淼('s avatar
Mr.奇淼( 已提交
224

225
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/    (coming soon)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
226

227
### 9.3 Golang basic course (coming soon)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
228

R
rainyan 已提交
229
> URL: https://space.bilibili.com/322210472/channel/detail?cid=108884
Mr.奇淼('s avatar
Mr.奇淼( 已提交
230

231
## 10. Contacts
Mr.奇淼('s avatar
Mr.奇淼( 已提交
232

233 234 235 236 237 238 239
| QQ group |  
|  :---:  |
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |


| Jiang | Yin | Yan | Du | Yin | Song |
|  :---:  |  :---: | :---: | :---:  |  :---: | :---: |
Mr.奇淼('s avatar
Mr.奇淼( 已提交
240
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryx.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryr.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrdjl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrygl.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qrsong.png"> |
Mr.奇淼('s avatar
Mr.奇淼( 已提交
241

242
### QQ group: 622360840
Mr.奇淼('s avatar
Mr.奇淼( 已提交
243

244
### Wechat group: add anyone above, comment "加入gin-vue-admin交流群"
Mr.奇淼('s avatar
Mr.奇淼( 已提交
245 246


247
## 11. Developers
Mr.奇淼('s avatar
Mr.奇淼( 已提交
248

249 250 251
|  Nick name   | Project position  | First name  |
|  ----  | ----  | ----  |
| [@piexlmax](https://github.com/piexlmax)  | Project sponsor | Jiang |
G
Granty1 已提交
252
| [@granty1](https://github.com/granty1)  | Backend developer | Yin |
253
| [@Ruio9244](https://github.com/Ruio9244)  | Full-stack developer | Yan |
254
| [@1319612909](https://github.com/1319612909)  | UI developer |  Du |
G
Granty1 已提交
255
| [@krank666](https://github.com/krank666)  | Frontend developer | Yin |
256
| [@chen-chen-up](https://github.com/chen-chen-up)  | Novice developer | Song |
Mr.奇淼('s avatar
Mr.奇淼( 已提交
257

258
## 12. Donate
Mr.奇淼('s avatar
Mr.奇淼( 已提交
259

260
If you find this project useful, you can buy author a glass of juice :tropical_drink:
Mr.奇淼('s avatar
Mr.奇淼( 已提交
261