diff --git a/public/nginx.htaccess b/public/nginx.htaccess new file mode 100644 index 0000000..6e384eb --- /dev/null +++ b/public/nginx.htaccess @@ -0,0 +1,7 @@ +# FastAdmin / ThinkPHP 伪静态 +# 本文件被 nginx vhost 的 location / 通过 include 引入(见 fenleixinxi_9980.conf)。 +# 作用:文件/目录不存在时,统一交给入口 index.php 走 ?s= 路由, +# 使 /api/v1/** 、/s.php/** 等完整 URL 与线上一致可用。 +if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?s=$1 last; +} diff --git a/uniapp/common/config/index.js b/uniapp/common/config/index.js index e093ae1..8f360f4 100644 --- a/uniapp/common/config/index.js +++ b/uniapp/common/config/index.js @@ -1,18 +1,33 @@ /** * 全局配置 - * 说明:小程序端默认走真实后端;在未联调/离线演示时自动降级到 mock。 + * + * 环境(无需手动切换): + * - HBuilderX「运行」 → NODE_ENV=development → dev:本地后端 + * - HBuilderX「发行/打包」→ NODE_ENV=production → prod:远程正式后端 */ -// 条件编译:H5 / 小程序 / App 分别可指向不同网关 -let BASE_URL = 'https://fenleixinxi.gzyakj.com.cn/api' -// #ifdef H5 -BASE_URL = '/api' -// #endif -// #ifdef MP-WEIXIN -BASE_URL = 'https://fenleixinxi.gzyakj.com.cn/api' -// #endif +// 编译期常量;发行包会摇树消除 dev 分支,不会把本地地址打进正式包 +const ENV = + (typeof process !== 'undefined' && process.env && process.env.NODE_ENV) || + 'development' +const IS_DEV = ENV !== 'production' + +// 各环境后端域名(dev=运行 / prod=发行) +const HOSTS = { + dev: 'http://127.0.0.1:9980', // 本地后端 + prod: 'https://fenleixinxi.gzyakj.com.cn', // 远程正式后端 +} +// 接口统一前缀 +const API_PREFIX = '/api' + +// 网关 = 域名 + /api(版本号由下方 apiVersion 拼接) +const BASE_URL = HOSTS[IS_DEV ? 'dev' : 'prod'] + API_PREFIX export const config = { + // 当前环境:'development'(HBuilderX 运行)| 'production'(发行) + env: ENV, + // 是否开发环境便于页面按需分支 + isDev: IS_DEV, // 后端服务地址(后台地址来自 AGENTS.md) baseURL: BASE_URL, // 接口版本 diff --git a/uniapp/manifest.json b/uniapp/manifest.json index 6e967b5..fe88f94 100644 --- a/uniapp/manifest.json +++ b/uniapp/manifest.json @@ -60,6 +60,11 @@ "usingComponents" : true, "optimization" : { "subPackages" : true + }, + "permission" : { + "scope.userLocation" : { + "desc" : "位置定位,附近服务匹配需要" + } } }, "mp-alipay" : {