统一暂无更多数据字段样式 和 添加

v2
king 1 year ago
parent 5137d3297f
commit c37e360cb6
  1. 11
      src/components/learningRecord/learningRecord.tsx
  2. 16
      src/pages/business/courType/courType.tsx
  3. 1
      src/pages/business/curHistory/curHistory.tsx
  4. 13
      src/pages/business/history/history.tsx
  5. 6
      src/pages/home/components/curRecommended.tsx
  6. 6
      src/pages/home/home.tsx
  7. 6
      src/pages/index/index.tsx
  8. 5
      src/pages/login/login.tsx
  9. 1
      src/pages/manage/courseAdmin/courseAdmin.tsx
  10. 1
      src/pages/manage/depAdmin/depAdmin.tsx
  11. 1
      src/pages/manage/selectDep/selectDep.tsx
  12. 3
      src/pages/manage/userInfo/userInfo.tsx
  13. 13
      src/pages/preview/brand/info/info.tsx
  14. 26
      src/pages/preview/brand/list/list.tsx
  15. 2
      src/pages/preview/health/health.tsx
  16. 3
      src/pages/preview/illness/list/list.tsx
  17. 1
      src/pages/preview/illness/sort/sort.module.scss
  18. 10
      src/pages/preview/illness/sort/sort.tsx
  19. 1
      src/pages/preview/profession/profession.tsx
  20. 3
      src/utils/time.tsx

