|
|
|
@ -7,6 +7,7 @@ import LineEllipsis from "@/components/textCollapse/collapse"; |
|
|
|
|
import Empty from "@/components/empty/empty"; |
|
|
|
|
import Img from "@/components/image/image"; |
|
|
|
|
import {rfc33392time} from "@/utils/day"; |
|
|
|
|
import Spin from "@/components/spinner"; |
|
|
|
|
|
|
|
|
|
type Params = { |
|
|
|
|
id: number |
|
|
|
@ -15,18 +16,12 @@ const BrandInfo: FC = () => { |
|
|
|
|
const {id} = useRouter().params as unknown as Params |
|
|
|
|
const [brandInfo, setBrandInfo] = useState<BrandRecord>() |
|
|
|
|
const [articleList, setArticleList] = useState<ArticleRecord[]>([]) |
|
|
|
|
const [curIndex,setCurIndex] = useState<number>(1) |
|
|
|
|
const [curIndex, setCurIndex] = useState<number>(1) |
|
|
|
|
const [page, setPage] = useState(1) |
|
|
|
|
const [total, setTotal] = useState(0) |
|
|
|
|
const [enable, setEnable] = useState(true) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
Taro.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}) |
|
|
|
|
setTimeout(function () { |
|
|
|
|
Taro.hideLoading() |
|
|
|
|
}, 1000) |
|
|
|
|
getData() |
|
|
|
|
}, [id]) |
|
|
|
|
|
|
|
|
@ -35,7 +30,7 @@ const BrandInfo: FC = () => { |
|
|
|
|
const data = await brandApi.info(id) |
|
|
|
|
Taro.setNavigationBarTitle({title: data.name}) |
|
|
|
|
setBrandInfo(data) |
|
|
|
|
const data1 = await brandApi.articleList(id,page) |
|
|
|
|
const data1 = await brandApi.articleList(id, page) |
|
|
|
|
setTotal(data1.total) |
|
|
|
|
setArticleList([ |
|
|
|
|
...(articleList || []), |
|
|
|
@ -44,6 +39,7 @@ const BrandInfo: FC = () => { |
|
|
|
|
} catch (e) { |
|
|
|
|
// setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']})
|
|
|
|
|
} |
|
|
|
|
setEnable(false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useReachBottom(useCallback(() => { |
|
|
|
@ -53,7 +49,7 @@ const BrandInfo: FC = () => { |
|
|
|
|
}, [total, articleList])) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
brandApi.articleList(id,page).then(res => { |
|
|
|
|
brandApi.articleList(id, page).then(res => { |
|
|
|
|
setTotal(res.total) |
|
|
|
|
setArticleList([ |
|
|
|
|
...(articleList || []), |
|
|
|
@ -63,46 +59,46 @@ const BrandInfo: FC = () => { |
|
|
|
|
|
|
|
|
|
}, [page]) |
|
|
|
|
|
|
|
|
|
function onChange(e){ |
|
|
|
|
console.log(e) |
|
|
|
|
setCurIndex(+e.detail.current+1) |
|
|
|
|
function onChange(e) { |
|
|
|
|
setCurIndex(+e.detail.current + 1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View className='flex flex-column' style={{display:brandInfo?'flex':'none'}}> |
|
|
|
|
<Swiper |
|
|
|
|
className={styles['swiper']} |
|
|
|
|
indicatorColor='#999' |
|
|
|
|
indicatorActiveColor='#333' |
|
|
|
|
indicatorDots={false} |
|
|
|
|
onChange={onChange} |
|
|
|
|
<View className='flex flex-column' style={{display: 'flex'}}> |
|
|
|
|
<Spin enable={enable} overlay/> |
|
|
|
|
<Swiper |
|
|
|
|
className={styles['swiper']} |
|
|
|
|
indicatorColor='#999' |
|
|
|
|
indicatorActiveColor='#333' |
|
|
|
|
indicatorDots={false} |
|
|
|
|
onChange={onChange} |
|
|
|
|
|
|
|
|
|
> |
|
|
|
|
{ brandInfo?.introductory_video_resource?.url && <SwiperItem> |
|
|
|
|
<Video |
|
|
|
|
style={{width: '750rpx', height: '600rpx'}} |
|
|
|
|
playBtnPosition={"center"} |
|
|
|
|
id='video' |
|
|
|
|
src={brandInfo?.introductory_video_resource?.url} |
|
|
|
|
initialTime={0} |
|
|
|
|
controls={true} |
|
|
|
|
enableProgressGesture={false} |
|
|
|
|
showFullscreenBtn={false} |
|
|
|
|
autoplay={false} |
|
|
|
|
loop={false} |
|
|
|
|
muted={false} |
|
|
|
|
/> |
|
|
|
|
</SwiperItem>} |
|
|
|
|
{brandInfo?.brand_album?.length |
|
|
|
|
&& brandInfo?.brand_album?.split(',').map((d) => |
|
|
|
|
<SwiperItem> |
|
|
|
|
<Image mode={'aspectFill'} style={{width:'750rpx',height:'600rpx'}} src={d}></Image> |
|
|
|
|
</SwiperItem>) |
|
|
|
|
} |
|
|
|
|
</Swiper> |
|
|
|
|
<View className={styles.curIndexBox}> |
|
|
|
|
<Text>{curIndex} / {(brandInfo?.brand_album?.split(',').length || 0) + ((brandInfo && brandInfo.introductory_video_resource) ? 1:0)}</Text> |
|
|
|
|
</View> |
|
|
|
|
> |
|
|
|
|
{brandInfo?.introductory_video_resource?.url && <SwiperItem> |
|
|
|
|
<Video |
|
|
|
|
style={{width: '750rpx', height: '600rpx'}} |
|
|
|
|
playBtnPosition={"center"} |
|
|
|
|
id='video' |
|
|
|
|
src={brandInfo?.introductory_video_resource?.url} |
|
|
|
|
initialTime={0} |
|
|
|
|
controls={true} |
|
|
|
|
enableProgressGesture={false} |
|
|
|
|
showFullscreenBtn={false} |
|
|
|
|
autoplay={false} |
|
|
|
|
loop={false} |
|
|
|
|
muted={false} |
|
|
|
|
/> |
|
|
|
|
</SwiperItem>} |
|
|
|
|
{brandInfo?.brand_album?.length |
|
|
|
|
&& brandInfo?.brand_album?.split(',').map((d) => |
|
|
|
|
<SwiperItem> |
|
|
|
|
<Image mode={'aspectFill'} style={{width: '750rpx', height: '600rpx'}} src={d}></Image> |
|
|
|
|
</SwiperItem>) |
|
|
|
|
} |
|
|
|
|
</Swiper> |
|
|
|
|
<View className={styles.curIndexBox}> |
|
|
|
|
<Text>{curIndex} / {(brandInfo?.brand_album?.split(',').length || 0) + ((brandInfo && brandInfo.introductory_video_resource) ? 1 : 0)}</Text> |
|
|
|
|
</View> |
|
|
|
|
<View className={styles['body']}> |
|
|
|
|
<View className={styles['top']}> |
|
|
|
|
<Text className={styles['title']}>{brandInfo?.name}</Text> |
|
|
|
|