图片默认图

v2
king 1 year ago
parent 4cc69d9c2f
commit 278a408137
  1. 5
      src/components/image/image.tsx
  2. 1
      src/pages/business/videoInfo/components/catalogue.tsx
  3. 2
      src/pages/business/videoInfo/videoInfo.tsx
  4. 21
      src/pages/home/components/feature_recommended.tsx
  5. 3
      src/pages/preview/brand/list/list.tsx
  6. 0
      src/static/img/brandSecond.png
  7. 1
      types/curriculum.d.ts
  8. 1
      types/user.d.ts

@ -5,6 +5,7 @@ import Taro from "@tarojs/taro";
import avatar from '@/static/img/avatar.png' import avatar from '@/static/img/avatar.png'
import healthShard from '@/static/img/healthShard.png' import healthShard from '@/static/img/healthShard.png'
import professionShard from '@/static/img/professionShard.png' import professionShard from '@/static/img/professionShard.png'
import brandSecond from '@/static/img/brandSecond.png'
interface Props extends ImageProps { interface Props extends ImageProps {
width?: number | string width?: number | string
@ -41,6 +42,9 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, height, fallback = sha
case 'profession': case 'profession':
setErrorUrl(professionShard) setErrorUrl(professionShard)
break break
case 'brand':
setErrorUrl(brandSecond)
break
} }
}, [props.errorType]) }, [props.errorType])
@ -60,6 +64,7 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, height, fallback = sha
return ( return (
<View <View
style={{ style={{
overflow: 'hidden',
width: width ? `${width}rpx` : "100%", width: width ? `${width}rpx` : "100%",
height: height ? `${height}rpx` : "100%", height: height ? `${height}rpx` : "100%",
backgroundColor: (isError || !loading) ? 'transparent' : '#F8F8F8' backgroundColor: (isError || !loading) ? 'transparent' : '#F8F8F8'

@ -195,6 +195,7 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => {
<Collect <Collect
owner_id={id} owner_id={id}
owner_type={3} owner_type={3}
select={data?.course.collect}
styles={{flexDirection: 'column', justifyContent: 'center', padding: '20rpx'}} styles={{flexDirection: 'column', justifyContent: 'center', padding: '20rpx'}}
stylesImage={{margin: '0 0 8rpx 0'}}/> stylesImage={{margin: '0 0 8rpx 0'}}/>
<View className='px-2' onClick={() => setShow(true)}> <View className='px-2' onClick={() => setShow(true)}>

@ -106,7 +106,7 @@ const VideoInfo: FC = () => {
{ {
playId playId
? <Course id={playId} courseId={id} curEnd={curEnd} preview={preview}/> ? <Course id={playId} courseId={id} curEnd={curEnd} preview={preview}/>
: <Img width={750} height={500} src={data?.course.thumb || ''} mode='aspectFill'/> : <Img width={750} height={500} src={data?.course.thumb || ''} errorType='health'/>
} }
</View> </View>

@ -26,12 +26,13 @@ interface Data {
url: string url: string
detailsUrl: string detailsUrl: string
data: DataContent[] data: DataContent[]
errorType: ImgErrType
type?: 'health' | 'kill' type?: 'health' | 'kill'
} }
interface Props { interface Props {
skill: Kill[] // 技能 skill: VideList[] // 技能
health: Health[] // 健康 health: VideList[] // 健康
brand: Brand[] // 品牌 brand: Brand[] // 品牌
illness: Illness[] // 疾病 illness: Illness[] // 疾病
} }
@ -42,27 +43,31 @@ const FeatureRecommended: FC<Props> = (props) => {
titleUrl: brandTop, titleUrl: brandTop,
url: '/pages/preview/brand/list/list', url: '/pages/preview/brand/list/list',
detailsUrl: '/pages/preview/brand/info/info', detailsUrl: '/pages/preview/brand/info/info',
data: [] data: [],
errorType: 'brand',
}, },
{ {
titleUrl: healthTop, titleUrl: healthTop,
url: '/pages/preview/health/health', url: '/pages/preview/health/health',
detailsUrl: '/pages/preview/videoFull/videoFull', detailsUrl: '/pages/preview/videoFull/videoFull',
data: [], data: [],
type: "health" type: "health",
errorType: 'health'
}, },
{ {
titleUrl: professionTop, titleUrl: professionTop,
url: '/pages/preview/profession/profession', url: '/pages/preview/profession/profession',
detailsUrl: '/pages/preview/videoFull/videoFull', detailsUrl: '/pages/preview/videoFull/videoFull',
data: [], data: [],
type: 'kill' type: 'kill',
errorType: 'profession'
}, },
{ {
titleUrl: illnessTop, titleUrl: illnessTop,
url: '/pages/preview/illness/sort/sort', url: '/pages/preview/illness/sort/sort',
detailsUrl: '/pages/preview/illness/list/list', detailsUrl: '/pages/preview/illness/list/list',
data: [] data: [],
errorType: 'health'
}, },
]) ])
@ -153,7 +158,7 @@ const FeatureRecommended: FC<Props> = (props) => {
<View className={styles.feature}> <View className={styles.feature}>
<Swiper nextMargin='30px' style={{height: '390rpx'}} circular autoplay> <Swiper nextMargin='30px' style={{height: '390rpx'}} circular autoplay>
{ {
data.filter(d=>d.data.length === 3).map(d => <SwiperItem key={d.url}> data.filter(d => d.data.length === 3).map(d => <SwiperItem key={d.url}>
<Image <Image
mode='heightFix' mode='heightFix'
className={styles.featureTitle} className={styles.featureTitle}
@ -166,7 +171,7 @@ const FeatureRecommended: FC<Props> = (props) => {
onClick={() => jump(d.detailsUrl + c.path, c.id, d.type)}> onClick={() => jump(d.detailsUrl + c.path, c.id, d.type)}>
<View style={{position: 'relative'}}> <View style={{position: 'relative'}}>
<View className={styles.featureImage}> <View className={styles.featureImage}>
<Img src={c.imageUrl} height={100} width={140}/> <Img src={c.imageUrl} height={100} width={140} errorType={d.errorType}/>
</View> </View>
<Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/> <Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/>
</View> </View>

@ -20,6 +20,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
} else if (data.brand_album) { } else if (data.brand_album) {
media = <Img media = <Img
height={320} height={320}
errorType='profession'
src={data.brand_album.split(",")[0]} src={data.brand_album.split(",")[0]}
mode="aspectFill" mode="aspectFill"
style={{background: '#ededed'}} style={{background: '#ededed'}}
@ -36,7 +37,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
height={76} height={76}
src={data.logo} src={data.logo}
mode='aspectFill' mode='aspectFill'
errorType='avatar' errorType='brand'
className="rounded-10 clip" className="rounded-10 clip"
style={{background: '#ededed'}} style={{background: '#ededed'}}
/> />

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

@ -8,6 +8,7 @@ interface Curriculum {
id: number; id: number;
title: string; title: string;
charge: number; charge: number;
collect:boolean
/** 课时 */ /** 课时 */
class_hour: number; class_hour: number;
created_at: string; created_at: string;

1
types/user.d.ts vendored

@ -113,5 +113,6 @@ type ImgErrType = "acquiesce" // 默认
| 'avatar' // 头像 | 'avatar' // 头像
| 'health' // 健康 | 'health' // 健康
| 'profession' // 技能 | 'profession' // 技能
| 'brand' // 品牌

Loading…
Cancel
Save