指纹验证

This commit is contained in:
wanyongkang
2020-12-03 14:34:35 +08:00
parent f3b71768b0
commit 6088930f29
4 changed files with 1322 additions and 51 deletions

View File

@@ -3,9 +3,46 @@
</template> </template>
<script> <script>
import FingerprintJS from '../static/js/finger'
export default { export default {
name: 'App' name: 'App',
created: function () {
this.confire_finger()
},
watch: {
// 方法1
'$route' (to, from) { // 监听路由是否变化
this.confire_finger()
}
},
methods: {
// 验证web指纹
confire_finger () {
(async () => {
// We recommend to call `load` at application startup.
const fp = await FingerprintJS.load()
// The FingerprintJS agent is ready.
// Get a visitor identifier when you'd like to.
const result = await fp.get()
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: visitorId}).then(res => {
// eslint-disable-next-line eqeqeq
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
}
}
} }
</script> </script>
<style> <style>

View File

@@ -18,7 +18,6 @@
<script> <script>
import QRCode from 'qrcodejs2' import QRCode from 'qrcodejs2'
import FingerprintJS from '@fingerprintjs/fingerprintjs'
var that = null var that = null
export default { export default {
@@ -31,31 +30,9 @@ export default {
}, },
props: {}, props: {},
created () { created () {
this.confire_finger()
}, },
methods: { methods: {
// 验证web指纹
confire_finger () {
(async () => {
// We recommend to call `load` at application startup.
const fp = await FingerprintJS.load()
// The FingerprintJS agent is ready.
// Get a visitor identifier when you'd like to.
const result = await fp.get()
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: visitorId}).then(res => {
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
},
open () { open () {
console.log(open) console.log(open)
var url = 'http://yk.hncore.net/store' var url = 'http://yk.hncore.net/store'

View File

@@ -28,8 +28,6 @@
</template> </template>
<script> <script>
import FingerprintJS from '@fingerprintjs/fingerprintjs'
export default { export default {
components: { components: {
@@ -56,35 +54,11 @@ export default {
}, },
created: function () { created: function () {
this.getvaild() this.getvaild()
this.confire_finger()
}, },
beforeDestroy: function () { beforeDestroy: function () {
clearTimeout(this.timerId) clearTimeout(this.timerId)
}, },
methods: { methods: {
// 验证web指纹
confire_finger () {
(async () => {
// We recommend to call `load` at application startup.
const fp = await FingerprintJS.load()
// The FingerprintJS agent is ready.
// Get a visitor identifier when you'd like to.
const result = await fp.get()
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: visitorId}).then(res => {
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
},
getMenus () { getMenus () {
this.$api this.$api
.get('manage/v1/ManagerToPermission/GetPermissions') .get('manage/v1/ManagerToPermission/GetPermissions')

1283
static/js/finger.js Normal file

File diff suppressed because it is too large Load Diff