2
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
"use strict";
|
||||
const _imports_0$1 = "/static/icons/icons8-shopping-cart-100.png";
|
||||
const _imports_0 = "/static/logo.png";
|
||||
exports._imports_0 = _imports_0$1;
|
||||
exports._imports_0$1 = _imports_0;
|
||||
const _imports_0$4 = "/static/icons/icons8-shopping-cart-100.png";
|
||||
const _imports_0$3 = "/static/icons/icons8-login-50.png";
|
||||
const _imports_0$2 = "/static/logo.png";
|
||||
const _imports_0$1 = "/static/icons/icons8-vip-48 (1).png";
|
||||
const _imports_0 = "/static/icons/icons8-close-48.png";
|
||||
exports._imports_0 = _imports_0$4;
|
||||
exports._imports_0$1 = _imports_0$3;
|
||||
exports._imports_0$2 = _imports_0$2;
|
||||
exports._imports_0$3 = _imports_0$1;
|
||||
exports._imports_0$4 = _imports_0;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/assets.js.map
|
||||
|
||||
@@ -6,26 +6,29 @@ const fallbackBaseUrl = "http://127.0.0.1:8080";
|
||||
const API_BASE_URL = (envBaseUrl || storageBaseUrl || fallbackBaseUrl).replace(/\/$/, "");
|
||||
const candidateBases = [envBaseUrl, storageBaseUrl, fallbackBaseUrl, "http://127.0.0.1:8080", "http://localhost:8080"];
|
||||
const API_BASE_URL_CANDIDATES = Array.from(new Set(candidateBases.filter(Boolean))).map((u) => String(u).replace(/\/$/, ""));
|
||||
typeof process !== "undefined" && process.env && (process.env.VITE_APP_SHOP_ID || process.env.SHOP_ID) || "";
|
||||
typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("SHOP_ID") || "" : "";
|
||||
const envShopId = typeof process !== "undefined" && process.env && (process.env.VITE_APP_SHOP_ID || process.env.SHOP_ID) || "";
|
||||
const storageShopId = typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("SHOP_ID") || "" : "";
|
||||
const SHOP_ID = Number(envShopId || storageShopId || 1);
|
||||
const envEnableDefaultUser = typeof process !== "undefined" && process.env && (process.env.VITE_APP_ENABLE_DEFAULT_USER || process.env.ENABLE_DEFAULT_USER) || "";
|
||||
const storageEnableDefaultUser = typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("ENABLE_DEFAULT_USER") || "" : "";
|
||||
String(envEnableDefaultUser || storageEnableDefaultUser || "false").toLowerCase() === "true";
|
||||
typeof process !== "undefined" && process.env && (process.env.VITE_APP_DEFAULT_USER_ID || process.env.DEFAULT_USER_ID) || "";
|
||||
typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("DEFAULT_USER_ID") || "" : "";
|
||||
const envVipPrice = typeof process !== "undefined" && process.env && (process.env.VITE_APP_VIP_PRICE || process.env.VIP_PRICE) || "";
|
||||
const storageVipPrice = typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("VIP_PRICE") || "" : "";
|
||||
const VIP_PRICE_PER_MONTH = Number(envVipPrice || storageVipPrice || 15);
|
||||
const ENABLE_DEFAULT_USER = String(envEnableDefaultUser || storageEnableDefaultUser || "false").toLowerCase() === "true";
|
||||
const envDefaultUserId = typeof process !== "undefined" && process.env && (process.env.VITE_APP_DEFAULT_USER_ID || process.env.DEFAULT_USER_ID) || "";
|
||||
const storageDefaultUserId = typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("DEFAULT_USER_ID") || "" : "";
|
||||
const DEFAULT_USER_ID = Number(envDefaultUserId || storageDefaultUserId || 0);
|
||||
typeof process !== "undefined" && process.env && (process.env.VITE_APP_VIP_PRICE || process.env.VIP_PRICE) || "";
|
||||
typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("VIP_PRICE") || "" : "";
|
||||
typeof process !== "undefined" && process.env && (process.env.VITE_APP_HOME_BANNER_IMG || process.env.HOME_BANNER_IMG) || "";
|
||||
typeof common_vendor.index !== "undefined" ? common_vendor.index.getStorageSync("HOME_BANNER_IMG") || "" : "";
|
||||
const KPI_ICONS = {
|
||||
todaySales: "/static/icons/sale.png",
|
||||
monthSales: "/static/icons/report.png",
|
||||
monthProfit: "/static/icons/report.png",
|
||||
todaySales: "/static/icons/webwxgetmsgimg.jpg",
|
||||
monthSales: "/static/icons/webwxgetmsgimg.jpg",
|
||||
monthProfit: "/static/icons/icons8-profit-50.png",
|
||||
stockCount: "/static/icons/product.png"
|
||||
};
|
||||
exports.API_BASE_URL = API_BASE_URL;
|
||||
exports.API_BASE_URL_CANDIDATES = API_BASE_URL_CANDIDATES;
|
||||
exports.DEFAULT_USER_ID = DEFAULT_USER_ID;
|
||||
exports.ENABLE_DEFAULT_USER = ENABLE_DEFAULT_USER;
|
||||
exports.KPI_ICONS = KPI_ICONS;
|
||||
exports.VIP_PRICE_PER_MONTH = VIP_PRICE_PER_MONTH;
|
||||
exports.SHOP_ID = SHOP_ID;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/config.js.map
|
||||
|
||||
@@ -30,8 +30,19 @@ function buildAuthHeaders(base = {}) {
|
||||
headers["X-Shop-Id"] = claims.shopId;
|
||||
if (claims && claims.userId)
|
||||
headers["X-User-Id"] = claims.userId;
|
||||
} else if (common_config.ENABLE_DEFAULT_USER && common_config.DEFAULT_USER_ID) {
|
||||
if (headers["Authorization"])
|
||||
delete headers["Authorization"];
|
||||
headers["X-User-Id"] = headers["X-User-Id"] || common_config.DEFAULT_USER_ID;
|
||||
if (common_config.SHOP_ID)
|
||||
headers["X-Shop-Id"] = headers["X-Shop-Id"] || common_config.SHOP_ID;
|
||||
}
|
||||
} catch (_) {
|
||||
if (common_config.ENABLE_DEFAULT_USER && common_config.DEFAULT_USER_ID) {
|
||||
headers["X-User-Id"] = headers["X-User-Id"] || common_config.DEFAULT_USER_ID;
|
||||
if (common_config.SHOP_ID)
|
||||
headers["X-Shop-Id"] = headers["X-Shop-Id"] || common_config.SHOP_ID;
|
||||
}
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
@@ -71,7 +82,7 @@ function post(path, body = {}) {
|
||||
const headers = buildAuthHeaders({ "Content-Type": "application/json" });
|
||||
const options = { url: buildUrl(path), method: "POST", data: body, header: headers };
|
||||
const p = String(path || "");
|
||||
if (p.includes("/api/auth/wxmp/login") || p.includes("/api/auth/sms/login") || p.includes("/api/auth/sms/send") || p.includes("/api/auth/password/login") || p.includes("/api/auth/register"))
|
||||
if (p.includes("/api/auth/wxmp/login") || p.includes("/api/auth/sms/login") || p.includes("/api/auth/sms/send") || p.includes("/api/auth/email/login") || p.includes("/api/auth/email/send") || p.includes("/api/auth/password/login") || p.includes("/api/auth/register"))
|
||||
options.__noRetry = true;
|
||||
requestWithFallback(options, common_config.API_BASE_URL_CANDIDATES, 0, resolve, reject);
|
||||
});
|
||||
@@ -106,9 +117,22 @@ function uploadWithFallback(options, candidates, idx, resolve, reject) {
|
||||
return resolve(res.data);
|
||||
}
|
||||
}
|
||||
if (statusCode >= 400 && statusCode < 500) {
|
||||
try {
|
||||
const data = typeof res.data === "string" ? JSON.parse(res.data) : res.data;
|
||||
return resolve(data);
|
||||
} catch (e) {
|
||||
return resolve({ success: false, message: "HTTP " + statusCode });
|
||||
}
|
||||
}
|
||||
if (idx + 1 < candidates.length)
|
||||
return uploadWithFallback(options, candidates, idx + 1, resolve, reject);
|
||||
reject(new Error("HTTP " + statusCode));
|
||||
try {
|
||||
const data = typeof res.data === "string" ? JSON.parse(res.data) : res.data;
|
||||
return resolve(data);
|
||||
} catch (e) {
|
||||
return resolve({ success: false, message: "HTTP " + statusCode });
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
if (idx + 1 < candidates.length)
|
||||
|
||||
Reference in New Issue
Block a user