52 lines
1.2 KiB
Vue
52 lines
1.2 KiB
Vue
<template>
|
|
<router-view ></router-view>
|
|
</template>
|
|
|
|
<script>
|
|
import FingerprintJS from '../static/js/finger'
|
|
|
|
export default {
|
|
name: 'App',
|
|
created: function () {
|
|
},
|
|
watch: {
|
|
// 方法1
|
|
'$route' (to, from) { // 监听路由是否变化
|
|
if(to.fullPath != '/r')
|
|
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>
|
|
#app {
|
|
}
|
|
</style>
|