fix: 修复微信小程序appid及URL配置错误

修复了微信小程序的appid配置错误,将appid从"wxabe9cc4db1005fcb"更新为"wx3ae63fb09936b379"。同时,将URL从生产环境切换为本地开发环境,修改为"http://127.0.0.1:8080"。此外,优化了http请求的错误处理逻辑,增加了对响应状态码和业务状态码的检查,确保请求失败时能够正确捕获并处理错误。
This commit is contained in:
fuck
2025-04-07 17:18:09 +08:00
parent 60bb924d5c
commit 40f523595b
207 changed files with 2896 additions and 47650 deletions
+289 -214
View File
@@ -3788,7 +3788,8 @@ function createComponentInstance(vnode, parent, suspense) {
$uniElements: /* @__PURE__ */ new Map(),
$templateUniElementRefs: [],
$templateUniElementStyles: {},
$eS: {}
$eS: {},
$eA: {}
};
{
instance.ctx = createDevRenderContext(instance);
@@ -4286,6 +4287,7 @@ function patch(instance, data, oldData) {
}
data = deepCopy(data);
data.$eS = instance.$eS || {};
data.$eA = instance.$eA || {};
const ctx = instance.ctx;
const mpType = ctx.mpType;
if (mpType === "page" || mpType === "component") {
@@ -5116,6 +5118,15 @@ function createApp$1(rootComponent, rootProps = null) {
return createVueApp(rootComponent, rootProps).use(plugin);
}
const createSSRApp = createApp$1;
function getLocaleLanguage$1() {
let localeLanguage = "";
{
const appBaseInfo = wx.getAppBaseInfo();
const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
localeLanguage = normalizeLocale(language) || LOCALE_EN;
}
return localeLanguage;
}
function validateProtocolFail(name, msg) {
console.warn(`${name}: ${msg}`);
}
@@ -5685,7 +5696,9 @@ const $once = defineSyncApi(API_ONCE, (name, callback) => {
const $off = defineSyncApi(API_OFF, (name, callback) => {
if (!isArray(name))
name = name ? [name] : [];
name.forEach((n2) => eventBus.off(n2, callback));
name.forEach((n2) => {
eventBus.off(n2, callback);
});
}, OffProtocol);
const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
eventBus.emit(name, ...args);
@@ -5877,6 +5890,9 @@ function initWrapper(protocols2) {
}
return function wrapper(methodName, method) {
const hasProtocol = hasOwn(protocols2, methodName);
if (!hasProtocol && typeof wx[methodName] !== "function") {
return method;
}
const needWrapper = hasProtocol || isFunction(protocols2.returnValue) || isContextApi(methodName) || isTaskApi(methodName);
const hasMethod = hasProtocol || isFunction(method);
if (!hasProtocol && !method) {
@@ -5916,7 +5932,7 @@ const getLocale = () => {
if (app && app.$vm) {
return app.$vm.$locale;
}
return normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN;
return getLocaleLanguage$1();
};
const setLocale = (locale) => {
const app = isFunction(getApp) && getApp();
@@ -5998,9 +6014,9 @@ function populateParameters(fromRes, toRes) {
appVersion: "1.0.0",
appVersionCode: "100",
appLanguage: getAppLanguage(hostLanguage),
uniCompileVersion: "4.45",
uniCompilerVersion: "4.45",
uniRuntimeVersion: "4.45",
uniCompileVersion: "4.57",
uniCompilerVersion: "4.57",
uniRuntimeVersion: "4.57",
uniPlatform: "mp-weixin",
deviceBrand,
deviceModel: model,
@@ -6149,9 +6165,9 @@ const getAppBaseInfo = {
appLanguage: getAppLanguage(hostLanguage),
isUniAppX: false,
uniPlatform: "mp-weixin",
uniCompileVersion: "4.45",
uniCompilerVersion: "4.45",
uniRuntimeVersion: "4.45"
uniCompileVersion: "4.57",
uniCompilerVersion: "4.57",
uniRuntimeVersion: "4.57"
};
extend(toRes, parameters);
}
@@ -6331,11 +6347,23 @@ function createSelectorQuery() {
const query = wx$2.createSelectorQuery();
const oldIn = query.in;
query.in = function newIn(component) {
if (component.$scope) {
return oldIn.call(this, component.$scope);
}
return oldIn.call(this, initComponentMocks(component));
};
return query;
}
const wx$2 = initWx();
if (!wx$2.canIUse("getAppBaseInfo")) {
wx$2.getAppBaseInfo = wx$2.getSystemInfoSync;
}
if (!wx$2.canIUse("getWindowInfo")) {
wx$2.getWindowInfo = wx$2.getSystemInfoSync;
}
if (!wx$2.canIUse("getDeviceInfo")) {
wx$2.getDeviceInfo = wx$2.getSystemInfoSync;
}
let baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();
if (!baseInfo) {
baseInfo = wx$2.getSystemInfoSync();
@@ -6377,84 +6405,48 @@ var protocols = /* @__PURE__ */ Object.freeze({
});
const wx$1 = initWx();
var index = initUni(shims, protocols, wx$1);
const CONSOLE_TYPES = ["log", "warn", "error", "info", "debug"];
let sendConsole = null;
const messageQueue = [];
function sendConsoleMessages(messages) {
if (sendConsole == null) {
messageQueue.push(...messages);
return;
}
sendConsole(JSON.stringify({
type: "console",
data: messages
}));
}
function setSendConsole(value) {
sendConsole = value;
if (value != null && messageQueue.length > 0) {
const messages = messageQueue.slice();
messageQueue.length = 0;
sendConsoleMessages(messages);
}
}
const originalConsole = /* @__PURE__ */ CONSOLE_TYPES.reduce((methods, type) => {
methods[type] = console[type].bind(console);
return methods;
}, {});
const atFileRegex = /^at\s+[\w/./-]+:\d+$/;
function rewriteConsole() {
function wrapConsole(type) {
return function(...args) {
const originalArgs = [...args];
if (originalArgs.length) {
const maybeAtFile = originalArgs[originalArgs.length - 1];
if (typeof maybeAtFile === "string" && atFileRegex.test(maybeAtFile)) {
originalArgs.pop();
}
}
{
originalConsole[type](...originalArgs);
}
sendConsoleMessages([formatMessage(type, args)]);
};
}
if (isConsoleWritable()) {
CONSOLE_TYPES.forEach((type) => {
console[type] = wrapConsole(type);
function initRuntimeSocket(hosts, port, id) {
if (hosts == "" || port == "" || id == "")
return Promise.resolve(null);
return hosts.split(",").reduce((promise, host2) => {
return promise.then((socket) => {
if (socket != null)
return Promise.resolve(socket);
return tryConnectSocket(host2, port, id);
});
return function restoreConsole() {
CONSOLE_TYPES.forEach((type) => {
console[type] = originalConsole[type];
});
};
} else {
const oldLog = index.__f__;
if (oldLog) {
index.__f__ = function(...args) {
const [type, filename, ...rest] = args;
oldLog(type, "", ...rest);
sendConsoleMessages([formatMessage(type, [...rest, filename])]);
};
return function restoreConsole() {
index.__f__ = oldLog;
};
}
}
return function restoreConsole() {
};
}, Promise.resolve(null));
}
function isConsoleWritable() {
const value = console.log;
const sym = Symbol();
try {
console.log = sym;
} catch (ex) {
return false;
}
const isWritable = console.log === sym;
console.log = value;
return isWritable;
const SOCKET_TIMEOUT = 500;
function tryConnectSocket(host2, port, id) {
return new Promise((resolve, reject) => {
const socket = index.connectSocket({
url: `ws://${host2}:${port}/${id}`,
multiple: true,
// 支付宝小程序 是否开启多实例
fail() {
resolve(null);
}
});
const timer = setTimeout(() => {
socket.close({
code: 1006,
reason: "connect timeout"
});
resolve(null);
}, SOCKET_TIMEOUT);
socket.onOpen((e2) => {
clearTimeout(timer);
resolve(socket);
});
socket.onClose((e2) => {
clearTimeout(timer);
resolve(null);
});
socket.onError((e2) => {
clearTimeout(timer);
resolve(null);
});
});
}
function formatMessage(type, args) {
try {
@@ -6463,7 +6455,6 @@ function formatMessage(type, args) {
args: formatArgs(args)
};
} catch (e2) {
originalConsole.error(e2);
}
return {
type,
@@ -6480,7 +6471,67 @@ function formatArg(arg, depth = 0) {
value: "[Maximum depth reached]"
};
}
return ARG_FORMATTERS[typeof arg](arg, depth);
const type = typeof arg;
switch (type) {
case "string":
return formatString(arg);
case "number":
return formatNumber(arg);
case "boolean":
return formatBoolean(arg);
case "object":
return formatObject(arg, depth);
case "undefined":
return formatUndefined();
case "function":
return formatFunction(arg);
case "symbol": {
return formatSymbol(arg);
}
case "bigint":
return formatBigInt(arg);
}
}
function formatFunction(value) {
return {
type: "function",
value: `function ${value.name}() {}`
};
}
function formatUndefined() {
return {
type: "undefined"
};
}
function formatBoolean(value) {
return {
type: "boolean",
value: String(value)
};
}
function formatNumber(value) {
return {
type: "number",
value: String(value)
};
}
function formatBigInt(value) {
return {
type: "bigint",
value: String(value)
};
}
function formatString(value) {
return {
type: "string",
value
};
}
function formatSymbol(value) {
return {
type: "symbol",
value: value.description
};
}
function formatObject(value, depth) {
if (value === null) {
@@ -6488,17 +6539,19 @@ function formatObject(value, depth) {
type: "null"
};
}
if (isComponentPublicInstance(value)) {
return formatComponentPublicInstance(value, depth);
}
if (isComponentInternalInstance(value)) {
return formatComponentInternalInstance(value, depth);
}
if (isUniElement(value)) {
return formatUniElement(value, depth);
}
if (isCSSStyleDeclaration(value)) {
return formatCSSStyleDeclaration(value, depth);
{
if (isComponentPublicInstance(value)) {
return formatComponentPublicInstance(value, depth);
}
if (isComponentInternalInstance(value)) {
return formatComponentInternalInstance(value, depth);
}
if (isUniElement(value)) {
return formatUniElement(value, depth);
}
if (isCSSStyleDeclaration(value)) {
return formatCSSStyleDeclaration(value, depth);
}
}
if (Array.isArray(value)) {
return {
@@ -6564,10 +6617,20 @@ function formatObject(value, depth) {
className: value.name || "Error"
};
}
let className = void 0;
{
const constructor = value.constructor;
if (constructor) {
if (constructor.get$UTSMetadata$) {
className = constructor.get$UTSMetadata$().name;
}
}
}
return {
type: "object",
className,
value: {
properties: Object.entries(value).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
properties: Object.entries(value).map((entry) => formatObjectProperty(entry[0], entry[1], depth + 1))
}
};
}
@@ -6628,14 +6691,14 @@ function formatCSSStyleDeclaration(style, depth) {
};
}
function formatObjectProperty(name, value, depth) {
return Object.assign(formatArg(value, depth), {
name
});
const result = formatArg(value, depth);
result.name = name;
return result;
}
function formatArrayElement(value, index2, depth) {
return Object.assign(formatArg(value, depth), {
name: `${index2}`
});
const result = formatArg(value, depth);
result.name = `${index2}`;
return result;
}
function formatSetEntry(value, depth) {
return {
@@ -6648,97 +6711,94 @@ function formatMapEntry(value, depth) {
value: formatArg(value[1], depth)
};
}
const ARG_FORMATTERS = {
function(value) {
return {
type: "function",
value: `function ${value.name}() {}`
};
},
undefined() {
return {
type: "undefined"
};
},
object(value, depth) {
return formatObject(value, depth);
},
boolean(value) {
return {
type: "boolean",
value: String(value)
};
},
number(value) {
return {
type: "number",
value: String(value)
};
},
bigint(value) {
return {
type: "bigint",
value: String(value)
};
},
string(value) {
return {
type: "string",
value
};
},
symbol(value) {
return {
type: "symbol",
value: value.description
const CONSOLE_TYPES = ["log", "warn", "error", "info", "debug"];
let sendConsole = null;
const messageQueue = [];
const messageExtra = {};
function sendConsoleMessages(messages) {
if (sendConsole == null) {
messageQueue.push(...messages);
return;
}
sendConsole(JSON.stringify(Object.assign({
type: "console",
data: messages
}, messageExtra)));
}
function setSendConsole(value, extra = {}) {
sendConsole = value;
Object.assign(messageExtra, extra);
if (value != null && messageQueue.length > 0) {
const messages = messageQueue.slice();
messageQueue.length = 0;
sendConsoleMessages(messages);
}
}
const originalConsole = /* @__PURE__ */ CONSOLE_TYPES.reduce((methods, type) => {
methods[type] = console[type].bind(console);
return methods;
}, {});
const atFileRegex = /^\s*at\s+[\w/./-]+:\d+$/;
function rewriteConsole() {
function wrapConsole(type) {
return function(...args) {
const originalArgs = [...args];
if (originalArgs.length) {
const maybeAtFile = originalArgs[originalArgs.length - 1];
if (typeof maybeAtFile === "string" && atFileRegex.test(maybeAtFile)) {
originalArgs.pop();
}
}
{
originalConsole[type](...originalArgs);
}
sendConsoleMessages([formatMessage(type, args)]);
};
}
};
function initRuntimeSocket(hosts, port, id) {
if (!hosts || !port || !id)
return Promise.resolve(null);
return hosts.split(",").reduce((promise, host2) => {
return promise.then((socket) => {
if (socket)
return socket;
return tryConnectSocket(host2, port, id);
if (isConsoleWritable()) {
CONSOLE_TYPES.forEach((type) => {
console[type] = wrapConsole(type);
});
}, Promise.resolve(null));
}
const SOCKET_TIMEOUT = 500;
function tryConnectSocket(host2, port, id) {
return new Promise((resolve, reject) => {
const socket = index.connectSocket({
url: `ws://${host2}:${port}/${id}`,
// 支付宝小程序 是否开启多实例
multiple: true,
fail() {
resolve(null);
}
});
const timer = setTimeout(() => {
socket.close({
code: 1006,
reason: "connect timeout"
return function restoreConsole() {
CONSOLE_TYPES.forEach((type) => {
console[type] = originalConsole[type];
});
resolve(null);
}, SOCKET_TIMEOUT);
socket.onOpen((e2) => {
clearTimeout(timer);
resolve(socket);
});
socket.onClose((e2) => {
clearTimeout(timer);
resolve(null);
});
socket.onError((e2) => {
clearTimeout(timer);
resolve(null);
});
});
};
} else {
{
if (typeof index !== "undefined" && index.__f__) {
const oldLog = index.__f__;
if (oldLog) {
index.__f__ = function(...args) {
const [type, filename, ...rest] = args;
oldLog(type, "", ...rest);
sendConsoleMessages([formatMessage(type, [...rest, filename])]);
};
return function restoreConsole() {
index.__f__ = oldLog;
};
}
}
}
}
return function restoreConsole() {
};
}
function isConsoleWritable() {
const value = console.log;
const sym = Symbol();
try {
console.log = sym;
} catch (ex) {
return false;
}
const isWritable = console.log === sym;
console.log = value;
return isWritable;
}
let sendError = null;
const errorQueue = /* @__PURE__ */ new Set();
const errorExtra = {};
function sendErrorMessages(errors) {
if (sendError == null) {
errors.forEach((error) => {
@@ -6746,30 +6806,38 @@ function sendErrorMessages(errors) {
});
return;
}
sendError(JSON.stringify({
type: "error",
data: errors.map((err) => {
const isPromiseRejection = err && "promise" in err && "reason" in err;
const prefix = isPromiseRejection ? "UnhandledPromiseRejection: " : "";
if (isPromiseRejection) {
err = err.reason;
const data = errors.map((err) => {
const isPromiseRejection = err && "promise" in err && "reason" in err;
const prefix = isPromiseRejection ? "UnhandledPromiseRejection: " : "";
if (isPromiseRejection) {
err = err.reason;
}
if (err instanceof Error && err.stack) {
if (err.message && !err.stack.includes(err.message)) {
return `${prefix}${err.message}
${err.stack}`;
}
if (err instanceof Error && err.stack) {
return prefix + err.stack;
return `${prefix}${err.stack}`;
}
if (typeof err === "object" && err !== null) {
try {
return prefix + JSON.stringify(err);
} catch (err2) {
return prefix + String(err2);
}
if (typeof err === "object" && err !== null) {
try {
return prefix + JSON.stringify(err);
} catch (err2) {
return prefix + String(err2);
}
}
return prefix + String(err);
})
}));
}
return prefix + String(err);
}).filter(Boolean);
if (data.length > 0) {
sendError(JSON.stringify(Object.assign({
type: "error",
data
}, errorExtra)));
}
}
function setSendError(value) {
function setSendError(value, extra = {}) {
sendError = value;
Object.assign(errorExtra, extra);
if (value != null && errorQueue.size > 0) {
const errors = Array.from(errorQueue);
errorQueue.clear();
@@ -6806,9 +6874,9 @@ function initOnError() {
};
}
function initRuntimeSocketService() {
const hosts = "192.168.10.21,127.0.0.1";
const hosts = "10.8.0.5,192.168.19.1,192.168.47.1,192.168.10.240,127.0.0.1";
const port = "8090";
const id = "mp-weixin_Y_zfuH";
const id = "mp-weixin_kSUXuu";
const lazy = typeof swan !== "undefined";
let restoreError = lazy ? () => {
} : initOnError();
@@ -6970,6 +7038,15 @@ function findVmByVueId(instance, vuePid) {
}
}
}
function getLocaleLanguage() {
let localeLanguage = "";
{
const appBaseInfo = wx.getAppBaseInfo();
const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
localeLanguage = normalizeLocale(language) || LOCALE_EN;
}
return localeLanguage;
}
const MP_METHODS = [
"createSelectorQuery",
"createIntersectionObserver",
@@ -7236,9 +7313,7 @@ function initAppLifecycle(appOptions, vm) {
}
}
function initLocale(appVm) {
const locale = ref(
normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN
);
const locale = ref(getLocaleLanguage());
Object.defineProperty(appVm, "$locale", {
get() {
return locale.value;