图片默认图

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

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

@ -106,7 +106,7 @@ const VideoInfo: FC = () => {
{
playId
? <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>

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

@ -20,6 +20,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
} else if (data.brand_album) {
media = <Img
height={320}
errorType='profession'
src={data.brand_album.split(",")[0]}
mode="aspectFill"
style={{background: '#ededed'}}
@ -36,7 +37,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
height={76}
src={data.logo}
mode='aspectFill'
errorType='avatar'
errorType='brand'
className="rounded-10 clip"
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;
title: string;
charge: number;
collect:boolean
/** 课时 */
class_hour: number;
created_at: string;

1
types/user.d.ts vendored

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

Loading…
Cancel
Save