main
king 1 year ago
parent 1b675daa75
commit 8180bffb43
  1. 1
      src/api/home.ts
  2. 3
      src/app.config.ts
  3. 13
      src/pages/home/components/adware.tsx
  4. 2
      src/pages/home/components/feature_recommended.tsx
  5. 2
      src/pages/home/home.module.scss
  6. 4
      src/pages/home/home.tsx
  7. 26
      src/pages/index/index.module.scss
  8. 11
      src/pages/preview/illness/list/list.tsx
  9. 2
      src/pages/preview/illness/sort/sort.tsx
  10. 11
      src/pages/preview/videoFull/videoFull.module.scss
  11. 3
      src/pages/preview/videoFull/videoFull.tsx

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

@ -86,11 +86,8 @@ export default defineAppConfig({
'profession/profession',
'health/health', // 健康
'videoFull/videoFull', // 资源id 视频全屏
'illness/article/article',
'illness/sort/sort',
'illness/list/list',
'illness/info/info',
'illness/article/article'
]
},
],

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

@ -142,7 +142,7 @@ const FeatureRecommended: FC = () => {
key={c.id}
onClick={() => jump(d.detailsUrl + c.path)}>
<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'/>
</View>
<View className={styles.featureText}>

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

@ -15,8 +15,8 @@ const Home: FC = () => {
const {token, empty} = Profile.useContainer()
return (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight}px`}>
<View className='text-center font-weight font-34 mt-3'></View>
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight + 30}px`}>
<View className={styles.header} style={`paddingTop:${globalData.statusBarHeight}px`}></View>
<Search/>
<Adware/>
<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 {
position: relative;
padding: 0 20px;

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

@ -18,7 +18,7 @@ const Sort: FC = () => {
}
function jump(id: number) {
console.log(id)
Taro.navigateTo({url: '/pages/preview/illness/list/list?id=' + id})
}
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 {FC} from "react";
import Taro from "@tarojs/taro";
import styles from './videoFull.module.scss'
interface Props {
url: string
@ -10,7 +11,7 @@ const VideoFull: FC<Props> = () => {
const {url} = Taro.useRouter().params
return (
<Video
style={{width: '100%', height: '100vh'}}
className={styles.video}
src={url!}
autoplay
loop

Loading…
Cancel
Save