From add1e65f294d265fb88f201f9d862e8953bdd677 Mon Sep 17 00:00:00 2001 From: eleliauk <2831336720@qq.com> Date: Thu, 19 Dec 2024 01:08:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(evaluate):=20=E6=9B=B4=E6=96=B0radio?= =?UTF-8?q?=E4=B8=BAcheckbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuestionDetail/QuestionDetail.tsx | 16 +++++-------- .../QuestionListComponent.tsx | 2 +- src/pages/evaluate/evaluate.tsx | 11 +++++---- src/pages/questionInfo/index.scss | 24 +++++++++++++++++++ 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/common/components/QuestionDetail/QuestionDetail.tsx b/src/common/components/QuestionDetail/QuestionDetail.tsx index f9d043f..ca7ef28 100644 --- a/src/common/components/QuestionDetail/QuestionDetail.tsx +++ b/src/common/components/QuestionDetail/QuestionDetail.tsx @@ -6,6 +6,7 @@ import answericon from '@/common/assets/img/publishQuestion/answer.png'; import askicon from '@/common/assets/img/publishQuestion/ask.png'; import IconFont from '@/common/components/iconfont'; import PublishHeader from '@/common/components/PublishHeader/PublishHeader'; +import { post } from '@/common/utils'; import { useCourseStore } from '@/pages/main/store/store'; interface IUser { @@ -129,18 +130,13 @@ const QuestionDetail: React.FC = ({ const handlePublishAnswer = async () => { try { - const response = await fetch('/answers/publish', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - content: answerContent, - question_id: question.id, - }), + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const response = await post('/answers/publish', { + content: answerContent, + question_id: question.id, }); - if (response.ok) { + if (response) { setAnswerContent(''); setShowAnswerForm(false); } diff --git a/src/common/components/QuestionListComponent/QuestionListComponent.tsx b/src/common/components/QuestionListComponent/QuestionListComponent.tsx index c25109b..3da3985 100644 --- a/src/common/components/QuestionListComponent/QuestionListComponent.tsx +++ b/src/common/components/QuestionListComponent/QuestionListComponent.tsx @@ -93,7 +93,7 @@ const QuestionListComponent: React.FC<{ question: IQuestion; courseId: string }> }; void fetchQuestionWithUserInfo(); - }, [question, dispatch]); + }, [question]); const handleQuestionDetailClick = () => { void Taro.navigateTo({ diff --git a/src/pages/evaluate/evaluate.tsx b/src/pages/evaluate/evaluate.tsx index dca4934..d83a336 100644 --- a/src/pages/evaluate/evaluate.tsx +++ b/src/pages/evaluate/evaluate.tsx @@ -3,7 +3,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable react-hooks/rules-of-hooks */ /* eslint-disable import/first */ -import { Button, Form, Radio, Text, Textarea, View } from '@tarojs/components'; +import { Button, Checkbox, Form, Radio, Text, Textarea, View } from '@tarojs/components'; import Taro from '@tarojs/taro'; import { useEffect, useState } from 'react'; @@ -180,7 +180,7 @@ export default function evaluate() { - 课程特点 + 课程特点 : {features.map((item) => { return ( @@ -204,13 +204,14 @@ export default function evaluate() { > 字数限制{textLength}/450 - 匿名: - setIsAnonymous(!isAnonymous)} color="#3399ff" - > + > + 匿名 diff --git a/src/pages/questionInfo/index.scss b/src/pages/questionInfo/index.scss index 30dd829..886b978 100644 --- a/src/pages/questionInfo/index.scss +++ b/src/pages/questionInfo/index.scss @@ -1 +1,25 @@ @import '~taro-ui/dist/style/components/float-layout.scss'; +.flex-page .at-row { + margin-bottom: 40px; + + .at-col { + padding: 18px 16px; + color: #fff; + font-size: 28px; + text-align: center; + + &:nth-child(odd) { + background-color: $color-brand-light; + } + + &:nth-child(even) { + background-color: tint($color-brand-light, 20%); + } + } +} + +.panel__content { + .example-item + .example-item.example-item--card { + margin-top: 48px; + } +}