Browse Source

Merge pull request #542 from flipped-aurora/gva_gormv2_dev

Gva gormv2 dev
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
b96c357eb1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      server/api/v1/sys_authority.go
  2. 3
      server/api/v1/sys_menu.go
  3. 4
      server/model/request/sys_casbin.go
  4. 20
      server/model/request/sys_menu.go
  5. 7
      web/src/utils/request.js
  6. 1
      web/src/view/init/index.vue
  7. 10
      web/src/view/person/person.vue

2
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,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)
}
}

3
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)
}
}

4
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"}}
}

20
server/model/request/sys_menu.go

@ -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",
},
}}
}

7
web/src/utils/request.js

@ -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: '取消'

1
web/src/view/init/index.vue

@ -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">
阅读文档

10
web/src/view/person/person.vue

@ -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;
}

Loading…
Cancel
Save