Skip to content

Commit 5bb93dd

Browse files
committed
fix: search
1 parent 097302a commit 5bb93dd

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { getQuestionKeywordJson } from '#resources/headers/questionKeywordJson.js'
22
import { graphql } from '#common/utils/http/graphql.js'
33

4-
export async function getQuestionKeyword(keyword) {
4+
export async function getQuestionByKeyword(keyword) {
55
const questionData = await graphql(getQuestionKeywordJson(keyword.toString()))
66
return questionData?.data?.problemsetQuestionList?.questions
77
}
8-
9-
console.log(getQuestionKeyword('两数'))

common/view/finder.view.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import inquirer from 'inquirer'
2-
import { getQuestionKeyword } from '#common/utils/question-getter/getQuestionByKeyword'
2+
import { getQuestionByKeyword } from '#common/utils/question-getter/getQuestionByKeyword.js'
33

44
export async function easyFinderView() {
55
const modeQuestion = [{
@@ -17,14 +17,28 @@ export async function easyFinderView() {
1717

1818
switch (mode) {
1919
case '关键词搜索':
20-
const {identity} = getQuestionKeyword(await inquirer.prompt(questionKeyword, null))
21-
console.log(identity)
20+
const data = await getQuestionByKeyword(await inquirer.prompt(questionKeyword, null))
21+
const questionList = [{
22+
type: 'list',
23+
name: 'chooseQuestion',
24+
message: '请选择题目',
25+
choices: []
26+
}]
27+
let list = []
28+
console.log(data)
29+
// data.map(q => list.push(q.titleCn))
30+
// questionList[0].choices = list.join(',')
31+
// console.log(list)
32+
// const { chooseQuestion } = await inquirer.prompt(questionList, null)
33+
// console.log(chooseQuestion)
2234
break
2335
case 'Top 100列表查询':
2436
break
2537
case '进入筛选模式':
2638
break
2739
}
40+
41+
process.exit(0)
2842
}
2943

3044
await easyFinderView()

resources/headers/questionKeywordJson.js

+2-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)