From cccb0577222b391416e5bf6ed92d8b7f429d81d9 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 22 Aug 2023 18:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=96=BE=E7=97=85=E7=9F=A5=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.playedu | 3 +- src/pages/home/components/curRecommended.tsx | 16 +++---- src/pages/home/home.config.ts | 2 +- src/pages/home/home.tsx | 11 +++-- src/pages/preview/illness/list/list.config.ts | 2 +- src/pages/preview/illness/list/list.tsx | 42 ++++++++++--------- src/pages/preview/illness/sort/sort.tsx | 2 +- 7 files changed, 42 insertions(+), 36 deletions(-) diff --git a/.env.playedu b/.env.playedu index 6eab0de..d126068 100644 --- a/.env.playedu +++ b/.env.playedu @@ -1,2 +1,3 @@ -TARO_APP_API=https://playedu.yaojiankang.top +#TARO_APP_API=https://playedu.yaojiankang.top +TARO_APP_API=https://mooc.yaojiankang.top TARO_APP_LGOIN=false diff --git a/src/pages/home/components/curRecommended.tsx b/src/pages/home/components/curRecommended.tsx index 09ebcaf..4dbb4a2 100644 --- a/src/pages/home/components/curRecommended.tsx +++ b/src/pages/home/components/curRecommended.tsx @@ -16,13 +16,13 @@ const CurRecommended: FC = () => { setTotal(res.total) const newData = res.data.reduce((pre, cut) => { const index = pre.findIndex(d => d.id === cut.id) - if (index === 1) { + if (index === -1) { pre.push(cut) } else { pre.splice(index, 1, cut) } return pre - }, data) + }, JSON.parse(JSON.stringify(data)) as Curriculum[]) setData(newData) } @@ -42,12 +42,12 @@ const CurRecommended: FC = () => { { data.map(c => ) + thumb={c.thumb} + title={c.title} + id={c.id} + depId={c.id} + key={c.id} + />) } diff --git a/src/pages/home/home.config.ts b/src/pages/home/home.config.ts index 3ad5d8a..c273565 100644 --- a/src/pages/home/home.config.ts +++ b/src/pages/home/home.config.ts @@ -1,5 +1,5 @@ export default definePageConfig({ navigationBarTitleText: '首页', navigationStyle: 'custom', - onReachBottomDistance: 30 + onReachBottomDistance: 50 }) diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 63ef0a7..6b7bbce 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -1,6 +1,6 @@ import {FC} from "react"; import {View} from "@tarojs/components"; -import styles from "@/pages/index/index.module.scss"; +import styles from "./home.module.scss"; import Taro from "@tarojs/taro"; import {Search} from "@/pages/home/components/search"; import Adware from "@/pages/home/components/adware"; @@ -11,12 +11,15 @@ import MyButton from "@/components/button/MyButton"; import {Profile} from "@/store"; const Home: FC = () => { - const globalData = Taro.getApp().globalData + const menu = Taro.getMenuButtonBoundingClientRect() const {token, empty} = Profile.useContainer() + const headerStyle: React.CSSProperties = { + height: `${menu.bottom}px`, + } return ( - - 康一诺 + + 康一诺 diff --git a/src/pages/preview/illness/list/list.config.ts b/src/pages/preview/illness/list/list.config.ts index 2a0a86b..9fe364f 100644 --- a/src/pages/preview/illness/list/list.config.ts +++ b/src/pages/preview/illness/list/list.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '', + navigationBarTitleText: '疾病知识列表', onReachBottomDistance: 30 }) diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index 2a3d08d..919a090 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -1,12 +1,13 @@ import {FC, useCallback, useEffect, useState} from "react"; -import { View} from "@tarojs/components"; +import {View} from "@tarojs/components"; import styles from './list.module.scss' import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; import Collapse from "@/components/collapse/collapse"; import {illnessApi} from "@/api/illness"; +import Empty from "@/components/empty/empty"; const BrandList: FC = () => { - const params = useRouter().params as unknown as {id:number} + const params = useRouter().params as unknown as { id: number } const [page, setPage] = useState(1) const [brands, setBrands] = useState([]) const [total, setTotal] = useState(0) @@ -17,7 +18,7 @@ const BrandList: FC = () => { const getData = useCallback(async () => { try { - const data = await illnessApi.list(params.id,1, 100) + const data = await illnessApi.list(params.id, 1, 100) setTotal(data.total) setBrands([ ...data.list @@ -38,23 +39,24 @@ const BrandList: FC = () => { return ( { - brands.length && - brands.map((d) => - - - - { - d.articles?.map((d) => - {Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})}} className='mt-2 font-28 ml-5'>{d.title} - - ) - } - - }> - - - ) + brands.length > 0 ? + brands.map((d) => + + + + { + d.articles?.map((d) => + { + Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`}) + }} className='mt-2 font-28 ml-5'>{d.title} + ) + } + + }> + + + ): } ) diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx index 2530d5f..de5df38 100644 --- a/src/pages/preview/illness/sort/sort.tsx +++ b/src/pages/preview/illness/sort/sort.tsx @@ -53,7 +53,7 @@ const Sort: FC = () => { { d.resource_category?.map(c => jump(d.id)} + onClick={() => jump(c.id)} key={d.id} className={styles.secondary}> {c.name}