Skip to content

Commit dfcf160

Browse files
author
奇淼(piexlmax
authored
Merge pull request #542 from flipped-aurora/gva_gormv2_dev
Gva gormv2 dev
2 parents ebf7a11 + 74cff90 commit dfcf160

File tree

7 files changed

+51
-8
lines changed

7 files changed

+51
-8
lines changed

server/api/v1/sys_authority.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"gin-vue-admin/model/response"
88
"gin-vue-admin/service"
99
"gin-vue-admin/utils"
10+
1011
"github.com/gin-gonic/gin"
1112
"go.uber.org/zap"
1213
)
@@ -30,6 +31,7 @@ func CreateAuthority(c *gin.Context) {
3031
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
3132
response.FailWithMessage("创建失败"+err.Error(), c)
3233
} else {
34+
_ = service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin())
3335
response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
3436
}
3537
}

server/api/v1/sys_menu.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ func GetMenu(c *gin.Context) {
2424
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
2525
response.FailWithMessage("获取失败", c)
2626
} else {
27+
if menus == nil {
28+
menus = []model.SysMenu{}
29+
}
2730
response.OkWithDetailed(response.SysMenusResponse{Menus: menus}, "获取成功", c)
2831
}
2932
}

server/model/request/sys_casbin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ type CasbinInReceive struct {
1111
AuthorityId string `json:"authorityId"` // 权限id
1212
CasbinInfos []CasbinInfo `json:"casbinInfos"`
1313
}
14+
15+
func DefaultCasbin() []CasbinInfo {
16+
return []CasbinInfo{{Path: "/menu/getMenu", Method: "POST"}, {Path: "/jwt/jsonInBlacklist", Method: "POST"}}
17+
}

server/model/request/sys_menu.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
package request
22

3-
import "gin-vue-admin/model"
3+
import (
4+
"gin-vue-admin/global"
5+
"gin-vue-admin/model"
6+
)
47

58
// Add menu authority info structure
69
type AddMenuAuthorityInfo struct {
710
Menus []model.SysBaseMenu
811
AuthorityId string // 角色ID
912
}
13+
14+
func DefaultMenu() []model.SysBaseMenu {
15+
return []model.SysBaseMenu{{
16+
GVA_MODEL: global.GVA_MODEL{ID: 1},
17+
ParentId: "0",
18+
Path: "dashboard",
19+
Name: "dashboard",
20+
Component: "view/dashboard/index.vue",
21+
Sort: 1,
22+
Meta: model.Meta{
23+
Title: "仪表盘",
24+
Icon: "setting",
25+
},
26+
}}
27+
}

web/src/utils/request.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ service.interceptors.response.use(
8080
},
8181
error => {
8282
closeLoading()
83-
MessageBox.confirm(`检测到接口错误${error},此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存`, '接口报错', {
83+
MessageBox.confirm(`
84+
<p>检测到接口错误${error}</p>
85+
<p>错误码500:此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存</p>
86+
<p>错误码404:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符</p>
87+
`, '接口报错', {
88+
dangerouslyUseHTMLString: true,
8489
distinguishCancelAndClose: true,
8590
confirmButtonText: '清理缓存',
8691
cancelButtonText: '取消'

web/src/view/init/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<p class="init_p">1.您需有用一定的VUE和golang基础</p>
99
<p class="init_p">2.请您确认是否已经阅读过官方文档</p>
1010
<p class="init_p">3.请您确认是否了解后续的配置流程</p>
11+
<p class="init_p">注:开发组不为文档中书写过的内容提供无偿服务</p>
1112
<p class="init_btn">
1213
<el-button type="primary" @click="goDoc">
1314
阅读文档

web/src/view/person/person.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,20 @@
1818
<li>
1919
<i class="el-icon-user" />{{ userInfo.nickName }}
2020
</li>
21-
<li>
22-
<i class="el-icon-data-analysis" />北京反转极光科技有限公司-技术部-前端事业群
23-
</li>
21+
<el-tooltip class="item" effect="light" content="北京反转极光科技有限公司-技术部-前端事业群" placement="top">
22+
<li>
23+
<i class="el-icon-data-analysis" />北京反转极光科技有限公司-技术部-前端事业群
24+
</li>
25+
</el-tooltip>
2426
<li>
2527
<i class="el-icon-video-camera-solid" />中国·北京市·朝阳区
2628
</li>
27-
<li>
28-
<i class="el-icon-medal-1" />goLang/JavaScript/Vue/Gorm
29-
</li>
29+
<el-tooltip class="item" effect="light" content="goLang/JavaScript/Vue/Gorm" placement="top">
30+
<li>
31+
<i class="el-icon-medal-1" />goLang/JavaScript/Vue/Gorm
32+
</li>
33+
</el-tooltip>
34+
3035
</ul>
3136
</div>
3237
</div>
@@ -245,7 +250,12 @@ export default {
245250
ul {
246251
display: inline-block;
247252
height: 100%;
253+
width: 100%;
248254
li {
255+
width: 100%;
256+
white-space:nowrap;
257+
overflow: hidden;
258+
text-overflow: ellipsis;
249259
i {
250260
margin-right: 8px;
251261
}

0 commit comments

Comments
 (0)