Просмотр исходного кода

优化任务管理器,新增更新 cookie 功能

luojunhui 1 месяц назад
Родитель
Сommit
65821c20b0
1 измененных файлов с 174 добавлено и 0 удалено
  1. 174 0
      ui/src/views/Welcome.vue

+ 174 - 0
ui/src/views/Welcome.vue

@@ -0,0 +1,174 @@
+<template>
+  <div class="welcome-page">
+    <el-card class="welcome-card">
+      <h1>Welcome to <span class="highlight">俊辉's Work Agent</span></h1>
+      <p class="subtitle">高效、简洁地管理与执行任务。</p>
+
+      <div class="btn-group">
+        <el-button type="primary" size="large" @click="goTasks">📋 查看任务列表</el-button>
+        <el-button type="success" size="large" @click="goToken">🔑 更新公众号 Token</el-button>
+      </div>
+
+      <div class="task-section">
+        <h2>🧠 定时任务管理器</h2>
+        <p class="desc">点击下方按钮可手动触发任务执行(需密码验证)</p>
+
+        <el-table :data="tasks" border stripe>
+          <el-table-column prop="name" label="任务名称" width="260" />
+          <el-table-column prop="desc" label="任务说明" />
+          <el-table-column prop="url" label="目标地址" width="280" show-overflow-tooltip />
+          <el-table-column label="操作" width="150" align="center">
+            <template #default="{ row }">
+              <el-button size="small" type="primary" @click="runTask(row)">
+                ▶️ 执行任务
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+
+      <div class="footer">
+        <p>🎯 让每个任务都更清晰可控,助你轻松掌握全局。</p>
+      </div>
+    </el-card>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { useRouter } from 'vue-router'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import axios from 'axios'
+
+const router = useRouter()
+const goTasks = () => router.push('/tasks')
+const goToken = () => router.push('/token')
+
+// ✅ 执行密码(改成你自己的)
+const EXEC_PASSWORD = 'curry'
+
+// ✅ 所有 curl 任务
+const tasks = [
+  { name: '公众号抓取-手动挑号', desc: '公众文章抓取-手动挑号', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'crawler_gzh_articles', account_method: '1030-手动挑号', crawl_mode: 'account', strategy: 'V1' } },
+  { name: '公众号抓取-合作账号', desc: '公众文章抓取-手动挑号', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'crawler_gzh_articles', account_method: 'cooperate_account', crawl_mode: 'account', strategy: 'V1' } },
+  { name: '头条文章抓取', desc: '头条推荐流文章专区', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'crawler_toutiao' } },
+  { name: '公众号文章冷启动(v1)', desc: '文章路冷启动-策略 1', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'article_pool_cold_start', strategy: 'strategy_v1' } },
+  { name: '公众号文章冷启动(v3)', desc: '文章路冷启动-策略 3', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'article_pool_cold_start', strategy: 'strategy_v3' } },
+  { name: '头条文章冷启动', desc: '文章路冷启动-头条平台', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'article_pool_cold_start', platform: 'toutiao', crawler_methods: ['toutiao_account_association'] } },
+  { name: '每日文章回收任务', desc: 'daily_publish_articles_recycle', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'daily_publish_articles_recycle' } },
+  { name: 'root_source_id 更新', desc: 'update_root_source_id', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'update_root_source_id' } },
+  { name: '视频下架任务', desc: 'get_off_videos', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'get_off_videos' } },
+  { name: '内部文章监测', desc: 'inner_article_monitor', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'inner_article_monitor' } },
+  { name: '关注公众号任务', desc: 'follow_gzh_task', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'follow_gzh_task' } },
+  { name: '获取自动回复结果', desc: 'get_auto_reply_task', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'get_auto_reply_task' } },
+  { name: '解析自动回复 xml', desc: 'extract_task', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'extract_task' } },
+  { name: '阅读率均值计算', desc: 'update_account_read_rate_avg', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'update_account_read_rate_avg' } },
+  { name: '阅读均值计算', desc: 'update_account_read_avg', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'update_account_read_avg' } },
+  { name: '打开率均值计算', desc: 'update_account_open_rate_avg', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'update_account_open_rate_avg' } },
+  { name: '视频审核状态校验', desc: 'check_publish_video_audit_status', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'check_publish_video_audit_status' } },
+  { name: 'kimi 余额校验', desc: 'check_kimi_balance', url: 'http://192.168.100.31:6060/api/run_task', data: { task_name: 'check_kimi_balance' } },
+  { name: '小程序信息更新', desc: 'mini_program_detail_process', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'mini_program_detail_process' } },
+  { name: '外部账号文章回收', desc: 'recycle_outside_account_articles', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'recycle_outside_account_articles' } },
+  { name: '外部文章 RootID 更新', desc: 'update_outside_account_article_root_source_id', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'update_outside_account_article_root_source_id' } },
+  { name: '限流文章分析', desc: 'update_limited_account_info', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'update_limited_account_info' } },
+  { name: '候选账号质量分析', desc: 'candidate_account_quality_analysis', url: 'http://192.168.142.66:6060/api/run_task', data: { task_name: 'candidate_account_quality_analysis' } },
+]
+
+// ✅ 执行任务(带密码验证)
+const runTask = async (task: any) => {
+  try {
+    const input = await ElMessageBox.prompt('请输入执行密码以确认操作', '安全验证', {
+      confirmButtonText: '执行',
+      cancelButtonText: '取消',
+      inputType: 'password',
+      inputPlaceholder: '请输入密码',
+    })
+
+    if (input.value !== EXEC_PASSWORD) {
+      ElMessage.error('密码错误 ❌')
+      return
+    }
+
+    const res = await axios.post(task.url, task.data)
+    if (res.data?.success) {
+      ElMessage.success(`✅ ${task.name} 执行成功`)
+    } else {
+      ElMessage.success(`${task.name} 已触发`)
+    }
+  } catch (err: any) {
+    if (err === 'cancel') return
+    console.error(err)
+    ElMessage.error('任务执行失败')
+  }
+}
+</script>
+
+<style scoped>
+.welcome-page {
+  background: linear-gradient(180deg, #f5f8ff, #eef1f8);
+  height: 100vh;
+  display: flex;
+  justify-content: center;
+  align-items: flex-start;
+  padding-top: 40px;
+  overflow-y: auto;
+}
+
+.welcome-card {
+  text-align: center;
+  padding: 40px 60px;
+  border-radius: 18px;
+  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.08);
+  background: #fff;
+  width: 90%;
+  max-width: 1300px;
+}
+
+h1 {
+  font-size: 30px;
+  font-weight: 700;
+  color: #333;
+  margin-bottom: 10px;
+}
+
+.highlight {
+  color: #2a76ff;
+}
+
+.subtitle {
+  color: #666;
+  font-size: 16px;
+  margin-bottom: 30px;
+}
+
+.btn-group {
+  display: flex;
+  justify-content: center;
+  gap: 24px;
+  margin-bottom: 40px;
+}
+
+.task-section {
+  text-align: left;
+  margin-top: 20px;
+}
+
+.task-section h2 {
+  font-size: 20px;
+  margin-bottom: 10px;
+  color: #333;
+}
+
+.task-section .desc {
+  color: #666;
+  font-size: 14px;
+  margin-bottom: 16px;
+}
+
+.footer {
+  margin-top: 40px;
+  font-size: 14px;
+  color: #888;
+  font-style: italic;
+  text-align: center;
+}
+</style>