refactor: 移除与UNI_PLATFORM相关的代码

不再需要处理不同平台的特殊逻辑,简化代码结构
This commit is contained in:
feige996
2025-09-22 17:46:38 +08:00
parent 07214d6497
commit b4273c7d95
4 changed files with 0 additions and 30 deletions

1
src/env.d.ts vendored
View File

@@ -33,4 +33,3 @@ interface ImportMeta {
}
declare const __VITE_APP_PROXY__: 'true' | 'false'
declare const __UNI_PLATFORM__: 'app' | 'h5' | 'mp-alipay' | 'mp-baidu' | 'mp-kuaishou' | 'mp-lark' | 'mp-qq' | 'mp-tiktok' | 'mp-weixin' | 'mp-xiaochengxu'

View File

@@ -1,7 +1,6 @@
import type { CustomRequestOptions } from '@/http/types'
import { useTokenStore } from '@/store'
import { getEnvBaseUrl } from '@/utils'
import { platform } from '@/utils/platform'
import { stringifyQuery } from './tools/queryString'
// 请求基准地址
@@ -44,7 +43,6 @@ const httpInterceptor = {
options.header = {
...options.header,
'Content-Type': 'application/json; charset=utf-8',
platform, // 可选,与 uniapp 定义的平台一致,告诉后台来源
}
// 3. 添加 token 请求头标识
const tokenStore = useTokenStore()

View File

@@ -1,26 +0,0 @@
/*
* @Author: 菲鸽
* @Date: 2024-03-28 19:13:55
* @Last Modified by: 菲鸽
* @Last Modified time: 2024-03-28 19:24:55
*/
export const platform = __UNI_PLATFORM__
export const isH5 = __UNI_PLATFORM__ === 'h5'
export const isApp = __UNI_PLATFORM__ === 'app'
export const isMp = __UNI_PLATFORM__.startsWith('mp-')
export const isMpWeixin = __UNI_PLATFORM__.startsWith('mp-weixin')
export const isMpAplipay = __UNI_PLATFORM__.startsWith('mp-alipay')
export const isMpToutiao = __UNI_PLATFORM__.startsWith('mp-toutiao')
export const isHarmony = __UNI_PLATFORM__.startsWith('app-harmony')
const PLATFORM = {
platform,
isH5,
isApp,
isMp,
isMpWeixin,
isMpAplipay,
isMpToutiao,
isHarmony,
}
export default PLATFORM

View File

@@ -138,7 +138,6 @@ export default defineConfig(({ command, mode }) => {
openDevTools(),
],
define: {
__UNI_PLATFORM__: JSON.stringify(UNI_PLATFORM),
__VITE_APP_PROXY__: JSON.stringify(VITE_APP_PROXY_ENABLE),
},
css: {