@ -5,7 +5,7 @@ import LineChart from "@/components/lineChart/lineChart";
import {CSSProperties, FC, useEffect, useState} from "react";
import {StatisticsParam, userApi} from "@/api";
import styles from './learningRecord.module.scss'
import Spin from "@/components/spinner";
// import Spin from "@/components/spinner";
import {Profile} from "@/store";
import Taro from "@tarojs/taro";
@ -43,20 +43,19 @@ interface Props {
*/
const LearningRecord: FC<Props> = ({userId, style, className}) => {
const [lineData, setLineData] = useState<any[]>([])
const [loading, setLoading] = useState(false)
// const [loading, setLoading] = useState(false)
const {token} = Profile.useContainer()
async function getStatistics(data: StatisticsParam) {
if (!userId) return;
try {
setLoading(true)
if (!userId) return;
setLineData([])
const res = await userApi.statistics(userId, data)
const everyDayValue = everyDay(data.start_time, Number(data.end_time), res.data)
setLineData(everyDayValue)
} catch (e) {
setLineData([])
}
setLoading(false)
}
function tabChange({tab}: OnChangOpt<StatisticsParam>) {
@ -74,7 +73,7 @@ const LearningRecord: FC<Props> = ({userId, style, className}) => {
return (<View className={[styles.box, className].filter(Boolean).join(' ')} style={{display: 'block', ...style}}>
<Tabs tabList={tabList} onChange={tabChange} backMode/>
<View style={{position: "relative"}}>
<Spin enable={loading} block/>
{/*<Spin enable={loading} block/>*/}
<View className={styles.total}>
<Text style={{margin: '0 10px', color: '#00D6AC'}}>

@ -57,17 +57,27 @@ const CourType: FC = () => {
})
return (
<>
{
data.length > 0 ?
<>
<View className='py-2 flex justify-between flex-wrap'>
{data.length > 0 ? data.map(c =>
<VideoCover
{
data.map(c => <VideoCover
thumb={c.thumb}
title={c.title}
id={c.id}
depId={c.id}
key={c.id}
time={formatMinute(c.course_duration)}
/>) : <Empty name='暂无数据'/>}
/>)
}
</View>
<View className='text-center font-24 text-dark'></View>
</>
: <Empty name='暂无数据'/>
}
</>
)
}

@ -106,6 +106,7 @@ const CurHistory = () => {
/>
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</View>
: <Empty name='暂无学习记录'/>
}

@ -1,7 +1,7 @@
import {Text, View} from "@tarojs/components";
import styles from './history.module.scss'
import Taro from "@tarojs/taro";
import {useEffect, useState} from "react";
import React, {useEffect, useState} from "react";
import {formatMinute} from "@/utils/time";
import Empty from "@/components/empty/empty";
import {userApi} from "@/api";
@ -27,7 +27,9 @@ const History = () => {
return (
<View className='mt-3'>
{data.length ? data.map((d, index) =>
{
data.length ? <> {
data.map((d, index) =>
<View key={index} className={styles.category} onClick={() => jump(d.userCourseRecord.course_id)}>
<View className={styles.thumb}>
<Img src={d.thumb} className={styles.image} width={300} height={188}/>
@ -41,7 +43,12 @@ const History = () => {
<Text>{(d.userCourseRecord.finished_count / d.userCourseRecord.hour_count * 100).toFixed(0)}%</Text>
</View>
</View>
</View>) : <Empty name='无观看记录'/>}
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='无观看记录'/>
}
</View>
)
}

@ -5,8 +5,8 @@ import Taro, {useReachBottom} from "@tarojs/taro";
import styles from "../home.module.scss";
import VideoCover from "@/components/videoCover/videoCover";
import courseTag from '@/static/img/courseTag.png'
import {rfc33392time} from "@/utils/day";
import Img from "@/components/image/image";
import {beforeTime} from "@/utils/time";
const toArticlePage = (d: any) => {
console.log({d})
@ -68,7 +68,7 @@ const CurRecommended: FC = () => {
{d.cover && <Img className='ml-l' width={140} height={100} src={d.cover} errorType="acquiesce"/>}
</View>)}
<View className="flex mt-3 justify-between font-24 text-muted">
<View>{rfc33392time(d.created_at).split(' ')[0]}</View>
<View>{beforeTime(d.created_at)}</View>
<View> {d.page_view || 0}</View>
</View>
</View>)}
@ -102,7 +102,7 @@ const CurRecommended: FC = () => {
<>
{examines}
{videos}
<View className='text-center text-muted font-28'>- -</View>
<View className='text-center font-24 text-dark'></View>
</>
)
}

@ -1,4 +1,4 @@
import {FC, useEffect, useState} from "react";
import {FC, useState} from "react";
import {Image, View, Text} from "@tarojs/components";
import styles from "./home.module.scss";
import Adware from "@/pages/home/components/adware";
@ -27,14 +27,14 @@ const Home: FC = () => {
Taro.navigateTo({url: '/pages/login/login'})
}
useEffect(() => {
Taro.useDidShow(() => {
HomeApi.home().then(res => {
setData(res)
})
setTimeout(() => {
setEnable(false)
}, 600)
}, [])
})
Taro.usePageScroll((e) => {
const v = (Math.min(e.scrollTop / navbarHeight, 1) * 0.9).toFixed(6)

@ -7,8 +7,7 @@ import {CoursesKey, publicApi} from "@/api/public";
import NavigationBar from "@/components/navigationBar/navigationBar";
import Spin from "@/components/spinner";
import Img from "@/components/image/image";
import {rfc33392time} from "@/utils/day";
// import Taro from "@tarojs/taro";
import {beforeTime} from "@/utils/time";
const category: TabList[] = [
{title: "企选课程", value: 'is_required'},
@ -65,12 +64,13 @@ const AuditMode: FC = () => {
{d.cover && <Img className='ml-l' width={140} height={100} src={d.cover} errorType="acquiesce"/>}
</View>)}
<View className="flex mt-3 justify-between font-24 text-muted">
<View>{rfc33392time(d.created_at).split(' ')[0]}</View>
<View>{beforeTime(d.created_at)}</View>
<View> {d.page_view || 0}</View>
</View>
</View>)
}
</View>
<View className='text-center font-24 text-dark mt-2'></View>
</>
: <Index/>
}

@ -57,10 +57,8 @@ const Login: FC = () => {
setToken(token)
setCompany(company)
setLoading(false)
Taro.switchTab({url: '/pages/home/home'})
Taro.navigateBack()
} else {
Taro.setStorageSync('openid', catch_key)
Taro.reLaunch({url: '/pages/check/check'})
}
@ -98,7 +96,6 @@ const Login: FC = () => {
<View style={{flex: 1}}>{error}</View>
<Icon name={'close'} onClick={() => setError(null)}/>
</View> : null}
{/*{process.env.TARO_APP_LGOIN === 'true' && <MyButton onClick={TESTLOGIN}>线下登录</MyButton>}*/}
</View>
)

@ -171,6 +171,7 @@ const CourseAdmin: FC = () => {
</View>
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</View>
<View className={styles.add}>

@ -158,6 +158,7 @@ const DepAdmin: FC = () => {
onClick={() => Taro.navigateTo({url: '/pages/manage/userInfo/userInfo?userId=' + d.id})}
content={['学员', '管理员', '超级管理员'][d.role_type]}
/>)}
<View className='text-center font-24 text-dark mt-3'></View>
{!manages.length && !users.length && <Empty name='暂无数据'/>}

@ -59,6 +59,7 @@ const SelectDep: FC = () => {
leftImage={folder}/>
</View>
</View>)}
<View className='text-center font-24 text-dark mt-3'></View>
<View className={'my-3'}>
<MyButton onClick={ok}></MyButton>

