feat: 服务地址动态获取
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"appid": "wx23f86d809ae80259",
|
"appid": "wx5e79df5996572539",
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "3.8.10",
|
"libVersion": "3.8.10",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import rawConfigs from '../../client-configs.json' with { type: 'json' };
|
|||||||
export const CLIENT_CONFIGS = rawConfigs;
|
export const CLIENT_CONFIGS = rawConfigs;
|
||||||
|
|
||||||
// 获取当前用户端配置
|
// 获取当前用户端配置
|
||||||
export const getCurrentConfig = () => CLIENT_CONFIGS.duohua;
|
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
|
||||||
export const clientId = getCurrentConfig().clientId;
|
export const clientId = getCurrentConfig().clientId;
|
||||||
export const appId = getCurrentConfig().appId;
|
export const appId = getCurrentConfig().appId;
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
朵花:wx23f86d809ae80259
|
朵花:wx23f86d809ae80259
|
||||||
*/
|
*/
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx23f86d809ae80259",
|
"appid": "wx5e79df5996572539",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"minified": true
|
"minified": true
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { useAppStore } from "@/store";
|
|||||||
const getEvnUrl = (args) => {
|
const getEvnUrl = (args) => {
|
||||||
if (isProd) {
|
if (isProd) {
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
request
|
||||||
request.post("/hotelBiz/mainScene/getServiceUrl", args).then(({ data }) => {
|
.post("https://biz.nianxx.cn/hotelBiz/mainScene/getServiceUrl", args)
|
||||||
console.log("🚀 ~ getEvnUrl ~ data:", data);
|
.then(({ data }) => {
|
||||||
appStore.setServerConfig(data);
|
appStore.setServerConfig(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
|||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
// 判断 url 是否以 http 开头
|
// 判断 url 是否以 http 开头
|
||||||
if (!/^http/.test(url)) {
|
if (!/^http/.test(url)) {
|
||||||
url = appStore.serverConfig.baseUrl + url;
|
url = appStore.serverConfig?.baseUrl + url;
|
||||||
}
|
}
|
||||||
// 动态获取 token
|
// 动态获取 token
|
||||||
const token = uni.getStorageSync("token");
|
const token = uni.getStorageSync("token");
|
||||||
|
|||||||
Reference in New Issue
Block a user