FEAT => 本次更新项目为:
初始化appbuild
This commit is contained in:
16
Appbuild/unpackage/dist/dev/mp-weixin/app.js
vendored
Normal file
16
Appbuild/unpackage/dist/dev/mp-weixin/app.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const common_vendor = require("./common/vendor.js");
|
||||
if (!Math) {
|
||||
"./pages/index/index.js";
|
||||
}
|
||||
const _sfc_main = {};
|
||||
function createApp() {
|
||||
const app = common_vendor.createSSRApp(_sfc_main);
|
||||
return {
|
||||
app
|
||||
};
|
||||
}
|
||||
createApp().app.mount("#app");
|
||||
exports.createApp = createApp;
|
||||
//# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map
|
||||
13
Appbuild/unpackage/dist/dev/mp-weixin/app.json
vendored
Normal file
13
Appbuild/unpackage/dist/dev/mp-weixin/app.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "存客宝",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"navigationStyle": "custom"
|
||||
},
|
||||
"usingComponents": {}
|
||||
}
|
||||
3
Appbuild/unpackage/dist/dev/mp-weixin/app.wxss
vendored
Normal file
3
Appbuild/unpackage/dist/dev/mp-weixin/app.wxss
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
/*每个页面公共css */
|
||||
page{--status-bar-height:25px;--top-window-height:0px;--window-top:0px;--window-bottom:0px;--window-left:0px;--window-right:0px;--window-magin:0px}[data-c-h="true"]{display: none !important;}
|
||||
7841
Appbuild/unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
Normal file
7841
Appbuild/unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
64
Appbuild/unpackage/dist/dev/mp-weixin/config.js
vendored
Normal file
64
Appbuild/unpackage/dist/dev/mp-weixin/config.js
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
const config = {
|
||||
// 目标网站配置
|
||||
webConfig: {
|
||||
// 主要目标网站URL(请替换为您的实际网站)
|
||||
mainUrl: "http://localhost:3000",
|
||||
// // 备用网站URL(如果主网站无法访问)
|
||||
fallbackUrl: "https://kr-op.quwanzhi.com",
|
||||
// 测试页面URL(用于开发测试)
|
||||
testUrl: "http://localhost:3000/test/postMessage",
|
||||
// 是否启用HTTPS强制跳转
|
||||
forceHttps: false,
|
||||
// 是否允许跨域请求
|
||||
allowCrossOrigin: true
|
||||
},
|
||||
// 应用配置
|
||||
appConfig: {
|
||||
// 应用名称
|
||||
appName: "存客宝",
|
||||
// 应用版本
|
||||
version: "1.0.0",
|
||||
// 是否启用超时检测
|
||||
enableTimeout: false,
|
||||
// 设为 false 禁用超时检测
|
||||
// 加载超时时间(毫秒)- 设为0禁用超时检测
|
||||
loadingTimeout: 3e4,
|
||||
// 增加到30秒
|
||||
// 是否启用调试模式
|
||||
debug: true,
|
||||
// 开发时设为 true,生产时设为 false
|
||||
// 是否使用测试页面
|
||||
useTestPage: true
|
||||
// 开发时设为 true,生产时设为 false
|
||||
},
|
||||
// 通信配置
|
||||
communication: {
|
||||
// 消息类型定义
|
||||
messageTypes: {
|
||||
GET_USER_INFO: "getUserInfo",
|
||||
GET_DEVICE_INFO: "getDeviceInfo",
|
||||
NAVIGATE: "navigate",
|
||||
SHARE: "share",
|
||||
PAYMENT: "payment",
|
||||
TOAST: "toast",
|
||||
ALERT: "alert",
|
||||
CONFIRM: "confirm"
|
||||
},
|
||||
// 允许的域名白名单
|
||||
allowedDomains: ["kr-op.quwanzhi.com", "quwanzhi.com", "localhost"]
|
||||
},
|
||||
// 用户配置
|
||||
userConfig: {
|
||||
// 默认用户信息
|
||||
defaultUser: {
|
||||
id: "user123",
|
||||
name: "测试用户",
|
||||
avatar: "https://example.com/avatar.jpg",
|
||||
phone: "13800138000",
|
||||
email: "test@example.com"
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.config = config;
|
||||
//# sourceMappingURL=../.sourcemap/mp-weixin/config.js.map
|
||||
529
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
Normal file
529
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
Normal file
@@ -0,0 +1,529 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const config = require("../../config.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
config: config.config,
|
||||
currentUrl: "",
|
||||
// 初始化为空字符串
|
||||
loading: false,
|
||||
error: "",
|
||||
loadingTimer: null,
|
||||
messageQueue: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:44", "WebView页面加载");
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:45", "UniApp: 当前平台信息:", common_vendor.index.getSystemInfoSync());
|
||||
this.initApp();
|
||||
},
|
||||
onShow() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:49", "WebView页面显示");
|
||||
this.resumeMessageQueue();
|
||||
},
|
||||
onHide() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:53", "WebView页面隐藏");
|
||||
},
|
||||
onUnload() {
|
||||
this.cleanup();
|
||||
},
|
||||
methods: {
|
||||
// 获取初始URL
|
||||
getInitialUrl() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:61", "获取初始URL,config:", this.config);
|
||||
if (this.config && this.config.appConfig && this.config.appConfig.useTestPage) {
|
||||
return this.config.webConfig.testUrl;
|
||||
}
|
||||
return this.config.webConfig.mainUrl;
|
||||
},
|
||||
// 初始化应用
|
||||
initApp() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:70", "UniApp: 开始初始化应用");
|
||||
this.currentUrl = this.getInitialUrl();
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:73", "UniApp: 设置URL:", this.currentUrl);
|
||||
this.setupLoadingTimeout();
|
||||
this.initMessageHandler();
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:79", "UniApp: 立即注入桥接代码");
|
||||
this.injectBridgeCode();
|
||||
},
|
||||
// 设置加载超时
|
||||
setupLoadingTimeout() {
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
}
|
||||
if (!this.config.appConfig.enableTimeout) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:92", "超时检测已禁用");
|
||||
return;
|
||||
}
|
||||
if (this.config.appConfig.loadingTimeout > 0) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:97", "设置加载超时:", this.config.appConfig.loadingTimeout + "ms");
|
||||
this.loadingTimer = setTimeout(() => {
|
||||
if (this.loading) {
|
||||
common_vendor.index.__f__("warn", "at pages/index/index.vue:100", "页面加载超时,当前状态:", this.loading);
|
||||
this.handleTimeout();
|
||||
}
|
||||
}, this.config.appConfig.loadingTimeout);
|
||||
}
|
||||
},
|
||||
// 处理加载超时
|
||||
handleTimeout() {
|
||||
common_vendor.index.__f__("warn", "at pages/index/index.vue:109", "触发页面加载超时处理");
|
||||
this.error = "页面加载超时,请检查网络连接";
|
||||
this.loading = false;
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
this.loadingTimer = null;
|
||||
}
|
||||
},
|
||||
// 初始化消息处理器
|
||||
initMessageHandler() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:121", "UniApp: 初始化消息处理器");
|
||||
window.addEventListener("message", (event) => {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:124", "UniApp: 收到window.message事件:", event.data);
|
||||
this.handleIframeMessage(event);
|
||||
});
|
||||
},
|
||||
// 设置WebView桥接
|
||||
setupWebViewBridge() {
|
||||
this.injectBridgeCode();
|
||||
},
|
||||
// 注入桥接代码
|
||||
injectBridgeCode() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:137", "UniApp: 开始注入桥接代码");
|
||||
const bridgeCode = `
|
||||
// UniApp WebView 桥接代码
|
||||
uni.__f__('log','at pages/index/index.vue:141','开始注入UniApp桥接代码...');
|
||||
|
||||
// 检查是否已经存在桥接
|
||||
if (window.uniAppBridge) {
|
||||
uni.__f__('log','at pages/index/index.vue:145','UniApp桥接已存在,跳过注入');
|
||||
return;
|
||||
}
|
||||
|
||||
window.uniAppBridge = {
|
||||
// 发送消息到UniApp
|
||||
postMessage: function(type, data) {
|
||||
uni.__f__('log','at pages/index/index.vue:152','UniApp桥接发送消息:', type, data);
|
||||
window.parent.postMessage({
|
||||
type: type,
|
||||
data: data,
|
||||
timestamp: Date.now()
|
||||
}, '*');
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
getUserInfo: function() {
|
||||
uni.__f__('log','at pages/index/index.vue:162','UniApp桥接: 请求用户信息');
|
||||
this.postMessage('getUserInfo', {});
|
||||
},
|
||||
|
||||
// 获取设备信息
|
||||
getDeviceInfo: function() {
|
||||
uni.__f__('log','at pages/index/index.vue:168','UniApp桥接: 请求设备信息');
|
||||
this.postMessage('getDeviceInfo', {});
|
||||
},
|
||||
|
||||
// 显示Toast
|
||||
showToast: function(message, duration = 2000) {
|
||||
uni.__f__('log','at pages/index/index.vue:174','UniApp桥接: 显示Toast', message, duration);
|
||||
this.postMessage('toast', { message, duration });
|
||||
},
|
||||
|
||||
// 显示Alert
|
||||
showAlert: function(title, content) {
|
||||
uni.__f__('log','at pages/index/index.vue:180','UniApp桥接: 显示Alert', title, content);
|
||||
this.postMessage('alert', { title, content });
|
||||
},
|
||||
|
||||
// 显示Confirm
|
||||
showConfirm: function(title, content) {
|
||||
uni.__f__('log','at pages/index/index.vue:186','UniApp桥接: 显示Confirm', title, content);
|
||||
this.postMessage('confirm', { title, content });
|
||||
},
|
||||
|
||||
// 分享
|
||||
share: function(data) {
|
||||
uni.__f__('log','at pages/index/index.vue:192','UniApp桥接: 分享', data);
|
||||
this.postMessage('share', data);
|
||||
},
|
||||
|
||||
// 支付
|
||||
payment: function(data) {
|
||||
uni.__f__('log','at pages/index/index.vue:198','UniApp桥接: 支付', data);
|
||||
this.postMessage('payment', data);
|
||||
},
|
||||
|
||||
// 页面导航
|
||||
navigate: function(url) {
|
||||
uni.__f__('log','at pages/index/index.vue:204','UniApp桥接: 导航', url);
|
||||
this.postMessage('navigate', { url });
|
||||
},
|
||||
|
||||
// 自定义消息
|
||||
sendCustomMessage: function(type, data) {
|
||||
uni.__f__('log','at pages/index/index.vue:210','UniApp桥接: 自定义消息', type, data);
|
||||
this.postMessage(type, data);
|
||||
},
|
||||
|
||||
// 页面准备就绪
|
||||
notifyPageReady: function(data) {
|
||||
uni.__f__('log','at pages/index/index.vue:216','UniApp桥接: 页面准备就绪', data);
|
||||
this.postMessage('pageReady', data);
|
||||
}
|
||||
};
|
||||
|
||||
// 监听来自UniApp的消息
|
||||
window.addEventListener('message', function(event) {
|
||||
uni.__f__('log','at pages/index/index.vue:223','UniApp桥接收到消息:', event.data);
|
||||
if (event.data && event.data.type) {
|
||||
// 触发自定义事件
|
||||
const customEvent = new CustomEvent('uniAppMessage', {
|
||||
detail: event.data
|
||||
});
|
||||
window.dispatchEvent(customEvent);
|
||||
}
|
||||
});
|
||||
|
||||
uni.__f__('log','at pages/index/index.vue:233','UniApp桥接代码注入成功');
|
||||
|
||||
// 通知UniApp页面已加载完成
|
||||
window.parent.postMessage({
|
||||
type: 'pageLoaded',
|
||||
data: { url: window.location.href },
|
||||
timestamp: Date.now()
|
||||
}, '*');
|
||||
`;
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:244", "UniApp: 立即注入桥接代码");
|
||||
this.evalJS(bridgeCode);
|
||||
setTimeout(() => {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:249", "UniApp: 延迟500ms后再次注入");
|
||||
this.evalJS(bridgeCode);
|
||||
}, 500);
|
||||
setTimeout(() => {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:255", "UniApp: 延迟1000ms后备用注入");
|
||||
this.evalJS(bridgeCode);
|
||||
}, 1e3);
|
||||
},
|
||||
// 执行JavaScript代码
|
||||
evalJS(code) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:262", "UniApp: 执行JavaScript代码");
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:263", "UniApp: 当前平台:", common_vendor.index.getSystemInfoSync().platform);
|
||||
const webview = this.$refs.webview;
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:266", "UniApp: webview引用:", webview);
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:285", "UniApp: 小程序环境,使用备用注入方案");
|
||||
this.tryAlternativeInjection(code);
|
||||
},
|
||||
// 备用注入方案
|
||||
tryAlternativeInjection(code) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:297", "UniApp: 尝试备用注入方案");
|
||||
try {
|
||||
window.postMessage({
|
||||
type: "injectCode",
|
||||
data: { code },
|
||||
timestamp: Date.now()
|
||||
}, "*");
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:305", "UniApp: 备用方案1执行成功");
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:307", "UniApp: 备用方案1失败:", error);
|
||||
try {
|
||||
const webview = this.$refs.webview;
|
||||
if (webview && webview.postMessage) {
|
||||
webview.postMessage({
|
||||
type: "injectCode",
|
||||
data: { code }
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:317", "UniApp: 备用方案2执行成功");
|
||||
} else {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:319", "UniApp: 备用方案2失败 - webview.postMessage不存在");
|
||||
}
|
||||
} catch (error2) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:322", "UniApp: 备用方案2失败:", error2);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 处理web-view组件的消息
|
||||
handleMessage(event) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:329", "收到web-view消息:", event.detail);
|
||||
try {
|
||||
const data = event.detail.data;
|
||||
if (data && data.type) {
|
||||
this.processMessage(data);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:336", "处理消息失败:", error);
|
||||
}
|
||||
},
|
||||
// 处理iframe消息
|
||||
handleIframeMessage(event) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:342", "收到iframe消息:", event.data);
|
||||
try {
|
||||
if (event.data && event.data.type) {
|
||||
if (event.data.type === "pageLoaded") {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:347", "收到页面加载完成消息:", event.data.data);
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
this.loadingTimer = null;
|
||||
}
|
||||
this.loading = false;
|
||||
this.processMessageQueue();
|
||||
return;
|
||||
}
|
||||
this.processMessage(event.data);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:362", "处理iframe消息失败:", error);
|
||||
}
|
||||
},
|
||||
// 处理消息
|
||||
processMessage(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:368", "UniApp处理消息:", data.type, data);
|
||||
switch (data.type) {
|
||||
case this.config.communication.messageTypes.GET_USER_INFO:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:372", "UniApp: 处理获取用户信息请求");
|
||||
this.sendUserInfo();
|
||||
break;
|
||||
case this.config.communication.messageTypes.GET_DEVICE_INFO:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:376", "UniApp: 处理获取设备信息请求");
|
||||
this.sendDeviceInfo();
|
||||
break;
|
||||
case this.config.communication.messageTypes.NAVIGATE:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:380", "UniApp: 处理导航请求");
|
||||
this.handleNavigation(data);
|
||||
break;
|
||||
case this.config.communication.messageTypes.SHARE:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:384", "UniApp: 处理分享请求");
|
||||
this.handleShare(data);
|
||||
break;
|
||||
case this.config.communication.messageTypes.PAYMENT:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:388", "UniApp: 处理支付请求");
|
||||
this.handlePayment(data);
|
||||
break;
|
||||
case this.config.communication.messageTypes.TOAST:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:392", "UniApp: 处理Toast请求");
|
||||
this.handleToast(data);
|
||||
break;
|
||||
case this.config.communication.messageTypes.ALERT:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:396", "UniApp: 处理Alert请求");
|
||||
this.handleAlert(data);
|
||||
break;
|
||||
case this.config.communication.messageTypes.CONFIRM:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:400", "UniApp: 处理Confirm请求");
|
||||
this.handleConfirm(data);
|
||||
break;
|
||||
case "pageReady":
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:404", "UniApp: 处理页面准备就绪消息");
|
||||
break;
|
||||
default:
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:408", "UniApp: 未知消息类型:", data.type);
|
||||
}
|
||||
},
|
||||
// 发送用户信息到iframe
|
||||
sendUserInfo() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:414", "UniApp: 发送用户信息");
|
||||
const userInfo = {
|
||||
type: "userInfo",
|
||||
data: this.config.userConfig.defaultUser
|
||||
};
|
||||
this.sendMessageToIframe(userInfo);
|
||||
},
|
||||
// 发送设备信息到iframe
|
||||
sendDeviceInfo() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:424", "UniApp: 发送设备信息");
|
||||
const systemInfo = common_vendor.index.getSystemInfoSync();
|
||||
const deviceInfo = {
|
||||
type: "deviceInfo",
|
||||
data: {
|
||||
platform: systemInfo.platform,
|
||||
model: systemInfo.model,
|
||||
version: systemInfo.version,
|
||||
appVersion: this.config.appConfig.version,
|
||||
appName: this.config.appConfig.appName,
|
||||
screenWidth: systemInfo.screenWidth,
|
||||
screenHeight: systemInfo.screenHeight,
|
||||
statusBarHeight: systemInfo.statusBarHeight
|
||||
}
|
||||
};
|
||||
this.sendMessageToIframe(deviceInfo);
|
||||
},
|
||||
// 处理导航
|
||||
handleNavigation(data) {
|
||||
if (data.url) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:445", "导航到:", data.url);
|
||||
}
|
||||
},
|
||||
// 处理分享
|
||||
handleShare(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:452", "UniApp: 处理分享请求", data);
|
||||
common_vendor.index.share({
|
||||
provider: "weixin",
|
||||
scene: "WXSceneSession",
|
||||
type: 0,
|
||||
href: data.url || this.currentUrl,
|
||||
title: data.title || this.config.appConfig.appName,
|
||||
summary: data.summary || "分享内容",
|
||||
success: (res) => {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:461", "UniApp: 分享成功:", res);
|
||||
this.sendToIframe("shareResult", { success: true });
|
||||
},
|
||||
fail: (err) => {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:465", "UniApp: 分享失败:", err);
|
||||
this.sendToIframe("shareResult", { success: false, error: err });
|
||||
}
|
||||
});
|
||||
},
|
||||
// 处理支付
|
||||
handlePayment(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:473", "UniApp: 处理支付请求", data);
|
||||
setTimeout(() => {
|
||||
this.sendToIframe("paymentResult", {
|
||||
success: true,
|
||||
orderId: data.orderId || "order123"
|
||||
});
|
||||
}, 1e3);
|
||||
},
|
||||
// 处理Toast
|
||||
handleToast(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:486", "UniApp: 处理Toast请求", data);
|
||||
common_vendor.index.showToast({
|
||||
title: data.message,
|
||||
icon: "none",
|
||||
duration: data.duration || 2e3
|
||||
});
|
||||
},
|
||||
// 处理Alert
|
||||
handleAlert(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:496", "UniApp: 处理Alert请求", data);
|
||||
common_vendor.index.showModal({
|
||||
title: data.title || "提示",
|
||||
content: data.content,
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
// 处理Confirm
|
||||
handleConfirm(data) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:506", "UniApp: 处理Confirm请求", data);
|
||||
common_vendor.index.showModal({
|
||||
title: data.title || "确认",
|
||||
content: data.content,
|
||||
success: (res) => {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:511", "UniApp: Confirm结果:", res);
|
||||
this.sendToIframe("confirmResult", {
|
||||
confirmed: res.confirm
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 发送消息到iframe
|
||||
sendMessageToIframe(message) {
|
||||
this.messageQueue.push(message);
|
||||
this.processMessageQueue();
|
||||
},
|
||||
// 处理消息队列
|
||||
processMessageQueue() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:527", "UniApp: 处理消息队列, 队列长度:", this.messageQueue.length, "加载状态:", this.loading);
|
||||
if (this.messageQueue.length > 0 && !this.loading) {
|
||||
const message = this.messageQueue.shift();
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:530", "UniApp: 发送消息到iframe:", message);
|
||||
this.evalJS(`
|
||||
window.postMessage(${JSON.stringify(message)}, '*');
|
||||
`);
|
||||
}
|
||||
},
|
||||
// 恢复消息队列处理
|
||||
resumeMessageQueue() {
|
||||
this.processMessageQueue();
|
||||
},
|
||||
// 向iframe发送消息的通用方法
|
||||
sendToIframe(type, data) {
|
||||
const message = {
|
||||
type,
|
||||
data,
|
||||
timestamp: Date.now()
|
||||
};
|
||||
this.sendMessageToIframe(message);
|
||||
},
|
||||
// 处理加载状态
|
||||
handleLoading(event) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:554", "WebView加载状态变化:", event.detail);
|
||||
const newLoadingState = event.detail.loading;
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:556", "加载状态从", this.loading, "变为", newLoadingState);
|
||||
this.loading = newLoadingState;
|
||||
if (!this.loading) {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:562", "页面加载完成,清除超时定时器");
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
this.loadingTimer = null;
|
||||
}
|
||||
this.injectBridgeCode();
|
||||
this.processMessageQueue();
|
||||
} else {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:574", "页面开始加载,设置超时检测");
|
||||
this.setupLoadingTimeout();
|
||||
}
|
||||
},
|
||||
// 处理错误
|
||||
handleError(event) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:581", "WebView错误:", event.detail);
|
||||
this.error = "页面加载失败,请检查网络连接";
|
||||
this.loading = false;
|
||||
clearTimeout(this.loadingTimer);
|
||||
},
|
||||
// 重新加载页面
|
||||
reloadPage() {
|
||||
this.error = "";
|
||||
this.loading = true;
|
||||
this.setupLoadingTimeout();
|
||||
const webview = this.$refs.webview;
|
||||
if (webview) {
|
||||
webview.reload();
|
||||
}
|
||||
},
|
||||
// 切换到备用地址
|
||||
switchToFallback() {
|
||||
this.currentUrl = this.config.webConfig.fallbackUrl;
|
||||
this.reloadPage();
|
||||
},
|
||||
// 清除超时
|
||||
clearTimeout() {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:607", "手动清除超时");
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
this.loadingTimer = null;
|
||||
}
|
||||
this.error = "";
|
||||
this.loading = false;
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:614", "超时已清除");
|
||||
},
|
||||
// 清理资源
|
||||
cleanup() {
|
||||
if (this.loadingTimer) {
|
||||
clearTimeout(this.loadingTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.currentUrl,
|
||||
b: common_vendor.o((...args) => $options.handleMessage && $options.handleMessage(...args)),
|
||||
c: common_vendor.o((...args) => $options.handleError && $options.handleError(...args)),
|
||||
d: common_vendor.o((...args) => $options.handleLoading && $options.handleLoading(...args)),
|
||||
e: $data.loading
|
||||
}, $data.loading ? {} : {}, {
|
||||
f: $data.error
|
||||
}, $data.error ? {
|
||||
g: common_vendor.t($data.error),
|
||||
h: common_vendor.o((...args) => $options.reloadPage && $options.reloadPage(...args)),
|
||||
i: common_vendor.o((...args) => $options.switchToFallback && $options.switchToFallback(...args)),
|
||||
j: common_vendor.o((...args) => $options.clearTimeout && $options.clearTimeout(...args))
|
||||
} : {}, {
|
||||
k: $data.config.appConfig.debug
|
||||
}, $data.config.appConfig.debug ? {
|
||||
l: common_vendor.t($data.currentUrl),
|
||||
m: common_vendor.t($data.loading ? "加载中" : "已加载")
|
||||
} : {});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map
|
||||
5
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.json
vendored
Normal file
5
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "存客宝",
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.wxml
vendored
Normal file
1
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="container"><web-view src="{{a}}" class="webview" ref="webview" bindmessage="{{b}}" binderror="{{c}}" bindloading="{{d}}"></web-view><view wx:if="{{e}}" class="loading-container"><view class="loading-spinner"></view><text class="loading-text">加载中...</text></view><view wx:if="{{f}}" class="error-container"><text class="error-text">{{g}}</text><button bindtap="{{h}}" class="reload-btn">重新加载</button><button bindtap="{{i}}" class="fallback-btn">使用备用地址</button><button bindtap="{{j}}" class="clear-btn">清除超时</button></view><view wx:if="{{k}}" class="debug-info"><text>当前URL: {{l}}</text><text>加载状态: {{m}}</text></view></view>
|
||||
105
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.wxss
vendored
Normal file
105
Appbuild/unpackage/dist/dev/mp-weixin/pages/index/index.wxss
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
background-color: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
.webview {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.loading-container {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loading-spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 4px solid #f3f3f3;
|
||||
border-top: 4px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.loading-text {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
.error-container {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||
min-width: 280px;
|
||||
}
|
||||
.error-text {
|
||||
font-size: 16px;
|
||||
color: #e74c3c;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.reload-btn,
|
||||
.fallback-btn,
|
||||
.clear-btn {
|
||||
background-color: #3498db;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
margin: 5px;
|
||||
min-width: 120px;
|
||||
}
|
||||
.fallback-btn {
|
||||
background-color: #95a5a6;
|
||||
}
|
||||
.clear-btn {
|
||||
background-color: #e74c3c;
|
||||
}
|
||||
.debug-info {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 3;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
color: white;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
29
Appbuild/unpackage/dist/dev/mp-weixin/project.config.json
vendored
Normal file
29
Appbuild/unpackage/dist/dev/mp-weixin/project.config.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"description": "项目配置文件。",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"postcss": false,
|
||||
"minified": false,
|
||||
"newFeature": true,
|
||||
"bigPackageSizeSupport": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.8.6",
|
||||
"appid": "touristappid",
|
||||
"projectname": "存客宝",
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
}
|
||||
}
|
||||
7
Appbuild/unpackage/dist/dev/mp-weixin/project.private.config.json
vendored
Normal file
7
Appbuild/unpackage/dist/dev/mp-weixin/project.private.config.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "存客宝",
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
}
|
||||
}
|
||||
BIN
Appbuild/unpackage/dist/dev/mp-weixin/static/logo.png
vendored
Normal file
BIN
Appbuild/unpackage/dist/dev/mp-weixin/static/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Reference in New Issue
Block a user