From 8c6f61c2b5ca441e9cc348edf139a2cafdcd0b05 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 22 Jun 2021 12:39:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9D=83=E9=99=90,=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E7=94=A8=E6=88=B7=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改了: - server/api/v1/sys_authority.go - server/model/request/sys_casbin.go - server/model/request/sys_menu.go --- server/api/v1/sys_authority.go | 3 +++ server/model/request/sys_casbin.go | 4 ++++ server/model/request/sys_menu.go | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index 4b3f7149..f9ff6574 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -7,6 +7,7 @@ import ( "gin-vue-admin/model/response" "gin-vue-admin/service" "gin-vue-admin/utils" + "github.com/gin-gonic/gin" "go.uber.org/zap" ) @@ -30,6 +31,8 @@ func CreateAuthority(c *gin.Context) { global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) response.FailWithMessage("创建失败"+err.Error(), c) } else { + service.AddMenuAuthority(request.DefaultMenu(), authority.AuthorityId) + service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin()) response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c) } } diff --git a/server/model/request/sys_casbin.go b/server/model/request/sys_casbin.go index ccb461b8..40ac21cd 100644 --- a/server/model/request/sys_casbin.go +++ b/server/model/request/sys_casbin.go @@ -11,3 +11,7 @@ type CasbinInReceive struct { AuthorityId string `json:"authorityId"` // 权限id CasbinInfos []CasbinInfo `json:"casbinInfos"` } + +func DefaultCasbin() []CasbinInfo { + return []CasbinInfo{{Path: "/menu/getMenu", Method: "POST"}, {Path: "/jwt/jsonInBlacklist", Method: "POST"}} +} diff --git a/server/model/request/sys_menu.go b/server/model/request/sys_menu.go index 0c4b95da..3fe59160 100644 --- a/server/model/request/sys_menu.go +++ b/server/model/request/sys_menu.go @@ -1,9 +1,25 @@ package request -import "gin-vue-admin/model" +import ( + "gin-vue-admin/model" +) // Add menu authority info structure type AddMenuAuthorityInfo struct { Menus []model.SysBaseMenu AuthorityId string // 角色ID } + +func DefaultMenu() []model.SysBaseMenu { + return []model.SysBaseMenu{{ + ParentId: "0", + Path: "dashboard", + Name: "dashboard", + Component: "view/dashboard/index.vue", + Sort: 1, + Meta: model.Meta{ + Title: "仪表盘", + Icon: "setting", + }, + }} +} From 84a60389065754e8a20344ab260e3c3d8c1e640f Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Wed, 23 Jun 2021 10:46:54 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=87=E6=A1=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/utils/request.js | 7 ++++++- web/src/view/init/index.vue | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/utils/request.js b/web/src/utils/request.js index 884a5838..f86fc4ee 100644 --- a/web/src/utils/request.js +++ b/web/src/utils/request.js @@ -80,7 +80,12 @@ service.interceptors.response.use( }, error => { closeLoading() - MessageBox.confirm(`检测到接口错误${error},此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存`, '接口报错', { + MessageBox.confirm(` +

检测到接口错误${error}

+

错误码500:此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存

+

错误码404:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符

+ `, '接口报错', { + dangerouslyUseHTMLString: true, distinguishCancelAndClose: true, confirmButtonText: '清理缓存', cancelButtonText: '取消' diff --git a/web/src/view/init/index.vue b/web/src/view/init/index.vue index b87d200b..fbf71e4b 100644 --- a/web/src/view/init/index.vue +++ b/web/src/view/init/index.vue @@ -8,6 +8,7 @@

1.您需有用一定的VUE和golang基础

2.请您确认是否已经阅读过官方文档

3.请您确认是否了解后续的配置流程

+

注:开发组不为文档中书写过的内容提供无偿服务

阅读文档 From fe50461cbc747f12705bcf09a19af400ae88b357 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Wed, 23 Jun 2021 12:53:41 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0id=E9=81=BF=E5=85=8Dt?= =?UTF-8?q?ree=E9=87=8D=E5=A4=8D=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/request/sys_menu.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/model/request/sys_menu.go b/server/model/request/sys_menu.go index 3fe59160..c88f9c69 100644 --- a/server/model/request/sys_menu.go +++ b/server/model/request/sys_menu.go @@ -1,6 +1,7 @@ package request import ( + "gin-vue-admin/global" "gin-vue-admin/model" ) @@ -12,6 +13,7 @@ type AddMenuAuthorityInfo struct { func DefaultMenu() []model.SysBaseMenu { return []model.SysBaseMenu{{ + GVA_MODEL: global.GVA_MODEL{ID: 1}, ParentId: "0", Path: "dashboard", Name: "dashboard", From b92d45788664bf101a94d7399654cd86c9827bc7 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Fri, 25 Jun 2021 12:15:12 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A9=BAmenu=E7=9A=84?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/v1/sys_authority.go | 3 +-- server/api/v1/sys_menu.go | 3 +++ web/src/view/person/person.vue | 22 ++++++++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index f9ff6574..d2740fe0 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -31,8 +31,7 @@ func CreateAuthority(c *gin.Context) { global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) response.FailWithMessage("创建失败"+err.Error(), c) } else { - service.AddMenuAuthority(request.DefaultMenu(), authority.AuthorityId) - service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin()) + _ = service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin()) response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c) } } diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go index 4f920d7b..72eeb26c 100644 --- a/server/api/v1/sys_menu.go +++ b/server/api/v1/sys_menu.go @@ -24,6 +24,9 @@ func GetMenu(c *gin.Context) { global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) response.FailWithMessage("获取失败", c) } else { + if menus == nil { + menus = []model.SysMenu{} + } response.OkWithDetailed(response.SysMenusResponse{Menus: menus}, "获取成功", c) } } diff --git a/web/src/view/person/person.vue b/web/src/view/person/person.vue index f2348e60..c33e085e 100644 --- a/web/src/view/person/person.vue +++ b/web/src/view/person/person.vue @@ -18,15 +18,20 @@

  • {{ userInfo.nickName }}
  • -
  • - 北京反转极光科技有限公司-技术部-前端事业群 -
  • + +
  • + 北京反转极光科技有限公司-技术部-前端事业群 +
  • +
  • 中国·北京市·朝阳区
  • -
  • - goLang/JavaScript/Vue/Gorm -
  • + +
  • + goLang/JavaScript/Vue/Gorm +
  • +
    + @@ -245,7 +250,12 @@ export default { ul { display: inline-block; height: 100%; + width: 100%; li { + width: 100%; + white-space:nowrap; + overflow: hidden; + text-overflow: ellipsis; i { margin-right: 8px; }