指纹验证
This commit is contained in:
39
src/App.vue
39
src/App.vue
@@ -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>
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
@@ -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
1283
static/js/finger.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user