2025-09-19
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// api.js - 适配uView3+uni-app版本
|
||||
|
||||
// 基础配置
|
||||
const BASE_URL = 'http://192.168.1.43:3000/api'
|
||||
const BASE_URL = 'http://192.168.1.55:5001/api'
|
||||
const TIMEOUT = 10000
|
||||
|
||||
// 初始化时设置token
|
||||
@@ -279,6 +279,7 @@ const handleError = (errorInfo) => {
|
||||
export const http = {
|
||||
get: (url, params = {}, config = {}) => request({
|
||||
url,
|
||||
params,
|
||||
method: 'GET',
|
||||
...config
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
// 校验
|
||||
export const validatePhone = (phone) => {
|
||||
const reg = /^1[3-9]\d{9}$/;
|
||||
return reg.test(phone);
|
||||
const reg = /^1[3-9]\d{9}$/;
|
||||
return reg.test(phone);
|
||||
};
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user