diff --git a/pages/index/index.vue b/pages/index/index.vue index b1928c91..8d953c6b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -51,6 +51,9 @@ if (options.page) { sheep.$router.go(decodeURIComponent(options.page)); } + + // TODO 芋艿:测试接口的调用 + sheep.$api.app.test(); }); // 下拉刷新 diff --git a/sheep/api/app.js b/sheep/api/app.js index 026caca8..7099047c 100644 --- a/sheep/api/app.js +++ b/sheep/api/app.js @@ -2,6 +2,18 @@ import request from '@/sheep/request'; import { baseUrl } from '@/sheep/config'; export default { + // TODO 芋艿:测试 + test: () => + request({ + url: '/app-api/promotion/decorate/list', + params: { + page: 1 + }, + custom: { + showError: false, + showLoading: false, + }, + }), // 系统初始化 init: (templateId) => request({ diff --git a/sheep/request/index.js b/sheep/request/index.js index d1d34088..8fb44616 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -85,6 +85,12 @@ http.interceptors.request.use( } const token = uni.getStorageSync('token'); if (token) config.header['Authorization'] = token; + // TODO 芋艿:特殊处理 + if (config.url.indexOf('/app-api/') !== -1) { + config.header['Accept'] = '*/*' + config.header['tenant-id'] = '1'; + config.header['Authorization'] = 'Bearer test247'; + } return config; }, (error) => { @@ -199,6 +205,11 @@ const request = (config) => { if (config.url[0] !== '/') { config.url = apiPath + config.url; } + // TODO 芋艿:额外拼接 + if (config.url.indexOf('/app-api/') >= 0) { + config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】 + // config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】 + } return http.middleware(config); };