Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
b9612a26
Commit
b9612a26
authored
Jul 06, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add geetest demo.
parent
43b64f4c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
243 additions
and
0 deletions
+243
-0
demo.htm
doc/demo.htm
+243
-0
No files found.
doc/demo.htm
0 → 100644
View file @
b9612a26
<!DOCTYPE html>
<html
lang=
"zh"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
大图模式
</title>
<style>
body
{
margin
:
50px
0
;
text-align
:
center
;
font-family
:
"PingFangSC-Regular"
,
"Open Sans"
,
Arial
,
"Microsoft YaHei"
,
"WenQuanYi Micro Hei"
,
SimSun
,
sans-serif
;
}
.inp
{
border
:
1px
solid
#cccccc
;
border-radius
:
2px
;
padding
:
0
10px
;
width
:
278px
;
height
:
40px
;
font-size
:
18px
;
}
.btn
{
display
:
inline-block
;
box-sizing
:
border-box
;
border
:
1px
solid
#cccccc
;
border-radius
:
2px
;
width
:
100px
;
height
:
40px
;
line-height
:
40px
;
font-size
:
16px
;
color
:
#666
;
cursor
:
pointer
;
background
:
white
linear-gradient
(
180deg
,
#ffffff
0%
,
#f3f3f3
100%
);
}
.btn
:hover
{
background
:
white
linear-gradient
(
0deg
,
#ffffff
0%
,
#f3f3f3
100%
)
}
#captcha
{
width
:
300px
;
display
:
inline-block
;
}
label
{
vertical-align
:
top
;
display
:
inline-block
;
width
:
80px
;
text-align
:
right
;
}
#text
{
height
:
42px
;
width
:
298px
;
text-align
:
center
;
border-radius
:
2px
;
background-color
:
#F3F3F3
;
color
:
#BBBBBB
;
font-size
:
14px
;
letter-spacing
:
0.1px
;
line-height
:
42px
;
}
#wait
{
display
:
none
;
height
:
42px
;
width
:
298px
;
text-align
:
center
;
border-radius
:
2px
;
background-color
:
#F3F3F3
;
}
.loading
{
margin
:
auto
;
width
:
70px
;
height
:
20px
;
}
.loading-dot
{
float
:
left
;
width
:
8px
;
height
:
8px
;
margin
:
18px
4px
;
background
:
#ccc
;
-webkit-border-radius
:
50%
;
-moz-border-radius
:
50%
;
border-radius
:
50%
;
opacity
:
0
;
-webkit-box-shadow
:
0
0
2px
black
;
-moz-box-shadow
:
0
0
2px
black
;
-ms-box-shadow
:
0
0
2px
black
;
-o-box-shadow
:
0
0
2px
black
;
box-shadow
:
0
0
2px
black
;
-webkit-animation
:
loadingFade
1s
infinite
;
-moz-animation
:
loadingFade
1s
infinite
;
animation
:
loadingFade
1s
infinite
;
}
.loading-dot
:nth-child
(
1
)
{
-webkit-animation-delay
:
0s
;
-moz-animation-delay
:
0s
;
animation-delay
:
0s
;
}
.loading-dot
:nth-child
(
2
)
{
-webkit-animation-delay
:
0.1s
;
-moz-animation-delay
:
0.1s
;
animation-delay
:
0.1s
;
}
.loading-dot
:nth-child
(
3
)
{
-webkit-animation-delay
:
0.2s
;
-moz-animation-delay
:
0.2s
;
animation-delay
:
0.2s
;
}
.loading-dot
:nth-child
(
4
)
{
-webkit-animation-delay
:
0.3s
;
-moz-animation-delay
:
0.3s
;
animation-delay
:
0.3s
;
}
@-webkit-keyframes
loadingFade
{
0
%
{
opacity
:
0
;
}
50
%
{
opacity
:
0.8
;
}
100
%
{
opacity
:
0
;
}
}
@-moz-keyframes
loadingFade
{
0
%
{
opacity
:
0
;
}
50
%
{
opacity
:
0.8
;
}
100
%
{
opacity
:
0
;
}
}
@keyframes
loadingFade
{
0
%
{
opacity
:
0
;
}
50
%
{
opacity
:
0.8
;
}
100
%
{
opacity
:
0
;
}
}
</style>
</head>
<body>
<h1>
大图模式
</h1>
<form
id=
"form"
>
<div>
<label>
完成验证:
</label>
<div
id=
"captcha"
>
<div
id=
"text"
>
行为验证™ 安全组件加载中
</div>
<div
id=
"wait"
class=
"show"
>
<div
class=
"loading"
>
<div
class=
"loading-dot"
></div>
<div
class=
"loading-dot"
></div>
<div
class=
"loading-dot"
></div>
<div
class=
"loading-dot"
></div>
</div>
</div>
</div>
</div>
<br>
<div
id=
"btn"
class=
"btn"
>
提交
</div>
</form>
<script
src=
"https://apps.bdimg.com/libs/jquery/1.9.1/jquery.js"
></script>
<!-- 引入 gt.js,既可以使用其中提供的 initGeetest 初始化函数。为防劫持,强烈建议将此文件放在客户服务器!!!-->
<script
src=
"https://static.geetest.com/static/js/gt.0.4.9.js"
></script>
<script>
var
id
;
var
handler
=
function
(
captchaObj
)
{
captchaObj
.
appendTo
(
'
#captcha
'
);
captchaObj
.
onReady
(
function
()
{
$
(
"
#wait
"
).
hide
();
});
$
(
'
#btn
'
).
click
(
function
()
{
var
result
=
captchaObj
.
getValidate
();
if
(
!
result
)
{
return
alert
(
'
请完成验证
'
);
}
$
.
ajax
({
url
:
'
http://localhost:7006/v2/oauth/login
'
,
type
:
'
POST
'
,
beforeSend
:
function
(
XMLHttpRequest
){
XMLHttpRequest
.
setRequestHeader
(
"
qg-behavior-type
"
,
1
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-behavior-id
"
,
id
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-behavior-challenge
"
,
result
.
geetest_challenge
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-behavior-validate
"
,
result
.
geetest_validate
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-behavior-seccode
"
,
result
.
geetest_seccode
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-tenant-id
"
,
560761
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-registered-from
"
,
42
);
},
contentType
:
"
application/json
"
,
success
:
function
(
data
)
{
if
(
data
.
status
===
'
success
'
)
{
alert
(
'
登录成功
'
);
}
else
if
(
data
.
status
===
'
fail
'
)
{
alert
(
'
登录失败,请完成验证
'
);
captchaObj
.
reset
();
}
}
});
})
};
$
.
ajax
({
url
:
"
http://localhost:7006/v2/behavior/code
"
,
type
:
"
post
"
,
dataType
:
"
json
"
,
data
:
JSON
.
stringify
({
"
type
"
:
1
,
"
clientType
"
:
1
,
"
initializeDt
"
:
"
2023-07-06 17:59:00
"
,
"
phone
"
:
"
13000000000
"
}),
contentType
:
"
application/json
"
,
beforeSend
:
function
(
XMLHttpRequest
){
XMLHttpRequest
.
setRequestHeader
(
"
qg-tenant-id
"
,
560761
);
XMLHttpRequest
.
setRequestHeader
(
"
qg-registered-from
"
,
42
);
},
success
:
function
(
data
)
{
$
(
'
#text
'
).
hide
();
$
(
'
#wait
'
).
show
();
id
=
data
.
data
.
id
;
initGeetest
({
gt
:
data
.
data
.
geetestCode
.
gt
,
challenge
:
data
.
data
.
geetestCode
.
challenge
,
offline
:
false
,
new_captcha
:
data
.
data
.
geetestCode
.
newCaptcha
,
product
:
"
popup
"
,
width
:
"
300px
"
,
https
:
true
,
api_server
:
"
apiv6.geetest.com
"
},
handler
);
}
});
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment