feat 开发环隔离

This commit is contained in:
Ironsp
2026-09-24 11:32:02 +08:00
parent 5ab82d4571
commit 8a28f8654c
7 changed files with 11 additions and 3 deletions

1
.env.development Normal file
View File

@@ -0,0 +1 @@
VITE_API_BASE_URL=http://192.168.0.136:8080

1
.env.example Normal file
View File

@@ -0,0 +1 @@
VITE_API_BASE_URL=http://192.168.0.136:8080

2
.env.production Normal file
View File

@@ -0,0 +1,2 @@
# TODO: 替换为正式环境 API 地址
VITE_API_BASE_URL=https://api.example.com

View File

@@ -66,7 +66,7 @@ export function getReportDetail(reportId: number | string) {
* 使用 uni.uploadFile,适用于 App / 小程序本地文件路径
*/
export function uploadReport(data: UploadReportParams) {
const baseURL = import.meta.env.VITE_API_BASE_URL || 'https://api.example.com'
const baseURL = import.meta.env.VITE_API_BASE_URL || ''
return new Promise<ApiResult>((resolve, reject) => {
uni.uploadFile({

View File

@@ -3,7 +3,7 @@ import { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter'
import axios from 'axios'
const instance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL || 'https://api.example.com',
baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: 10000,
adapter: createUniAppAxiosAdapter(),
})

View File

@@ -40,6 +40,7 @@ declare global {
const extendRef: typeof import('@vueuse/core')['extendRef']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const getDeviceId: typeof import('./utils/device')['getDeviceId']
const getDeviceInfoFromStorage: typeof import('./utils/device')['getDeviceInfoFromStorage']
const getDeviceTypeName: typeof import('./utils/device')['getDeviceTypeName']
const getOrInitDeviceInfo: typeof import('./utils/device')['getOrInitDeviceInfo']
@@ -192,6 +193,7 @@ declare global {
const useDebounce: typeof import('@vueuse/core')['useDebounce']
const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
const useDeviceAuth: typeof import('./composables/useDeviceAuth')['useDeviceAuth']
const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
@@ -391,6 +393,7 @@ declare module 'vue' {
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
readonly getDeviceId: UnwrapRef<typeof import('./utils/device')['getDeviceId']>
readonly getDeviceInfoFromStorage: UnwrapRef<typeof import('./utils/device')['getDeviceInfoFromStorage']>
readonly getDeviceTypeName: UnwrapRef<typeof import('./utils/device')['getDeviceTypeName']>
readonly getOrInitDeviceInfo: UnwrapRef<typeof import('./utils/device')['getOrInitDeviceInfo']>
@@ -543,6 +546,7 @@ declare module 'vue' {
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
readonly useDebouncedRefHistory: UnwrapRef<typeof import('@vueuse/core')['useDebouncedRefHistory']>
readonly useDeviceAuth: UnwrapRef<typeof import('./composables/useDeviceAuth')['useDeviceAuth']>
readonly useDeviceMotion: UnwrapRef<typeof import('@vueuse/core')['useDeviceMotion']>
readonly useDeviceOrientation: UnwrapRef<typeof import('@vueuse/core')['useDeviceOrientation']>
readonly useDevicePixelRatio: UnwrapRef<typeof import('@vueuse/core')['useDevicePixelRatio']>

View File

@@ -73,7 +73,7 @@ function goActivate() {
</view>
<wd-input
v-model="activationCode"
prefix-icon="lock"
prefix-icon="unlock"
clearable
/>
</view>