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.

257 lines
10 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. 
  2. <div align=center>
  3. <img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
  4. </div>
  5. <div align=center>
  6. <img src="https://img.shields.io/badge/golang-1.12-blue"/>
  7. <img src="https://img.shields.io/badge/gin-1.4.0-lightBlue"/>
  8. <img src="https://img.shields.io/badge/vue-2.6.10-brightgreen"/>
  9. <img src="https://img.shields.io/badge/element--ui-2.12.0-green"/>
  10. <img src="https://img.shields.io/badge/gorm-1.9.10-red"/>
  11. </div>
  12. English | [简体中文](./README-zh_CN.md)
  13. # Project Guidelines
  14. [Online Documentation](http://doc.henrongyi.top/)
  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://qmplus.henrongyi.top/)
  20. > Gin-vue-admin is a full-stack (frontend and backend separation) framework designed for management system.
  21. > 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.
  22. ### 1.2 Version list
  23. master: 2.0 dev code
  24. [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)
  25. [gin-vue-adminv 2.0 dev](https://github.com/piexlmax/gin-vue-admin) (v2.0 is no longer compatible with v1.0)
  26. ## 2. Getting started
  27. ```
  28. - node version > v8.6.0
  29. - golang version >= v1.11
  30. - IDE recommendation: Goland
  31. - After you clone the project, use the scripts in directory db to create your own database.
  32. - 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.
  33. ```
  34. ### 2.1 Web
  35. ```bash
  36. # clone the project
  37. git clone https://github.com/piexlmax/gin-vue-admin.git
  38. # enter the project directory
  39. cd web
  40. # install dependency
  41. npm install
  42. # develop
  43. npm run dev
  44. ```
  45. ### 2.2 Server
  46. ```bash
  47. # using go.mod
  48. # install go modules
  49. go list (go mod tidy)
  50. # build the server
  51. go build
  52. ```
  53. ### 2.3 API docs auto-generation using swagger
  54. #### 2.3.1 install swagger
  55. ##### (1) Using VPN or outside mainland China
  56. ````
  57. go get -u github.com/swaggo/swag/cmd/swag
  58. ````
  59. ##### (2) In mainland China
  60. In mainland China, access to go.org/x is prohibited,we recommend `gopm`
  61. ````bash
  62. # install gopm
  63. go get -v -u github.com/gpmgo/gopm
  64. # get swag
  65. gopm get -g -v github.com/swaggo/swag/cmd/swag
  66. # cd GOPATH/src/github.com/swaggo/swag/cmd/swag
  67. go install
  68. ````
  69. #### 2.3.2 API docs generation
  70. ````
  71. cd server
  72. swag init
  73. ````
  74. 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.
  75. ### 2.4 Docker image
  76. Thanks [@chenlinzhong](https://github.com/chenlinzhong) for providing docker image.
  77. ```
  78. # start docker
  79. docker run -itd --net=host --name=go_container shareclz/go_node /bin/bash;
  80. # come into docker
  81. docker exec -it go_container /bin/bash;
  82. git clone https://github.com/piexlmax/gin-vue-admin.git /data1/www/htdocs/go/admin;
  83. # run web
  84. cd /data1/www/htdocs/go/admin/QMPlusVuePage;
  85. cnpm i ;
  86. npm run serve;
  87. # update db config
  88. vi /data1/www/htdocs/go/admin/QMPlusServer/static/dbconfig/config.json;
  89. # run server
  90. cd /data1/www/htdocs/go/admin/QMPlusServer;z
  91. go run main.go;
  92. ```
  93. ## 3. Technical selection
  94. - Frontend: using `Element-UI` based on vue,to code the page.
  95. - Backend: using `Gin` to quickly build basic RESTful API. `Gin` is a web framework written in Go (Golang).
  96. - DB: `MySql`(5.6.44),using `gorm` to implement data manipulation.
  97. - Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
  98. - API: using Swagger to auto generate APIs docs。
  99. - Config: using `fsnotify` and `viper` to implement `yaml` config file。
  100. - Log: using `go-logging` record logs。
  101. ## 4. Project layout
  102. ```
  103. ├─server (backend)
  104. │ ├─api (API entrance)
  105. │ ├─config (config file)
  106. │ ├─core (core code)
  107. │ ├─db (db scripts)
  108. │ ├─docs (swagger APIs docs)
  109. │ ├─global (global objet)
  110. │ ├─initialiaze (initialiazation)
  111. │ ├─middleware (middle ware)
  112. │ ├─model (model and services)
  113. │ ├─resource (resources, such as static pages, templates)
  114. │ ├─router (routers)
  115. │ └─utils (common utilities)
  116. └─web (frontend)
  117. ├─public (deploy templates)
  118. └─src (source code)
  119. ├─api (frontend APIs)
  120. ├─assets (static files)
  121. ├─components(components)
  122. ├─router (frontend routers)
  123. ├─store (vuex state management)
  124. ├─style (common styles)
  125. ├─utils (frontend common utilitie)
  126. └─view (pages)
  127. ```
  128. ## 5. Features
  129. - Authority management: Authority management based on `jwt` and `casbin`.
  130. - 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).
  131. - Pagination Encapsulation:The frontend uses mixins to encapsulate paging, and the paging method can call mixins
  132. - User management: The system administrator assigns user roles and role permissions.
  133. - Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
  134. - Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
  135. - API management: Different users can call different API permissions.
  136. - Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function).
  137. - Rich text editor: Embed MarkDown editor function.
  138. - Conditional search: Add an example of conditional search.
  139. ```
  140. fontend code file: src\view\superAdmin\api\api.vue
  141. backend code file: model\dnModel\api.go
  142. ```
  143. - 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).
  144. - Upload file by chunk:Provides examples of file upload and large file upload by chunk.
  145. - Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
  146. - Code generator: Providing backend with basic logic and simple curd code generator.
  147. ## 6. To-do list
  148. - [ ] upload & export Excel
  149. - [ ] e-chart
  150. - [ ] workflow, task transfer function
  151. - [ ] frontend independent mode, mock
  152. ## 7. Changelog
  153. | Date | Log |
  154. | :---: | --- |
  155. |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 |
  156. |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 |
  157. |2020/02/21| Modified `casbin` custom authentication method to fully support `/:params and?Query=` interface modes in RESTful API |
  158. |2020/03/17| Added verification code function with [@dchest/captcha](https://github.com/dchest/captcha) |
  159. |2020/03/30| Code generator implementation, form generator implementation with[@form-generator](https://github.com/JakHuang/form-generator) |
  160. |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`) |
  161. |2020/04/04| Starting version 2.x, standardize the project documentation, reconstructing the log function, and adding English comments to all methods |
  162. ## 8. Team blog
  163. > https://blog.henrongyi.top
  164. >
  165. >
  166. 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。
  167. ## 9. Video courses
  168. ### 9.1 Development environment course
  169. > Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/ (coming soon)
  170. ### 9.2 Template course
  171. > Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/ (coming soon)
  172. ### 9.3 Golang basic course (coming soon)
  173. > URL: https://space.bilibili.com/322210472/channel/detail?cid=108884
  174. ## 10. Contacts
  175. | 奇淼 | krank666 |qq group|
  176. | :---: | :---: | :---: |
  177. | <img src="http://qmplusimg.henrongyi.top/jjz.jpg" width="180"/> | <img src="http://qmplusimg.henrongyi.top/yx.jpg" width="180"/> | <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
  178. ### QQ group: 622360840
  179. ### Wechat group: add anyone above, comment "加入gin-vue-admin交流群"
  180. ## 11. Developers
  181. | Nick name | Project position | First name |
  182. | ---- | ---- | ---- |
  183. | [@piexlmax](https://github.com/piexlmax) | Project sponsor | Jiang |
  184. | [@krank666](https://github.com/krank666) | Frontend developer | Yin |
  185. | [@1319612909](https://github.com/1319612909) | UI developer | Du |
  186. | [@granty1](https://github.com/granty1) | Backend developer | Yin |
  187. | [@Ruio9244](https://github.com/Ruio9244) | Full-stack developer | Yan |
  188. | [@chen-chen-up](https://github.com/chen-chen-up) | Novice developer | Song |
  189. ## 12. Donate
  190. If you find this project useful, you can buy author a glass of juice :tropical_drink:
  191. | Ali pay | Wechat pay |
  192. | :---: | :---: |
  193. | ![markdown](http://qmplusimg.henrongyi.top/zfb.png "支付宝") | ![markdown](http://qmplusimg.henrongyi.top/wxzf.png "微信") |