Browse Source
Merge pull request #542 from flipped-aurora/gva_gormv2_dev
Gva gormv2 dev
main
奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
51 additions and
8 deletions
-
server/api/v1/sys_authority.go
-
server/api/v1/sys_menu.go
-
server/model/request/sys_casbin.go
-
server/model/request/sys_menu.go
-
web/src/utils/request.js
-
web/src/view/init/index.vue
-
web/src/view/person/person.vue
|
|
@ -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,7 @@ func CreateAuthority(c *gin.Context) { |
|
|
|
global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) |
|
|
|
response.FailWithMessage("创建失败"+err.Error(), c) |
|
|
|
} else { |
|
|
|
_ = service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin()) |
|
|
|
response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -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"}} |
|
|
|
} |
|
|
@ -1,9 +1,27 @@ |
|
|
|
package request |
|
|
|
|
|
|
|
import "gin-vue-admin/model" |
|
|
|
import ( |
|
|
|
"gin-vue-admin/global" |
|
|
|
"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{{ |
|
|
|
GVA_MODEL: global.GVA_MODEL{ID: 1}, |
|
|
|
ParentId: "0", |
|
|
|
Path: "dashboard", |
|
|
|
Name: "dashboard", |
|
|
|
Component: "view/dashboard/index.vue", |
|
|
|
Sort: 1, |
|
|
|
Meta: model.Meta{ |
|
|
|
Title: "仪表盘", |
|
|
|
Icon: "setting", |
|
|
|
}, |
|
|
|
}} |
|
|
|
} |
|
|
@ -80,7 +80,12 @@ service.interceptors.response.use( |
|
|
|
}, |
|
|
|
error => { |
|
|
|
closeLoading() |
|
|
|
MessageBox.confirm(`检测到接口错误${error},此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存`, '接口报错', { |
|
|
|
MessageBox.confirm(`
|
|
|
|
<p>检测到接口错误${error}</p> |
|
|
|
<p>错误码500:此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存</p> |
|
|
|
<p>错误码404:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符</p> |
|
|
|
`, '接口报错', {
|
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
distinguishCancelAndClose: true, |
|
|
|
confirmButtonText: '清理缓存', |
|
|
|
cancelButtonText: '取消' |
|
|
|
|
|
@ -8,6 +8,7 @@ |
|
|
|
<p class="init_p">1.您需有用一定的VUE和golang基础</p> |
|
|
|
<p class="init_p">2.请您确认是否已经阅读过官方文档</p> |
|
|
|
<p class="init_p">3.请您确认是否了解后续的配置流程</p> |
|
|
|
<p class="init_p">注:开发组不为文档中书写过的内容提供无偿服务</p> |
|
|
|
<p class="init_btn"> |
|
|
|
<el-button type="primary" @click="goDoc"> |
|
|
|
阅读文档 |
|
|
|
|
|
@ -18,15 +18,20 @@ |
|
|
|
<li> |
|
|
|
<i class="el-icon-user" />{{ userInfo.nickName }} |
|
|
|
</li> |
|
|
|
<el-tooltip class="item" effect="light" content="北京反转极光科技有限公司-技术部-前端事业群" placement="top"> |
|
|
|
<li> |
|
|
|
<i class="el-icon-data-analysis" />北京反转极光科技有限公司-技术部-前端事业群 |
|
|
|
</li> |
|
|
|
</el-tooltip> |
|
|
|
<li> |
|
|
|
<i class="el-icon-video-camera-solid" />中国·北京市·朝阳区 |
|
|
|
</li> |
|
|
|
<el-tooltip class="item" effect="light" content="goLang/JavaScript/Vue/Gorm" placement="top"> |
|
|
|
<li> |
|
|
|
<i class="el-icon-medal-1" />goLang/JavaScript/Vue/Gorm |
|
|
|
</li> |
|
|
|
</el-tooltip> |
|
|
|
|
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -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; |
|
|
|
} |
|
|
|