Files
rd_mes_uniapp/utils/judge.ts
2025-12-18 14:11:48 +08:00

29 lines
884 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 判断传入的值是否有值(不为null,'',undefined)
* 有则返回true没有则返回false
* @param {number | string | object} value
* @return boolean
*/
export function hasValue(value : number | string | { [key: string]: any}):boolean{
if(typeof value == 'number' || typeof value == 'string'){
if(value != null && value != '' && value != undefined) return true
}
if(typeof value === 'object'){
for(let i in value){
if(value[i] != null && value[i] != '' && value[i] != undefined) return true
}
}
return false
}
/**
* 获取当前北京时间
* @return
*/
export function getBeijingTime():string{
//获取当前北京时间的时间戳(单位为毫秒)
const stamp= new Date().getTime() + 8 * 60 * 60 * 1000;
const beijingTime = new Date(stamp).toISOString().replace(/T/, ' ').replace(/\..+/, '').substring(0, 19);
return beijingTime
}