TaskDetailView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <div class="detail-page">
  3. <div class="detail-topbar">
  4. <el-button text class="detail-topbar__back" @click="goBack">返回列表</el-button>
  5. </div>
  6. <section class="hero-card">
  7. <div class="hero-main">
  8. <div class="hero-kicker">Task Detail</div>
  9. <h1 class="hero-title">{{ task.taskName || "任务详情" }}</h1>
  10. </div>
  11. <div class="hero-actions">
  12. <el-button type="primary" @click="reload">刷新数据</el-button>
  13. </div>
  14. </section>
  15. <section class="stats-grid">
  16. <article class="stat-card stat-card--status">
  17. <div class="stat-label">任务状态</div>
  18. <div class="stat-status">
  19. <el-tag :type="statusTagType(task.status)" effect="dark" size="large">{{ formatStatus(task.status) }}</el-tag>
  20. </div>
  21. <div class="stat-desc">{{ statusDescription }}</div>
  22. </article>
  23. <article class="stat-card">
  24. <div class="stat-label">任务编号</div>
  25. <div class="stat-value">#{{ task.id || "-" }}</div>
  26. </article>
  27. <article class="stat-card">
  28. <div class="stat-label">脚本类型</div>
  29. <div class="stat-value">{{ formatScriptType(task.scriptType) }}</div>
  30. </article>
  31. <article class="stat-card">
  32. <div class="stat-label">视频数量</div>
  33. <div class="stat-value">{{ videoUrls.length || 0 }}</div>
  34. </article>
  35. <article class="stat-card">
  36. <div class="stat-label">创建人</div>
  37. <div class="stat-value">{{ task.creatorName || "-" }}</div>
  38. </article>
  39. <article class="stat-card">
  40. <div class="stat-label">CodeDesk任务ID</div>
  41. <div class="stat-value stat-value--small">{{ task.codedeskTaskId || "-" }}</div>
  42. </article>
  43. </section>
  44. <section class="section-card">
  45. <div class="section-header">
  46. <div>
  47. <div class="section-kicker">Summary</div>
  48. <h2 class="section-title">摘要</h2>
  49. </div>
  50. </div>
  51. <pre class="content-block content-block--summary">{{ task.summary || "-" }}</pre>
  52. </section>
  53. <section class="section-card">
  54. <div class="section-header">
  55. <div>
  56. <div class="section-kicker">Analysis</div>
  57. <h2 class="section-title">视频分析文案</h2>
  58. </div>
  59. </div>
  60. <pre class="content-block content-block--analysis">{{ task.analysisContent || "-" }}</pre>
  61. </section>
  62. <section class="section-card">
  63. <div class="section-header">
  64. <div>
  65. <div class="section-kicker">Brief</div>
  66. <h2 class="section-title">用户要求</h2>
  67. </div>
  68. </div>
  69. <pre class="content-block content-block--brief">{{ task.promptHint || "-" }}</pre>
  70. </section>
  71. <section class="section-card section-card--script">
  72. <div class="section-header">
  73. <div>
  74. <div class="section-kicker">Final Script</div>
  75. <h2 class="section-title">脚本内容</h2>
  76. </div>
  77. </div>
  78. <pre class="content-block content-block--script">{{ task.scriptContent || "-" }}</pre>
  79. </section>
  80. <section class="section-card" v-if="task.errorMessage">
  81. <div class="section-header">
  82. <div>
  83. <div class="section-kicker">Error</div>
  84. <h2 class="section-title">失败原因</h2>
  85. </div>
  86. </div>
  87. <pre class="content-block content-block--danger">{{ task.errorMessage }}</pre>
  88. </section>
  89. <section class="section-card">
  90. <div class="section-header">
  91. <div>
  92. <div class="section-kicker">Inputs</div>
  93. <h2 class="section-title">素材输入</h2>
  94. </div>
  95. </div>
  96. <el-tabs class="material-tabs">
  97. <el-tab-pane label="结构化内容">
  98. <pre class="content-block content-block--material">{{ task.videoContent || "-" }}</pre>
  99. </el-tab-pane>
  100. <el-tab-pane label="转写文本">
  101. <pre class="content-block content-block--material">{{ task.transcript || "-" }}</pre>
  102. </el-tab-pane>
  103. </el-tabs>
  104. </section>
  105. <section class="section-card">
  106. <div class="section-header">
  107. <div>
  108. <div class="section-kicker">Source URLs</div>
  109. <h2 class="section-title">视频链接</h2>
  110. </div>
  111. </div>
  112. <div class="link-list">
  113. <div class="link-item link-item--lead">
  114. <div class="link-label">首个链接</div>
  115. <div class="link-text">{{ task.videoUrl || "-" }}</div>
  116. </div>
  117. <div v-for="(item, index) in videoUrls" :key="index" class="link-item">
  118. <div class="link-label">视频 {{ index + 1 }}</div>
  119. <div class="link-text">{{ item }}</div>
  120. </div>
  121. <div v-if="!videoUrls.length" class="empty-tip">暂无视频链接</div>
  122. </div>
  123. </section>
  124. </div>
  125. </template>
  126. <script setup>
  127. import { computed, onMounted, reactive } from "vue";
  128. import { useRoute, useRouter } from "vue-router";
  129. import { ElMessage } from "element-plus";
  130. import { getTaskApi } from "../api/modules";
  131. const route = useRoute();
  132. const router = useRouter();
  133. const task = reactive({});
  134. const videoUrls = computed(() => {
  135. if (!task.videoUrls) {
  136. return task.videoUrl ? [task.videoUrl] : [];
  137. }
  138. return String(task.videoUrls)
  139. .split(/\r?\n|,/)
  140. .map((item) => item.trim())
  141. .filter(Boolean);
  142. });
  143. const statusDescription = computed(() => {
  144. if (task.status === "DONE") return "结果已生成,可直接审阅与修改。";
  145. if (task.status === "RUNNING") return "任务处理中,建议稍后刷新。";
  146. if (task.status === "FAILED") return "任务执行失败,建议优先排查错误原因。";
  147. return "等待进入处理队列。";
  148. });
  149. const loadData = async () => {
  150. const id = route.params.id;
  151. const payload = await getTaskApi(id);
  152. Object.assign(task, payload);
  153. };
  154. const reload = async () => {
  155. try {
  156. await loadData();
  157. } catch (error) {
  158. ElMessage.error(error.message || "加载任务详情失败");
  159. }
  160. };
  161. const goBack = () => {
  162. router.push("/tasks");
  163. };
  164. const statusTagType = (status) => {
  165. if (status === "DONE") return "success";
  166. if (status === "RUNNING") return "warning";
  167. if (status === "FAILED") return "danger";
  168. return "info";
  169. };
  170. const formatStatus = (value) => {
  171. const map = {
  172. PENDING: "待处理",
  173. RUNNING: "处理中",
  174. DONE: "已完成",
  175. FAILED: "失败",
  176. };
  177. return map[value] || value || "-";
  178. };
  179. const formatScriptType = (value) => {
  180. const map = {
  181. VOICEOVER: "口播稿",
  182. STORYBOARD: "分镜稿",
  183. SUMMARY: "摘要稿",
  184. };
  185. return map[value] || value || "-";
  186. };
  187. onMounted(reload);
  188. </script>
  189. <style scoped>
  190. .detail-page {
  191. display: grid;
  192. gap: 18px;
  193. }
  194. .detail-topbar {
  195. display: flex;
  196. align-items: center;
  197. }
  198. .detail-topbar__back {
  199. padding-left: 0;
  200. font-size: 14px;
  201. font-weight: 600;
  202. }
  203. .hero-card {
  204. display: flex;
  205. justify-content: space-between;
  206. gap: 20px;
  207. padding: 24px 28px;
  208. border-radius: 20px;
  209. background: linear-gradient(135deg, #17324d 0%, #234869 100%);
  210. color: #f8fafc;
  211. box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
  212. }
  213. .hero-main {
  214. max-width: 760px;
  215. }
  216. .hero-kicker {
  217. font-size: 12px;
  218. font-weight: 800;
  219. letter-spacing: 0.12em;
  220. text-transform: uppercase;
  221. color: rgba(255, 255, 255, 0.68);
  222. }
  223. .hero-title {
  224. margin: 10px 0;
  225. font-size: 36px;
  226. line-height: 1.08;
  227. font-weight: 800;
  228. }
  229. .hero-actions {
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: center;
  233. gap: 12px;
  234. min-width: 132px;
  235. }
  236. .stats-grid {
  237. display: grid;
  238. grid-template-columns: 1.8fr repeat(5, minmax(0, 1fr));
  239. gap: 14px;
  240. }
  241. .stat-card,
  242. .section-card {
  243. background: #fff;
  244. border: 1px solid rgba(226, 232, 240, 0.92);
  245. border-radius: 18px;
  246. box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
  247. }
  248. .stat-card {
  249. padding: 18px;
  250. }
  251. .stat-card--status {
  252. background: linear-gradient(135deg, #fff9dd 0%, #fffef3 100%);
  253. }
  254. .stat-label {
  255. color: #64748b;
  256. font-size: 12px;
  257. font-weight: 700;
  258. letter-spacing: 0.04em;
  259. text-transform: uppercase;
  260. }
  261. .stat-status {
  262. margin-top: 14px;
  263. }
  264. .stat-desc {
  265. margin-top: 12px;
  266. color: #4b5563;
  267. line-height: 1.7;
  268. }
  269. .stat-value {
  270. margin-top: 14px;
  271. color: #0f172a;
  272. font-size: 24px;
  273. line-height: 1.15;
  274. font-weight: 800;
  275. word-break: break-word;
  276. }
  277. .stat-value--small {
  278. font-size: 15px;
  279. }
  280. .section-card {
  281. padding: 20px;
  282. }
  283. .section-card--script {
  284. background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  285. }
  286. .section-header {
  287. margin-bottom: 14px;
  288. }
  289. .section-kicker {
  290. color: #64748b;
  291. font-size: 11px;
  292. font-weight: 800;
  293. letter-spacing: 0.12em;
  294. text-transform: uppercase;
  295. }
  296. .section-title {
  297. margin: 8px 0 6px;
  298. color: #0f172a;
  299. font-size: 24px;
  300. line-height: 1.15;
  301. font-weight: 800;
  302. }
  303. .content-block {
  304. margin: 0;
  305. min-height: 140px;
  306. padding: 16px 18px;
  307. border-radius: 14px;
  308. background: #f8fafc;
  309. white-space: pre-wrap;
  310. word-break: break-word;
  311. line-height: 1.8;
  312. color: #0f172a;
  313. overflow-x: auto;
  314. }
  315. .content-block--summary {
  316. background: linear-gradient(135deg, #fff8e8 0%, #fffdf5 100%);
  317. }
  318. .content-block--analysis {
  319. background: linear-gradient(135deg, #eefcf4 0%, #f8fffb 100%);
  320. }
  321. .content-block--brief {
  322. background: linear-gradient(135deg, #fffdf2 0%, #fffaf0 100%);
  323. }
  324. .content-block--script {
  325. min-height: 340px;
  326. background: linear-gradient(180deg, #f6f8ff 0%, #ffffff 100%);
  327. font-size: 15px;
  328. }
  329. .content-block--danger {
  330. background: linear-gradient(135deg, #fff1f2 0%, #fff8f8 100%);
  331. color: #991b1b;
  332. }
  333. .content-block--material {
  334. min-height: 260px;
  335. }
  336. .link-list {
  337. display: grid;
  338. gap: 10px;
  339. }
  340. .link-item {
  341. padding: 14px 16px;
  342. border-radius: 14px;
  343. background: #f8fafc;
  344. }
  345. .link-item--lead {
  346. background: linear-gradient(135deg, #eef6ff 0%, #f8fbff 100%);
  347. }
  348. .link-label {
  349. color: #0369a1;
  350. font-size: 12px;
  351. font-weight: 700;
  352. }
  353. .link-text {
  354. margin-top: 8px;
  355. line-height: 1.75;
  356. word-break: break-all;
  357. color: #0f172a;
  358. }
  359. .empty-tip {
  360. padding: 16px;
  361. border-radius: 14px;
  362. background: #f8fafc;
  363. color: #94a3b8;
  364. text-align: center;
  365. }
  366. :deep(.material-tabs .el-tabs__nav-wrap::after) {
  367. background-color: #e2e8f0;
  368. }
  369. :deep(.material-tabs .el-tabs__item) {
  370. font-weight: 700;
  371. }
  372. :deep(.material-tabs .el-tabs__item.is-active) {
  373. color: #2563eb;
  374. }
  375. :deep(.material-tabs .el-tabs__active-bar) {
  376. background-color: #2563eb;
  377. }
  378. @media (max-width: 1440px) {
  379. .stats-grid {
  380. grid-template-columns: repeat(3, minmax(0, 1fr));
  381. }
  382. }
  383. @media (max-width: 960px) {
  384. .hero-card {
  385. flex-direction: column;
  386. }
  387. .hero-actions {
  388. flex-direction: row;
  389. min-width: 0;
  390. }
  391. .stats-grid {
  392. grid-template-columns: 1fr;
  393. }
  394. }
  395. @media (max-width: 640px) {
  396. .hero-card,
  397. .stat-card,
  398. .section-card {
  399. padding: 16px;
  400. border-radius: 16px;
  401. }
  402. .hero-title {
  403. font-size: 30px;
  404. }
  405. .section-title {
  406. font-size: 21px;
  407. }
  408. .content-block {
  409. padding: 14px;
  410. }
  411. }
  412. </style>