品牌列表品牌详情调整

v2
一杯沧海 1 year ago committed by xing
parent 2029037d7a
commit 7844106068
  1. 1
      src/api/brand.ts
  2. 17
      src/pages/preview/brand/info/info.module.scss
  3. 22
      src/pages/preview/brand/info/info.tsx
  4. 4
      src/pages/preview/brand/list/list.tsx

@ -1,6 +1,7 @@
import {request} from "@/api/request"; import {request} from "@/api/request";
export type BrandRecord = { export type BrandRecord = {
logo: string;
name: string; name: string;
id: number id: number
introductory_video: string introductory_video: string

@ -1,16 +1,27 @@
page{
background-color: #fff !important;
}
.swiper{ .swiper{
width:750rpx; width:750rpx;
height:600rpx; height:600rpx;
background-color: pink; }
.curIndexBox{
position: absolute;
top:450rpx;
right:30rpx;
background-color: rgba(0,0,0,0.5);
border-radius: 30rpx;
padding: 5rpx 30rpx;
color:#fff;
} }
.body{ .body{
border-radius: 32rpx 32rpx 0 0; border-radius: 32rpx 32rpx 0 0;
background-color:cadetblue; background-color:#f1f8f6;
width: 750rpx; width: 750rpx;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 80vh; min-height: 600rpx;
position: absolute; position: absolute;
top: 520rpx; top: 520rpx;
.top{ .top{

@ -13,6 +13,7 @@ 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)
useEffect(() => { useEffect(() => {
getData() getData()
@ -30,22 +31,26 @@ const BrandInfo: FC = () => {
} }
} }
function onChange(e){
console.log(e)
setCurIndex(+e.detail.current+1)
}
return ( return (
<View className='flex flex-column '> <View className='flex flex-column '>
{
<Swiper <Swiper
className={styles['swiper']} className={styles['swiper']}
indicatorColor='#999' indicatorColor='#999'
indicatorActiveColor='#333' indicatorActiveColor='#333'
indicatorDots indicatorDots
onChange={onChange}
> >
<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}
@ -54,16 +59,17 @@ const BrandInfo: FC = () => {
loop={false} loop={false}
muted={false} muted={false}
/> />
</SwiperItem>) </SwiperItem>}
{brandInfo?.brand_album?.length {brandInfo?.brand_album?.length
&& brandInfo?.brand_album?.map((d) => && brandInfo?.brand_album?.split(',').map((d) =>
<SwiperItem> <SwiperItem>
<Image src={d}></Image> <Image mode={'aspectFill'} style={{width:'750rpx',height:'600rpx'}} src={d}></Image>
</SwiperItem>) </SwiperItem>)
} }
</Swiper> </Swiper>
<View className={styles.curIndexBox}>
} <Text>{curIndex} / {brandInfo?.brand_album?.split(',').length + ((brandInfo && brandInfo.introductory_video_resource) ? 1:0)}</Text>
</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>

@ -42,10 +42,10 @@ const BrandList: FC = () => {
{ {
brands.length ? brands.map((d) => brands.length ? brands.map((d) =>
<View onClick={() => jumpInfo(d.id)} className={styles.box} key={d.id}> <View onClick={() => jumpInfo(d.id)} className={styles.box} key={d.id}>
<Image src={d.brand_album?.[0]} mode='aspectFill' className={styles.image}/> <Image src={d.logo} mode='aspectFill' className={styles.image}/>
<View className={styles.rightBox}> <View className={styles.rightBox}>
<View className='font-weight mb-2 font-28'>{d.name}</View> <View className='font-weight mb-2 font-28'>{d.name}</View>
<View className={styles.desc}>{d.graphic_introduction.repeat(30)}</View> <View className={styles.desc}>{d.graphic_introduction}</View>
</View> </View>
</View>) </View>)
: <Empty name='空空如也'/> : <Empty name='空空如也'/>

Loading…
Cancel
Save