zycp-ddxcx/utils/tools.js

29 lines
619 B
JavaScript
Raw Normal View History

2022-03-09 07:06:54 +00:00
const toolAll = {
// 设置缓存
setCache(key,value){
dd.setStorageSync({
key: key,
data: value,
success: (res)=> {}
});
},
// 执行获取缓存
getCache(key){
return dd.getStorageSync({key}).data;
},
//执行删除缓存
removeCache(key){
return dd.removeStorage({key}).data;
},
// 手机号验证
isPhone(phone){
// 手机号正则表达式
let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if(!reg_tel.test(phone)){
return true
}
return false
},
}
export default toolAll;