import Taro from "@tarojs/taro" const BASE_URL = process.env.TARO_APP_API_BASE_URL || '未设置域名' console.log('BASE_URL', BASE_URL) const getHeaders = () => { return { 'Content-Type': 'application/json', } } // 发起GET请求 export const doGet = async (url: string, data?: any) => { try { const res = await Taro.request({ url: BASE_URL + url, method: 'GET', data: data || {}, header: getHeaders(), }) if (res.statusCode !== 200) { throw new Error(res.errMsg) } return res.data } catch (error) { throw error } }