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