You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
13 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <div align=center>
  2. <img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
  3. </div>
  4. <div align=center>
  5. <img src="https://img.shields.io/badge/golang-1.12-blue"/>
  6. <img src="https://img.shields.io/badge/gin-1.4.0-lightBlue"/>
  7. <img src="https://img.shields.io/badge/vue-2.6.10-brightgreen"/>
  8. <img src="https://img.shields.io/badge/element--ui-2.12.0-green"/>
  9. <img src="https://img.shields.io/badge/gorm-1.9.12-red"/>
  10. </div>
  11. English | [简体中文](./README.md)
  12. # Project Guidelines
  13. [Online Documentation](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/
  14. [Development Steps](https://www.gin-vue-admin.com/docs/help) (Contributor: <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
  15. - Web UI Framework:[element-ui](https://github.com/ElemeFE/element)
  16. - Server Framework:[gin](https://github.com/gin-gonic/gin)
  17. ## 1. Basic Introduction
  18. ### 1.1 Project Introduction
  19. [Online Demo](http://demo.gin-vue-admin.com/)
  20. username:admin
  21. password:123456
  22. > Gin-vue-admin is a full-stack (frontend and backend separation) framework designed for management system.
  23. > 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.
  24. Hi! Thank you for choosing gin-vue-admin.
  25. Gin-vue-admin is a full-stack (frontend and backend separation) framework for developers, designers and product managers.
  26. We are excited that you are interested in contributing to gin-vue-admin. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
  27. ### 1.2 Contributing Guide
  28. #### 1.2.1 Issue Guidelines
  29. - Issues are exclusively for bug reports, feature requests and design-related topics. Other questions may be closed directly. If any questions come up when you are using Element, please hit [Gitter](https://gitter.im/element-en/Lobby) for help.
  30. - Before submitting an issue, please check if similar problems have already been issued.
  31. #### 1.2.2 Pull Request Guidelines
  32. - Fork this repository to your own account. Do not create branches here.
  33. - Commit info should be formatted as `[File Name]: Info about commit.` (e.g. `README.md: Fix xxx bug`)
  34. - <font color=red>Make sure PRs are created to `develop` branch instead of `master` branch.</font>
  35. - If your PR fixes a bug, please provide a description about the related bug.
  36. - Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.
  37. ### 1.3 Version list
  38. - master: 2.0 code, for prod
  39. - develop: 2.0 dev code, for test
  40. - [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1](https://v1.gorm.io) Stable branch)
  41. - [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2](https://v2.gorm.io) Development branch)
  42. ## 2. Getting started
  43. ```
  44. - node version > v8.6.0
  45. - golang version >= v1.11
  46. - IDE recommendation: Goland
  47. - After you clone the project, use the scripts in directory db to create your own database.
  48. - 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.
  49. ```
  50. > Use docker-compose to experience this project
  51. - Installation docker-compose [Official document](https://docs.docker.com/compose/install/)
  52. - ```shell script
  53. # Install on Linux
  54. # 1.1 Run this command to download the current stable version of Docker Compose
  55. sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  56. # 1.2 Apply executable permissions to binary files
  57. sudo chmod +x /usr/local/bin/docker-compose
  58. ```
  59. - ```shell script
  60. # Use Python's pip installation
  61. pip3 install docker-compose -i https://pypi.tuna.tsinghua.edu.cn/simple
  62. ```
  63. - Use Docker Desktop
  64. - Windows: https://hub.docker.com/editions/community/docker-ce-desktop-windows
  65. - Mac: https://hub.docker.com/editions/community/docker-ce-desktop-mac/
  66. - Use git to clone this project
  67. - ```git
  68. git clone https://github.com/flipped-aurora/gin-vue-admin.git
  69. ```
  70. - Use docker-compose up to start the startup project with one click
  71. - ```shell script
  72. # Use docker-compose to start four containers
  73. docker-compose up
  74. # If you modify some configuration options, you can use this command to repackage the image
  75. docker-compose up --build
  76. # Use docker-compose to start in the background
  77. docker-compose up -d
  78. ```
  79. - Web project preview [http://127.0.0.1:8000](http://127.0.0.1:8000)
  80. - swagger APIs [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
  81. - If the internal ip of the server's 177.7.0.12 container is occupied, the place to be modified is
  82. - Replace 177.7.0.12 on line 39 of [docker-compose.yaml](./docker-compose.yaml) with the ip you want
  83. - Replace 177.7.0.12 in line 20 of [.docker-compose/nginx/conf.d/my.conf](./.docker-compose/nginx/conf.d/my.conf) with the ip you want
  84. - docker-compose uses a custom docker network
  85. - ```dockerfile
  86. networks:
  87. network:
  88. ipam:
  89. driver: default
  90. config:
  91. - subnet: '177.7.0.0/16'
  92. ```
  93. - Subnet address, the default gateway is 177.7.0.1 (docker-compose V2 needs to write, V3 does not need),For specific information, see the [official document](https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address)
  94. - The default network name is gin-vue-admin_network, and the default is bridge mode
  95. - If the subnet is modified, the ipv4_address of each service needs to be modified, and the ip of the server on line 20 of [.docker-compose/nginx/conf.d/my.conf](.docker-compose/nginx/conf.d/my.conf) also needs to be modified
  96. ### 2.1 Web
  97. ```bash
  98. # clone the project
  99. git clone https://github.com/piexlmax/gin-vue-admin.git
  100. # enter the project directory
  101. cd web
  102. # install dependency
  103. npm install
  104. # develop
  105. npm run serve
  106. ```
  107. ### 2.2 Server
  108. ```bash
  109. # using go.mod
  110. # install go modules
  111. go list (go mod tidy)
  112. # build the server
  113. go build
  114. ```
  115. ### 2.3 API docs auto-generation using swagger
  116. #### 2.3.1 install swagger
  117. ##### (1) Using VPN or outside mainland China
  118. ````
  119. go get -u github.com/swaggo/swag/cmd/swag
  120. ````
  121. ##### (2) In mainland China
  122. In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/)
  123. ````bash
  124. If you are using Go version 1.13 and above (recommended)
  125. # Enable Go Modules function
  126. go env -w GO111MODULE=on
  127. # Configure GOPROXY environment variables
  128. go env -w GOPROXY=https://goproxy.io,direct
  129. If you are using Go version 1.12 and below
  130. go env -w GO111MODULE=on
  131. go env -w GOPROXY=https://goproxy.io
  132. # get swag
  133. go get -g -v github.com/swaggo/swag/cmd/swag
  134. # cd GOPATH/src/github.com/swaggo/swag/cmd/swag
  135. go install
  136. ````
  137. #### 2.3.2 API docs generation
  138. ````
  139. cd server
  140. swag init
  141. ````
  142. 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.
  143. ## 3. Technical selection
  144. - Frontend: using `Element-UI` based on vue,to code the page.
  145. - Backend: using `Gin` to quickly build basic RESTful API. `Gin` is a web framework written in Go (Golang).
  146. - DB: `MySql`(5.6.44),using `gorm` to implement data manipulation, added support for SQLite databases.
  147. - Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
  148. - API: using Swagger to auto generate APIs docs。
  149. - Config: using `fsnotify` and `viper` to implement `yaml` config file。
  150. - Log: using `go-logging` record logs。
  151. ## 4. Project Architecture
  152. ### 4.1 Architecture Diagram
  153. ![Architecture diagram](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
  154. ### 4.2 Front-end Detailed Design Diagram (Contributor: <a href="https://github.com/baobeisuper">baobeisuper</a>)
  155. ![Front-end Detailed Design Diagram](http://qmplusimg.henrongyi.top/naotu.png)
  156. ### 4.3 Project Layout
  157. ```
  158. ├─server (backend)
  159. │ ├─api (API entrance)
  160. │ ├─config (config file)
  161. │ ├─core (core code)
  162. │ ├─db (db scripts)
  163. │ ├─docs (swagger APIs docs)
  164. │ ├─global (global objet)
  165. │ ├─initialiaze (initialiazation)
  166. │ ├─middleware (middle ware)
  167. │ ├─model (model and services)
  168. │ ├─resource (resources, such as static pages, templates)
  169. │ ├─router (routers)
  170. │ ├─service (services)
  171. │ └─utils (common utilities)
  172. └─web (frontend)
  173. ├─public (deploy templates)
  174. └─src (source code)
  175. ├─api (frontend APIs)
  176. ├─assets (static files)
  177. ├─components(components)
  178. ├─router (frontend routers)
  179. ├─store (vuex state management)
  180. ├─style (common styles)
  181. ├─utils (frontend common utilitie)
  182. └─view (pages)
  183. ```
  184. ## 5. Features
  185. - Authority management: Authority management based on `jwt` and `casbin`.
  186. - 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).
  187. - Pagination Encapsulation:The frontend uses mixins to encapsulate paging, and the paging method can call mixins
  188. - User management: The system administrator assigns user roles and role permissions.
  189. - Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
  190. - Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
  191. - API management: Different users can call different API permissions.
  192. - Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function).
  193. - Rich text editor: Embed MarkDown editor function.
  194. - Conditional search: Add an example of conditional search.
  195. - Restful example: You can see sample APIs in user management module.
  196. ```
  197. fontend code file: src\view\superAdmin\api\api.vue
  198. backend code file: model\dnModel\api.go
  199. ```
  200. - 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).
  201. - Upload file by chunk:Provides examples of file upload and large file upload by chunk.
  202. - Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
  203. - Code generator: Providing backend with basic logic and simple curd code generator.
  204. ## 6. To-do list
  205. - [ ] upload & export Excel
  206. - [ ] e-chart
  207. - [ ] workflow, task transfer function
  208. - [ ] frontend independent mode, mock
  209. ## 7. Knowledge base
  210. ### 7.1 Team blog
  211. > https://www.yuque.com/flipped-aurora
  212. >
  213. >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。
  214. ### 7.2 Video courses
  215. (1) Development environment course
  216. > Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
  217. (2) Template course
  218. > Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/
  219. (3)2.0 version introduction and development experience
  220. > Bilibili:https://www.bilibili.com/video/BV1aV411d7Gm#reply2831798461
  221. (4) Golang basic course (coming soon)
  222. > https://space.bilibili.com/322210472/channel/detail?cid=108884
  223. ## 8. Contacts
  224. ### 8.1 Groups
  225. #### QQ group: 622360840
  226. | QQ group |
  227. | :---: |
  228. | <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
  229. #### Wechat group: comment "加入gin-vue-admin交流群"
  230. | Wechat |
  231. | :---: |
  232. | <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
  233. #### [About Us](https://www.gin-vue-admin.com/about/)
  234. ## 9. Donate
  235. If you find this project useful, you can buy author a glass of juice :tropical_drink: [here](https://www.gin-vue-admin.com/docs/coffee)
  236. ## 10. Commercial considerations
  237. If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.