后端:公告√
注意数据库新建notice表
This commit is contained in:
14
frontend/common/config.js
Normal file
14
frontend/common/config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// 统一配置:禁止在业务代码中硬编码
|
||||
// 优先级:环境变量(Vite/HBuilderX 构建注入) > 本地存储 > 默认值
|
||||
|
||||
const envBaseUrl = (typeof process !== 'undefined' && process.env && (process.env.VITE_APP_API_BASE_URL || process.env.API_BASE_URL)) || '';
|
||||
const storageBaseUrl = typeof uni !== 'undefined' ? (uni.getStorageSync('API_BASE_URL') || '') : '';
|
||||
const fallbackBaseUrl = 'http://localhost:8080';
|
||||
|
||||
export const API_BASE_URL = (envBaseUrl || storageBaseUrl || fallbackBaseUrl).replace(/\/$/, '');
|
||||
|
||||
const envShopId = (typeof process !== 'undefined' && process.env && (process.env.VITE_APP_SHOP_ID || process.env.SHOP_ID)) || '';
|
||||
const storageShopId = typeof uni !== 'undefined' ? (uni.getStorageSync('SHOP_ID') || '') : '';
|
||||
export const SHOP_ID = Number(envShopId || storageShopId || 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user