feat: 服务地址动态获取

This commit is contained in:
duanshuwen
2025-11-13 21:22:37 +08:00
parent 1028e20d42
commit 47d1c5ab6f
5 changed files with 9 additions and 9 deletions

View File

@@ -6,11 +6,11 @@ import { useAppStore } from "@/store";
const getEvnUrl = (args) => {
if (isProd) {
const appStore = useAppStore();
request.post("/hotelBiz/mainScene/getServiceUrl", args).then(({ data }) => {
console.log("🚀 ~ getEvnUrl ~ data:", data);
appStore.setServerConfig(data);
});
request
.post("https://biz.nianxx.cn/hotelBiz/mainScene/getServiceUrl", args)
.then(({ data }) => {
appStore.setServerConfig(data);
});
}
};

View File

@@ -16,7 +16,7 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
const appStore = useAppStore();
// 判断 url 是否以 http 开头
if (!/^http/.test(url)) {
url = appStore.serverConfig.baseUrl + url;
url = appStore.serverConfig?.baseUrl + url;
}
// 动态获取 token
const token = uni.getStorageSync("token");