Skip to content

Commit

Permalink
feat(evaluate): 更新radio为checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk committed Dec 18, 2024
1 parent 8393ed5 commit add1e65
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
16 changes: 6 additions & 10 deletions src/common/components/QuestionDetail/QuestionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -129,18 +130,13 @@ const QuestionDetail: React.FC<IQuestionProps> = ({

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const QuestionListComponent: React.FC<{ question: IQuestion; courseId: string }>
};

void fetchQuestionWithUserInfo();
}, [question, dispatch]);
}, [question]);

const handleQuestionDetailClick = () => {
void Taro.navigateTo({
Expand Down
11 changes: 6 additions & 5 deletions src/pages/evaluate/evaluate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -180,7 +180,7 @@ export default function evaluate() {
</View>
</View>
<View className="p">
<Text>课程特点</Text>
<Text>课程特点 :</Text>
<View className="fea">
{features.map((item) => {
return (
Expand All @@ -204,13 +204,14 @@ export default function evaluate() {
></Textarea>
<Text className="zsxz">字数限制{textLength}/450</Text>
<View className="p">
<Text>匿名:</Text>
<Radio
<Checkbox
value="anonymous"
className="myradio"
checked={isAnonymous}
onClick={() => setIsAnonymous(!isAnonymous)}
color="#3399ff"
></Radio>
></Checkbox>
<Text>匿名</Text>
</View>
<Button onClick={postEvaluation}>发布</Button>
</Form>
Expand Down
24 changes: 24 additions & 0 deletions src/pages/questionInfo/index.scss
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit add1e65

Please sign in to comment.