完善保险端前后端和养殖端小程序

This commit is contained in:
xuqiuyun
2025-09-22 19:09:45 +08:00
parent 02a25515a9
commit 325c114c38
256 changed files with 48348 additions and 4444 deletions

View File

@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dayjs Locale 测试工具</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; line-height: 1.6; }
.container { background: #f5f5f5; padding: 30px; border-radius: 8px; margin-top: 20px; }
.title { color: #1890ff; text-align: center; margin-bottom: 20px; }
.test-result { margin-top: 20px; padding: 15px; background: white; border-radius: 4px; border-left: 4px solid #52c41a; }
.error-result { border-left-color: #ff4d4f; }
.btn { background: #1890ff; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; margin-top: 20px; }
.btn:hover { background: #40a9ff; }
code { background: #f5f5f5; padding: 2px 5px; border-radius: 3px; font-family: 'Courier New', Courier, monospace; }
</style>
</head>
<body>
<h1 class="title">Dayjs Locale 功能测试</h1>
<div class="container">
<h2>测试说明</h2>
<p>这个工具用于直接测试 Ant Design Vue 和 dayjs 的集成情况,特别是检查 <code>date4.locale is not a function</code> 错误是否已修复。</p>
<h2>测试步骤</h2>
<ol>
<li>确保前端服务已启动: <code>http://127.0.0.1:3002/</code></li>
<li>点击下方的测试按钮</li>
<li>查看测试结果</li>
</ol>
<button class="btn" onclick="runTest()">运行测试</button>
<div id="test-result" class="test-result">
<h3>测试结果将显示在这里</h3>
</div>
</div>
<script>
function runTest() {
const resultElement = document.getElementById('test-result');
resultElement.innerHTML = '<h3>正在测试...</h3>';
try {
// 测试 1: 尝试从 Ant Design Vue 中获取 dayjs 实例
console.log('开始测试 dayjs locale 功能...');
// 创建一个临时的 iframe 来加载前端页面
const iframe = document.createElement('iframe');
iframe.src = 'http://127.0.0.1:3002/';
iframe.style.display = 'none';
document.body.appendChild(iframe);
iframe.onload = function() {
try {
// 等待页面完全加载
setTimeout(() => {
try {
// 尝试访问 iframe 中的 dayjs 实例
const iframeWindow = iframe.contentWindow;
const app = iframeWindow.app || iframeWindow.__VUE_APP__;
if (app) {
const dayjs = app.config.globalProperties.$dayjs;
if (dayjs) {
// 检查 locale 方法是否存在
const hasLocaleMethod = typeof dayjs.locale === 'function';
const currentLocale = hasLocaleMethod ? dayjs.locale() : '未知';
let resultHTML = `
<h3>🎉 测试成功!</h3>
<p>✅ 成功获取 dayjs 实例</p>
<p>✅ locale 方法: ${hasLocaleMethod ? '存在' : '不存在'}</p>
<p>✅ 当前语言: ${currentLocale}</p>
<p>✅ 日期格式化测试: ${dayjs().format('YYYY年MM月DD日 HH:mm:ss')}</p>
<p><strong>结论:</strong> 'date4.locale is not a function' 错误已修复!</p>
`;
resultElement.innerHTML = resultHTML;
resultElement.className = 'test-result';
} else {
throw new Error('无法从 app 实例中获取 dayjs');
}
} else {
throw new Error('无法在 iframe 中找到 Vue 应用实例');
}
} catch (error) {
resultElement.innerHTML = `
<h3>❌ 测试失败</h3>
<p>错误: ${error.message}</p>
<p>请确保前端服务已在 http://127.0.0.1:3002/ 启动</p>
`;
resultElement.className = 'test-result error-result';
} finally {
// 清理 iframe
document.body.removeChild(iframe);
}
}, 2000); // 等待 2 秒确保页面加载完成
} catch (error) {
resultElement.innerHTML = `
<h3>❌ 测试异常</h3>
<p>错误: ${error.message}</p>
`;
resultElement.className = 'test-result error-result';
document.body.removeChild(iframe);
}
};
} catch (error) {
resultElement.innerHTML = `
<h3>❌ 测试失败</h3>
<p>错误: ${error.message}</p>
`;
resultElement.className = 'test-result error-result';
}
}
// 页面加载后自动运行测试
window.onload = function() {
// 延迟 1 秒后自动运行测试
setTimeout(runTest, 1000);
};
</script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
<!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: sans-serif; padding: 20px; max-width: 800px; margin: 0 auto; }
h1 { color: #1890ff; }
.step { margin: 20px 0; padding: 15px; border-left: 4px solid #1890ff; background: #f0f7ff; }
.success { color: #52c41a; }
.error { color: #ff4d4f; }
code { background: #f5f5f5; padding: 2px 5px; border-radius: 3px; }
</style>
</head>
<body>
<h1>Dayjs 错误修复验证</h1>
<div class="step">
<h2>验证步骤</h2>
<p>请按照以下步骤验证 'date4.locale is not a function' 错误是否已修复:</p>
<ol>
<li>确保前端服务已启动: <code>npm run dev</code></li>
<li>打开浏览器开发者工具的控制台</li>
<li>访问日期选择器测试页面: <a href="/date-picker-test" target="_blank">/date-picker-test</a></li>
<li>在测试页面中尝试使用日期选择器组件</li>
<li>检查控制台是否有错误信息</li>
</ol>
</div>
<div class="step">
<h2>成功标志</h2>
<p class="success">✅ 如果日期选择器能正常工作,且控制台没有 'date4.locale is not a function' 错误,则修复成功!</p>
</div>
<div class="step">
<h2>失败处理</h2>
<p class="error">❌ 如果错误仍然存在请重新检查main.js中的配置是否完全正确。</p>
<p>特别注意:</p>
<ul>
<li>确保使用 <code>dayjs.locale('zh-cn')</code> 而不是 <code>dayjs.locale(zhCN)</code></li>
<li>确保ConfigProvider中设置了 <code>dateFormatter: 'dayjs'</code></li>
<li>确保ConfigProvider中配置了 <code>getDayjsInstance: () => dayjs</code></li>
</ul>
</div>
</body>
</html>