@ -58,7 +58,6 @@ const UserInfo: FC = () => {
useEffect(() => {
userApi.info(userId).then(res => {
setData(res)
})
@ -76,7 +75,7 @@ const UserInfo: FC = () => {
<View className={styles.page}>
<Info data={data}/>
<LearningRecord userId={userId}/>
<LearningRecord userId={userId} style={{padding: '20px'}}/>
<View className='mt-2'>

@ -113,11 +113,9 @@ const BrandInfo: FC = () => {
</View>
<View className={styles['bottom']}>
{
articleList?.length ?
articleList.map((i: any) =>
<View className={styles.box} onClick={() => {
Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`})
}}>
articleList?.length ? <>{
articleList.map((i: any) => <View className={styles.box}
onClick={() => Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`})}>
<View className={styles.inner}>
<View className={styles.leftBox}>
<View className='font-weight mb-2 font-28 lh-40'>{i.title}</View>
@ -127,8 +125,9 @@ const BrandInfo: FC = () => {
<Img width={172} height={128} src={i.cover}/>
</View>
</View>
</View>
)
</View>)}
<View className='text-center font-24 text-dark'></View>
</>
: <Empty name='空空如也'/>
}
</View>

@ -5,7 +5,7 @@ import Taro, {useReachBottom} from "@tarojs/taro";
import Empty from "@/components/empty/empty";
import Spinner from "@/components/spinner";
import Img from "@/components/image/image";
import {formatDate} from "@/utils/time";
import {beforeTime} from "@/utils/time";
const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onClick}) => {
let media: ReactNode
@ -16,7 +16,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
/>
} else if (data.brand_album) {
media = <Img
width={712}
// width={712}
height={320}
src={data.brand_album.split(",")[0]}
mode="aspectFill"
@ -27,26 +27,32 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
return (
<View className="bg-white flex flex-column justify-stretch mb-2_4 rounded-10 clip">
{media}
<View className="p-3" onClick={onClick}>
<View className='font-weight mb-2 font-32 flex align-center'>
<View className='mb-2 font-32 flex'>
<Img
width={32}
height={32}
width={76}
height={76}
src={data.logo}
mode='aspectFill'
errorType='avatar'
className="rounded-10 clip"
style={{background: '#ededed'}}
/>
<View className="ml-1 flex-1">
<View className="ml-2 flex-1">
<View className="text-row1 font-28">{data.name}</View>
<View className='font-24 mt-1 text-dark'>{beforeTime(data.created_at)}·</View>
</View>
</View>
<View>
{media}
</View>
<View className="font-24 text-muted mb-4 text-row3" style={{lineHeight: 1.4}}>
<View className="font-24 text-muted mb-4 text-row3 mt-2" style={{lineHeight: 1.4}}>
{data.graphic_introduction}
</View>
<View className="flex gap20rpx font-24 text-muted">
<View>{formatDate(new Date(data.created_at), "YY-MM-dd hh:mm:ss")}</View>
<View className="flex-1"></View>
<View>{data.article_count || 0}</View>
<View>{(Math.random() * 100).toFixed(0)}</View>
@ -105,7 +111,7 @@ const BrandList: FC = () => {
content = (
<>
{brands.map(d => <BrandItem data={d} key={d.id} onClick={() => jumpInfo(d.id)}/>)}
<View style={{width: '710rpx', textAlign: 'center', color: '#999'}} className="font-28 mt-3">{text}</View>
<View className='text-center font-24 text-dark mt-3'>{text}</View>
</>
)
} else {

@ -55,7 +55,7 @@ const Health: FC = () => {
</View>
</View>)}
</View>
<View className="font-28 mt-3 text-center text-muted"></View>
<View className='text-center font-24 text-dark mt-2'></View>
</>
: <Empty name='暂无数据'/>
}

@ -50,6 +50,7 @@ const BrandList: FC = () => {
<Spin enable={enable} overlay/>
{
articles.length > 0 ?
<>
<View className='bg-white'>
{
articles.map((d, index) => <View key={d.id} className={styles.articles} onClick={() => jump(d.id)}>
@ -57,6 +58,8 @@ const BrandList: FC = () => {
</View>)
}
</View>
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='暂无文章'/>
}
</View>

@ -58,6 +58,7 @@
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #323635;
position: relative;
}
.list {

@ -96,14 +96,14 @@ const Sort: FC = () => {
scrollY
className={styles.tree}
scrollWithAnimation>
{
loading ? <Spin enable={loading}/> : <>
<Spin enable={loading} block/>
{
list.length ?
list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.name}</View>)
: <Empty name='暂无数据'/>
}
<>
{list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.name}</View>)}
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='暂无数据'/>
}
</ScrollView>
</View>

@ -104,6 +104,7 @@ const Profession = () => {
</View>
)
}
<View className='text-center font-24 text-dark mt-2'></View>
</ScrollView>
)
}

@ -153,8 +153,7 @@ export function beforeTime(time?: string): string {
const initiateTime = new Date(time || 0).getTime()
const today = Date.now()
const timeDifference = Math.floor((today - initiateTime) / 86400000)
console.log(timeDifference)
if (timeDifference < 0) {
if (timeDifference <= 0) {
return '今天'
} else if (timeDifference >= 365) {
return `${Math.floor(timeDifference / 365)}年前`

Loading…
Cancel
Save