更新请求环境配置

This commit is contained in:
微微一笑
2025-07-16 10:23:06 +08:00
parent f3a3778452
commit e42d4af3b2
8 changed files with 2287 additions and 2194 deletions

View File

@ -1,9 +1,10 @@
const BASE_URL = 'http://192.168.2.34:8000';
import config from '../config/index.js';
const request = (options) => {
console.log("options"+JSON.stringify(options))
return new Promise((resolve, reject) => {
// 处理GET请求参数
let url = BASE_URL + options.url;
let url = config.BASE_URL + options.url;
if (options.method === 'GET' && options.data) {
// 使用qs序列化参数
const params = Object.keys(options.data)
@ -41,7 +42,7 @@ const request = (options) => {
});
};
// 导出基础URL以便其他地方使用
export const baseURL = BASE_URL
export const baseURL = config.BASE_URL
export const getToken = () => uni.getStorageSync('token') // 获取token的方法
export const clientid =() => uni.getStorageSync('clientID');
export default request;