指纹验证

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>
<script>
import FingerprintJS from '../static/js/finger'
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>
<style>

View File

@@ -18,7 +18,6 @@
<script>
import QRCode from 'qrcodejs2'
import FingerprintJS from '@fingerprintjs/fingerprintjs'
var that = null
export default {
@@ -31,31 +30,9 @@ export default {
},
props: {},
created () {
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 => {
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
},
open () {
console.log(open)
var url = 'http://yk.hncore.net/store'

View File

@@ -28,8 +28,6 @@
</template>
<script>
import FingerprintJS from '@fingerprintjs/fingerprintjs'
export default {
components: {
@@ -56,35 +54,11 @@ export default {
},
created: function () {
this.getvaild()
this.confire_finger()
},
beforeDestroy: function () {
clearTimeout(this.timerId)
},
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 () {
this.$api
.get('manage/v1/ManagerToPermission/GetPermissions')

1283
static/js/finger.js Normal file

File diff suppressed because it is too large Load Diff