10
This commit is contained in:
+79
-6
@@ -1,16 +1,88 @@
|
||||
import _ from "lodash";
|
||||
|
||||
//import i18n from '@/locales'
|
||||
import base from '@/common/config';
|
||||
//import store from "@/store";
|
||||
const isString = (v)=> {
|
||||
return typeof v === 'string' || v instanceof String;
|
||||
},
|
||||
isNumber=(v) =>{
|
||||
return typeof v === 'number' && !isNaN(v);
|
||||
},
|
||||
isInteger=(v) =>{
|
||||
return typeof v === 'number' && isFinite(v) && Math.floor(v) === v;
|
||||
},
|
||||
isBoolean=(v) =>{
|
||||
return typeof v === 'boolean';
|
||||
},
|
||||
isArray=(v) =>{
|
||||
return Array.isArray(v);
|
||||
},
|
||||
isObject=(v) =>{
|
||||
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
||||
},
|
||||
isFunction=(v) =>{
|
||||
return typeof v === 'function';
|
||||
},
|
||||
isNull=(v) =>{
|
||||
return v === null;
|
||||
},
|
||||
isUndefined=(v) =>{
|
||||
return typeof v === 'undefined';
|
||||
},
|
||||
isSymbol=(v) =>{
|
||||
return typeof v === 'symbol';
|
||||
},
|
||||
isDate=(v) =>{
|
||||
return Object.prototype.toString.call(v) === '[object Date]';
|
||||
},
|
||||
isRegExp=(v) =>{
|
||||
return Object.prototype.toString.call(v) === '[object RegExp]';
|
||||
},
|
||||
isError=(v) =>{
|
||||
return v instanceof Error;
|
||||
},
|
||||
isMap=(v) =>{
|
||||
return v instanceof Map;
|
||||
},
|
||||
isSet=(v) =>{
|
||||
return v instanceof Set;
|
||||
},
|
||||
isWeakMap=(v) =>{
|
||||
return v instanceof WeakMap;
|
||||
},
|
||||
isWeakSet=(v) =>{
|
||||
return v instanceof WeakSet;
|
||||
};
|
||||
export default{
|
||||
isString :isString,
|
||||
isNumber :isNumber,
|
||||
isInteger :isInteger,
|
||||
isBoolean :isBoolean,
|
||||
isArray :isArray,
|
||||
isObject :isObject,
|
||||
isFunction :isFunction,
|
||||
isNull :isNull,
|
||||
isUndefined :isUndefined,
|
||||
isSymbol :isSymbol,
|
||||
isDate :isDate,
|
||||
isRegExp :isRegExp,
|
||||
isError :isError,
|
||||
isMap :isMap,
|
||||
isSet :isSet,
|
||||
isWeakMap :isWeakMap,
|
||||
isWeakSet :isWeakSet,
|
||||
cdn(v){
|
||||
v= v || "";
|
||||
v = v.replace(/\\/ig,"/").replace('/\/\/ig',"/");
|
||||
if(_.isString(v)){
|
||||
if(v.substr(0,5) == 'blob:'){
|
||||
console.log(v);
|
||||
if(isString(v)){
|
||||
if(v.startsWith('blob:')){
|
||||
return v;
|
||||
}
|
||||
v= v.substring(0,1) == '/' ? v : '/'+v;
|
||||
if(v.startsWith('file://')){
|
||||
return v;
|
||||
}
|
||||
v= v.startsWith('/') ? v : '/'+v;
|
||||
return base.cdnUrl+''+v;
|
||||
}
|
||||
return "";
|
||||
@@ -19,7 +91,7 @@ export default{
|
||||
console.log(url);
|
||||
type = type || '0'; //0 navigateTo 1 redirectTo
|
||||
if(url){
|
||||
if(_.isInteger(url)){
|
||||
if(isInteger(url)){
|
||||
uni.navigateBack({
|
||||
delta:url,
|
||||
})
|
||||
@@ -144,5 +216,6 @@ export default{
|
||||
v=v+"";
|
||||
v = parseFloat(v).toFixed(wei || 2);
|
||||
return parseFloat(v);
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user