console
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex, nofollow"/>
<meta name="googlebot" content="noindex, nofollow"/>
<title>新建测试组 - JSRUN 驱动</title>
<script type="text/javascript" src="" ></script>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>新建测试组配置 - AB测试管理系统</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #4361ee;
--secondary: #3f37c9;
--success: #4cc9f0;
--warning: #f72585;
--dark: #1d3557;
--light: #f8f9fa;
--gray: #6c757d;
--border: #dee2e6;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto', sans-serif;
background: linear-gradient(120deg, #e0f7fa 0%, #f5f7fa 100%);
color: #333;
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 30px auto;
background: white;
border-radius: 16px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
overflow: hidden;
}
.header {
background: var(--dark);
color: white;
padding: 25px 30px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
overflow: hidden;
}
.header::before {
content: '';
position: absolute;
top: -50px;
right: -50px;
width: 200px;
height: 200px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
}
.header h1 {
font-weight: 700;
font-size: 28px;
display: flex;
align-items: center;
gap: 15px;
position: relative;
z-index: 2;
}
.header h1 i {
color: var(--success);
background: rgba(255, 255, 255, 0.15);
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.btn {
padding: 12px 25px;
border-radius: 10px;
border: none;
cursor: pointer;
font-weight: 600;
display: flex;
align-items: center;
gap: 10px;
transition: all 0.3s ease;
font-size: 15px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}
.btn:active {
transform: translateY(1px);
}
.btn-primary {
background: var(--primary);
color: white;
}
.btn-outline {
background: transparent;
border: 2px solid var(--success);
color: var(--success);
}
.btn-outline:hover {
background: rgba(76, 201, 240, 0.1);
}
.content {
padding: 30px;
}
.form-container {
display: grid;
grid-template-columns: 1fr;
gap: 25px;
}
.form-card {
background: white;
border-radius: 14px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
overflow: hidden;
border: 1px solid var(--border);
margin-bottom: 25px;
}
.card-header {
padding: 20px;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
background: #f9fbfd;
}
.card-title {
font-size: 18px;
font-weight: 600;
color: var(--dark);
display: flex;
align-items: center;
gap: 10px;
}
.card-body {
padding: 20px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: var(--dark);
}
.form-control {
width: 100%;
padding: 12px 15px;
border: 1px solid var(--border);
border-radius: 8px;
font-size: 15px;
transition: all 0.3s;
}
.form-control:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.form-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
}
textarea.form-control {
min-height: 100px;
resize: vertical;
}
.bucket-config {
margin-bottom: 25px;
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.bucket-header {
padding: 15px;
background: #f8f9fa;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
}
.bucket-actions {
display: flex;
gap: 10px;
}
.bucket-body {
padding: 15px;
}
.bucket-row {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 40px;
gap: 10px;
margin-bottom: 12px;
align-items: center;
}
.add-bucket {
display: flex;
justify-content: center;
margin-top: 15px;
}
.file-upload {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 12px;
text-align: center;
background: #f8f9fa;
transition: all 0.3s;
cursor: pointer;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.file-upload:hover {
border-color: var(--primary);
background: rgba(67, 97, 238, 0.05);
}
.file-upload i {
font-size: 24px;
color: var(--primary);
margin-bottom: 8px;
}
.file-upload p {
color: var(--gray);
margin: 0;
font-size: 12px;
}
.file-info {
background: rgba(76, 201, 240, 0.1);
border-radius: 8px;
padding: 10px;
margin-top: 8px;
display: none;
font-size: 12px;
}
.file-info.active {
display: block;
}
.file-name {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
}
.file-stats {
font-size: 12px;
color: var(--gray);
}
.advanced-settings {
background: #f8f9fa;
border-radius: 8px;
padding: 20px;
margin-top: 20px;
}
.toggle-header {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
margin-bottom: 15px;
}
.toggle-content {
display: none;
}
.toggle-content.active {
display: block;
}
.form-note {
font-size: 13px;
color: var(--gray);
margin-top: 5px;
font-style: italic;
}
.footer-actions {
display: flex;
justify-content: flex-end;
gap: 15px;
padding: 20px 0;
margin-top: 20px;
border-top: 1px solid var(--border);
}
@media (max-width: 992px) {
.bucket-row {
grid-template-columns: 1fr 1fr 1fr 1fr 40px;
}
}
@media (max-width: 768px) {
.bucket-row {
grid-template-columns: 1fr;
}
.form-row {
grid-template-columns: 1fr;
}
}
.config-label {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
color: white;
}
.config-A { background: #4cc9f0; }
.config-B { background: #4361ee; }
.config-C { background: #3a0ca3; }
.config-D { background: #7209b7; }
.config-X { background: #f72585; }
.config-Y { background: #4895ef; }
.readonly-field {
background-color: #f8f9fa;
color: #495057;
cursor: not-allowed;
}
.auto-gen-info {
font-size: 12px;
color: #6c757d;
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>
<i class="fas fa-plus-circle"></i>
新建测试组配置
</h1>
<div>
<button class="btn btn-outline">
<i class="fas fa-times"></i> 取消
</button>
</div>
</div>
<div class="content">
<div class="form-container">
<div class="form-section">
<div class="form-card">
<div class="card-header">
<div class="card-title">
<i class="fas fa-info-circle"></i>
基础信息
</div>
</div>
<div class="card-body">
<div class="form-row">
<div class="form-group">
<label for="testName">测试组名称</label>
<input type="text" id="testName" class="form-control" placeholder="例如:新手指引测试_v2">
</div>
<div class="form-group">
<label for="testGroupId">测试组ID</label>
<input type="text" id="testGroupId" class="form-control readonly-field" value="TG_001" readonly>
<div class="auto-gen-info">系统自动生成的唯一ID</div>
</div>
</div>
<div class="form-group">
<label for="testEnglishName">测试组打点名</label>
<input type="text" id="testEnglishName" class="form-control" placeholder="例如:newbie_guide_v2">
<div class="form-note">使用小写字母和下划线组合(如:new_player_guide)</div>
</div>
<div class="form-group">
<label for="testDesc">测试描述</label>
<textarea id="testDesc" class="form-control" rows="3" placeholder="描述测试目的和范围..."></textarea>
</div>
<div class="form-row">
<div class="form-group">
<label for="owner">负责人</label>
<input type="text" id="owner" class="form-control" placeholder="输入负责人姓名">
</div>
<div class="form-group">
<label for="version">版本号</label>
<input type="text" id="version" class="form-control readonly-field" value="v1.0" readonly>
<div class="auto-gen-info">系统自动生成的版本号</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="functionId">功能ID</label>
<select id="functionId" class="form-control">
<option value="">-- 选择功能ID --</option>
<option value="FUNC_001">FUNC_001 - 新手指引</option>
<option value="FUNC_002">FUNC_002 - 支付流程</option>
<option value="FUNC_003">FUNC_003 - 推荐系统</option>
<option value="FUNC_004">FUNC_004 - 搜索功能</option>
<option value="FUNC_005">FUNC_005 - 个人中心</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-card">
<div class="card-header">
<div class="card-title">
<i class="fas fa-project-diagram"></i>
互斥组设置
</div>
</div>
<div class="card-body">
<div class="form-group">
<label>
<input type="checkbox" id="useMutex">
<span>属于互斥组</span>
</label>
<div class="form-note">启用后,用户在此互斥组中只会参与一个测试</div>
</div>
<div id="mutexSettings" style="display: none;">
<div class="form-group">
<label for="mutexGroup">选择互斥组</label>
<select id="mutexGroup" class="form-control">
<option value="">-- 选择互斥组 --</option>
<option value="core">MG_001</option>
<option value="commercial">MG_002</option>
<option value="social">MG_003</option>
<option value="new">新建互斥组...</option>
</select>
</div>
<div class="mutex-group">
<div class="mutex-header">
<div class="mutex-title">互斥组信息</div>
</div>
<div class="form-group">
<div class="form-note">此互斥组包含以下测试:</div>
<div class="preview-content">
<div>MG_001</div>
<div>MG_002</div>
<div>当前测试</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-card">
<div class="card-header">
<div class="card-title">
<i class="fas fa-cubes"></i>
分桶配置
</div>
</div>
<div class="card-body">
<div class="form-group">
<label>桶数量</label>
<div style="display: flex; align-items: center; gap: 15px;">
<div style="flex: 1;">
<input type="range" min="2" max="100" value="100" class="form-control" id="bucketRange">
</div>
<div style="width: 80px;">
<input type="number" min="2" max="100" value="100" class="form-control" id="bucketCount">
</div>
<span>桶 (2-100)</span>
</div>
</div>
<div class="form-group">
<label>配置方案</label>
<div class="form-note">为每个桶范围分配一个配置方案(最多支持6种配置方案)</div>
</div>
<div class="bucket-config">
<div class="bucket-header">
<div>配置方案分配</div>
<div class="bucket-actions">
<button class="btn btn-outline" style="padding: 8px 12px;">
<i class="fas fa-download"></i> 下载模板
</button>
</div>
</div>
<div class="bucket-body">
<div class="bucket-row">
<div>用户分群</div>
<div>起始桶</div>
<div>结束桶</div>
<div>Excel配置</div>
<div></div>
</div>
<div class="bucket-row">
<div>A</div>
<div><input type="number" min="0" max="99" value="0" class="form-control" style="padding: 8px;"></div>
<div><input type="number" min="0" max="99" value="19" class="form-control" style="padding: 8px;"></div>
<div>
<div class="file-upload" onclick="handleExcelUpload(this)">
<i class="fas fa-file-excel"></i>
<p>上传Excel</p>
</div>
<div class="file-info" style="display: none;">
<div class="file-name">
<div>
<i class="fas fa-file-excel" style="color: #1d6f42;"></i>
<strong>未上传</strong>
</div>
<i class="fas fa-times" style="cursor: pointer;" onclick="removeExcelFile(this)"></i>
</div>
</div>
</div>
<div><i class="fas fa-trash-alt" style="color: #dc3545; cursor: pointer;"></i></div>
</div>
<div class="bucket-row">
<div>B</div>
<div><input type="number" min="0" max="99" value="20" class="form-control" style="padding: 8px;"></div>
<div><input type="number" min="0" max="99" value="79" class="form-control" style="padding: 8px;"></div>
<div>
<div class="file-upload" onclick="handleExcelUpload(this)">
<i class="fas fa-file-excel"></i>
<p>上传Excel</p>
</div>
<div class="file-info" style="display: none;">
<div class="file-name">
<div>
<i class="fas fa-file-excel" style="color: #1d6f42;"></i>
<strong>未上传</strong>
</div>
<i class="fas fa-times" style="cursor: pointer;" onclick="removeExcelFile(this)"></i>
</div>
</div>
</div>
<div><i class="fas fa-trash-alt" style="color: #dc3545; cursor: pointer;"></i></div>
</div>
<div class="bucket-row">
<div>C</div>
<div><input type="number" min="0" max="99" value="80" class="form-control" style="padding: 8px;"></div>
<div><input type="number" min="0" max="99" value="99" class="form-control" style="padding: 8px;"></div>
<div>
<div class="file-upload" onclick="handleExcelUpload(this)">
<i class="fas fa-file-excel"></i>
<p>上传Excel</p>
</div>
<div class="file-info" style="display: none;">
<div class="file-name">
<div>
<i class="fas fa-file-excel" style="color: #1d6f42;"></i>
<strong>未上传</strong>
</div>
<i class="fas fa-times" style="cursor: pointer;" onclick="removeExcelFile(this)"></i>
</div>
</div>
</div>
<div><i class="fas fa-trash-alt" style="color: #dc3545; cursor: pointer;"></i></div>
</div>
<div class="add-bucket">
<button class="btn btn-outline" style="padding: 8px 15px;">
<i class="fas fa-plus"></i> 添加配置方案
</button>
</div>
</div>
</div>
</div>
</div>
<div class="form-card">
<div class="card-header">
<div class="card-title">
<i class="fas fa-cog"></i>
高级设置
</div>
</div>
<div class="card-body">
<div class="advanced-settings">
<div class="toggle-header" id="toggleAdvanced">
<div>
<i class="fas fa-chevron-down" id="toggleIcon"></i>
<span>高级设置选项</span>
</div>
</div>
<div class="toggle-content" id="advancedContent">
<div class="form-group">
<label for="defaultConfig">默认配置方案</label>
<select id="defaultConfig" class="form-control">
<option value="A">方案A</option>
<option value="B">方案B</option>
<option value="C">方案C</option>
<option value="D">方案D</option>
<option value="X">方案X</option>
<option value="Y">方案Y</option>
</select>
<div class="form-note">当配置缺失或错误时使用的默认方案</div>
</div>
<div class="form-group">
<label for="fallbackBucket">异常处理桶</label>
<div class="form-control" style="background-color: #f8f9fa; cursor: not-allowed;">
桶100
</div>
<div class="form-note">发生异常时用户将被分配到桶99</div>
</div>
<div class="form-group">
<label for="filterList">用户过滤名单</label>
<textarea id="filterList" class="form-control" rows="3" placeholder="每行一个用户ID或设备码,这些用户将被排除在测试之外"></textarea>
<div class="form-note">排除测试账号、机器人账号等</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer-actions">
<button class="btn btn-outline">
<i class="fas fa-save"></i> 保存草稿
</button>
<button class="btn btn-primary">
<i class="fas fa-check"></i> 提交测试组
</button>
</div>
</div>
</div>
</div>
</div>
<script>
function initBucketVisualization() {
const container = document.getElementById('bucketsVisual');
if (container) {
container.innerHTML = '';
for (let i = 0; i < 100; i++) {
const bucket = document.createElement('div');
bucket.className = 'bucket-item';
let configClass = 'config-C';
if (i < 20) configClass = 'config-A';
else if (i < 80) configClass = 'config-B';
bucket.classList.add(configClass);
bucket.textContent = i;
bucket.title = `桶 ${i}: ${configClass.replace('config-', '方案')}`;
container.appendChild(bucket);
}
}
}
const useMutex = document.getElementById('useMutex');
const mutexSettings = document.getElementById('mutexSettings');
if (useMutex && mutexSettings) {
useMutex.addEventListener('change', function() {
mutexSettings.style.display = this.checked ? 'block' : 'none';
});
}
const bucketRange = document.getElementById('bucketRange');
const bucketCount = document.getElementById('bucketCount');
if (bucketRange && bucketCount) {
bucketRange.addEventListener('input', function() {
bucketCount.value = this.value;
});
bucketCount.addEventListener('input', function() {
const value = Math.min(100, Math.max(2, this.value));
bucketRange.value = value;
this.value = value;
});
}
const toggleAdvanced = document.getElementById('toggleAdvanced');
const toggleIcon = document.getElementById('toggleIcon');
const advancedContent = document.getElementById('advancedContent');
if (toggleAdvanced && toggleIcon && advancedContent) {
toggleAdvanced.addEventListener('click', function() {
advancedContent.classList.toggle('active');
toggleIcon.classList.toggle('fa-chevron-down');
toggleIcon.classList.toggle('fa-chevron-up');
});
}
function handleExcelUpload(element) {
const fileInfo = element.nextElementSibling;
const fileName = fileInfo.querySelector('strong');
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = '.xlsx';
fileInput.onchange = function(e) {
const file = e.target.files[0];
if (file) {
const bucketRow = element.closest('.bucket-row');
const schemeName = bucketRow.querySelector('div:first-child').textContent;
fileName.textContent = file.name;
fileInfo.style.display = 'block';
element.style.display = 'none';
showNotification(`${schemeName}的Excel配置上传成功!`);
}
};
fileInput.click();
}
function removeExcelFile(element) {
const fileInfo = element.closest('.file-info');
const fileUpload = fileInfo.previousElementSibling;
fileInfo.style.display = 'none';
fileUpload.style.display = 'block';
fileInfo.querySelector('strong').textContent = '未上传';
}
function showNotification(message) {
const notification = document.createElement('div');
notification.innerHTML = `<i class="fas fa-check-circle"></i> ${message}`;
notification.style.position = 'fixed';
notification.style.bottom = '20px';
notification.style.right = '20px';
notification.style.background = 'var(--success)';
notification.style.color = 'white';
notification.style.padding = '12px 25px';
notification.style.borderRadius = '8px';
notification.style.boxShadow = '0 4px 12px rgba(0,0,0,0.15)';
notification.style.zIndex = '1000';
notification.style.display = 'flex';
notification.style.alignItems = 'center';
notification.style.gap = '10px';
notification.style.fontWeight = '500';
document.body.appendChild(notification);
setTimeout(() => {
notification.style.transition = 'transform 0.3s ease, opacity 0.3s ease';
notification.style.transform = 'translateY(100px)';
notification.style.opacity = '0';
setTimeout(() => {
document.body.removeChild(notification);
}, 300);
}, 3000);
}
document.querySelector('.add-bucket button').addEventListener('click', function() {
const bucketBody = this.closest('.add-bucket').previousElementSibling;
const newRow = document.createElement('div');
newRow.className = 'bucket-row';
const schemeCount = document.querySelectorAll('.bucket-row:not(:first-child)').length + 1;
newRow.innerHTML = `
<div>方案${schemeCount}</div>
<div><input type="number" min="0" max="99" value="0" class="form-control" style="padding: 8px;"></div>
<div><input type="number" min="0" max="99" value="0" class="form-control" style="padding: 8px;"></div>
<div>
<div class="file-upload" onclick="handleExcelUpload(this)">
<i class="fas fa-file-excel"></i>
<p>上传Excel</p>
</div>
<div class="file-info" style="display: none;">
<div class="file-name">
<div>
<i class="fas fa-file-excel" style="color: #1d6f42;"></i>
<strong>未上传</strong>
</div>
<i class="fas fa-times" style="cursor: pointer;" onclick="removeExcelFile(this)"></i>
</div>
</div>
</div>
<div><i class="fas fa-trash-alt" style="color: #dc3545; cursor: pointer;"></i></div>
`;
bucketBody.appendChild(newRow);
const deleteBtn = newRow.querySelector('.fa-trash-alt');
deleteBtn.addEventListener('click', function() {
newRow.remove();
renumberSchemes();
});
});
function renumberSchemes() {
const schemeRows = document.querySelectorAll('.bucket-row:not(:first-child)');
schemeRows.forEach((row, index) => {
row.querySelector('div:first-child').textContent = `方案${index + 1}`;
});
}
function generateTestGroupId() {
const now = new Date();
const dateStr = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}`;
return `TG_${dateStr}_${Math.floor(Math.random() * 100).toString().padStart(3, '0')}`;
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('testGroupId').value = generateTestGroupId();
document.querySelectorAll('.fa-trash-alt').forEach(btn => {
btn.addEventListener('click', function() {
const row = this.closest('.bucket-row');
if (row) {
row.remove();
renumberSchemes();
}
});
});
initBucketVisualization();
});
</script>
</body>
</html>
<script type="application/javascript" src="main.js"></script>
</html>