fix
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Fingerprint2 from 'fingerprintjs2';//获取浏览器唯一标识
|
||||
const isEmail = (email) => {
|
||||
let reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
|
||||
let result = reg.test(email)
|
||||
@@ -182,6 +183,25 @@ function getBrowserInfo() {//获取是什么浏览器
|
||||
return agent.match(regStr_saf);
|
||||
}
|
||||
}
|
||||
async function murmur(){
|
||||
return await new Promise((resolve,reject)=>{
|
||||
Fingerprint2.get(function (components) {
|
||||
const values = components.map(function (
|
||||
component,
|
||||
index
|
||||
) {
|
||||
if (index === 0) {
|
||||
//把微信浏览器里UA的wifi或4G等网络替换成空,不然切换网络会ID不一样
|
||||
return component.value.replace(/\bNetType\/\w+\b/, "");
|
||||
}
|
||||
return component.value;
|
||||
});
|
||||
// 生成最终id murmur
|
||||
let murmur = Fingerprint2.x64hash128(values.join(""), 31);
|
||||
resolve(murmur)
|
||||
});
|
||||
})
|
||||
}
|
||||
export {
|
||||
isEmail,
|
||||
getUploadUrl,
|
||||
@@ -194,4 +214,5 @@ export {
|
||||
isMoible,
|
||||
downloadIamge,
|
||||
getBrowserInfo,
|
||||
murmur,
|
||||
}
|
||||
Reference in New Issue
Block a user