指纹验证
This commit is contained in:
39
src/App.vue
39
src/App.vue
@@ -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>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user