From 8180bffb43fdd9b14c4de2c34f852a9878e57701 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 22 Aug 2023 16:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.ts | 1 + src/app.config.ts | 3 --- src/pages/home/components/adware.tsx | 13 +++++++--- .../home/components/feature_recommended.tsx | 2 +- src/pages/home/home.module.scss | 2 ++ src/pages/home/home.tsx | 4 +-- src/pages/index/index.module.scss | 26 +++++++++++++++++++ src/pages/preview/illness/list/list.tsx | 11 +++----- src/pages/preview/illness/sort/sort.tsx | 2 +- .../preview/videoFull/videoFull.module.scss | 11 ++++++++ src/pages/preview/videoFull/videoFull.tsx | 3 ++- 11 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 src/pages/preview/videoFull/videoFull.module.scss diff --git a/src/api/home.ts b/src/api/home.ts index e6ef81c..5d39f6a 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -16,6 +16,7 @@ export interface AdwareLinkType { } export interface AdwareType { + image_path:string advert_link: AdwareLinkType scope_id: number | string id: number diff --git a/src/app.config.ts b/src/app.config.ts index a2fadac..35b5f24 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -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' ] }, ], diff --git a/src/pages/home/components/adware.tsx b/src/pages/home/components/adware.tsx index fbe7b6e..37c68bd 100644 --- a/src/pages/home/components/adware.tsx +++ b/src/pages/home/components/adware.tsx @@ -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([]) @@ -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%"}}/> )} diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index d74dcd6..1ff842c 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -142,7 +142,7 @@ const FeatureRecommended: FC = () => { key={c.id} onClick={() => jump(d.detailsUrl + c.path)}> - + diff --git a/src/pages/home/home.module.scss b/src/pages/home/home.module.scss index 30eb09a..c9954e3 100644 --- a/src/pages/home/home.module.scss +++ b/src/pages/home/home.module.scss @@ -1,3 +1,5 @@ + + .content { position: relative; padding: 0 20px; diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 93d07f3..63ef0a7 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -15,8 +15,8 @@ const Home: FC = () => { const {token, empty} = Profile.useContainer() return ( - - 康一诺 + + 康一诺 diff --git a/src/pages/index/index.module.scss b/src/pages/index/index.module.scss index b58360c..e130875 100644 --- a/src/pages/index/index.module.scss +++ b/src/pages/index/index.module.scss @@ -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; diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index ebbccd9..2a3d08d 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -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([]) 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 diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx index c4e9781..2530d5f 100644 --- a/src/pages/preview/illness/sort/sort.tsx +++ b/src/pages/preview/illness/sort/sort.tsx @@ -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) diff --git a/src/pages/preview/videoFull/videoFull.module.scss b/src/pages/preview/videoFull/videoFull.module.scss new file mode 100644 index 0000000..94766d1 --- /dev/null +++ b/src/pages/preview/videoFull/videoFull.module.scss @@ -0,0 +1,11 @@ +.video { + width: 100%; + height: 100vh; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + background: #000; +} diff --git a/src/pages/preview/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx index c88333b..7f33431 100644 --- a/src/pages/preview/videoFull/videoFull.tsx +++ b/src/pages/preview/videoFull/videoFull.tsx @@ -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 = () => { const {url} = Taro.useRouter().params return (