Commit d7187807 authored by chenqikuai's avatar chenqikuai

add fingerprint

parent c9307f04
...@@ -1207,6 +1207,14 @@ ...@@ -1207,6 +1207,14 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@fingerprintjs/fingerprintjs": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs/-/fingerprintjs-3.3.0.tgz",
"integrity": "sha512-2kw2yVrfMKd0YvmYAdNxhGytNhhLvChqNAbBZWMglYVw2J95Jm50ketK5yS1C8SJmqG2nFJgeuWvYXeZEh+b8g==",
"requires": {
"tslib": "^2.0.1"
}
},
"@hapi/address": { "@hapi/address": {
"version": "2.1.4", "version": "2.1.4",
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
}, },
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@fingerprintjs/fingerprintjs": "^3.3.0",
"@quasar/extras": "^1.0.0", "@quasar/extras": "^1.0.0",
"ali-oss": "^6.16.0", "ali-oss": "^6.16.0",
"autosize": "^5.0.1", "autosize": "^5.0.1",
......
...@@ -18,6 +18,7 @@ import { getMasterIdFromDisplayMsg, getTargetIdFromDisplayMsg } from "./utils/ch ...@@ -18,6 +18,7 @@ import { getMasterIdFromDisplayMsg, getTargetIdFromDisplayMsg } from "./utils/ch
import isChattingWith from "./utils/isChattingWith"; import isChattingWith from "./utils/isChattingWith";
import { ChatMessageTypes } from "@/types/chatMessageTypes" import { ChatMessageTypes } from "@/types/chatMessageTypes"
import { chatCardTimeStamp } from "./store/chatCardStore"; import { chatCardTimeStamp } from "./store/chatCardStore";
import { getVisitorId } from "./utils/visitorId";
export default defineComponent({ export default defineComponent({
setup() { setup() {
...@@ -50,6 +51,9 @@ export default defineComponent({ ...@@ -50,6 +51,9 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
connect(); connect();
getVisitorId().then(id=>{
console.log(id, "show id");
})
}) })
watch(() => connectionState.error, () => { watch(() => connectionState.error, () => {
......
import axios from 'axios'
import { Toast } from 'vant'
const BaseInstance = axios.create({
baseURL: '/proxyApi',
})
BaseInstance.interceptors.response.use(
(value: any) => {
return value.data
},
(error) => {
Toast.fail(error.message)
throw new Error(error)
},
)
import FingerprintJS from '@fingerprintjs/fingerprintjs'
const VISITORID = 'VISITORID'
export async function getVisitorId() {
let id = sessionStorage.getItem(VISITORID)
if (!id) {
const fp = await FingerprintJS.load()
const result = await fp.get()
id = result.visitorId
sessionStorage.setItem(VISITORID, id)
}
return id
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment