1.绑定手机号样式

2.添加课时学习记录时间段
3.学员无学习记录的显示
main
king 1 year ago
parent 289240d179
commit c9afe27986
  1. 5
      src/components/lineChart/lineChart.tsx
  2. 8
      src/pages/business/hourHistory/hourHistory.tsx
  3. 9
      src/pages/business/videoInfo/videoInfo.tsx
  4. 11
      src/pages/check/check.tsx
  5. 17
      src/pages/manage/depAdmin/depAdmin.tsx
  6. 1
      src/utils/time.ts

@ -30,11 +30,12 @@ const LineChart: FC<Props> = ({data}) => {
return ( return (
<> <>
<ScrollView scrollX={!!maxHeight.value}> <ScrollView scrollX={!!maxHeight.value}>
<View>{maxHeight.time}{formatMinute(maxHeight.value)}</View> {maxHeight.time && <View>{maxHeight.time}{formatMinute(maxHeight.value)}</View>}
<View className={style.lineChart}> <View className={style.lineChart}>
{!maxHeight.value && <View className={style.empty}></View>} {!maxHeight.value && <View className={style.empty}></View>}
{ {
maxHeight.value && lineChartList.map(d => <View key={d.time}> !!maxHeight.value && lineChartList.map(d => <View key={d.time}>
<View className={style.columnBox} style={{width: "100px"}}> <View className={style.columnBox} style={{width: "100px"}}>
<View className={style.line} <View className={style.line}
style={{height: height - 10 - (d.value / maxHeight.value * height) + "px"}}></View> style={{height: height - 10 - (d.value / maxHeight.value * height) + "px"}}></View>

@ -52,10 +52,14 @@ const HourHistory: FC = () => {
<View className={styles.progressBox}> <View className={styles.progressBox}>
{ {
times.map(d => <View key={d.id} className={styles.recordItem}> times.map(d => <View key={d.id} className={styles.recordItem}>
<View>{formatDateTime(new Date(d.start_at), 'MM-dd')}</View> <View>
{formatDateTime(new Date(d.start_at), 'MM-dd')}
{formatDateTime(new Date(d.start_at), 'HH:mm:ss')} -
{formatDateTime(new Date(d.end_at), 'HH:mm:ss')}
</View>
<Progress <Progress
className={styles.progress} className={styles.progress}
percent={Number((d.duration / (hour?.duration || 0)).toFixed(2))} percent={Number((d.duration / (hour?.duration || 0) * 100).toFixed(2))}
showInfo showInfo
borderRadius={10} borderRadius={10}
active active

@ -34,9 +34,10 @@ const VideoInfo: FC = () => {
} }
} }
function setHors(is_complete: boolean, play_id: number) { function setHors(preview: boolean, play_id: number) {
console.log(preview)
setPlaying(true) setPlaying(true)
setPreview(is_complete) setPreview(preview)
setPlayId(play_id) setPlayId(play_id)
} }
@ -48,7 +49,7 @@ const VideoInfo: FC = () => {
/** 播放下一个视频 */ /** 播放下一个视频 */
const playNext = useCallback(() => { const playNext = useCallback(() => {
const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[]
if (playId === flats?.[flats.length - 1]?.id) { if (playId === flats?.[flats.length - 1]?.id && !preview) {
Taro.showModal({title: '当前课程结束'}) Taro.showModal({title: '当前课程结束'})
eventsIndex.trigger({id: Number(id)}) eventsIndex.trigger({id: Number(id)})
return; return;
@ -70,7 +71,7 @@ const VideoInfo: FC = () => {
return return
} }
} }
}, [playId, data]) }, [playId, data, preview])
/** /**
* *

@ -1,5 +1,5 @@
import {FC, useCallback, useEffect, useRef, useState} from "react"; import {FC, useCallback, useEffect, useRef, useState} from "react";
import {Button, Form, Image, Input, View} from "@tarojs/components"; import { Form, Image, Input, View} from "@tarojs/components";
import {Profile} from "@/store"; import {Profile} from "@/store";
import {userApi} from "@/api"; import {userApi} from "@/api";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
@ -7,6 +7,7 @@ import {regexTel} from "@/utils/regu";
import styles from './check.module.scss' import styles from './check.module.scss'
import code from '@/static/img/vCode.png' import code from '@/static/img/vCode.png'
import tel from '@/static/img/tel.png' import tel from '@/static/img/tel.png'
import MyButton from "@/components/button/MyButton";
const Bing: FC = () => { const Bing: FC = () => {
const form = useRef<HTMLFormElement | null>(null) const form = useRef<HTMLFormElement | null>(null)
@ -66,7 +67,7 @@ const Bing: FC = () => {
}, [codeTime, phone_number]) }, [codeTime, phone_number])
return ( return (
<View className='h-10 pt-6 px-3 bg-white'> <View className='px-3 bg-white h-10'>
<Form onSubmit={Submit} ref={form}> <Form onSubmit={Submit} ref={form}>
<View className={styles.formItem}> <View className={styles.formItem}>
@ -94,14 +95,14 @@ const Bing: FC = () => {
</View> </View>
</View> </View>
<Button <MyButton
className={'button ' + styles.submit} className={styles.submit}
style={{margin: '30px auto'}} style={{margin: '30px auto'}}
formType='submit' formType='submit'
disabled={loading} disabled={loading}
> >
</Button> </MyButton>
</Form> </Form>
</View> </View>
) )

@ -16,15 +16,20 @@ const DepAdmin: FC = () => {
const [users, setUsers] = useState<User[]>([]) const [users, setUsers] = useState<User[]>([])
const [isPut, setIsPut] = useState(false) const [isPut, setIsPut] = useState(false)
const [depName, setDepName] = useState('') const [depName, setDepName] = useState('')
const [reset, setReset] = useState(false)
const {company} = Profile.useContainer() const {company} = Profile.useContainer()
async function getData() { async function getData() {
show && setShow(false) show && setShow(false)
const res = await ManageApi.depList(router.params.dep_id || 0) try {
if (res) { const res = await ManageApi.depList(router.params.dep_id || 0)
setManages(res.department) if (res) {
setUsers(res.data) setReset(true)
setManages(res.department)
setUsers(res.data)
}
} catch (e) {
} }
} }
@ -127,9 +132,7 @@ const DepAdmin: FC = () => {
}, []) }, [])
Taro.useDidShow(() => { Taro.useDidShow(() => {
if (manages.length) { reset && getData()
getData()
}
}) })
return ( return (

@ -108,6 +108,7 @@ export function everyDay(start_time: number, end_time: number, data: Record<numb
try { try {
const days = Math.floor((end_time - start_time) / time) const days = Math.floor((end_time - start_time) / time)
if (isNaN(days)) return []; if (isNaN(days)) return [];
return new Array(days === 1 ? 1 : days + 1).fill(0).map((_, index) => { return new Array(days === 1 ? 1 : days + 1).fill(0).map((_, index) => {
const day = start_time + index * time const day = start_time + index * time
return { return {

Loading…
Cancel
Save