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.

346 lines
14 KiB

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.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 is no longer compatible with v1.0)
  41. - [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (stop maintenance)
  42. - [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (stop maintenance)
  43. ## 2. Getting started
  44. ```
  45. - node version > v8.6.0
  46. - golang version >= v1.11
  47. - IDE recommendation: Goland
  48. - After you clone the project, use the scripts in directory db to create your own database.
  49. - 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.
  50. ```
  51. > Use docker-compose to experience this project
  52. - Installation docker-compose [Official document](https://docs.docker.com/compose/install/)
  53. - ```shell script
  54. # Install on Linux
  55. # 1.1 Run this command to download the current stable version of Docker Compose
  56. 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
  57. # 1.2 Apply executable permissions to binary files
  58. sudo chmod +x /usr/local/bin/docker-compose
  59. ```
  60. - ```shell script
  61. # Use Python's pip installation
  62. pip3 install docker-compose -i https://pypi.tuna.tsinghua.edu.cn/simple
  63. ```
  64. - Use Docker Desktop
  65. - Windows: https://hub.docker.com/editions/community/docker-ce-desktop-windows
  66. - Mac: https://hub.docker.com/editions/community/docker-ce-desktop-mac/
  67. - Use git to clone this project
  68. - ```git
  69. git clone https://github.com/flipped-aurora/gin-vue-admin.git
  70. ```
  71. - Use docker-compose up to start the startup project with one click
  72. - ```shell script
  73. # Use docker-compose to start four containers
  74. docker-compose up
  75. # If you modify some configuration options, you can use this command to repackage the image
  76. docker-compose up --build
  77. # Use docker-compose to start in the background
  78. docker-compose up -d
  79. ```
  80. - Web project preview [http://127.0.0.1:8000](http://127.0.0.1:8000)
  81. - swagger APIs [http://127.0.0.1:8888/swagger/index.html](http://127.0.0.1:8888/swagger/index.html)
  82. - If the internal ip of the server's 177.7.0.12 container is occupied, the place to be modified is
  83. - Replace 177.7.0.12 on line 39 of [docker-compose.yaml](./docker-compose.yaml) with the ip you want
  84. - 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
  85. - docker-compose uses a custom docker network
  86. - ```dockerfile
  87. networks:
  88. network:
  89. ipam:
  90. driver: default
  91. config:
  92. - subnet: '177.7.0.0/16'
  93. ```
  94. - 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)
  95. - The default network name is gin-vue-admin_network, and the default is bridge mode
  96. - 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
  97. ### 2.1 Web
  98. ```bash
  99. # clone the project
  100. git clone https://github.com/piexlmax/gin-vue-admin.git
  101. # enter the project directory
  102. cd web
  103. # install dependency
  104. npm install
  105. # develop
  106. npm run serve
  107. ```
  108. ### 2.2 Server
  109. ```bash
  110. # using go.mod
  111. # install go modules
  112. go list (go mod tidy)
  113. # build the server
  114. go build
  115. ```
  116. ### 2.3 API docs auto-generation using swagger
  117. #### 2.3.1 install swagger
  118. ##### (1) Using VPN or outside mainland China
  119. ````
  120. go get -u github.com/swaggo/swag/cmd/swag
  121. ````
  122. ##### (2) In mainland China
  123. In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/)
  124. ````bash
  125. If you are using Go version 1.13 and above (recommended)
  126. # Enable Go Modules function
  127. go env -w GO111MODULE=on
  128. # Configure GOPROXY environment variables
  129. go env -w GOPROXY=https://goproxy.io,direct
  130. If you are using Go version 1.12 and below
  131. go env -w GO111MODULE=on
  132. go env -w GOPROXY=https://goproxy.io
  133. # get swag
  134. go get -g -v github.com/swaggo/swag/cmd/swag
  135. # cd GOPATH/src/github.com/swaggo/swag/cmd/swag
  136. go install
  137. ````
  138. #### 2.3.2 API docs generation
  139. ````
  140. cd server
  141. swag init
  142. ````
  143. 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.
  144. ## 3. Technical selection
  145. - Frontend: using `Element-UI` based on vue,to code the page.
  146. - Backend: using `Gin` to quickly build basic RESTful API. `Gin` is a web framework written in Go (Golang).
  147. - DB: `MySql`(5.6.44),using `gorm` to implement data manipulation, added support for SQLite databases.
  148. - Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
  149. - API: using Swagger to auto generate APIs docs。
  150. - Config: using `fsnotify` and `viper` to implement `yaml` config file。
  151. - Log: using `go-logging` record logs。
  152. ## 4. Project Architecture
  153. ### 4.1 Architecture Diagram
  154. ![Architecture diagram](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
  155. ### 4.2 Front-end Detailed Design Diagram (Contributor: <a href="https://github.com/baobeisuper">baobeisuper</a>)
  156. ![Front-end Detailed Design Diagram](http://qmplusimg.henrongyi.top/naotu.png)
  157. ### 4.3 Project Layout
  158. ```
  159. ├─server (backend)
  160. │ ├─api (API entrance)
  161. │ ├─config (config file)
  162. │ ├─core (core code)
  163. │ ├─db (db scripts)
  164. │ ├─docs (swagger APIs docs)
  165. │ ├─global (global objet)
  166. │ ├─initialiaze (initialiazation)
  167. │ ├─middleware (middle ware)
  168. │ ├─model (model and services)
  169. │ ├─resource (resources, such as static pages, templates)
  170. │ ├─router (routers)
  171. │ ├─service (services)
  172. │ └─utils (common utilities)
  173. └─web (frontend)
  174. ├─public (deploy templates)
  175. └─src (source code)
  176. ├─api (frontend APIs)
  177. ├─assets (static files)
  178. ├─components(components)
  179. ├─router (frontend routers)
  180. ├─store (vuex state management)
  181. ├─style (common styles)
  182. ├─utils (frontend common utilitie)
  183. └─view (pages)
  184. ```
  185. ## 5. Features
  186. - Authority management: Authority management based on `jwt` and `casbin`.
  187. - 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).
  188. - Pagination Encapsulation:The frontend uses mixins to encapsulate paging, and the paging method can call mixins
  189. - User management: The system administrator assigns user roles and role permissions.
  190. - Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
  191. - Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
  192. - API management: Different users can call different API permissions.
  193. - Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function).
  194. - Rich text editor: Embed MarkDown editor function.
  195. - Conditional search: Add an example of conditional search.
  196. - Restful example: You can see sample APIs in user management module.
  197. ```
  198. fontend code file: src\view\superAdmin\api\api.vue
  199. backend code file: model\dnModel\api.go
  200. ```
  201. - 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).
  202. - Upload file by chunk:Provides examples of file upload and large file upload by chunk.
  203. - Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
  204. - Code generator: Providing backend with basic logic and simple curd code generator.
  205. ## 6. To-do list
  206. - [ ] upload & export Excel
  207. - [ ] e-chart
  208. - [ ] workflow, task transfer function
  209. - [ ] frontend independent mode, mock
  210. ## 7. Knowledge base
  211. ### 7.1 Team blog
  212. > https://www.yuque.com/flipped-aurora
  213. >
  214. >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。
  215. ### 7.2 Video courses
  216. (1) Development environment course
  217. > Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
  218. (2) Template course
  219. > Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/
  220. (3)2.0 version introduction and development experience
  221. > Bilibili:https://www.bilibili.com/video/BV1aV411d7Gm#reply2831798461
  222. (4) Golang basic course (coming soon)
  223. > https://space.bilibili.com/322210472/channel/detail?cid=108884
  224. ## 8. Contacts
  225. ### 8.1 Groups
  226. #### QQ group: 622360840
  227. | QQ group |
  228. | :---: |
  229. | <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
  230. #### Wechat group: add anyone above, comment "加入gin-vue-admin交流群"
  231. ### 8.2 Team members
  232. | Jiang | Yan | Yin | Du | Yin | Song |
  233. | :---: | :---: | :---: | :---: | :---: | :---: |
  234. | <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryr.png"> | <img width="150" src="http://qmplusimg.henrongyi.top/qryx.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"> |
  235. | Nick name | Project position | First name |
  236. | ---- | ---- | ---- |
  237. | [@piexlmax](https://github.com/piexlmax) | Project sponsor | Jiang |
  238. | [@Ruio9244](https://github.com/Ruio9244) | Architect | Yan |
  239. | [@granty1](https://github.com/granty1) | Backend developer | Yin |
  240. | [@1319612909](https://github.com/1319612909) | UI developer | Du |
  241. | [@krank666](https://github.com/krank666) | Frontend developer | Yin |
  242. | [@chen-chen-up](https://github.com/chen-chen-up) | Novice developer | Song |
  243. | [@SliverHorn](https://github.com/SliverHorn) | Community Administrator | Lai |
  244. ## 9. Donate
  245. 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)
  246. ## 10. Commercial considerations
  247. If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.