king 1 year ago committed by xing
parent ea75fdc4c9
commit 7ee05c66d0
  1. 1
      src/api/home.ts
  2. 13
      src/pages/home/components/adware.tsx
  3. 2
      src/pages/home/components/feature_recommended.tsx
  4. 2
      src/pages/home/home.module.scss
  5. 4
      src/pages/home/home.tsx
  6. 26
      src/pages/index/index.module.scss
  7. 11
      src/pages/preview/illness/list/list.tsx
  8. 2
      src/pages/preview/illness/sort/sort.tsx
  9. 11
      src/pages/preview/videoFull/videoFull.module.scss
  10. 3
      src/pages/preview/videoFull/videoFull.tsx

@ -16,6 +16,7 @@ export interface AdwareLinkType {
} }
export interface AdwareType { export interface AdwareType {
image_path:string
advert_link: AdwareLinkType advert_link: AdwareLinkType
scope_id: number | string scope_id: number | string
id: number id: number

@ -3,7 +3,6 @@ import {FC, useState} from "react";
import {AdwareType, HomeApi} from "@/api"; import {AdwareType, HomeApi} from "@/api";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import styles from '../home.module.scss' import styles from '../home.module.scss'
import {jumpAdware} from "@/utils/pathFormt";
const Adware: FC = () => { const Adware: FC = () => {
const [data, setData] = useState<AdwareType[]>([]) const [data, setData] = useState<AdwareType[]>([])
@ -13,6 +12,14 @@ const Adware: FC = () => {
setData(res) setData(res)
} }
function jumpAdware(url: string) {
if (url.substring(0, 3) === 'wx:') {
Taro.navigateTo({
url: url.substring(3, url.length)
})
}
}
Taro.useLoad(getAdware) Taro.useLoad(getAdware)
return ( return (
@ -23,7 +30,7 @@ const Adware: FC = () => {
mode='scaleToFill' mode='scaleToFill'
lazyLoad lazyLoad
fadeIn fadeIn
onClick={() => jumpAdware(data[0].advert_link)} onClick={() => jumpAdware(data[0].image_path)}
className={styles.adware}/> className={styles.adware}/>
} }
{ {
@ -39,7 +46,7 @@ const Adware: FC = () => {
mode='widthFix' mode='widthFix'
lazyLoad lazyLoad
fadeIn fadeIn
onClick={() => jumpAdware(d.advert_link)} onClick={() => jumpAdware(d.image_path)}
style={{width: "100%"}}/> style={{width: "100%"}}/>
</SwiperItem>)} </SwiperItem>)}
</Swiper> </Swiper>

@ -142,7 +142,7 @@ const FeatureRecommended: FC = () => {
key={c.id} key={c.id}
onClick={() => jump(d.detailsUrl + c.path)}> onClick={() => jump(d.detailsUrl + c.path)}>
<View> <View>
<Image src={c.imageUrl} className={styles.featureImage}/> <Image src={c.imageUrl} className={styles.featureImage} mode='widthFix'/>
<Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/> <Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/>
</View> </View>
<View className={styles.featureText}> <View className={styles.featureText}>

@ -1,3 +1,5 @@
.content { .content {
position: relative; position: relative;
padding: 0 20px; padding: 0 20px;

@ -15,8 +15,8 @@ const Home: FC = () => {
const {token, empty} = Profile.useContainer() const {token, empty} = Profile.useContainer()
return ( return (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight}px`}> <View className={styles.content} style={`paddingTop:${globalData.statusBarHeight + 30}px`}>
<View className='text-center font-weight font-34 mt-3'></View> <View className={styles.header} style={`paddingTop:${globalData.statusBarHeight}px`}></View>
<Search/> <Search/>
<Adware/> <Adware/>
<Feature/> <Feature/>

@ -1,3 +1,29 @@
.header {
text-align: center;
font-weight: bold;
font-size: 34rpx;
position: fixed;
width: 100%;
left: 0;
top: 0;
height: 70rpx;
overflow: hidden;
&:after {
min-height: 100vh;
position: absolute;
top: 0;
left: -10%;
width: 120%;
content: '';
display: block;
background: linear-gradient(40deg, #fff 50rpx, #caf0e2, #92ecc5) no-repeat;
min-height: 100vh;
background-size: 100% 600rpx;
z-index: -1;
}
}
.content { .content {
position: relative; position: relative;
padding: 0 20px; padding: 0 20px;

@ -1,15 +1,12 @@
import {FC, useCallback, useEffect, useState} from "react"; import {FC, useCallback, useEffect, useState} from "react";
import {Image, View} from "@tarojs/components"; import { View} from "@tarojs/components";
import {brandApi, BrandRecord} from "@/api";
import styles from './list.module.scss' import styles from './list.module.scss'
import Taro, {useReachBottom} from "@tarojs/taro"; import Taro, {useReachBottom, useRouter} from "@tarojs/taro";
import Empty from "@/components/empty/empty";
import Collapse from "@/components/collapse/collapse"; import Collapse from "@/components/collapse/collapse";
import {illnessApi} from "@/api/illness"; import {illnessApi} from "@/api/illness";
import {apis} from "@tarojs/plugin-platform-h5/dist/dist/definition.json";
import setNavigationBarTitle = apis.setNavigationBarTitle;
const BrandList: FC = () => { const BrandList: FC = () => {
const params = useRouter().params as unknown as {id:number}
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [brands, setBrands] = useState<any[]>([]) const [brands, setBrands] = useState<any[]>([])
const [total, setTotal] = useState(0) const [total, setTotal] = useState(0)
@ -20,7 +17,7 @@ const BrandList: FC = () => {
const getData = useCallback(async () => { const getData = useCallback(async () => {
try { try {
const data = await illnessApi.list(22,1, 100) const data = await illnessApi.list(params.id,1, 100)
setTotal(data.total) setTotal(data.total)
setBrands([ setBrands([
...data.list ...data.list

@ -18,7 +18,7 @@ const Sort: FC = () => {
} }
function jump(id: number) { function jump(id: number) {
console.log(id) Taro.navigateTo({url: '/pages/preview/illness/list/list?id=' + id})
} }
Taro.useLoad(getData) Taro.useLoad(getData)

@ -0,0 +1,11 @@
.video {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
background: #000;
}

@ -1,6 +1,7 @@
import {Video} from "@tarojs/components"; import {Video} from "@tarojs/components";
import {FC} from "react"; import {FC} from "react";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import styles from './videoFull.module.scss'
interface Props { interface Props {
url: string url: string
@ -10,7 +11,7 @@ const VideoFull: FC<Props> = () => {
const {url} = Taro.useRouter().params const {url} = Taro.useRouter().params
return ( return (
<Video <Video
style={{width: '100%', height: '100vh'}} className={styles.video}
src={url!} src={url!}
autoplay autoplay
loop loop

Loading…
Cancel
Save