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.

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