考题底部样式

main
king 1 year ago
parent d052aa82d0
commit 0983880725
  1. 4
      src/api/curriculum.ts
  2. 5
      src/components/topic/judge.tsx
  3. 5
      src/components/topic/multi.tsx
  4. 5
      src/components/topic/shortAnswer.tsx
  5. 19
      src/components/topic/topic.scss
  6. 6
      src/components/video/video.tsx
  7. 5
      src/hooks/unique_ident.ts
  8. 30
      src/pages/business/videoInfo/components/course.tsx
  9. 2
      src/pages/business/videoInfo/videoInfo.tsx
  10. BIN
      src/static/img/empty.png

@ -110,5 +110,9 @@ export const curriculum = {
/** 学习记录 */
hourCache(courseId: number, data: HourCacheParam) {
return request(`/api/v1/course/${courseId}/hour/cache`, "PUT", data)
},
/** 删除 */
delCache(courseId: number) {
return request(`/api/v1/course/${courseId}/hour/cache`, "DELETE")
}
}

@ -9,9 +9,10 @@ interface Props {
index: number
validate: boolean
frequency?: number
end: boolean
}
const Judge: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency}) => {
const Judge: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency, end}) => {
const [rightAnswer, setRightAnswer] = useState<string | null>(null) //答案
const rightKey = data.right_answer ? 'correct' : 'error' // 正确答案数组
const [error, setError] = useState(false)
@ -68,7 +69,7 @@ const Judge: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequen
{onUpAndDown && <View className='upAndDown'>
{index > 0 && <Button className='button' onClick={() => onUpAndDown(index - 1)}></Button>}
<Button className='button' onClick={() => onUpAndDown(index + 1)}></Button>
{!end && <Button className='button' onClick={() => onUpAndDown(index + 1)}></Button>}
</View>}

@ -9,9 +9,10 @@ interface Props {
index: number
validate: boolean
frequency?: number
end: boolean
}
const Multi: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency}) => {
const Multi: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency, end}) => {
const [rightAnswer, setRightAnswer] = useState<string[]>([]) //答案
const rightKey = data?.right_answer?.split(',') || [] // 正确答案数组
@ -83,7 +84,7 @@ const Multi: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequen
{onUpAndDown && <View className='upAndDown'>
{index > 0 && <Button className='button' onClick={() => onUpAndDown?.(index - 1)}></Button>}
<Button onClick={() => onUpAndDown?.(index + 1)} className='button'></Button>
{!end && <Button onClick={() => onUpAndDown?.(index + 1)} className='button'>{end}</Button>}
</View>}

@ -10,9 +10,10 @@ interface Props {
index: number
validate: boolean
frequency?: number
end:boolean
}
const ShortAnswer: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency}) => {
const ShortAnswer: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, frequency,end}) => {
const [value, setValue] = useState<string>('')
function onBlur() {
@ -57,7 +58,7 @@ const ShortAnswer: FC<Props> = ({data, onAnswer, onUpAndDown, index, validate, f
{onUpAndDown && <View className='upAndDown'>
{index > 0 && <Button className='button' onClick={() => onUpAndDown?.(index - 1)}></Button>}
<Button className='button' onClick={() => onUpAndDown?.(index + 1)}></Button>
{!end && <Button className='button' onClick={() => onUpAndDown?.(index + 1)}></Button>}
</View>}

@ -11,23 +11,34 @@
}
.statistics {
padding: 40px 20px;
border-top: 1px solid #F5F8F7;
padding: 30px;
display: flex;
justify-content: space-around;
align-items: center;
justify-content: space-between;
margin-bottom: env(safe-area-inset-bottom);
.button {
border-radius: 100px;
height: 76px;
width: 304rpx;
margin: 0;
}
}
.upAndDown {
display: flex;
justify-content: space-around;
justify-content: space-between;
margin-top: 30px;
button {
width: 40%;
border-radius: 100px;
}
}
.right_answer{
.right_answer {
font-weight: bold;
color: #FF9E5F;
line-height: 40rpx;

@ -2,6 +2,7 @@ import {BaseEventOrig, Video, VideoProps} from "@tarojs/components";
import {HVideoOptions} from "@/components/video/type";
import Taro from "@tarojs/taro";
import {FC, useState} from "react";
import unique_ident from "@/hooks/unique_ident";
// import {Profile} from '@/store'
const deviation: number = 0.5
@ -50,6 +51,11 @@ const HVideo: FC<HVideoOptions> = (opt: HVideoOptions) => {
}
}
Taro.useUnload(() => {
unique_ident.put(Number(currentTime.toFixed(2)), Date.now())
})
return (
<Video
id={'myVideo'}

@ -32,6 +32,11 @@ function put(duration?: number, start_date?: number, upload = true) {
}
function del() {
put()
const data: HourCacheParam | undefined = Taro.getStorageSync(KEY)
if (data) {
curriculum.delCache(data.courseId)
}
Taro.removeStorageSync(KEY)
}

@ -192,7 +192,11 @@ const Course: FC<Props> = ({id, courseId, preview, curEnd}: Props) => {
round
onAfterLeave={again}
>
<Swiper style={{height: "70vh"}} snapToEdge current={index}>
<Swiper
style={{height: "70vh"}}
snapToEdge
current={index}
onChange={(e) => setIndex((e.target as any).value)}>
{examAll?.[time]?.map((d, index) =>
<SwiperItem>
<ScrollView style='height:70vh' scrollY>
@ -204,6 +208,7 @@ const Course: FC<Props> = ({id, courseId, preview, curEnd}: Props) => {
onUpAndDown={(index) => setIndex(index)}
index={index}
validate={validate}
end={index === examAll?.[time].length - 1}
/>}
{d.question_type === 2 &&
<Judge
@ -213,6 +218,7 @@ const Course: FC<Props> = ({id, courseId, preview, curEnd}: Props) => {
data={d as ShareSubject}
validate={validate}
onAnswer={onAnswer}
end={index === examAll?.[time].length}
/>}
{d.question_type === 3 &&
<ShortAnswer
@ -222,27 +228,19 @@ const Course: FC<Props> = ({id, courseId, preview, curEnd}: Props) => {
onUpAndDown={(index) => setIndex(index)}
index={index}
validate={validate}
end={index === examAll?.[time].length}
/>}
</ScrollView>
</SwiperItem>
)}
<SwiperItem>
<ScrollView style='height:70vh' scrollY>
<View className='mt-10 ml-4'>
<View className='mt-3'>{newRecord.filter(d => d).length}</View>
<View className='mt-3'>{newRecord.filter(d => !d).length}</View>
<View className='mt-3'>{frequency}</View>
</View>
{!validate && <Button className='button mt-10' onClick={() => setValidate(true)}></Button>}
{frequency > 0 && validate && <Button className='button mt-10' onClick={onceMore}></Button>}
{frequency === 0 && validate && <Button className='button mt-10' onClick={again}></Button>}
</ScrollView>
</SwiperItem>
</Swiper>
<View className='statistics'>
<View>{examAll?.[time]?.length}</View>
<View>{frequency}</View>
<View>{index + 1}/{examAll?.[time]?.length}</View>
{!validate && <Button className='button' onClick={() => setValidate(true)}></Button>}
{frequency > 0 && validate && <Button className='button' onClick={onceMore}></Button>}
{frequency === 0 && validate && <Button className='button' onClick={again}></Button>}
</View>
</PageContainer>
</view>

@ -6,7 +6,6 @@ import {Profile} from '@/store'
import Catalogue from "./components/catalogue";
import Course from "./components/course";
import Taro from "@tarojs/taro";
import unique_ident from "@/hooks/unique_ident";
const VideoInfo: FC = () => {
@ -88,7 +87,6 @@ const VideoInfo: FC = () => {
}
})
Taro.useUnload(unique_ident.put)
return (

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Loading…
Cancel
Save