diff --git a/QMPlusServer/controller/api/exa_customer.go b/QMPlusServer/controller/api/exa_customer.go index 03c09c9ad3749fc5eebb3b9b7625074e889da940..4f15896457918e3696763464da5a4d2d3bcccd19 100644 --- a/QMPlusServer/controller/api/exa_customer.go +++ b/QMPlusServer/controller/api/exa_customer.go @@ -19,7 +19,7 @@ import ( // @Router /customer/createExaCustomer [post] func CreateExaCustomer(c *gin.Context) { var cu dbModel.ExaCustomer - _ = c.BindJSON(&cu) + _ = c.ShouldBindJSON(&cu) claims, _ := c.Get("claims") waitUse := claims.(*middleware.CustomClaims) cu.SysUserID = waitUse.ID @@ -42,7 +42,7 @@ func CreateExaCustomer(c *gin.Context) { // @Router /customer/deleteExaCustomer [post] func DeleteExaCustomer(c *gin.Context) { var cu dbModel.ExaCustomer - _ = c.BindJSON(&cu) + _ = c.ShouldBindJSON(&cu) err := cu.DeleteExaCustomer() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{}) @@ -61,7 +61,7 @@ func DeleteExaCustomer(c *gin.Context) { // @Router /customer/updataExaCustomer [post] func UpdataExaCustomer(c *gin.Context) { var cu dbModel.ExaCustomer - _ = c.BindJSON(&cu) + _ = c.ShouldBindJSON(&cu) err := cu.UpdataExaCustomer() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{}) @@ -80,13 +80,13 @@ func UpdataExaCustomer(c *gin.Context) { // @Router /customer/getExaCustomer [post] func GetExaCustomer(c *gin.Context) { var cu dbModel.ExaCustomer - _ = c.BindJSON(&cu) - err,customer := cu.GetExaCustomer() + _ = c.ShouldBindJSON(&cu) + err, customer := cu.GetExaCustomer() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{}) } else { servers.ReportFormat(c, true, "创建成功", gin.H{ - "customer":customer, + "customer": customer, }) } } @@ -105,16 +105,16 @@ func GetExaCustomerList(c *gin.Context) { var cu dbModel.ExaCustomer cu.SysUserAuthorityID = waitUse.AuthorityId var pageInfo modelInterface.PageInfo - _ = c.BindJSON(&pageInfo) + _ = c.ShouldBindJSON(&pageInfo) err, customerList, total := cu.GetInfoList(pageInfo) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{}) } else { servers.ReportFormat(c, true, "创建成功", gin.H{ - "customer":customerList, + "customer": customerList, "total": total, "page": pageInfo.Page, "pageSize": pageInfo.PageSize, }) } -} \ No newline at end of file +} diff --git a/QMPlusServer/controller/api/exa_fileUploadAndDownload.go b/QMPlusServer/controller/api/exa_fileUploadAndDownload.go index ff50703791f34db86296dd0a0bc30e325f0d99ae..93a64c2f503c5f5e929e20edb8d419a55d30768e 100644 --- a/QMPlusServer/controller/api/exa_fileUploadAndDownload.go +++ b/QMPlusServer/controller/api/exa_fileUploadAndDownload.go @@ -85,7 +85,7 @@ func DeleteFile(c *gin.Context) { // @Router /fileUploadAndDownload/getFileList [post] func GetFileList(c *gin.Context) { var pageInfo modelInterface.PageInfo - _ = c.BindJSON(&pageInfo) + _ = c.ShouldBindJSON(&pageInfo) err, list, total := new(dbModel.ExaFileUploadAndDownload).GetInfoList(pageInfo) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) diff --git a/QMPlusServer/controller/api/sys_api.go b/QMPlusServer/controller/api/sys_api.go index d10f2259d936841a0fa1406914cbf9877aa3579c..eae8ff6bafdb1eb2e2a3909882713465d1a625d0 100644 --- a/QMPlusServer/controller/api/sys_api.go +++ b/QMPlusServer/controller/api/sys_api.go @@ -27,7 +27,7 @@ type DeleteApiParams struct { // @Router /api/createApi [post] func CreateApi(c *gin.Context) { var api sysModel.SysApi - _ = c.BindJSON(&api) + _ = c.ShouldBindJSON(&api) err := api.CreateApi() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{}) @@ -46,7 +46,7 @@ func CreateApi(c *gin.Context) { // @Router /api/deleteApi [post] func DeleteApi(c *gin.Context) { var a sysModel.SysApi - _ = c.BindJSON(&a) + _ = c.ShouldBindJSON(&a) err := a.DeleteApi() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("删除失败:%v", err), gin.H{}) @@ -102,7 +102,7 @@ func GetApiList(c *gin.Context) { // @Router /api/getApiById [post] func GetApiById(c *gin.Context) { var idInfo GetById - _ = c.BindJSON(&idInfo) + _ = c.ShouldBindJSON(&idInfo) err, api := new(sysModel.SysApi).GetApiById(idInfo.Id) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) @@ -124,7 +124,7 @@ func GetApiById(c *gin.Context) { // @Router /api/updataApi [post] func UpdataApi(c *gin.Context) { var api sysModel.SysApi - _ = c.BindJSON(&api) + _ = c.ShouldBindJSON(&api) err := api.UpdataApi() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("修改数据失败,%v", err), gin.H{}) diff --git a/QMPlusServer/controller/api/sys_authority.go b/QMPlusServer/controller/api/sys_authority.go index d01d0bc0dd23dbabe2447bb0ccec7f4a02844798..d86d50de7566675848fe6169fa1bdb98a7809d93 100644 --- a/QMPlusServer/controller/api/sys_authority.go +++ b/QMPlusServer/controller/api/sys_authority.go @@ -50,7 +50,7 @@ type DeleteAuthorityPatams struct { // @Router /authority/deleteAuthority [post] func DeleteAuthority(c *gin.Context) { var a sysModel.SysAuthority - _ = c.BindJSON(&a) + _ = c.ShouldBindJSON(&a) //删除角色之前需要判断是否有用户正在使用此角色 err := a.DeleteAuthority() if err != nil { @@ -70,7 +70,7 @@ func DeleteAuthority(c *gin.Context) { // @Router /authority/getAuthorityList [post] func GetAuthorityList(c *gin.Context) { var pageInfo modelInterface.PageInfo - _ = c.BindJSON(&pageInfo) + _ = c.ShouldBindJSON(&pageInfo) err, list, total := new(sysModel.SysAuthority).GetInfoList(pageInfo) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) diff --git a/QMPlusServer/controller/api/sys_menu.go b/QMPlusServer/controller/api/sys_menu.go index ce9582db185b888dad259bb2955f8a65f91e482b..f60623c7015453b5755bb6680b669ca968f23baa 100644 --- a/QMPlusServer/controller/api/sys_menu.go +++ b/QMPlusServer/controller/api/sys_menu.go @@ -37,7 +37,7 @@ func GetMenu(c *gin.Context) { // @Router /menu/getMenuList [post] func GetMenuList(c *gin.Context) { var pageInfo modelInterface.PageInfo - _ = c.BindJSON(&pageInfo) + _ = c.ShouldBindJSON(&pageInfo) err, menuList, total := new(sysModel.SysBaseMenu).GetInfoList(pageInfo) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) @@ -61,7 +61,7 @@ func GetMenuList(c *gin.Context) { // @Router /menu/addBaseMenu [post] func AddBaseMenu(c *gin.Context) { var addMenu sysModel.SysBaseMenu - _ = c.BindJSON(&addMenu) + _ = c.ShouldBindJSON(&addMenu) err := addMenu.AddBaseMenu() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{}) @@ -101,7 +101,7 @@ type AddMenuAuthorityInfo struct { // @Router /menu/addMenuAuthority [post] func AddMenuAuthority(c *gin.Context) { var addMenuAuthorityInfo AddMenuAuthorityInfo - _ = c.BindJSON(&addMenuAuthorityInfo) + _ = c.ShouldBindJSON(&addMenuAuthorityInfo) err := new(sysModel.SysMenu).AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{}) @@ -124,7 +124,7 @@ type AuthorityIdInfo struct { // @Router /menu/addMenuAuthority [post] func GetMenuAuthority(c *gin.Context) { var authorityIdInfo AuthorityIdInfo - _ = c.BindJSON(&authorityIdInfo) + _ = c.ShouldBindJSON(&authorityIdInfo) err, menus := new(sysModel.SysMenu).GetMenuAuthority(authorityIdInfo.AuthorityId) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus}) @@ -147,7 +147,7 @@ type IdInfo struct { // @Router /menu/deleteBaseMenu [post] func DeleteBaseMenu(c *gin.Context) { var idInfo IdInfo - _ = c.BindJSON(&idInfo) + _ = c.ShouldBindJSON(&idInfo) err := new(sysModel.SysBaseMenu).DeleteBaseMenu(idInfo.Id) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("删除失败:%v", err), gin.H{}) @@ -166,7 +166,7 @@ func DeleteBaseMenu(c *gin.Context) { // @Router /menu/updataBaseMen [post] func UpdataBaseMenu(c *gin.Context) { var menu sysModel.SysBaseMenu - _ = c.BindJSON(&menu) + _ = c.ShouldBindJSON(&menu) err := menu.UpdataBaseMenu() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("修改失败:%v", err), gin.H{}) @@ -189,7 +189,7 @@ type GetById struct { // @Router /menu/getBaseMenuById [post] func GetBaseMenuById(c *gin.Context) { var idInfo GetById - _ = c.BindJSON(&idInfo) + _ = c.ShouldBindJSON(&idInfo) err, menu := new(sysModel.SysBaseMenu).GetBaseMenuById(idInfo.Id) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("查询失败:%v", err), gin.H{}) diff --git a/QMPlusServer/controller/api/sys_user.go b/QMPlusServer/controller/api/sys_user.go index 8982fb28aa1ac19291461cb9dfc2444130f7a0c2..cf3f1a09d89e60271001bbd33f7c32b3093e86c1 100644 --- a/QMPlusServer/controller/api/sys_user.go +++ b/QMPlusServer/controller/api/sys_user.go @@ -22,10 +22,10 @@ var ( ) type RegistAndLoginStuct struct { - Username string `json:"username"` - Password string `json:"password"` - Captcha string `json:"captcha"` - CaptchaId string `json:"captchaId"` + Username string `json:"username"` + Password string `json:"password"` + Captcha string `json:"captcha"` + CaptchaId string `json:"captchaId"` } type RegestStuct struct { @@ -44,7 +44,7 @@ type RegestStuct struct { // @Router /base/regist [post] func Regist(c *gin.Context) { var R RegestStuct - _ = c.BindJSON(&R) + _ = c.ShouldBindJSON(&R) user := &sysModel.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId} err, user := user.Regist() if err != nil { @@ -66,15 +66,15 @@ func Regist(c *gin.Context) { // @Router /base/login [post] func Login(c *gin.Context) { var L RegistAndLoginStuct - _ = c.BindJSON(&L) - if captcha.VerifyString(L.CaptchaId,L.Captcha) { + _ = c.ShouldBindJSON(&L) + if captcha.VerifyString(L.CaptchaId, L.Captcha) { U := &sysModel.SysUser{Username: L.Username, Password: L.Password} if err, user := U.Login(); err != nil { servers.ReportFormat(c, false, fmt.Sprintf("用户名密码错误或%v", err), gin.H{}) } else { tokenNext(c, *user) } - }else{ + } else { servers.ReportFormat(c, false, "验证码错误", gin.H{}) } @@ -149,7 +149,7 @@ type ChangePasswordStutrc struct { // @Router /user/changePassword [post] func ChangePassword(c *gin.Context) { var params ChangePasswordStutrc - _ = c.BindJSON(¶ms) + _ = c.ShouldBindJSON(¶ms) U := &sysModel.SysUser{Username: params.Username, Password: params.Password} if err, _ := U.ChangePassword(params.NewPassword); err != nil { servers.ReportFormat(c, false, "修改失败,请检查用户名密码", gin.H{}) @@ -208,7 +208,7 @@ func UploadHeaderImg(c *gin.Context) { // @Router /user/getUserList [post] func GetUserList(c *gin.Context) { var pageInfo modelInterface.PageInfo - _ = c.BindJSON(&pageInfo) + _ = c.ShouldBindJSON(&pageInfo) err, list, total := new(sysModel.SysUser).GetInfoList(pageInfo) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) @@ -237,7 +237,7 @@ type SetUserAuth struct { // @Router /user/setUserAuthority [post] func SetUserAuthority(c *gin.Context) { var sua SetUserAuth - _ = c.BindJSON(&sua) + _ = c.ShouldBindJSON(&sua) err := new(sysModel.SysUser).SetUserAuthority(sua.UUID, sua.AuthorityId) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("修改失败,%v", err), gin.H{}) diff --git a/QMPlusVuePage/src/view/login/login.vue b/QMPlusVuePage/src/view/login/login.vue index ac98838527bf4993c7b33a6b146ef10d61cafc75..de6e55cdc7830f9c1765e776cdce565e6045c853 100644 --- a/QMPlusVuePage/src/view/login/login.vue +++ b/QMPlusVuePage/src/view/login/login.vue @@ -20,7 +20,7 @@ 请输入验证码 diff --git a/QMPlusVuePage/vue.config.js b/QMPlusVuePage/vue.config.js index 0471071cdd5f2b5ea2e25f20981ddca01ae7a03c..6ea101218e27408ab196689ff359329b19f227aa 100644 --- a/QMPlusVuePage/vue.config.js +++ b/QMPlusVuePage/vue.config.js @@ -1,7 +1,7 @@ 'use strict' const path = require('path') - + function resolve(dir) { return path.join(__dirname, dir) }