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.

317 lines
13 KiB

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.14-blue"/>
  6. <img src="https://img.shields.io/badge/gin-1.6.3-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.20.7-red"/>
  10. </div>
  11. English | [简体中文](./README.md)
  12. [gitee](https://gitee.com/pixelmax/gin-vue-admin): https://gitee.com/pixelmax/gin-vue-admin
  13. [github](https://github.com/flipped-aurora/gin-vue-admin): https://github.com/flipped-aurora/gin-vue-admin
  14. [Vue3 version branch address](https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop): https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop
  15. [Approval flow branch](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow): https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow
  16. # Project Guidelines
  17. [Online Documentation](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/
  18. [From the environment to the deployment of teaching videos](https://www.bilibili.com/video/BV1fV411y7dT)
  19. [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>)
  20. ## 1. Basic Introduction
  21. ### 1.1 Project Introduction
  22. > Gin-vue-admin is a backstage management system based on [vue](https://vuejs.org) and [gin](https://gin-gonic.com), which separates the front and rear of the full stack. It integrates jwt authentication, dynamic routing, dynamic menu, casbin authentication, form generator, code generator and other functions. It provides a variety of sample files, allowing you to focus more time on business development.
  23. [Online Demo](http://demo.gin-vue-admin.com): http://demo.gin-vue-admin.com
  24. username:admin
  25. password:123456
  26. ### 1.2 Contributing Guide
  27. Hi! Thank you for choosing gin-vue-admin.
  28. Gin-vue-admin is a full-stack (frontend and backend separation) framework for developers, designers and product managers.
  29. 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.
  30. #### 1.2.1 Issue Guidelines
  31. - 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.
  32. - Before submitting an issue, please check if similar problems have already been issued.
  33. #### 1.2.2 Pull Request Guidelines
  34. - Fork this repository to your own account. Do not create branches here.
  35. - Commit info should be formatted as `[File Name]: Info about commit.` (e.g. `README.md: Fix xxx bug`)
  36. - <font color=red>Make sure PRs are created to `develop` branch instead of `master` branch.</font>
  37. - If your PR fixes a bug, please provide a description about the related bug.
  38. - Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.
  39. ### 1.3 Version list
  40. - master: 2.0 code, for prod
  41. - develop: 2.0 dev code, for test
  42. - [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)
  43. - [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2](https://v2.gorm.io) Development branch)
  44. ## 2. Getting started
  45. ```
  46. - node version > v8.6.0
  47. - golang version >= v1.14
  48. - IDE recommendation: Goland
  49. - initialization project: different versions of the database are not initialized. See synonyms at initialization https://www.gin-vue-admin.com/docs/first
  50. - Replace the Qiniuyun public key, private key, warehouse name and default url address in the project to avoid data confusion in the test file.
  51. ```
  52. ### 2.1 server project
  53. use `Goland` And other editing tools,open server catalogue,You can't open it. `gin-vue-admin` root directory
  54. ```bash
  55. # clone the project
  56. git clone https://github.com/flipped-aurora/gin-vue-admin.git
  57. # open server catalogue
  58. cd server
  59. # use go mod And install the go dependency package
  60. go generate
  61. # Compile
  62. go build -o server main.go (windows the compile command is go build -o server.exe main.go )
  63. # Run binary
  64. ./server (windows The run command is server.exe)
  65. ```
  66. ### 2.1 web project
  67. ```bash
  68. # enter the project directory
  69. cd web
  70. # install dependency
  71. npm install
  72. # develop
  73. npm run serve
  74. ```
  75. ### 2.2 Server
  76. ```bash
  77. # using go.mod
  78. # install go modules
  79. go list (go mod tidy)
  80. # build the server
  81. go build
  82. ```
  83. ### 2.3 API docs auto-generation using swagger
  84. #### 2.3.1 install swagger
  85. ##### (1) Using VPN or outside mainland China
  86. ````
  87. go get -u github.com/swaggo/swag/cmd/swag
  88. ````
  89. ##### (2) In mainland China
  90. In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/) or [goproxy.cn](https://goproxy.cn)
  91. ````bash
  92. # If you are using a version of Go 1.13 - 1.15 Need to set up manually GO111MODULE=on, The opening mode is as follows, If your Go version is 1.16 ~ Latest edition You can ignore the following step one
  93. # Step one、Enable Go Modules Function
  94. go env -w GO111MODULE=on
  95. # Step two、Configuration GOPROXY Environment variable
  96. go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
  97. # If you dislike trouble,You can use the go generate Automatically execute code before compilation, But this can't be used command line terminal of `Goland` or `Vscode`
  98. cd server
  99. go generate -run "go env -w .*?"
  100. # 使用如下命令下载swag
  101. go get -u github.com/swaggo/swag/cmd/swag
  102. ````
  103. #### 2.3.2 API docs generation
  104. ````
  105. cd server
  106. swag init
  107. ````
  108. > After executing the above command,server directory will appear in the docs folder `docs.go`, `swagger.json`, `swagger.yaml` Three file updates,After starting the go service, type in the browser [http://localhost:8888/swagger/index.html](http://localhost:8888/swagger/index.html) You can view swagger document
  109. ## 3. Technical selection
  110. - Frontend: using [Element](https://github.com/ElemeFE/element) based on [Vue](https://vuejs.org),to code the page.
  111. - Backend: using [Gin](https://gin-gonic.com/) to quickly build basic RESTful API. [Gin](https://gin-gonic.com/)is a web framework written in Go (Golang).
  112. - DB: `MySql`(5.6.44),using [gorm](http://gorm.io)` to implement data manipulation, added support for SQLite databases.
  113. - Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
  114. - API: using Swagger to auto generate APIs docs。
  115. - Config: using [fsnotify](https://github.com/fsnotify/fsnotify) and [viper](https://github.com/spf13/viper) to implement `yaml` config file。
  116. - Log: using [zap](https://github.com/uber-go/zap) record logs。
  117. ## 4. Project Architecture
  118. ### 4.1 Architecture Diagram
  119. ![Architecture diagram](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
  120. ### 4.2 Front-end Detailed Design Diagram (Contributor: <a href="https://github.com/baobeisuper">baobeisuper</a>)
  121. ![Front-end Detailed Design Diagram](http://qmplusimg.henrongyi.top/naotu.png)
  122. ### 4.3 Project Layout
  123. ```
  124. ├── server
  125. ├── api (api entrance)
  126. │ └── v1 (v1 version interface)
  127. ├── config (configuration package)
  128. ├── core (core document)
  129. ├── docs (swagger document directory)
  130. ├── global (global object)
  131. ├── initialize (initialization)
  132. │ └── internal (initialize internal function)
  133. ├── middleware (middleware layer)
  134. ├── model (model layer)
  135. │ ├── request (input parameter structure)
  136. │ └── response (out-of-parameter structure)
  137. ├── packfile (static file packaging)
  138. ├── resource (static resource folder)
  139. │ ├── excel (excel import and export default path)
  140. │ ├── page (form generator)
  141. │ └── template (template)
  142. ├── router (routing layer)
  143. ├── service (service layer)
  144. ├── source (source layer)
  145. └── utils (tool kit)
  146. ├── timer (timer interface encapsulation)
  147. └── upload (oss interface encapsulation)
  148. └─web (frontend)
  149. ├─public (deploy templates)
  150. └─src (source code)
  151. ├─api (frontend APIs)
  152. ├─assets (static files)
  153. ├─components(components)
  154. ├─router (frontend routers)
  155. ├─store (vuex state management)
  156. ├─style (common styles)
  157. ├─utils (frontend common utilitie)
  158. └─view (pages)
  159. ```
  160. ## 5. Features
  161. - Authority management: Authority management based on `jwt` and `casbin`.
  162. - File upload and download: implement file upload operations based on `Qiniuyun', `Aliyun 'and `Tencent Cloud` (please develop your own application for each platform corresponding to `token` or `key` ).
  163. - Pagination Encapsulation:The frontend uses `mixins` to encapsulate paging, and the paging method can call `mixins` .
  164. - User management: The system administrator assigns user roles and role permissions.
  165. - Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
  166. - Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
  167. - API management: Different users can call different API permissions.
  168. - Configuration management: the configuration file can be modified in the foreground (this feature is not available in the online experience site).
  169. - Conditional search: Add an example of conditional search.
  170. - Restful example: You can see sample APIs in user management module.
  171. - Front-end file reference: [web/src/view/superAdmin/api/api.vue](https://github.com/flipped-aurora/gin-vue-admin/blob/master/web/src/view/superAdmin/api/api.vue).
  172. - Stage reference: [server/router/sys_api.go](https://github.com/flipped-aurora/gin-vue-admin/blob/master/server/router/sys_api.go).
  173. - Multi-login restriction: Change `user-multipoint` 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).
  174. - Upload file by chunk:Provides examples of file upload and large file upload by chunk.
  175. - Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
  176. - Code generator: Providing backend with basic logic and simple curd code generator.
  177. ## 6. Knowledge base
  178. ### 6.1 Team blog
  179. > https://www.yuque.com/flipped-aurora
  180. >
  181. >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。
  182. ### 6.2 Video courses
  183. (1) Development environment course
  184. > Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
  185. (2) Template course
  186. > Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/
  187. (3) 2.0 version introduction and development experience
  188. > Bilibili:https://www.bilibili.com/video/BV1aV411d7Gm#reply2831798461
  189. (4) Golang basic course
  190. > https://space.bilibili.com/322210472/channel/detail?cid=108884
  191. (5) gin frame basic teaching
  192. > bilibili:https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0
  193. (6) gin-vue-admin version update introduction video
  194. > bilibili:https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0
  195. ## 7.Contacts
  196. ### 7.1 Groups
  197. #### QQ group: 622360840
  198. | QQ group |d
  199. | :---: |
  200. | <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
  201. #### Wechat group: comment "加入gin-vue-admin交流群"
  202. | Wechat |
  203. | :---: |
  204. | <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
  205. #### [About Us](https://www.gin-vue-admin.com/about/)
  206. ## 8. Contributors
  207. Thank you for considering your contribution to gin-vue-admin!
  208. <a href="https://github.com/flipped-aurora/gin-vue-admin/graphs/contributors">
  209. <img src="https://contrib.rocks/image?repo=flipped-aurora/gin-vue-admin" />
  210. </a>
  211. ## 9. Donate
  212. 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)
  213. ## 10. Commercial considerations
  214. If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.