2025-09-15 21:03:25 +08:00
|
|
|
|
// 校验
|
|
|
|
|
|
export const validatePhone = (phone) => {
|
2025-09-19 16:45:02 +08:00
|
|
|
|
const reg = /^1[3-9]\d{9}$/;
|
|
|
|
|
|
return reg.test(phone);
|
2025-09-15 21:03:25 +08:00
|
|
|
|
};
|
2025-09-19 16:45:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const getImageUrl = (imagePath) => {
|
|
|
|
|
|
if (!imagePath ) return ''
|
|
|
|
|
|
if (imagePath.startsWith('http')) return imagePath
|
|
|
|
|
|
|
|
|
|
|
|
// const baseURL = "http://192.168.1.43:3000"
|
|
|
|
|
|
|
|
|
|
|
|
// 如果图片路径以/uploads开头,直接返回原路径
|
|
|
|
|
|
if (imagePath.startsWith('/uploads')) {
|
|
|
|
|
|
return `${imagePath}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return fullUrl
|
|
|
|
|
|
}
|