From 8c970bb52a9b6ef83618b7f1dc2d55fa26045024 Mon Sep 17 00:00:00 2001 From: enncy <877526278@qq.com> Date: Mon, 16 May 2022 18:50:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20AnswererWrapper=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0:=20headers=20=E5=92=8C=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/src/components/SearchResults.tsx | 45 ++++--- packages/core/src/components/index.tsx | 13 +- packages/core/src/core/utils/common.ts | 55 ++++---- .../src/core/worker/answer.wrapper.handler.ts | 119 +++++++++++------- 4 files changed, 141 insertions(+), 91 deletions(-) diff --git a/packages/core/src/components/SearchResults.tsx b/packages/core/src/components/SearchResults.tsx index 0f09afb8..c74a8df9 100644 --- a/packages/core/src/components/SearchResults.tsx +++ b/packages/core/src/components/SearchResults.tsx @@ -59,32 +59,41 @@ export const SearchResults = defineComponent({ {currentSearchResults.value?.map((res) => ( +
+ 题库: {res.name} - 一共有 {res.answers.length} 个答案 + {res.error ? '此题库请求错误: ' + res.error.message : `一共有 ${res.answers.length} 个答案`} -
- {res.answers.map((answer) => ( -
-
- - 题目: - {StringUtils.of(answer.question).nowrap().max(50).toString()} - -
-
- - 回答: - {StringUtils.of(answer.answer).nowrap().max(50).toString()} - -
+ {res.error + ? ( +
+ ) + : ( +
+ {res.answers.map((answer) => ( +
+
+ + 题目: + {StringUtils.of(answer.question).nowrap().max(50).toString()} + +
+
+ + 回答: + {StringUtils.of(answer.answer).nowrap().max(50).toString()} + +
+
+ ))}
- ))} -
+ )} +
))}
diff --git a/packages/core/src/components/index.tsx b/packages/core/src/components/index.tsx index 447fda01..57119d9e 100644 --- a/packages/core/src/components/index.tsx +++ b/packages/core/src/components/index.tsx @@ -137,8 +137,19 @@ export function createWorkerSetting (
  • 接口: {aw.url}
  • 请求方式: {aw.method}
  • 数据类型: {aw.contentType}
  • +
  • 请求类型: {aw.type}
  • - 请求数据: + 请求头: + +
  • +
  • + 请求数据: