fix: app启动报错问题修复

This commit is contained in:
2026-05-28 14:33:10 +08:00
parent 2eb5f30d74
commit 7a75f8b4bf
6 changed files with 70 additions and 23 deletions
+19 -2
View File
@@ -6,11 +6,27 @@
import Request from 'luch-request';
import { apiPath, baseUrl, tenantId } from '@/sheep/config';
import $store from '@/sheep/store';
import $platform from '@/sheep/platform';
import { showAuthModal } from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth';
import { getTerminal } from '@/sheep/helper/const';
const getPlatformName = () => {
let name = 'H5';
// #ifdef APP-PLUS
name = 'App';
// #endif
// #ifdef MP-WEIXIN
name = 'WechatMiniProgram';
// #endif
// #ifdef H5
try {
const ua = String(navigator?.userAgent || '');
if (/MicroMessenger/i.test(ua)) name = 'WechatOfficialAccount';
} catch (e) {}
// #endif
return name;
};
const options = {
// 显示操作成功消息 默认不显示
showSuccess: false,
@@ -54,7 +70,7 @@ const http = new Request({
header: {
Accept: 'text/json',
'Content-Type': 'application/json;charset=UTF-8',
platform: $platform.name,
platform: getPlatformName(),
},
// #ifdef APP-PLUS
sslVerify: false,
@@ -105,6 +121,7 @@ http.interceptors.request.use(
if (token) {
config.header['Authorization'] = token;
}
config.header['platform'] = getPlatformName();
config.header['terminal'] = getTerminal();
config.header['Accept'] = '*/*';