Compare commits

...

2 Commits

Author SHA1 Message Date
king a538461a9b 修改课程样式 1 year ago
king c1e6f8a5bc 1.修改文章没有内容时不能添加收藏 1 year ago
  1. 1
      src/components/collect/collect.module.scss
  2. 20
      src/components/image/image.tsx
  3. 2
      src/components/videoList/videoList.tsx
  4. 4
      src/pages/business/videoInfo/components/catalogue.tsx
  5. 1
      src/pages/home/components/search.tsx
  6. 2
      src/pages/home/home.module.scss
  7. 2
      src/pages/index/components/videoList.tsx
  8. 2
      src/pages/manage/courseAdmin/courseAdmin.tsx
  9. 2
      src/pages/my/components/header/time.tsx
  10. 13
      src/pages/preview/brand/article/article.tsx
  11. 1
      src/pages/preview/brand/info/info.module.scss
  12. 2
      src/pages/preview/brand/info/info.tsx
  13. 24
      src/pages/preview/search/search/components/list.tsx
  14. 2
      src/pages/preview/search/search/index.tsx
  15. 0
      src/static/img/courseShard.png
  16. 1
      types/user.d.ts

@ -1,4 +1,5 @@
.collect { .collect {
width: 130rpx;
display: flex; display: flex;
align-items: center; align-items: center;
color: #909795; color: #909795;

@ -6,12 +6,14 @@ 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' import brandSecond from '@/static/img/brandSecond.png'
import courseShard from '@/static/img/courseShard.png'
interface Props extends ImageProps { interface Props extends ImageProps {
width?: number | string width?: number | string
height?: number | string height?: number | string
fallback?: string fallback?: string
errorType?: ImgErrType errorType?: ImgErrType
fit?: boolean // 当网络图片加载完成后高度自动
} }
const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...props}) => { const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...props}) => {
@ -24,7 +26,7 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...p
useEffect(() => { useEffect(() => {
if (!height && !isError && mode !== 'heightFix') { if (!isError && props.fit) {
Taro.getImageInfo({ Taro.getImageInfo({
src, src,
success() { success() {
@ -54,6 +56,9 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...p
case 'brand': case 'brand':
setErrorUrl(brandSecond) setErrorUrl(brandSecond)
break break
case 'course':
setErrorUrl(courseShard)
break
} }
}, [props.errorType]) }, [props.errorType])
@ -71,16 +76,15 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...p
} }
return ( return (
<View <View className={props?.className}
style={{ style={{
overflow: 'hidden', 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'
}} }}>
className={`${props?.className}`}>
{!isError && {!isError &&
<View animation={animationData}> <View animation={animationData} style={{height: '100%', width: '100%'}}>
<Image <Image
{...props} {...props}
src={src} src={src}
@ -100,13 +104,11 @@ const Img: FC<Props> = ({src, mode = 'aspectFill', width, fallback = shard, ...p
{ {
isError && !loading && isError && !loading &&
<Image <Image
mode='widthFix' mode='aspectFill'
src={errorUrl} src={errorUrl}
lazyLoad lazyLoad
fadeIn fadeIn
style={{ style={{width: "100%", height: '100%'}}/>
width: "100%",
}}/>
} }
</View> </View>
) )

@ -19,7 +19,7 @@ const VideoList: FC<Props> = ({data, errorType}) => {
return ( return (
<View key={data.id} className={styles.health} onClick={jump}> <View key={data.id} className={styles.health} onClick={jump}>
<Img src={data.url_path} mode='widthFix' errorType={errorType} height={346}/> <Img src={data.url_path} mode='widthFix' errorType={errorType} height={346} fit/>
<Image src={play} className={styles.play} mode='aspectFit'/> <Image src={play} className={styles.play} mode='aspectFit'/>
<View className='p-1'> <View className='p-1'>
<View className='text-ellipsis-2 text-dark'>{data.title}</View> <View className='text-ellipsis-2 text-dark'>{data.title}</View>

@ -196,9 +196,9 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => {
owner_id={id} owner_id={id}
owner_type={3} owner_type={3}
select={data?.course.collect} select={data?.course.collect}
styles={{flexDirection: 'column', justifyContent: 'center', padding: '20rpx'}} styles={{flexDirection: 'column', justifyContent: 'center'}}
stylesImage={{margin: '0 0 8rpx 0'}}/> stylesImage={{margin: '0 0 8rpx 0'}}/>
<View className='px-2' onClick={() => setShow(true)}> <View className='px-2 text-center' onClick={() => setShow(true)}>
<Image src={omit} style={{width: '32rpx', height: '32rpx'}} mode='widthFix'/> <Image src={omit} style={{width: '32rpx', height: '32rpx'}} mode='widthFix'/>
<View></View> <View></View>
</View> </View>

@ -14,7 +14,6 @@ export const Search: FC = () => {
return ( return (
<View className={styles.search} onClick={jump}> <View className={styles.search} onClick={jump}>
<Image src={search} mode='widthFix' style={{width: 16, height: 16, verticalAlign: 'middle',padding:'0 20rpx'}}/> <Image src={search} mode='widthFix' style={{width: 16, height: 16, verticalAlign: 'middle',padding:'0 20rpx'}}/>
{/*<Icon name='search' size={18} color='#808080'/>*/}
<View></View> <View></View>
</View> </View>
) )

@ -61,7 +61,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
//justify-content: center; justify-content: center;
height: 68rpx; height: 68rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
font-size: 28rpx; font-size: 28rpx;

@ -128,7 +128,7 @@ export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => {
/>) />)
} }
</View> </View>
<View className='text-center text-muted'></View> <View className='text-center font-24 text-dark mt-2'></View>
</> </>
: <Empty name='暂无课程'/> : <Empty name='暂无课程'/>
} }

@ -163,7 +163,7 @@ const CourseAdmin: FC = () => {
checked={curs.includes(d.id)} checked={curs.includes(d.id)}
style={{marginTop: '30px'}} style={{marginTop: '30px'}}
onClick={() => addCurs(d.id)}/>} onClick={() => addCurs(d.id)}/>}
<Img src={d.thumb} className={styles.curImage} width={280} height={164}/> <Img src={d.thumb} className={styles.curImage} width={280} height={164} errorType='course'/>
<View>{d.title}</View> <View>{d.title}</View>
</View> </View>
<View className={styles.Operation}> <View className={styles.Operation}>

@ -39,7 +39,7 @@ const Time: FC = () => {
// oldList[3].time = res.not_finished_count // oldList[3].time = res.not_finished_count
setList(oldList) setList(oldList)
}) })
}) }, [])
function jump(type?: number) { function jump(type?: number) {
if (!token) { if (!token) {

@ -87,7 +87,8 @@ const article: FC = () => {
function helloWorld() { function helloWorld() {
return ( return (
<> <>
<View className={styles.botmBox}> {
headings.length > 0 && <View className={styles.botmBox}>
<View> <View>
<Collect <Collect
select={articleInfo?.collect} select={articleInfo?.collect}
@ -98,15 +99,12 @@ const article: FC = () => {
onUpdate={onCollect} onUpdate={onCollect}
/> />
</View> </View>
{
headings.length > 0 && (
<View className='flex flex-column justify-center align-center' onClick={() => setShow(true)}> <View className='flex flex-column justify-center align-center' onClick={() => setShow(true)}>
<Image src={catalogue} mode='widthFix' style={{width: '40rpx', height: '40rpx'}}/> <Image src={catalogue} mode='widthFix' style={{width: '40rpx', height: '40rpx'}}/>
<View></View> <View></View>
</View> </View>
)
}
</View> </View>
}
<Spin overlay enable={enable}/> <Spin overlay enable={enable}/>
<View <View
@ -118,7 +116,7 @@ const article: FC = () => {
<View id="childrenNode"> <View id="childrenNode">
<View className={styles.articleTitle}>{articleInfo?.title}</View> <View className={styles.articleTitle}>{articleInfo?.title}</View>
{ {
articleInfo?.brands.map(d => ( articleInfo?.brands?.map(d => (
<View className='flex align-center mb-4'> <View className='flex align-center mb-4'>
<View className={`${styles.article} flex-1`}> <View className={`${styles.article} flex-1`}>
<Img src={d.logo} width={80} height={80} className={styles.articleImag} errorType='avatar'/> <Img src={d.logo} width={80} height={80} className={styles.articleImag} errorType='avatar'/>
@ -175,7 +173,8 @@ const article: FC = () => {
> >
<View> <View>
<View className='text-center text-black relative clip'> <View className='text-center text-black relative clip'>
<View className='absolute left top bottom flex flex-column justify-center align-center' style={{width: '58px'}} onClick={() => setShow(false)}> <View className='absolute left top bottom flex flex-column justify-center align-center'
style={{width: '58px'}} onClick={() => setShow(false)}>
<Icon name='close' color="#000" bold/> <Icon name='close' color="#000" bold/>
</View> </View>
<View className='py-3 bold'></View> <View className='py-3 bold'></View>

@ -57,6 +57,7 @@ page{
height:128rpx; height:128rpx;
background-color: #eee; background-color: #eee;
border-radius: 8rpx; border-radius: 8rpx;
overflow: hidden;
} }
.leftBox{ .leftBox{
padding-right: 24rpx; padding-right: 24rpx;

@ -126,7 +126,7 @@ const BrandInfo: FC = () => {
<View className={styles.desc}>{rfc33392time(i.created_at)} {i.page_view}</View> <View className={styles.desc}>{rfc33392time(i.created_at)} {i.page_view}</View>
</View> </View>
<View className={styles.image}> <View className={styles.image}>
<Img width={172} height={128} src={i.cover}/> <Img width={172} height={128} src={i.cover} errorType='brand'/>
</View> </View>
</View> </View>
</View>)} </View>)}

@ -7,7 +7,7 @@ import Img from "@/components/image/image";
import {SearchApi} from "@/api/search"; import {SearchApi} from "@/api/search";
import {AtLoadMore} from 'taro-ui' import {AtLoadMore} from 'taro-ui'
import {rfc33392time} from "@/utils/day"; import {rfc33392time} from "@/utils/day";
import play from "@/static/img/play.png"; import play from "@/static/img/play-back.png";
type Props = { type Props = {
name: string name: string
@ -107,7 +107,8 @@ const SearchList: FC<Props> = ({name,clear}) => {
{ {
d.data.table === 'brand' && d.data.table === 'brand' &&
<> <>
<Img width={128} height={128} src={d.data['@data'].logo} mode='aspectFill' className={styles.image}/> <Img width={128} height={128} src={d.data['@data'].logo} mode='aspectFill' className={styles.image}
errorType='brand'/>
<View className={styles.rightBox}> <View className={styles.rightBox}>
<View className='font-weight mb-2 font-28'>{d.data.title}</View> <View className='font-weight mb-2 font-28'>{d.data.title}</View>
<View className={styles.desc}>{d.data.content || '暂无品牌简介'}</View> <View className={styles.desc}>{d.data.content || '暂无品牌简介'}</View>
@ -119,15 +120,18 @@ const SearchList: FC<Props> = ({name,clear}) => {
<> <>
<View className={styles.articleLeftBox}> <View className={styles.articleLeftBox}>
<View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View> <View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View>
<View className={styles.desc}>{rfc33392time(d.data['@data'].created_at)} {d.data['@data'].page_view}</View> <View
className={styles.desc}>{rfc33392time(d.data['@data'].created_at)} {d.data['@data'].page_view}</View>
</View> </View>
<Img width={172} height={128} src={d.data['@data'].logo} mode='aspectFill' className={styles.image}/> <Img width={172} height={128} src={d.data['@data'].logo} mode='aspectFill' className={styles.image}
errorType='course'/>
</> </>
} }
{ {
d.data.table === 'video_records' && d.data.table === 'video_records' &&
<> <>
<Img width={192} height={192} src={d.data['@data'].url_path} mode='aspectFill' className={styles.image}/> <Img width={192} height={192} src={d.data['@data'].url_path} mode='aspectFill' errorType='health'
className={styles.image}/>
<Image src={play} className={styles.play} mode='aspectFit'/> <Image src={play} className={styles.play} mode='aspectFit'/>
<View className={styles.videoRightBox}> <View className={styles.videoRightBox}>
<View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View> <View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View>
@ -139,18 +143,20 @@ const SearchList: FC<Props> = ({name,clear}) => {
{ {
d.data.table === 'courses' && d.data.table === 'courses' &&
<> <>
<Img width={192} height={138} src={d.data['@data'].thumb} mode='aspectFill' className={styles.image}/> <Img width={192} height={138} src={d.data['@data'].thumb} mode='aspectFill' className={styles.image}
errorType='course'/>
<View className={styles.courseRightBox}> <View className={styles.courseRightBox}>
<View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View> <View className='font-weight mb-2 font-28 lh-40'>{d.data['@data'].title}</View>
<View className={styles.desc}>:{d.data['@data'].class_hour} {d.data['@data'].charge}</View> <View className={styles.desc}>:{d.data['@data'].class_hour}
{d.data['@data'].charge}</View>
</View> </View>
</> </>
} }
</View> </View>
) )
} }
<View style={{width: '750rpx', textAlign: 'center', color: '#999'}} className="font-28 mt-3 mb-3">{text}</View> <View style={{width: '750rpx', textAlign: 'center', color: '#999'}}
className="font-28 mt-3 mb-3">{text}</View>
</> </>
} }
{!loading && brands.length === 0 && <Empty name='空空如也'/>} {!loading && brands.length === 0 && <Empty name='空空如也'/>}

@ -142,7 +142,7 @@ const Search: FC = () => {
round round
overlay overlay
overlayStyle={'background:rgba(0,0,0,0)'}> overlayStyle={'background:rgba(0,0,0,0)'}>
<SearchList name={value} clear={show}/> {show && <SearchList name={value} clear={show}/>}
</PageContainer> </PageContainer>
</View> </View>
) )

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

1
types/user.d.ts vendored

@ -114,5 +114,6 @@ type ImgErrType = "acquiesce" // 默认
| 'health' // 健康 | 'health' // 健康
| 'profession' // 技能 | 'profession' // 技能
| 'brand' // 品牌 | 'brand' // 品牌
| 'course' // 课程

Loading…
Cancel
Save