初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
// 定义一个全局请求配置(可被多个拦截器修改)
|
||||
import {setCache} from "@/utils/cache";
|
||||
import {API_BASE, BRAND} from './env.js';
|
||||
|
||||
export let globalConfig = {
|
||||
baseURL: 'https://wx.api.borman.top/api/',
|
||||
// baseURL: 'http://brm.wx.api.borman.top/api/',
|
||||
// baseURL: 'https://wx.boerman.top/api/',
|
||||
// baseURL: 'http://127.0.0.1:18004/api/', // 本地测试地址
|
||||
// baseURL: 'http://127.0.0.1:18006/api/', // 本地测试地址
|
||||
// baseURL 由 api/env.js 统一注入:开发环境走本地,生产环境按 BRAND(brm/wl)切换
|
||||
baseURL: API_BASE,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
'Content-Type': 'application/json',
|
||||
// 双品牌共用后端时靠这个分流 AppID / 默认装修模板
|
||||
'X-App-Code': BRAND,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,10 +48,8 @@ export async function runResponseInterceptors(response) {
|
||||
|
||||
// 初始化默认拦截器(可选)
|
||||
addRequestInterceptor(config => {
|
||||
// 自动携带token示例
|
||||
// 自动携带token:从本地缓存读,不再有硬编码测试 token
|
||||
const token = uni.getStorageSync('token');
|
||||
// 临时token(测试用)
|
||||
// const token = 'JG7hKhTQoANh/hyL67BzIg==';
|
||||
if (token) {
|
||||
config.header.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user