Procházet zdrojové kódy

feat(admin-h5): 支持开发/正式双环境自动切换 & 修复 Sass 弃用警告

- 新增 .env.development / .env.production 环境配置文件
- src/utils/index.js: baseApi 改为读取 VITE_BASE_API 环境变量
- package.json: 新增 build:h5:dev 脚本支持构建测试环境包
- vite.config.js: 添加 silenceDeprecations 消除 Sass legacy-js-api 和 @import 弃用警告
skyline před 15 hodinami
rodič
revize
327c0ab846

+ 3 - 0
admin-h5/.env.development

@@ -0,0 +1,3 @@
+# 开发/测试环境
+VITE_BASE_API = https://dev-wash-cloud.kuaiyuman.cn/admin
+VITE_APP_TITLE = 自助洗车运营管理(测试)

+ 3 - 0
admin-h5/.env.production

@@ -0,0 +1,3 @@
+# 正式生产环境
+VITE_BASE_API = https://cloud.yeswash.cn/admin
+VITE_APP_TITLE = 自助洗车运营管理

+ 1 - 0
admin-h5/package.json

@@ -6,6 +6,7 @@
   "scripts": {
     "dev:h5": "uni",
     "build:h5": "uni build",
+    "build:h5:dev": "uni build --mode development",
     "dev": "uni",
     "build": "uni build"
   },

+ 1 - 3
admin-h5/src/utils/index.js

@@ -161,9 +161,7 @@ export const request = (config) => {
     showLoading()
   }
 
-  // 根据admin-web配置,基础API地址为后台服务地址
-  // 请根据实际部署情况修改此地址
-  const baseApi = 'https://cloud.yeswash.cn/admin' // admin-web的后台服务地址
+  const baseApi = import.meta.env.VITE_BASE_API || 'https://cloud.yeswash.cn/admin'
 
   const fullUrl = `${baseApi}${url}`
   console.log(`发起${method}请求:`, fullUrl)

+ 8 - 1
admin-h5/vite.config.js

@@ -4,5 +4,12 @@ import uni from '@dcloudio/vite-plugin-uni'
 export default defineConfig({
   plugins: [
     uni()
-  ]
+  ],
+  css: {
+    preprocessorOptions: {
+      scss: {
+        silenceDeprecations: ['legacy-js-api', 'import']
+      }
+    }
+  }
 })