From 8a28f8654ccdad2fffed3bd55a32da1bdc600281 Mon Sep 17 00:00:00 2001 From: Ironsp <1522278303@qq.com> Date: Thu, 24 Sep 2026 11:32:02 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=BC=80=E5=8F=91=E7=8E=AF=E9=9A=94?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + .env.example | 1 + .env.production | 2 ++ src/api/report/index.ts | 2 +- src/api/request.ts | 2 +- src/auto-imports.d.ts | 4 ++++ src/components/home/activateNotice.vue | 2 +- 7 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .env.development create mode 100644 .env.example create mode 100644 .env.production diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..e4ccad1 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_API_BASE_URL=http://192.168.0.136:8080 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e4ccad1 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_API_BASE_URL=http://192.168.0.136:8080 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..b950800 --- /dev/null +++ b/.env.production @@ -0,0 +1,2 @@ +# TODO: 替换为正式环境 API 地址 +VITE_API_BASE_URL=https://api.example.com diff --git a/src/api/report/index.ts b/src/api/report/index.ts index 3f865a3..817d9d8 100644 --- a/src/api/report/index.ts +++ b/src/api/report/index.ts @@ -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((resolve, reject) => { uni.uploadFile({ diff --git a/src/api/request.ts b/src/api/request.ts index fa4e4cf..1ea195d 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -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(), }) diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index 1959f69..04db546 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -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 readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef + readonly getDeviceId: UnwrapRef readonly getDeviceInfoFromStorage: UnwrapRef readonly getDeviceTypeName: UnwrapRef readonly getOrInitDeviceInfo: UnwrapRef @@ -543,6 +546,7 @@ declare module 'vue' { readonly useDebounce: UnwrapRef readonly useDebounceFn: UnwrapRef readonly useDebouncedRefHistory: UnwrapRef + readonly useDeviceAuth: UnwrapRef readonly useDeviceMotion: UnwrapRef readonly useDeviceOrientation: UnwrapRef readonly useDevicePixelRatio: UnwrapRef diff --git a/src/components/home/activateNotice.vue b/src/components/home/activateNotice.vue index 594a041..5a2e2e3 100644 --- a/src/components/home/activateNotice.vue +++ b/src/components/home/activateNotice.vue @@ -73,7 +73,7 @@ function goActivate() {