Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
gin-vue-admin
提交
01736764
G
gin-vue-admin
项目概览
飞鱼0526
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
01736764
编写于
3月 18, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
将验证码配置到配置文件中 增加ie适配css
上级
b6ea56ee
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
15 deletion
+23
-15
QMPlusServer/config/config.go
QMPlusServer/config/config.go
+7
-0
QMPlusServer/controller/api/sys_captcha.go
QMPlusServer/controller/api/sys_captcha.go
+6
-12
QMPlusServer/controller/servers/captcha.go
QMPlusServer/controller/servers/captcha.go
+2
-2
QMPlusServer/static/config/config.json
QMPlusServer/static/config/config.json
+5
-0
QMPlusVuePage/src/view/login/login.vue
QMPlusVuePage/src/view/login/login.vue
+3
-1
未找到文件。
QMPlusServer/config/config.go
浏览文件 @
01736764
...
...
@@ -13,6 +13,7 @@ type Config struct {
RedisAdmin
RedisAdmin
`json:"redisAdmin"`
System
System
`json:"system"`
JWT
JWT
`json:"jwt"`
Captcha
Captcha
`json:"captcha"`
}
type
System
struct
{
// 系统配置
...
...
@@ -47,6 +48,12 @@ type Qiniu struct { // 七牛 密钥配置
SecretKey
string
`json:"secretKey"`
}
type
Captcha
struct
{
// 验证码配置
KeyLong
int
`json:"keyLong"`
ImgWidth
int
`json:"imgWidth"`
ImgHeight
int
`json:"imgHeight"`
}
var
GinVueAdminconfig
Config
var
VTool
*
viper
.
Viper
...
...
QMPlusServer/controller/api/sys_captcha.go
浏览文件 @
01736764
package
api
import
(
"gin-vue-admin/config"
"gin-vue-admin/controller/servers"
"github.com/dchest/captcha"
"github.com/gin-gonic/gin"
...
...
@@ -15,11 +16,11 @@ import (
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /base/captcha [post]
func
Captcha
(
c
*
gin
.
Context
)
{
captchaId
:=
captcha
.
NewLen
(
6
)
servers
.
ReportFormat
(
c
,
true
,
"验证码获取成功"
,
gin
.
H
{
"captchaId"
:
captchaId
,
"picPath"
:
"/base/captcha/"
+
captchaId
+
".png"
,
})
captchaId
:=
captcha
.
NewLen
(
config
.
GinVueAdminconfig
.
Captcha
.
KeyLong
)
servers
.
ReportFormat
(
c
,
true
,
"验证码获取成功"
,
gin
.
H
{
"captchaId"
:
captchaId
,
"picPath"
:
"/base/captcha/"
+
captchaId
+
".png"
,
})
}
// @Tags base
...
...
@@ -32,10 +33,3 @@ func Captcha(c *gin.Context) {
func
CaptchaImg
(
c
*
gin
.
Context
)
{
servers
.
GinCapthcaServeHTTP
(
c
.
Writer
,
c
.
Request
)
}
QMPlusServer/controller/servers/captcha.go
浏览文件 @
01736764
...
...
@@ -3,6 +3,7 @@ package servers
import
(
"bytes"
"fmt"
"gin-vue-admin/config"
"github.com/dchest/captcha"
"net/http"
"path"
...
...
@@ -25,7 +26,7 @@ func GinCapthcaServeHTTP(w http.ResponseWriter, r *http.Request) {
}
lang
:=
strings
.
ToLower
(
r
.
FormValue
(
"lang"
))
download
:=
path
.
Base
(
dir
)
==
"download"
if
Serve
(
w
,
r
,
id
,
ext
,
lang
,
download
,
120
,
40
)
==
captcha
.
ErrNotFound
{
if
Serve
(
w
,
r
,
id
,
ext
,
lang
,
download
,
config
.
GinVueAdminconfig
.
Captcha
.
ImgWidth
,
config
.
GinVueAdminconfig
.
Captcha
.
ImgHeight
)
==
captcha
.
ErrNotFound
{
http
.
NotFound
(
w
,
r
)
}
}
...
...
@@ -52,4 +53,3 @@ func Serve(w http.ResponseWriter, r *http.Request, id, ext, lang string, downloa
http
.
ServeContent
(
w
,
r
,
id
+
ext
,
time
.
Time
{},
bytes
.
NewReader
(
content
.
Bytes
()))
return
nil
}
QMPlusServer/static/config/config.json
浏览文件 @
01736764
...
...
@@ -25,5 +25,10 @@
"useMultipoint"
:
false
,
"env"
:
"develop"
,
"addr"
:
8888
},
"captcha"
:
{
"keyLong"
:
6
,
"imgWidth"
:
120
,
"imgHeight"
:
40
}
}
\ No newline at end of file
QMPlusVuePage/src/view/login/login.vue
浏览文件 @
01736764
...
...
@@ -16,10 +16,11 @@
<i
:class=
"'el-input__icon el-icon-' + lock"
@
click=
"changeLock"
slot=
"suffix"
></i>
</el-input>
</el-form-item>
<el-form-item>
<el-form-item
style=
"position:relative"
>
<el-input
v-model=
"loginForm.captcha"
name=
"logVerify"
placeholder=
"请输入验证码"
maxlength=
"10"
/>
<img
:src=
"path + picPath"
alt=
"请输入验证码"
@
click=
"loginVefify()"
class=
"vPic"
>
...
...
@@ -121,6 +122,7 @@ export default {
.vPic
{
position
:
absolute
;
right
:
10px
;
bottom
:
0px
;
// 适配ie
}
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录