完善保险前后端、养殖端小程序
This commit is contained in:
157
insurance_admin-system/public/dayjs_fix_test.html
Normal file
157
insurance_admin-system/public/dayjs_fix_test.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dayjs 修复测试</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.test-container {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
.test-result {
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.success {
|
||||
background-color: #f6ffed;
|
||||
border: 1px solid #b7eb8f;
|
||||
color: #52c41a;
|
||||
}
|
||||
.error {
|
||||
background-color: #fff2f0;
|
||||
border: 1px solid #ffccc7;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.info {
|
||||
background-color: #e6f7ff;
|
||||
border: 1px solid #91d5ff;
|
||||
color: #1890ff;
|
||||
}
|
||||
button {
|
||||
background-color: #1890ff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin: 10px 5px;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #40a9ff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="test-container">
|
||||
<h1>🔧 Dayjs 修复测试</h1>
|
||||
<p>这个页面用于测试 DataWarehouse.vue 中的 dayjs 修复是否成功。</p>
|
||||
|
||||
<button onclick="testDataWarehouse()">测试 DataWarehouse 页面</button>
|
||||
<button onclick="testConsoleErrors()">检查控制台错误</button>
|
||||
|
||||
<div id="test-results"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function addResult(message, type = 'info') {
|
||||
const resultsDiv = document.getElementById('test-results');
|
||||
const resultDiv = document.createElement('div');
|
||||
resultDiv.className = `test-result ${type}`;
|
||||
resultDiv.innerHTML = message;
|
||||
resultsDiv.appendChild(resultDiv);
|
||||
}
|
||||
|
||||
function testDataWarehouse() {
|
||||
addResult('🔍 开始测试 DataWarehouse 页面...', 'info');
|
||||
|
||||
// 创建一个 iframe 来加载主应用
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = 'http://localhost:3002/#/data-warehouse';
|
||||
|
||||
iframe.onload = function() {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
// 检查 iframe 中是否有错误
|
||||
const iframeWindow = iframe.contentWindow;
|
||||
const iframeDocument = iframe.contentDocument;
|
||||
|
||||
if (iframeDocument) {
|
||||
addResult('✅ DataWarehouse 页面加载成功', 'success');
|
||||
addResult('📍 页面 URL: http://localhost:3002/#/data-warehouse', 'info');
|
||||
addResult('💡 请手动访问该页面并检查浏览器控制台是否还有 "require is not defined" 错误', 'info');
|
||||
} else {
|
||||
addResult('❌ 无法访问 iframe 内容,可能存在跨域问题', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
addResult(`⚠️ 测试过程中出现异常: ${error.message}`, 'error');
|
||||
} finally {
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
iframe.onerror = function() {
|
||||
addResult('❌ DataWarehouse 页面加载失败', 'error');
|
||||
document.body.removeChild(iframe);
|
||||
};
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function testConsoleErrors() {
|
||||
addResult('🔍 检查控制台错误...', 'info');
|
||||
|
||||
// 监听控制台错误
|
||||
const originalError = console.error;
|
||||
const errors = [];
|
||||
|
||||
console.error = function(...args) {
|
||||
errors.push(args.join(' '));
|
||||
originalError.apply(console, args);
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
console.error = originalError;
|
||||
|
||||
const requireErrors = errors.filter(error =>
|
||||
error.includes('require is not defined') ||
|
||||
error.includes('ReferenceError: require is not defined')
|
||||
);
|
||||
|
||||
if (requireErrors.length === 0) {
|
||||
addResult('✅ 没有发现 "require is not defined" 错误', 'success');
|
||||
} else {
|
||||
addResult(`❌ 发现 ${requireErrors.length} 个 require 相关错误:`, 'error');
|
||||
requireErrors.forEach(error => {
|
||||
addResult(` ${error}`, 'error');
|
||||
});
|
||||
}
|
||||
|
||||
if (errors.length === 0) {
|
||||
addResult('✅ 控制台没有错误信息', 'success');
|
||||
} else {
|
||||
addResult(`⚠️ 控制台共有 ${errors.length} 个错误信息`, 'info');
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// 页面加载完成后的初始化
|
||||
window.onload = function() {
|
||||
addResult('🚀 测试页面已加载,请点击按钮开始测试', 'info');
|
||||
addResult('📋 修复内容: 将 DataWarehouse.vue 中的 require("dayjs") 改为 ES6 import', 'info');
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user