parent
380b7be4fa
commit
bc0682351e
@ -1,5 +1,5 @@ |
|||||||
#TARO_APP_API=https://yjx.dev.yaojiankang.top |
TARO_APP_API=https://yjx.dev.yaojiankang.top |
||||||
TARO_APP_API=https://mooc.yaojiankang.top |
#TARO_APP_API=https://mooc.yaojiankang.top |
||||||
#TARO_APP_API=https://shopfix.yaojiankang.top |
#TARO_APP_API=https://shopfix.yaojiankang.top |
||||||
#TARO_APP_API=https://playedu.yaojiankang.top |
#TARO_APP_API=https://playedu.yaojiankang.top |
||||||
TARO_APP_LGOIN=true |
TARO_APP_LGOIN=true |
||||||
|
@ -0,0 +1,40 @@ |
|||||||
|
.artcles { |
||||||
|
padding: 30rpx 0; |
||||||
|
border-bottom: 1px solid #F5F8F7; |
||||||
|
} |
||||||
|
|
||||||
|
.outside { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
|
||||||
|
|
||||||
|
.title { |
||||||
|
font-size: 28rpx; |
||||||
|
font-family: PingFang SC-Bold, PingFang SC; |
||||||
|
font-weight: bold; |
||||||
|
color: #323635; |
||||||
|
} |
||||||
|
|
||||||
|
.intro { |
||||||
|
font-size: 24rpx; |
||||||
|
font-family: PingFang SC-Medium, PingFang SC; |
||||||
|
font-weight: 500; |
||||||
|
color: #909795; |
||||||
|
margin-top: 10rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.img { |
||||||
|
overflow: hidden; |
||||||
|
border-radius: 10rpx; |
||||||
|
} |
||||||
|
|
||||||
|
.pageView { |
||||||
|
font-size: 22rpx; |
||||||
|
font-family: PingFang SC-Medium, PingFang SC; |
||||||
|
font-weight: 500; |
||||||
|
color: #909795; |
||||||
|
margin-top: 20rpx; |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,45 @@ |
|||||||
|
import {FC, useEffect, useState} from "react"; |
||||||
|
import {Text, View} from "@tarojs/components"; |
||||||
|
import Taro from "@tarojs/taro"; |
||||||
|
import styles from './articlesBox.module.scss' |
||||||
|
import Img from "@/components/image/image"; |
||||||
|
import {beforeTime} from "@/utils/time"; |
||||||
|
|
||||||
|
interface Props { |
||||||
|
data: Articles |
||||||
|
} |
||||||
|
|
||||||
|
const ArticlesBox: FC<Props> = (props) => { |
||||||
|
const [data, setData] = useState(props.data) |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
setData(props.data) |
||||||
|
}, [props.data]) |
||||||
|
|
||||||
|
const toArticlePage = () => { |
||||||
|
Taro.navigateTo({ |
||||||
|
url: `/pages/preview/brand/article/article?id=${data.id}` |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
return ( |
||||||
|
<View className={styles.artcles} onClick={toArticlePage}> |
||||||
|
<View className={styles.outside}> |
||||||
|
<View className='flex-1 mr-2'> |
||||||
|
<View className={`${styles.title} text-ellipsis-1`}>{data.title}</View> |
||||||
|
<View className={`${styles.intro} text-ellipsis-2`}>{data.intro}</View> |
||||||
|
<View className={styles.pageView}> |
||||||
|
<Text>{beforeTime(data.created_at)}</Text>· |
||||||
|
<Text>{data.page_view || 0}阅读</Text> |
||||||
|
</View> |
||||||
|
</View> |
||||||
|
<Img src={data.cover || ''} |
||||||
|
errorType={data.owner_type === 1 ? 'brand' : 'health'} |
||||||
|
width={148} |
||||||
|
height={116} |
||||||
|
className={styles.img}/> |
||||||
|
</View> |
||||||
|
</View> |
||||||
|
) |
||||||
|
} |
||||||
|
export default ArticlesBox |
@ -0,0 +1,11 @@ |
|||||||
|
interface Articles { |
||||||
|
id: number |
||||||
|
title: string |
||||||
|
/** 封面 */ |
||||||
|
cover?: string |
||||||
|
created_at: string |
||||||
|
page_view: number |
||||||
|
/** 描述 */ |
||||||
|
intro: string |
||||||
|
owner_type:number |
||||||
|
} |
Loading…
Reference in new issue