 | |  |  | AIWROK软件框架的抖音自动化营销系统
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>🎵 抖音自动化营销系统 - AIWROK Pro</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
-
- body {
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- min-height: 100vh;
- padding: 15px;
- }
-
- .container {
- max-width: 800px;
- margin: 0 auto;
- background: white;
- border-radius: 20px;
- box-shadow: 0 20px 60px rgba(0,0,0,0.15);
- overflow: hidden;
- }
-
- /* 头部样式 */
- .header {
- background: linear-gradient(135deg, #fe2c55 0%, #ff6b6b 50%, #ffa502 100%);
- color: white;
- padding: 35px 25px;
- text-align: center;
- position: relative;
- overflow: hidden;
- }
-
- .header::before {
- content: '';
- position: absolute;
- top: -50%;
- left: -50%;
- width: 200%;
- height: 200%;
- background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
- animation: pulse 4s ease-in-out infinite;
- }
-
- @keyframes pulse {
- 0%, 100% { transform: scale(1); opacity: 0.5; }
- 50% { transform: scale(1.1); opacity: 0.8; }
- }
-
- .header h1 {
- font-size: 28px;
- margin-bottom: 10px;
- position: relative;
- z-index: 1;
- text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
- }
-
- .header p {
- font-size: 15px;
- opacity: 0.95;
- position: relative;
- z-index: 1;
- }
-
- .version-badge {
- display: inline-block;
- background: rgba(255,255,255,0.2);
- padding: 5px 15px;
- border-radius: 20px;
- font-size: 12px;
- margin-top: 10px;
- position: relative;
- z-index: 1;
- }
-
- /* 标签页导航 */
- .tab-nav {
- display: flex;
- background: #f8f9fa;
- border-bottom: 2px solid #e0e0e0;
- overflow-x: auto;
- }
-
- .tab-btn {
- flex: 1;
- padding: 15px 20px;
- border: none;
- background: transparent;
- font-size: 14px;
- font-weight: 600;
- color: #666;
- cursor: pointer;
- transition: all 0.3s;
- white-space: nowrap;
- position: relative;
- }
-
- .tab-btn.active {
- color: #fe2c55;
- background: white;
- }
-
- .tab-btn.active::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- height: 3px;
- background: #fe2c55;
- }
-
- .tab-btn:hover {
- background: rgba(254, 44, 85, 0.05);
- }
-
- /* 内容区域 */
- .content {
- padding: 25px;
- }
-
- .tab-content {
- display: none;
- }
-
- .tab-content.active {
- display: block;
- animation: fadeIn 0.3s ease;
- }
-
- @keyframes fadeIn {
- from { opacity: 0; transform: translateY(10px); }
- to { opacity: 1; transform: translateY(0); }
- }
-
- /* 卡片样式 */
- .card {
- background: white;
- border: 2px solid #f0f0f0;
- border-radius: 12px;
- padding: 20px;
- margin-bottom: 20px;
- transition: all 0.3s;
- }
-
- .card:hover {
- border-color: #fe2c55;
- box-shadow: 0 5px 20px rgba(254, 44, 85, 0.1);
- }
-
- .card-title {
- font-size: 18px;
- font-weight: bold;
- color: #333;
- margin-bottom: 15px;
- display: flex;
- align-items: center;
- gap: 8px;
- }
-
- .card-title::before {
- content: '';
- width: 4px;
- height: 20px;
- background: linear-gradient(to bottom, #fe2c55, #ff6b6b);
- border-radius: 2px;
- }
-
- /* 表单元素 */
- .form-group {
- margin-bottom: 18px;
- }
-
- .form-group label {
- display: block;
- font-size: 14px;
- color: #555;
- margin-bottom: 8px;
- font-weight: 500;
- }
-
- .form-group input[type="text"],
- .form-group input[type="number"],
- .form-group textarea,
- .form-group select {
- width: 100%;
- padding: 12px 15px;
- border: 2px solid #e0e0e0;
- border-radius: 8px;
- font-size: 15px;
- transition: all 0.3s;
- background: #fafafa;
- }
-
- .form-group input:focus,
- .form-group textarea:focus,
- .form-group select:focus {
- outline: none;
- border-color: #fe2c55;
- background: white;
- box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
- }
-
- .form-group textarea {
- resize: vertical;
- min-height: 100px;
- font-family: inherit;
- }
-
- .form-hint {
- font-size: 12px;
- color: #999;
- margin-top: 5px;
- }
-
- /* 开关样式 */
- .switch-group {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 15px;
- background: #f8f9fa;
- border-radius: 10px;
- margin-bottom: 10px;
- transition: all 0.3s;
- }
-
- .switch-group:hover {
- background: #f0f0f0;
- }
-
- .switch-info {
- flex: 1;
- }
-
- .switch-label {
- font-size: 15px;
- color: #333;
- font-weight: 500;
- margin-bottom: 3px;
- }
-
- .switch-desc {
- font-size: 12px;
- color: #999;
- }
-
- .switch {
- position: relative;
- width: 56px;
- height: 30px;
- margin-left: 15px;
- }
-
- .switch input {
- opacity: 0;
- width: 0;
- height: 0;
- }
-
- .slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #ccc;
- transition: 0.3s;
- border-radius: 30px;
- }
-
- .slider:before {
- position: absolute;
- content: "";
- height: 24px;
- width: 24px;
- left: 3px;
- bottom: 3px;
- background-color: white;
- transition: 0.3s;
- border-radius: 50%;
- box-shadow: 0 2px 4px rgba(0,0,0,0.2);
- }
-
- input:checked + .slider {
- background: linear-gradient(135deg, #fe2c55 0%, #ff6b6b 100%);
- }
-
- input:checked + .slider:before {
- transform: translateX(26px);
- }
-
- /* 按钮组 */
- .btn-group {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
- gap: 12px;
- margin-top: 20px;
- }
-
- .btn {
- padding: 14px 20px;
- border: none;
- border-radius: 10px;
- font-size: 15px;
- font-weight: 600;
- cursor: pointer;
- transition: all 0.3s;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- position: relative;
- overflow: hidden;
- }
-
- .btn::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- width: 0;
- height: 0;
- border-radius: 50%;
- background: rgba(255,255,255,0.3);
- transform: translate(-50%, -50%);
- transition: width 0.6s, height 0.6s;
- }
-
- .btn:active::before {
- width: 300px;
- height: 300px;
- }
-
- .btn-primary {
- background: linear-gradient(135deg, #fe2c55 0%, #ff6b6b 100%);
- color: white;
- box-shadow: 0 4px 15px rgba(254, 44, 85, 0.3);
- }
-
- .btn-primary:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(254, 44, 85, 0.4);
- }
-
- .btn-success {
- background: linear-gradient(135deg, #00C851 0%, #00a843 100%);
- color: white;
- box-shadow: 0 4px 15px rgba(0, 200, 81, 0.3);
- }
-
- .btn-success:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(0, 200, 81, 0.4);
- }
-
- .btn-warning {
- background: linear-gradient(135deg, #ffbb33 0%, #ff8800 100%);
- color: white;
- box-shadow: 0 4px 15px rgba(255, 187, 51, 0.3);
- }
-
- .btn-warning:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(255, 187, 51, 0.4);
- }
-
- .btn-danger {
- background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
- color: white;
- box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
- }
-
- .btn-danger:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(255, 68, 68, 0.4);
- }
-
- .btn-secondary {
- background: #f0f0f0;
- color: #333;
- }
-
- .btn-secondary:hover {
- background: #e0e0e0;
- }
-
- /* 状态面板 */
- .status-panel {
- background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
- border: 2px solid #e0e0e0;
- border-radius: 12px;
- padding: 20px;
- margin-top: 20px;
- }
-
- .status-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
- }
-
- .status-title {
- font-size: 16px;
- font-weight: bold;
- color: #333;
- }
-
- .status-indicator {
- display: flex;
- align-items: center;
- gap: 8px;
- font-size: 14px;
- font-weight: 600;
- }
-
- .status-dot {
- width: 10px;
- height: 10px;
- border-radius: 50%;
- animation: blink 1.5s infinite;
- }
-
- .status-dot.running {
- background: #00C851;
- }
-
- .status-dot.stopped {
- background: #ff4444;
- animation: none;
- }
-
- @keyframes blink {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.3; }
- }
-
- .stats-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
- gap: 12px;
- margin-top: 15px;
- }
-
- .stat-item {
- background: white;
- border: 1px solid #e0e0e0;
- border-radius: 8px;
- padding: 12px;
- text-align: center;
- }
-
- .stat-value {
- font-size: 24px;
- font-weight: bold;
- color: #fe2c55;
- margin-bottom: 5px;
- }
-
- .stat-label {
- font-size: 12px;
- color: #999;
- }
-
- /* 进度条 */
- .progress-container {
- margin-top: 15px;
- }
-
- .progress-bar {
- width: 100%;
- height: 10px;
- background: #e0e0e0;
- border-radius: 5px;
- overflow: hidden;
- position: relative;
- }
-
- .progress-fill {
- height: 100%;
- background: linear-gradient(90deg, #fe2c55 0%, #ff6b6b 50%, #ffa502 100%);
- transition: width 0.5s ease;
- border-radius: 5px;
- position: relative;
- }
-
- .progress-fill::after {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
- animation: shimmer 2s infinite;
- }
-
- @keyframes shimmer {
- 0% { transform: translateX(-100%); }
- 100% { transform: translateX(100%); }
- }
-
- .progress-text {
- text-align: center;
- margin-top: 8px;
- font-size: 13px;
- color: #666;
- }
-
- /* 日志面板 */
- .log-panel {
- background: #1e1e1e;
- border-radius: 12px;
- padding: 15px;
- margin-top: 20px;
- max-height: 400px;
- overflow-y: auto;
- font-family: 'Courier New', Consolas, monospace;
- font-size: 13px;
- line-height: 1.8;
- }
-
- .log-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10px;
- padding-bottom: 10px;
- border-bottom: 1px solid #333;
- }
-
- .log-title {
- color: #fff;
- font-weight: bold;
- }
-
- .log-clear {
- background: #333;
- color: #fff;
- border: none;
- padding: 5px 12px;
- border-radius: 5px;
- font-size: 12px;
- cursor: pointer;
- }
-
- .log-clear:hover {
- background: #444;
- }
-
- .log-entry {
- margin-bottom: 6px;
- padding: 4px 0;
- border-bottom: 1px solid #2a2a2a;
- }
-
- .log-time {
- color: #888;
- margin-right: 8px;
- }
-
- .log-info {
- color: #4ec9b0;
- }
-
- .log-success {
- color: #89d185;
- }
-
- .log-error {
- color: #f48771;
- }
-
- .log-warn {
- color: #dcdcaa;
- }
-
- /* 提示框 */
- .toast {
- position: fixed;
- top: 20px;
- right: 20px;
- background: white;
- border-left: 4px solid #fe2c55;
- box-shadow: 0 5px 20px rgba(0,0,0,0.2);
- padding: 15px 20px;
- border-radius: 8px;
- display: none;
- animation: slideIn 0.3s ease;
- z-index: 1000;
- max-width: 350px;
- }
-
- @keyframes slideIn {
- from {
- transform: translateX(100%);
- opacity: 0;
- }
- to {
- transform: translateX(0);
- opacity: 1;
- }
- }
-
- .toast.show {
- display: block;
- }
-
- .toast-title {
- font-weight: bold;
- margin-bottom: 5px;
- color: #333;
- }
-
- .toast-message {
- color: #666;
- font-size: 14px;
- }
-
- /* 响应式设计 */
- @media (max-width: 768px) {
- .container {
- border-radius: 15px;
- }
-
- .header {
- padding: 25px 15px;
- }
-
- .header h1 {
- font-size: 22px;
- }
-
- .content {
- padding: 15px;
- }
-
- .btn-group {
- grid-template-columns: 1fr;
- }
-
- .stats-grid {
- grid-template-columns: repeat(2, 1fr);
- }
- }
- </style>
- </head>
- <body>
- <!-- Toast提示 -->
- <div class="toast" id="toast">
- <div class="toast-title" id="toastTitle">提示</div>
- <div class="toast-message" id="toastMessage"></div>
- </div>
-
- <div class="container">
- <!-- 头部 -->
- <div class="header">
- <h1>🎵 抖音自动化营销系统</h1>
- <p>AIWROK Pro - 智能广告投放平台</p>
- <div class="version-badge">v2.0.0 | Build 2026.06.13</div>
- </div>
-
- <!-- 标签页导航 -->
- <div class="tab-nav">
- <button class="tab-btn active" onclick="switchTab('config')">️ 任务配置</button>
- <button class="tab-btn" onclick="switchTab('control')">🎮 执行控制</button>
- <button class="tab-btn" onclick="switchTab('monitor')">📊 实时监控</button>
- <button class="tab-btn" onclick="switchTab('logs')">📝 运行日志</button>
- </div>
-
- <div class="content">
- <!-- 任务配置 -->
- <div class="tab-content active" id="tab-config">
- <div class="card">
- <div class="card-title">搜索关键词</div>
- <div class="form-group">
- <label for="keywords">请输入要搜索的关键词,多个关键词用逗号分隔:</label>
- <input type="text" id="keywords" placeholder="美食探店,旅游攻略,健身教程">
- </div>
- </div>
-
- <div class="card">
- <div class="card-title">任务设置</div>
- <div class="form-group">
- <label for="maxVideos">最大视频数:</label>
- <input type="number" id="maxVideos" placeholder="5">
- </div>
- <div class="form-group">
- <label for="waitTime">操作间隔(秒):</label>
- <input type="number" id="waitTime" placeholder="2">
- </div>
- </div>
-
- <div class="card">
- <div class="card-title">操作开关</div>
- <div class="switch-group">
- <div class="switch-info">
- <div class="switch-label">点赞</div>
- <div class="switch-desc">是否自动点赞视频</div>
- </div>
- <label class="switch">
- <input type="checkbox" id="likeEnabled">
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-group">
- <div class="switch-info">
- <div class="switch-label">评论</div>
- <div class="switch-desc">是否自动评论视频</div>
- </div>
- <label class="switch">
- <input type="checkbox" id="commentEnabled">
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-group">
- <div class="switch-info">
- <div class="switch-label">分享</div>
- <div class="switch-desc">是否自动分享视频</div>
- </div>
- <label class="switch">
- <input type="checkbox" id="shareEnabled">
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-group">
- <div class="switch-info">
- <div class="switch-label">关注</div>
- <div class="switch-desc">是否自动关注作者</div>
- </div>
- <label class="switch">
- <input type="checkbox" id="followEnabled">
- <span class="slider"></span>
- </label>
- </div>
- </div>
-
- <div class="card">
- <div class="card-title">评论模板</div>
- <div class="form-group">
- <label for="commentTemplates">请输入评论模板,每行一个模板:</label>
- <textarea id="commentTemplates" placeholder="这个视频真不错!👍\n学到了,感谢分享!\n太实用了,已收藏\n支持一下!加油💪"></textarea>
- </div>
- </div>
-
- <div class="btn-group">
- <button class="btn btn-primary" onclick="saveConfig()">💾 保存配置</button>
- <button class="btn btn-secondary" onclick="loadConfig()">📂 加载配置</button>
- <button class="btn btn-danger" onclick="resetConfig()">🗑️ 重置配置</button>
- </div>
- </div>
-
- <!-- 执行控制 -->
- <div class="tab-content" id="tab-control">
- <div class="btn-group">
- <button class="btn btn-primary" id="btnStart" onclick="startCampaign()">🚀 启动任务</button>
- <button class="btn btn-danger" id="btnStop" onclick="stopCampaign()">⏹️ 停止任务</button>
- </div>
- </div>
-
- <!-- 实时监控 -->
- <div class="tab-content" id="tab-monitor">
- <div class="status-panel">
- <div class="status-header">
- <div class="status-title">任务状态</div>
- <div class="status-indicator">
- <div id="statusDot" class="status-dot stopped"></div>
- <div id="statusText">已停止</div>
- </div>
- </div>
- <div class="stats-grid">
- <div class="stat-item">
- <div class="stat-value" id="statTotal">0</div>
- <div class="stat-label">总视频数</div>
- </div>
- <div class="stat-item">
- <div class="stat-value" id="statLiked">0</div>
- <div class="stat-label">点赞数</div>
- </div>
- <div class="stat-item">
- <div class="stat-value" id="statCommented">0</div>
- <div class="stat-label">评论数</div>
- </div>
- <div class="stat-item">
- <div class="stat-value" id="statShared">0</div>
- <div class="stat-label">分享数</div>
- </div>
- <div class="stat-item">
- <div class="stat-value" id="statFollowed">0</div>
- <div class="stat-label">关注数</div>
- </div>
- <div class="stat-item">
- <div class="stat-value" id="statFailed">0</div>
- <div class="stat-label">失败数</div>
- </div>
- </div>
- <div class="progress-container">
- <div class="progress-bar">
- <div class="progress-fill" id="progressBar"></div>
- </div>
- <div class="progress-text" id="progressText">准备就绪</div>
- </div>
- <div class="status-header">
- <div class="status-title">任务进度</div>
- <div class="status-indicator">
- <div id="currentStep">-</div>
- <div id="startTime">-</div>
- </div>
- </div>
- </div>
-
- <div class="btn-group">
- <button class="btn btn-secondary" onclick="resetStats()">🔄 重置统计</button>
- <button class="btn btn-primary" onclick="exportReport()">📄 导出报告</button>
- </div>
- </div>
-
- <!-- 运行日志 -->
- <div class="tab-content" id="tab-logs">
- <div class="log-panel">
- <div class="log-header">
- <div class="log-title">运行日志</div>
- <button class="log-clear" onclick="clearLogs()">🗑️ 清空日志</button>
- </div>
- <div id="logContainer">
- <div class="log-entry"><span class="log-time">[系统]</span><span class="log-info">日志已清空</span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- // ==================== 全局变量 ====================
- var isRunning = false;
- var statusInterval = null;
- var taskConfig = {
- keywords: '',
- maxVideos: 5,
- waitTime: 2,
- likeEnabled: true,
- commentEnabled: true,
- shareEnabled: false,
- followEnabled: false,
- commentTemplates: ''
- };
-
- // ==================== 工具函数 ====================
-
- function showToast(title, message, type) {
- var toast = document.getElementById('toast');
- var toastTitle = document.getElementById('toastTitle');
- var toastMessage = document.getElementById('toastMessage');
-
- toastTitle.textContent = title;
- toastMessage.textContent = message;
-
- if (type === 'success') {
- toast.style.borderLeftColor = '#00C851';
- } else if (type === 'error') {
- toast.style.borderLeftColor = '#ff4444';
- } else if (type === 'warning') {
- toast.style.borderLeftColor = '#ffbb33';
- } else {
- toast.style.borderLeftColor = '#fe2c55';
- }
-
- toast.classList.add('show');
-
- setTimeout(function() {
- toast.classList.remove('show');
- }, 3000);
- }
-
- function addLog(message, type) {
- var logContainer = document.getElementById('logContainer');
- var timestamp = new Date().toLocaleTimeString();
- var entry = document.createElement('div');
- entry.className = 'log-entry';
-
- var timeSpan = document.createElement('span');
- timeSpan.className = 'log-time';
- timeSpan.textContent = '[' + timestamp + '] ';
-
- var msgSpan = document.createElement('span');
- msgSpan.className = 'log-' + type;
- msgSpan.textContent = message;
-
- entry.appendChild(timeSpan);
- entry.appendChild(msgSpan);
- logContainer.appendChild(entry);
-
- // 自动滚动到底部
- var logPanel = document.querySelector('.log-panel');
- logPanel.scrollTop = logPanel.scrollHeight;
- }
-
- function clearLogs() {
- var logContainer = document.getElementById('logContainer');
- logContainer.innerHTML = '<div class="log-entry"><span class="log-time">[系统]</span><span class="log-info">日志已清空</span></div>';
- showToast('提示', '日志已清空', 'info');
- }
-
- function switchTab(tabName) {
- // 隐藏所有标签页内容
- var tabContents = document.querySelectorAll('.tab-content');
- tabContents.forEach(function(content) {
- content.classList.remove('active');
- });
-
- // 取消所有按钮激活状态
- var tabBtns = document.querySelectorAll('.tab-btn');
- tabBtns.forEach(function(btn) {
- btn.classList.remove('active');
- });
-
- // 显示选中的标签页
- document.getElementById('tab-' + tabName).classList.add('active');
-
- // 激活对应按钮
- event.target.classList.add('active');
- }
-
- function updateProgress(current, total) {
- var percent = Math.round((current / total) * 100);
- document.getElementById('progressBar').style.width = percent + '%';
- document.getElementById('progressText').textContent = '进度: ' + current + '/' + total + ' (' + percent + '%)';
- }
-
- function updateStatus(data) {
- try {
- var status = typeof data === 'string' ? JSON.parse(data) : data;
-
- // 更新运行状态
- var statusDot = document.getElementById('statusDot');
- var statusText = document.getElementById('statusText');
-
- if (status.isRunning) {
- statusDot.className = 'status-dot running';
- statusText.textContent = '运行中';
- statusText.style.color = '#00C851';
- } else {
- statusDot.className = 'status-dot stopped';
- statusText.textContent = '已停止';
- statusText.style.color = '#ff4444';
- }
-
- // 更新步骤信息
- if (status.currentStep && status.totalSteps) {
- document.getElementById('currentStep').textContent =
- status.currentStep + '/' + status.totalSteps;
- updateProgress(status.currentStep, status.totalSteps);
- }
-
- // 更新统计数据
- if (status.statistics) {
- document.getElementById('statTotal').textContent = status.statistics.totalVideos || 0;
- document.getElementById('statLiked').textContent = status.statistics.likedCount || 0;
- document.getElementById('statCommented').textContent = status.statistics.commentedCount || 0;
- document.getElementById('statShared').textContent = status.statistics.sharedCount || 0;
- document.getElementById('statFollowed').textContent = status.statistics.followedCount || 0;
- document.getElementById('statFailed').textContent = status.statistics.failedCount || 0;
- }
-
- // 更新开始时间
- if (status.statistics && status.statistics.startTime) {
- document.getElementById('startTime').textContent = status.statistics.startTime;
- }
-
- } catch (e) {
- console.error('更新状态失败:', e);
- }
- }
-
- // ==================== 配置管理 ====================
-
- function saveConfig() {
- try {
- addLog('正在保存配置...', 'info');
-
- if (window.at && window.at.publicSet) {
- // 保存搜索关键词
- var keywords = document.getElementById('keywords').value;
- window.at.publicSet('douyin_keywords', keywords);
-
- // 保存最大视频数
- var maxVideos = document.getElementById('maxVideos').value;
- window.at.publicSet('douyin_max_videos', maxVideos);
-
- // 保存等待时间
- var waitTime = document.getElementById('waitTime').value;
- window.at.publicSet('douyin_wait_time', waitTime);
-
- // 保存开关配置
- window.at.publicSet('douyin_like_enabled',
- document.getElementById('likeEnabled').checked ? 'true' : 'false');
- window.at.publicSet('douyin_comment_enabled',
- document.getElementById('commentEnabled').checked ? 'true' : 'false');
- window.at.publicSet('douyin_share_enabled',
- document.getElementById('shareEnabled').checked ? 'true' : 'false');
- window.at.publicSet('douyin_follow_enabled',
- document.getElementById('followEnabled').checked ? 'true' : 'false');
-
- // 保存评论模板
- var commentTemplates = document.getElementById('commentTemplates').value;
- window.at.publicSet('douyin_comment_templates', commentTemplates);
-
- addLog('配置保存成功', 'success');
- showToast('成功', '配置已保存到原生环境', 'success');
-
- // 同时通知原生端
- if (window.at.callFun) {
- window.at.callFun('main', 'MSG:💾 配置已保存');
- }
- } else {
- addLog('publicSet方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
- } catch (e) {
- addLog('保存配置失败: ' + e.message, 'error');
- showToast('错误', '保存失败: ' + e.message, 'error');
- }
- }
-
- function loadConfig() {
- try {
- addLog('正在加载配置...', 'info');
-
- if (window.at && window.at.publicGet) {
- // 加载搜索关键词
- var keywords = window.at.publicGet('douyin_keywords');
- if (keywords) {
- document.getElementById('keywords').value = keywords;
- }
-
- // 加载最大视频数
- var maxVideos = window.at.publicGet('douyin_max_videos');
- if (maxVideos) {
- document.getElementById('maxVideos').value = maxVideos;
- }
-
- // 加载等待时间
- var waitTime = window.at.publicGet('douyin_wait_time');
- if (waitTime) {
- document.getElementById('waitTime').value = waitTime;
- }
-
- // 加载开关配置
- var likeEnabled = window.at.publicGet('douyin_like_enabled');
- if (likeEnabled !== null) {
- document.getElementById('likeEnabled').checked = likeEnabled === 'true';
- }
-
- var commentEnabled = window.at.publicGet('douyin_comment_enabled');
- if (commentEnabled !== null) {
- document.getElementById('commentEnabled').checked = commentEnabled === 'true';
- }
-
- var shareEnabled = window.at.publicGet('douyin_share_enabled');
- if (shareEnabled !== null) {
- document.getElementById('shareEnabled').checked = shareEnabled === 'true';
- }
-
- var followEnabled = window.at.publicGet('douyin_follow_enabled');
- if (followEnabled !== null) {
- document.getElementById('followEnabled').checked = followEnabled === 'true';
- }
-
- // 加载评论模板
- var commentTemplates = window.at.publicGet('douyin_comment_templates');
- if (commentTemplates) {
- document.getElementById('commentTemplates').value = commentTemplates;
- }
-
- addLog('配置加载成功', 'success');
- showToast('成功', '配置已从原生环境加载', 'success');
- } else {
- addLog('publicGet方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
- } catch (e) {
- addLog('加载配置失败: ' + e.message, 'error');
- showToast('错误', '加载失败: ' + e.message, 'error');
- }
- }
-
- function resetConfig() {
- if (confirm('确定要重置为默认配置吗?')) {
- document.getElementById('keywords').value = '美食探店,旅游攻略,健身教程';
- document.getElementById('maxVideos').value = '5';
- document.getElementById('waitTime').value = '2';
- document.getElementById('likeEnabled').checked = true;
- document.getElementById('commentEnabled').checked = true;
- document.getElementById('shareEnabled').checked = false;
- document.getElementById('followEnabled').checked = false;
- document.getElementById('commentTemplates').value = '这个视频真不错!👍\n学到了,感谢分享!\n太实用了,已收藏\n支持一下!加油💪';
-
- addLog('配置已重置为默认值', 'info');
- showToast('提示', '配置已重置', 'info');
- }
- }
-
- // ==================== 任务控制 ====================
-
- function startCampaign() {
- if (isRunning) {
- showToast('警告', '任务已在运行中', 'warning');
- return;
- }
-
- try {
- addLog('🚀 正在启动抖音广告任务...', 'info');
-
- // 先保存配置
- saveConfig();
-
- // 调用原生函数 - AIWROK只支持调用main函数
- if (window.at && window.at.callFun) {
- var result = window.at.callFun('main', 'START_CAMPAIGN');
- addLog('任务启动指令已发送', 'success');
-
- isRunning = true;
- document.getElementById('btnStart').disabled = true;
- document.getElementById('btnStop').disabled = false;
-
- showToast('成功', '任务已启动', 'success');
-
- // 定期获取状态
- if (statusInterval) {
- clearInterval(statusInterval);
- }
- statusInterval = setInterval(function() {
- getStatus();
- }, 2000);
-
- } else {
- addLog('callFun方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
-
- } catch (e) {
- addLog('启动失败: ' + e.message, 'error');
- showToast('错误', '启动失败: ' + e.message, 'error');
- }
- }
-
- function stopCampaign() {
- if (!isRunning) {
- showToast('警告', '当前没有运行中的任务', 'warning');
- return;
- }
-
- try {
- addLog('⏹️ 正在停止任务...', 'warn');
-
- if (window.at && window.at.callFun) {
- var result = window.at.callFun('main', 'STOP_CAMPAIGN');
- addLog('任务停止指令已发送', 'success');
-
- isRunning = false;
- document.getElementById('btnStart').disabled = false;
- document.getElementById('btnStop').disabled = true;
-
- if (statusInterval) {
- clearInterval(statusInterval);
- statusInterval = null;
- }
-
- showToast('成功', '任务已停止', 'success');
- } else {
- addLog('callFun方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
-
- } catch (e) {
- addLog('停止失败: ' + e.message, 'error');
- showToast('错误', '停止失败: ' + e.message, 'error');
- }
- }
-
- function getStatus() {
- try {
- if (window.at && window.at.callFun) {
- var status = window.at.callFun('main', 'GET_STATUS');
- updateStatus(status);
- }
- } catch (e) {
- // 静默失败,避免频繁报错
- }
- }
-
- function resetStats() {
- if (confirm('确定要重置统计数据吗?')) {
- try {
- addLog('🔄 正在重置统计数据...', 'info');
-
- if (window.at && window.at.callFun) {
- var result = window.at.callFun('main', 'RESET_STATS');
- addLog(result, 'success');
-
- // 清空状态显示
- document.getElementById('statTotal').textContent = '0';
- document.getElementById('statLiked').textContent = '0';
- document.getElementById('statCommented').textContent = '0';
- document.getElementById('statShared').textContent = '0';
- document.getElementById('statFollowed').textContent = '0';
- document.getElementById('statFailed').textContent = '0';
- document.getElementById('progressBar').style.width = '0%';
- document.getElementById('progressText').textContent = '准备就绪';
- document.getElementById('currentStep').textContent = '-';
- document.getElementById('startTime').textContent = '-';
-
- showToast('成功', '统计数据已重置', 'success');
- } else {
- addLog('callFun方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
-
- } catch (e) {
- addLog('重置失败: ' + e.message, 'error');
- showToast('错误', '重置失败: ' + e.message, 'error');
- }
- }
- }
-
- function exportReport() {
- try {
- addLog('📄 正在生成执行报告...', 'info');
-
- var report = '========================================\n';
- report += '📊 抖音广告投放执行报告\n';
- report += '========================================\n';
- report += '生成时间: ' + new Date().toLocaleString() + '\n\n';
-
- // 添加配置信息
- report += '--- 配置信息 ---\n';
- report += '搜索关键词: ' + document.getElementById('keywords').value + '\n';
- report += '最大视频数: ' + document.getElementById('maxVideos').value + '\n';
- report += '操作间隔: ' + document.getElementById('waitTime').value + '秒\n';
- report += '点赞: ' + (document.getElementById('likeEnabled').checked ? '开启' : '关闭') + '\n';
- report += '评论: ' + (document.getElementById('commentEnabled').checked ? '开启' : '关闭') + '\n';
- report += '分享: ' + (document.getElementById('shareEnabled').checked ? '开启' : '关闭') + '\n';
- report += '关注: ' + (document.getElementById('followEnabled').checked ? '开启' : '关闭') + '\n\n';
-
- // 添加统计数据
- report += '--- 统计数据 ---\n';
- report += '总视频数: ' + document.getElementById('statTotal').textContent + '\n';
- report += '点赞数: ' + document.getElementById('statLiked').textContent + '\n';
- report += '评论数: ' + document.getElementById('statCommented').textContent + '\n';
- report += '分享数: ' + document.getElementById('statShared').textContent + '\n';
- report += '关注数: ' + document.getElementById('statFollowed').textContent + '\n';
- report += '失败数: ' + document.getElementById('statFailed').textContent + '\n';
- report += '========================================\n';
-
- // 显示报告
- alert(report);
-
- addLog('报告已生成', 'success');
- showToast('成功', '执行报告已生成', 'success');
-
- } catch (e) {
- addLog('生成报告失败: ' + e.message, 'error');
- showToast('错误', '生成报告失败: ' + e.message, 'error');
- }
- }
-
- function testConnection() {
- try {
- addLog('🔗 正在测试连接...', 'info');
-
- if (window.at && window.at.callFun) {
- var testMessage = 'H5控制台连接测试 - ' + new Date().toLocaleString();
- var result = window.at.callFun('main', 'TEST:' + testMessage);
- addLog(result, 'success');
- showToast('成功', result, 'success');
- } else {
- addLog('callFun方法不可用', 'error');
- showToast('错误', '无法连接到原生环境', 'error');
- }
-
- } catch (e) {
- addLog('测试连接失败: ' + e.message, 'error');
- showToast('错误', '连接失败: ' + e.message, 'error');
- }
- }
-
- // ==================== 初始化 ====================
-
- window.onload = function() {
- addLog('控制台初始化完成', 'info');
- addLog('系统版本: v2.0.0 | Build 2026.06.13', 'info');
-
- // 自动加载配置
- setTimeout(function() {
- loadConfig();
- }, 300);
-
- // 测试连接(延迟更长时间确保WebView完全初始化)
- setTimeout(function() {
- try {
- testConnection();
- } catch (e) {
- addLog('连接测试失败(可忽略): ' + e.message, 'warn');
- }
- }, 1500);
-
- addLog('等待用户操作...', 'info');
- };
- </script>
- </body>
- </html>
复制代码
| |  | |  |
|