From c3b564fb7777a75cdf61435cbe56f4de9cad8db4 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 31 Jul 2023 16:43:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=94=E9=A2=98=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/button/MyButton.tsx | 4 ++ src/components/button/myButton.module.scss | 3 ++ .../custom-page-container.module.scss | 2 + src/components/topic/judge.tsx | 19 +++------ src/components/topic/multi.tsx | 25 +++++------- src/components/topic/shortAnswer.tsx | 16 ++------ src/components/topic/topic.scss | 39 +++++++++++-------- .../business/videoInfo/components/course.tsx | 21 +++++----- src/static/css/module.scss | 1 + 9 files changed, 62 insertions(+), 68 deletions(-) diff --git a/src/components/button/MyButton.tsx b/src/components/button/MyButton.tsx index 202f613..896a26d 100644 --- a/src/components/button/MyButton.tsx +++ b/src/components/button/MyButton.tsx @@ -6,6 +6,7 @@ import {ButtonProps} from "@tarojs/components/types/Button"; interface Props extends ButtonProps { fillet?: boolean loading?: boolean + width?: number } const MyButton: FC = (props) => { @@ -24,6 +25,9 @@ const MyButton: FC = (props) => { if (props.fillet) { style.borderRadius = '100px' } + if (props.width) { + style.width = props.width + "px" + } return style } diff --git a/src/components/button/myButton.module.scss b/src/components/button/myButton.module.scss index 8e3b0bf..601d965 100644 --- a/src/components/button/myButton.module.scss +++ b/src/components/button/myButton.module.scss @@ -7,4 +7,7 @@ border: none !important; outline: none !important; position: sticky; + margin: 0; + padding: 0; + box-sizing: border-box; } diff --git a/src/components/custom-page-container/custom-page-container.module.scss b/src/components/custom-page-container/custom-page-container.module.scss index 3602778..d758583 100644 --- a/src/components/custom-page-container/custom-page-container.module.scss +++ b/src/components/custom-page-container/custom-page-container.module.scss @@ -1,5 +1,6 @@ .customPageContainer { position: fixed; + z-index: 99999; top: 0; right: 0; left: 0; @@ -24,4 +25,5 @@ position: absolute; padding: 0 30px env(safe-area-inset-bottom); box-sizing: border-box; + overflow: hidden; } diff --git a/src/components/topic/judge.tsx b/src/components/topic/judge.tsx index 3a13965..065e413 100644 --- a/src/components/topic/judge.tsx +++ b/src/components/topic/judge.tsx @@ -1,6 +1,7 @@ import {FC, useEffect, useState} from "react"; -import {Button, Radio, RadioGroup, Text, View} from "@tarojs/components"; +import { Radio, RadioGroup, Text, View} from "@tarojs/components"; import './topic.scss' +import MyButton from "@/components/button/MyButton"; interface Props { data: ShareSubject @@ -35,17 +36,7 @@ const Judge: FC = ({data, onAnswer, onUpAndDown, index, validate, frequen - 判断题 + 判断题 {data.question} @@ -68,8 +59,8 @@ const Judge: FC = ({data, onAnswer, onUpAndDown, index, validate, frequen {onUpAndDown && - {index > 0 && } - {!end && } + {index > 0 && onUpAndDown(index - 1)}>上一题} + {!end && onUpAndDown(index + 1)}>下一题} } diff --git a/src/components/topic/multi.tsx b/src/components/topic/multi.tsx index 501a923..d98f7f4 100644 --- a/src/components/topic/multi.tsx +++ b/src/components/topic/multi.tsx @@ -1,6 +1,7 @@ import {FC, useEffect, useState} from "react"; -import {Button, Checkbox, CheckboxGroup, Radio, RadioGroup, Text, View} from "@tarojs/components"; +import {Checkbox, CheckboxGroup, Radio, RadioGroup, Text, View} from "@tarojs/components"; import './topic.scss' +import MyButton from "@/components/button/MyButton"; interface Props { data: Multi @@ -45,46 +46,38 @@ const Multi: FC = ({data, onAnswer, onUpAndDown, index, validate, frequen return ( - {data.type ? "多选题" : '单选题'} + {data.type ? "多选题" : '单选题'} {data.question} {data.type ? {answers.map(d => - {d.title} + {d.value}:{d.title} )} : {answers.map(d => - {d.title} + {d.value}:{d.title} )} } {onUpAndDown && - {index > 0 && } - {!end && } + {index > 0 && onUpAndDown?.(index - 1)}>上一题} + {!end && onUpAndDown?.(index + 1)}>下一题} } diff --git a/src/components/topic/shortAnswer.tsx b/src/components/topic/shortAnswer.tsx index c3426c2..bf3fe82 100644 --- a/src/components/topic/shortAnswer.tsx +++ b/src/components/topic/shortAnswer.tsx @@ -35,26 +35,18 @@ const ShortAnswer: FC = ({data, onAnswer, onUpAndDown, index, validate, f return ( - 简答题 + 简答题 {data.question}