Browse Source

Merge branches 'gva_gormv2_dev' and 'gva_workflow' of https://github.com/flipped-aurora/gin-vue-admin into gva_workflow

main
QM303176530 4 years ago
parent
commit
2c9e446826
  1. 2
      server/middleware/cors.go
  2. 4
      server/middleware/jwt.go
  3. 2
      server/resource/template/fe/table.vue.tpl
  4. 5
      web/src/style/main.scss

2
server/middleware/cors.go

@ -11,7 +11,7 @@ func Cors() gin.HandlerFunc {
method := c.Request.Method
origin := c.Request.Header.Get("Origin")
c.Header("Access-Control-Allow-Origin", origin)
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id\"")
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id")
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT")
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
c.Header("Access-Control-Allow-Credentials", "true")

4
server/middleware/jwt.go

@ -16,7 +16,7 @@ import (
func JWTAuth() gin.HandlerFunc {
return func(c *gin.Context) {
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localSstorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localStorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
token := c.Request.Header.Get("x-token")
if token == "" {
response.Result(response.ERROR, gin.H{
@ -66,7 +66,7 @@ func JWTAuth() gin.HandlerFunc {
if err!=nil {
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
}else{
service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
//当之前的取成功时才进行拉黑操作
}
// 无论如何都要记录当前的活跃状态

2
server/resource/template/fe/table.vue.tpl

@ -67,7 +67,7 @@
{{ end }}
<el-table-column label="按钮组">
<template slot-scope="scope">
<el-button @click="update{{.StructName}}(scope.row)" size="small" type="primary">变更</el-button>
<el-button class="table-button" @click="update{{.StructName}}(scope.row)" size="small" type="primary" icon="el-icon-edit">变更</el-button>
<el-popover placement="top" width="160" v-model="scope.row.visible">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">

5
web/src/style/main.scss

@ -1026,4 +1026,9 @@ li {
color: #606266;
cursor: pointer;
font-size: 13px;
}
.table-button{
margin-right:8px !important;
}
Loading…
Cancel
Save