Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fj-captcha-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
郑磊
fj-captcha-service
Commits
b62800d3
Commit
b62800d3
authored
May 20, 2024
by
郑磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播app特殊支持页
parent
994eacc7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
3 deletions
+89
-3
index.html
web/index.html
+1
-1
live.html
web/live.html
+15
-0
App.vue
web/src/index/App.vue
+0
-0
main.ts
web/src/index/main.ts
+2
-2
App.vue
web/src/live/App.vue
+38
-0
in-app.ts
web/src/live/in-app.ts
+21
-0
main.ts
web/src/live/main.ts
+6
-0
vite.config.ts
web/vite.config.ts
+6
-0
No files found.
web/index.html
View file @
b62800d3
...
...
@@ -10,6 +10,6 @@
</head>
<body>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/main.ts"
></script>
<script
type=
"module"
src=
"/src/
index/
main.ts"
></script>
</body>
</html>
web/live.html
0 → 100644
View file @
b62800d3
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
/>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover"
/>
<title>
Captcha
</title>
</head>
<body>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/live/main.ts"
></script>
</body>
</html>
web/src/App.vue
→
web/src/
index/
App.vue
View file @
b62800d3
File moved
web/src/main.ts
→
web/src/
index/
main.ts
View file @
b62800d3
import
{
createApp
}
from
'vue'
import
'./style.css'
import
'fj-captcha-vue/esm/style.css'
import
{
createApp
}
from
'vue'
import
'../style.css'
import
App
from
'./App.vue'
createApp
(
App
).
mount
(
'#app'
)
web/src/live/App.vue
0 → 100644
View file @
b62800d3
<
script
setup
lang=
"ts"
>
import
URL
from
'core-js-pure/features/url'
import
{
Captcha
}
from
'fj-captcha-vue'
import
{
callAppMethod
}
from
'./in-app'
const
requestCaptchaDataUrl
=
import
.
meta
.
env
.
VITE_REQUEST_CAPTCHA_URL
const
validCaptchaUrl
=
import
.
meta
.
env
.
VITE_VALID_CAPTCHA_URL
//通过URL上的参数解析验证码组件的参数
const
{
locale
}
=
(()
=>
{
const
url
=
new
URL
(
location
.
href
)
const
locale
=
url
.
searchParams
.
get
(
'lang'
)
??
undefined
return
{
locale
,
}
})()
/**
* 当验证码校验成功时
* @param id
*/
const
onSuccess
=
(
id
:
string
)
=>
{
callAppMethod
(
'fetchImageCode'
,
{
captcha_key
:
id
,
})
}
</
script
>
<
template
>
<Captcha
:requestCaptchaDataUrl=
"requestCaptchaDataUrl"
:validCaptchaUrl=
"validCaptchaUrl"
:showClose=
"false"
:locale=
"locale"
@
success=
"onSuccess"
/>
</
template
>
web/src/live/in-app.ts
0 → 100644
View file @
b62800d3
const
device
=
navigator
.
userAgent
.
includes
(
'iPhone'
)
?
'iOS'
:
'android'
/**
* 调用app侧提供的方法
*/
export
function
callAppMethod
(
name
:
string
,
data
:
any
)
{
switch
(
device
)
{
case
'iOS'
:
// @ts-ignore
window
.
webkit
.
messageHandlers
[
name
].
postMessage
(
typeof
data
===
undefined
?
true
:
data
,
)
break
case
'android'
:
// @ts-ignore
window
.
liveapp
[
name
](
typeof
data
===
undefined
?
undefined
:
JSON
.
stringify
(
data
),
)
break
}
}
web/src/live/main.ts
0 → 100644
View file @
b62800d3
import
'fj-captcha-vue/esm/style.css'
import
{
createApp
}
from
'vue'
import
'../style.css'
import
App
from
'./App.vue'
createApp
(
App
).
mount
(
'#app'
)
web/vite.config.ts
View file @
b62800d3
...
...
@@ -14,5 +14,11 @@ export default defineConfig({
},
build
:
{
cssTarget
:
'chrome61'
,
rollupOptions
:
{
input
:
{
index
:
'./index.html'
,
live
:
'./live.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