mirror of
https://gitee.com/liuxioabin/fengketrade.git
synced 2026-04-17 21:03:17 +08:00
504 lines
16 KiB
HTML
504 lines
16 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>建行生活集成测试</title>
|
||
|
|
<style>
|
||
|
|
* {
|
||
|
|
margin: 0;
|
||
|
|
padding: 0;
|
||
|
|
box-sizing: border-box;
|
||
|
|
}
|
||
|
|
|
||
|
|
body {
|
||
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
|
||
|
|
background: #f5f5f5;
|
||
|
|
padding: 20px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.container {
|
||
|
|
max-width: 600px;
|
||
|
|
margin: 0 auto;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header {
|
||
|
|
background: linear-gradient(135deg, #F51C13 0%, #ff4444 100%);
|
||
|
|
color: white;
|
||
|
|
padding: 30px 20px;
|
||
|
|
border-radius: 10px;
|
||
|
|
text-align: center;
|
||
|
|
margin-bottom: 20px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header h1 {
|
||
|
|
font-size: 24px;
|
||
|
|
margin-bottom: 10px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header p {
|
||
|
|
font-size: 14px;
|
||
|
|
opacity: 0.9;
|
||
|
|
}
|
||
|
|
|
||
|
|
.card {
|
||
|
|
background: white;
|
||
|
|
border-radius: 10px;
|
||
|
|
padding: 20px;
|
||
|
|
margin-bottom: 15px;
|
||
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
||
|
|
}
|
||
|
|
|
||
|
|
.card h3 {
|
||
|
|
font-size: 18px;
|
||
|
|
color: #333;
|
||
|
|
margin-bottom: 15px;
|
||
|
|
padding-bottom: 10px;
|
||
|
|
border-bottom: 2px solid #f5f5f5;
|
||
|
|
}
|
||
|
|
|
||
|
|
.info-item {
|
||
|
|
display: flex;
|
||
|
|
justify-content: space-between;
|
||
|
|
padding: 10px 0;
|
||
|
|
border-bottom: 1px solid #f5f5f5;
|
||
|
|
}
|
||
|
|
|
||
|
|
.info-item:last-child {
|
||
|
|
border-bottom: none;
|
||
|
|
}
|
||
|
|
|
||
|
|
.info-label {
|
||
|
|
color: #666;
|
||
|
|
font-size: 14px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.info-value {
|
||
|
|
color: #333;
|
||
|
|
font-size: 14px;
|
||
|
|
font-weight: 500;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status-badge {
|
||
|
|
display: inline-block;
|
||
|
|
padding: 4px 12px;
|
||
|
|
border-radius: 12px;
|
||
|
|
font-size: 12px;
|
||
|
|
font-weight: 500;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status-success {
|
||
|
|
background: #d4edda;
|
||
|
|
color: #155724;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status-error {
|
||
|
|
background: #f8d7da;
|
||
|
|
color: #721c24;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status-warning {
|
||
|
|
background: #fff3cd;
|
||
|
|
color: #856404;
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn {
|
||
|
|
display: block;
|
||
|
|
width: 100%;
|
||
|
|
padding: 15px;
|
||
|
|
background: #F51C13;
|
||
|
|
color: white;
|
||
|
|
border: none;
|
||
|
|
border-radius: 8px;
|
||
|
|
font-size: 16px;
|
||
|
|
font-weight: 500;
|
||
|
|
cursor: pointer;
|
||
|
|
margin-bottom: 10px;
|
||
|
|
transition: all 0.3s;
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn:hover {
|
||
|
|
background: #d01810;
|
||
|
|
transform: translateY(-1px);
|
||
|
|
box-shadow: 0 4px 12px rgba(245, 28, 19, 0.3);
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn:active {
|
||
|
|
transform: translateY(0);
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn-secondary {
|
||
|
|
background: #6c757d;
|
||
|
|
}
|
||
|
|
|
||
|
|
.btn-secondary:hover {
|
||
|
|
background: #5a6268;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console {
|
||
|
|
background: #1e1e1e;
|
||
|
|
color: #d4d4d4;
|
||
|
|
padding: 15px;
|
||
|
|
border-radius: 8px;
|
||
|
|
font-family: 'Courier New', monospace;
|
||
|
|
font-size: 12px;
|
||
|
|
max-height: 300px;
|
||
|
|
overflow-y: auto;
|
||
|
|
margin-top: 10px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console-line {
|
||
|
|
margin-bottom: 5px;
|
||
|
|
line-height: 1.5;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console-time {
|
||
|
|
color: #858585;
|
||
|
|
margin-right: 8px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console-success {
|
||
|
|
color: #4ec9b0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console-error {
|
||
|
|
color: #f48771;
|
||
|
|
}
|
||
|
|
|
||
|
|
.console-info {
|
||
|
|
color: #4fc1ff;
|
||
|
|
}
|
||
|
|
|
||
|
|
.loading {
|
||
|
|
display: none;
|
||
|
|
text-align: center;
|
||
|
|
padding: 20px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.loading.active {
|
||
|
|
display: block;
|
||
|
|
}
|
||
|
|
|
||
|
|
.spinner {
|
||
|
|
border: 3px solid #f3f3f3;
|
||
|
|
border-top: 3px solid #F51C13;
|
||
|
|
border-radius: 50%;
|
||
|
|
width: 40px;
|
||
|
|
height: 40px;
|
||
|
|
animation: spin 1s linear infinite;
|
||
|
|
margin: 0 auto 10px;
|
||
|
|
}
|
||
|
|
|
||
|
|
@keyframes spin {
|
||
|
|
0% { transform: rotate(0deg); }
|
||
|
|
100% { transform: rotate(360deg); }
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="container">
|
||
|
|
<div class="header">
|
||
|
|
<h1>🏦 建行生活集成测试</h1>
|
||
|
|
<p>测试前端模块是否正常集成</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 环境信息 -->
|
||
|
|
<div class="card">
|
||
|
|
<h3>📱 运行环境</h3>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">当前平台:</span>
|
||
|
|
<span class="info-value" id="platform-name">-</span>
|
||
|
|
</div>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">是否在建行App内:</span>
|
||
|
|
<span class="info-value" id="is-ccb-app">
|
||
|
|
<span class="status-badge status-warning">检测中...</span>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">User-Agent:</span>
|
||
|
|
<span class="info-value" style="word-break: break-all; font-size: 12px;" id="user-agent">-</span>
|
||
|
|
</div>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">URL参数:</span>
|
||
|
|
<span class="info-value" id="url-params">-</span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 模块加载状态 -->
|
||
|
|
<div class="card">
|
||
|
|
<h3>📦 模块加载状态</h3>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">平台模块:</span>
|
||
|
|
<span class="info-value" id="platform-module-status">
|
||
|
|
<span class="status-badge status-warning">未测试</span>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">建行模块:</span>
|
||
|
|
<span class="info-value" id="ccb-module-status">
|
||
|
|
<span class="status-badge status-warning">未测试</span>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<div class="info-item">
|
||
|
|
<span class="info-label">API模块:</span>
|
||
|
|
<span class="info-value" id="api-module-status">
|
||
|
|
<span class="status-badge status-warning">未测试</span>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 测试按钮 -->
|
||
|
|
<div class="card">
|
||
|
|
<h3>🧪 功能测试</h3>
|
||
|
|
<button class="btn" onclick="testModuleImport()">测试模块导入</button>
|
||
|
|
<button class="btn" onclick="testEnvironmentDetection()">测试环境检测</button>
|
||
|
|
<button class="btn" onclick="testUrlParams()">测试URL参数解析</button>
|
||
|
|
<button class="btn btn-secondary" onclick="clearConsole()">清空控制台</button>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 加载状态 -->
|
||
|
|
<div class="loading" id="loading">
|
||
|
|
<div class="spinner"></div>
|
||
|
|
<p>处理中...</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 控制台输出 -->
|
||
|
|
<div class="card">
|
||
|
|
<h3>💻 控制台输出</h3>
|
||
|
|
<div class="console" id="console"></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
// 控制台输出
|
||
|
|
function log(message, type = 'info') {
|
||
|
|
const console = document.getElementById('console');
|
||
|
|
const time = new Date().toLocaleTimeString();
|
||
|
|
const colors = {
|
||
|
|
info: 'console-info',
|
||
|
|
success: 'console-success',
|
||
|
|
error: 'console-error'
|
||
|
|
};
|
||
|
|
|
||
|
|
const line = document.createElement('div');
|
||
|
|
line.className = 'console-line';
|
||
|
|
line.innerHTML = `<span class="console-time">[${time}]</span><span class="${colors[type]}">${message}</span>`;
|
||
|
|
console.appendChild(line);
|
||
|
|
console.scrollTop = console.scrollHeight;
|
||
|
|
}
|
||
|
|
|
||
|
|
function clearConsole() {
|
||
|
|
document.getElementById('console').innerHTML = '';
|
||
|
|
log('控制台已清空', 'info');
|
||
|
|
}
|
||
|
|
|
||
|
|
// 显示加载状态
|
||
|
|
function showLoading(show) {
|
||
|
|
const loading = document.getElementById('loading');
|
||
|
|
if (show) {
|
||
|
|
loading.classList.add('active');
|
||
|
|
} else {
|
||
|
|
loading.classList.remove('active');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 更新状态徽章
|
||
|
|
function updateStatus(elementId, status, text) {
|
||
|
|
const element = document.getElementById(elementId);
|
||
|
|
const statusClasses = {
|
||
|
|
success: 'status-success',
|
||
|
|
error: 'status-error',
|
||
|
|
warning: 'status-warning'
|
||
|
|
};
|
||
|
|
element.innerHTML = `<span class="status-badge ${statusClasses[status]}">${text}</span>`;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 初始化环境信息
|
||
|
|
function initEnvironment() {
|
||
|
|
log('=== 初始化测试环境 ===', 'info');
|
||
|
|
|
||
|
|
// 平台信息
|
||
|
|
const platformName = navigator.platform || 'Unknown';
|
||
|
|
document.getElementById('platform-name').textContent = platformName;
|
||
|
|
log(`平台: ${platformName}`, 'info');
|
||
|
|
|
||
|
|
// User-Agent
|
||
|
|
const ua = navigator.userAgent;
|
||
|
|
document.getElementById('user-agent').textContent = ua;
|
||
|
|
log(`UA: ${ua.substring(0, 50)}...`, 'info');
|
||
|
|
|
||
|
|
// URL参数
|
||
|
|
const urlParams = new URLSearchParams(window.location.search);
|
||
|
|
const params = {};
|
||
|
|
urlParams.forEach((value, key) => {
|
||
|
|
params[key] = value;
|
||
|
|
});
|
||
|
|
const paramsStr = Object.keys(params).length > 0 ? JSON.stringify(params) : '无';
|
||
|
|
document.getElementById('url-params').textContent = paramsStr;
|
||
|
|
log(`URL参数: ${paramsStr}`, 'info');
|
||
|
|
|
||
|
|
// 简单的环境检测
|
||
|
|
const isInCcbApp = ua.toLowerCase().includes('ccb') ||
|
||
|
|
urlParams.has('ccbParamSJ') ||
|
||
|
|
urlParams.get('from') === 'ccblife';
|
||
|
|
|
||
|
|
if (isInCcbApp) {
|
||
|
|
updateStatus('is-ccb-app', 'success', '是');
|
||
|
|
log('✓ 检测到建行环境', 'success');
|
||
|
|
} else {
|
||
|
|
updateStatus('is-ccb-app', 'error', '否');
|
||
|
|
log('✗ 非建行环境', 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
log('=== 环境初始化完成 ===', 'success');
|
||
|
|
}
|
||
|
|
|
||
|
|
// 测试模块导入
|
||
|
|
function testModuleImport() {
|
||
|
|
log('=== 开始测试模块导入 ===', 'info');
|
||
|
|
showLoading(true);
|
||
|
|
|
||
|
|
try {
|
||
|
|
// 在实际的 uni-app 环境中,这些模块会正常加载
|
||
|
|
// 这里我们只是测试文件是否存在
|
||
|
|
log('检查平台模块...', 'info');
|
||
|
|
|
||
|
|
fetch('/sheep/platform/index.js')
|
||
|
|
.then(response => {
|
||
|
|
if (response.ok) {
|
||
|
|
updateStatus('platform-module-status', 'success', '已加载');
|
||
|
|
log('✓ 平台模块存在', 'success');
|
||
|
|
} else {
|
||
|
|
updateStatus('platform-module-status', 'error', '加载失败');
|
||
|
|
log('✗ 平台模块不存在', 'error');
|
||
|
|
}
|
||
|
|
})
|
||
|
|
.catch(err => {
|
||
|
|
updateStatus('platform-module-status', 'error', '加载失败');
|
||
|
|
log('✗ 平台模块检查失败: ' + err.message, 'error');
|
||
|
|
});
|
||
|
|
|
||
|
|
fetch('/sheep/platform/provider/ccblife/index.js')
|
||
|
|
.then(response => {
|
||
|
|
if (response.ok) {
|
||
|
|
updateStatus('ccb-module-status', 'success', '已加载');
|
||
|
|
log('✓ 建行模块存在', 'success');
|
||
|
|
} else {
|
||
|
|
updateStatus('ccb-module-status', 'error', '加载失败');
|
||
|
|
log('✗ 建行模块不存在', 'error');
|
||
|
|
}
|
||
|
|
})
|
||
|
|
.catch(err => {
|
||
|
|
updateStatus('ccb-module-status', 'error', '加载失败');
|
||
|
|
log('✗ 建行模块检查失败: ' + err.message, 'error');
|
||
|
|
});
|
||
|
|
|
||
|
|
fetch('/sheep/platform/provider/ccblife/api.js')
|
||
|
|
.then(response => {
|
||
|
|
if (response.ok) {
|
||
|
|
updateStatus('api-module-status', 'success', '已加载');
|
||
|
|
log('✓ API模块存在', 'success');
|
||
|
|
} else {
|
||
|
|
updateStatus('api-module-status', 'error', '加载失败');
|
||
|
|
log('✗ API模块不存在', 'error');
|
||
|
|
}
|
||
|
|
showLoading(false);
|
||
|
|
log('=== 模块导入测试完成 ===', 'success');
|
||
|
|
})
|
||
|
|
.catch(err => {
|
||
|
|
updateStatus('api-module-status', 'error', '加载失败');
|
||
|
|
log('✗ API模块检查失败: ' + err.message, 'error');
|
||
|
|
showLoading(false);
|
||
|
|
});
|
||
|
|
|
||
|
|
} catch (error) {
|
||
|
|
log('✗ 模块导入测试失败: ' + error.message, 'error');
|
||
|
|
showLoading(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 测试环境检测
|
||
|
|
function testEnvironmentDetection() {
|
||
|
|
log('=== 开始测试环境检测 ===', 'info');
|
||
|
|
showLoading(true);
|
||
|
|
|
||
|
|
try {
|
||
|
|
const ua = navigator.userAgent.toLowerCase();
|
||
|
|
const urlParams = new URLSearchParams(window.location.search);
|
||
|
|
|
||
|
|
log('检测方式1: User-Agent', 'info');
|
||
|
|
if (ua.includes('ccb') || ua.includes('ccblife')) {
|
||
|
|
log(' ✓ User-Agent中包含建行标识', 'success');
|
||
|
|
} else {
|
||
|
|
log(' ✗ User-Agent中不包含建行标识', 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
log('检测方式2: URL参数', 'info');
|
||
|
|
if (urlParams.has('ccbParamSJ')) {
|
||
|
|
log(' ✓ URL包含ccbParamSJ参数', 'success');
|
||
|
|
} else {
|
||
|
|
log(' ✗ URL不包含ccbParamSJ参数', 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
if (urlParams.get('from') === 'ccblife') {
|
||
|
|
log(' ✓ URL包含from=ccblife标识', 'success');
|
||
|
|
} else {
|
||
|
|
log(' ✗ URL不包含from=ccblife标识', 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
log('检测方式3: JSBridge', 'info');
|
||
|
|
if (window.WebViewJavascriptBridge) {
|
||
|
|
log(' ✓ 检测到iOS JSBridge', 'success');
|
||
|
|
} else if (window.mbspay) {
|
||
|
|
log(' ✓ 检测到Android JSBridge', 'success');
|
||
|
|
} else {
|
||
|
|
log(' ✗ 未检测到JSBridge', 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
log('=== 环境检测测试完成 ===', 'success');
|
||
|
|
} catch (error) {
|
||
|
|
log('✗ 环境检测测试失败: ' + error.message, 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
showLoading(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 测试URL参数解析
|
||
|
|
function testUrlParams() {
|
||
|
|
log('=== 开始测试URL参数解析 ===', 'info');
|
||
|
|
showLoading(true);
|
||
|
|
|
||
|
|
try {
|
||
|
|
const urlParams = new URLSearchParams(window.location.search);
|
||
|
|
const params = {};
|
||
|
|
|
||
|
|
urlParams.forEach((value, key) => {
|
||
|
|
params[key] = value;
|
||
|
|
log(` 参数 ${key} = ${value}`, 'info');
|
||
|
|
});
|
||
|
|
|
||
|
|
if (Object.keys(params).length === 0) {
|
||
|
|
log(' 没有URL参数', 'warning');
|
||
|
|
log(' 提示: 可以添加 ?from=ccblife&ccbParamSJ=test 来模拟建行环境', 'info');
|
||
|
|
} else {
|
||
|
|
log(` 共解析到 ${Object.keys(params).length} 个参数`, 'success');
|
||
|
|
}
|
||
|
|
|
||
|
|
log('=== URL参数解析测试完成 ===', 'success');
|
||
|
|
} catch (error) {
|
||
|
|
log('✗ URL参数解析测试失败: ' + error.message, 'error');
|
||
|
|
}
|
||
|
|
|
||
|
|
showLoading(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 页面加载时自动初始化
|
||
|
|
window.onload = function() {
|
||
|
|
initEnvironment();
|
||
|
|
log('页面加载完成,可以开始测试', 'success');
|
||
|
|
log('提示: 点击上方按钮进行各项测试', 'info');
|
||
|
|
};
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|