feat:H5 访问域名,改为 .env 配置

pull/147/head
YunaiV 2025-04-28 23:01:34 +08:00
parent 20e7593e14
commit 791e99057c
4 changed files with 7 additions and 3 deletions

3
.env
View File

@ -24,6 +24,9 @@ SHOPRO_DEV_PORT=3000
SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn
### SHOPRO_STATIC_URL = https://file.sheepjs.com ### SHOPRO_STATIC_URL = https://file.sheepjs.com
# 前端 H5 访问域名
SHOPRO_H5_URL=http://127.0.0.1:3000
# 是否开启直播 1 开启直播 | 0 关闭直播 # 是否开启直播 1 开启直播 | 0 关闭直播
SHOPRO_MPLIVE_ON=0 SHOPRO_MPLIVE_ON=0

View File

@ -19,6 +19,7 @@ export const apiPath = import.meta.env.SHOPRO_API_PATH;
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL; export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
export const tenantId = import.meta.env.SHOPRO_TENANT_ID; export const tenantId = import.meta.env.SHOPRO_TENANT_ID;
export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH; export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH;
export const h5Url = import.meta.env.SHOPRO_H5_URL;
export default { export default {
baseUrl, baseUrl,
@ -26,4 +27,5 @@ export default {
staticUrl, staticUrl,
tenantId, tenantId,
websocketPath, websocketPath,
h5Url,
}; };

View File

@ -309,4 +309,3 @@ export function jsonParse(str) {
return str; return str;
} }
} }
// TODO @芋艿:融合下;

View File

@ -4,7 +4,7 @@ import $platform from '@/sheep/platform';
import $router from '@/sheep/router'; import $router from '@/sheep/router';
import user from './user'; import user from './user';
import sys from './sys'; import sys from './sys';
import { baseUrl } from '@/sheep/config'; import { baseUrl, h5Url } from '@/sheep/config';
const app = defineStore({ const app = defineStore({
id: 'app', id: 'app',
@ -78,7 +78,7 @@ const app = defineStore({
this.platform = { this.platform = {
share: { share: {
methods: ['forward', 'poster', 'link'], methods: ['forward', 'poster', 'link'],
linkAddress: 'http://127.0.0.1:3000', // TODO 芋艿:可以考虑改到 .env 那 linkAddress: h5Url,
posterInfo: { posterInfo: {
user_bg: '/static/img/shop/config/user-poster-bg.png', user_bg: '/static/img/shop/config/user-poster-bg.png',
goods_bg: '/static/img/shop/config/goods-poster-bg.png', goods_bg: '/static/img/shop/config/goods-poster-bg.png',