疾病知识

main
king 1 year ago
parent b6736c49d2
commit 0a7669f0ef
  1. 3
      .env.playedu
  2. 4
      src/pages/home/components/curRecommended.tsx
  3. 2
      src/pages/home/home.config.ts
  4. 11
      src/pages/home/home.tsx
  5. 2
      src/pages/preview/illness/list/list.config.ts
  6. 10
      src/pages/preview/illness/list/list.tsx
  7. 2
      src/pages/preview/illness/sort/sort.tsx

@ -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 TARO_APP_LGOIN=false

@ -16,13 +16,13 @@ const CurRecommended: FC = () => {
setTotal(res.total) setTotal(res.total)
const newData = res.data.reduce((pre, cut) => { const newData = res.data.reduce((pre, cut) => {
const index = pre.findIndex(d => d.id === cut.id) const index = pre.findIndex(d => d.id === cut.id)
if (index === 1) { if (index === -1) {
pre.push(cut) pre.push(cut)
} else { } else {
pre.splice(index, 1, cut) pre.splice(index, 1, cut)
} }
return pre return pre
}, data) }, JSON.parse(JSON.stringify(data)) as Curriculum[])
setData(newData) setData(newData)
} }

@ -1,5 +1,5 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '首页', navigationBarTitleText: '首页',
navigationStyle: 'custom', navigationStyle: 'custom',
onReachBottomDistance: 30 onReachBottomDistance: 50
}) })

@ -1,6 +1,6 @@
import {FC} from "react"; import {FC} from "react";
import {View} from "@tarojs/components"; 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 Taro from "@tarojs/taro";
import {Search} from "@/pages/home/components/search"; import {Search} from "@/pages/home/components/search";
import Adware from "@/pages/home/components/adware"; import Adware from "@/pages/home/components/adware";
@ -11,12 +11,15 @@ import MyButton from "@/components/button/MyButton";
import {Profile} from "@/store"; import {Profile} from "@/store";
const Home: FC = () => { const Home: FC = () => {
const globalData = Taro.getApp().globalData const menu = Taro.getMenuButtonBoundingClientRect()
const {token, empty} = Profile.useContainer() const {token, empty} = Profile.useContainer()
const headerStyle: React.CSSProperties = {
height: `${menu.bottom}px`,
}
return ( return (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight + 30}px`}> <View className={styles.content} style={`paddingTop:${menu.bottom}px`}>
<View className={styles.header} style={`paddingTop:${globalData.statusBarHeight}px`}></View> <View className={styles.header} style={headerStyle}></View>
<Search/> <Search/>
<Adware/> <Adware/>
<Feature/> <Feature/>

@ -1,4 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '', navigationBarTitleText: '疾病知识列表',
onReachBottomDistance: 30 onReachBottomDistance: 30
}) })

@ -4,6 +4,7 @@ import styles from './list.module.scss'
import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; import Taro, {useReachBottom, useRouter} from "@tarojs/taro";
import Collapse from "@/components/collapse/collapse"; import Collapse from "@/components/collapse/collapse";
import {illnessApi} from "@/api/illness"; import {illnessApi} from "@/api/illness";
import Empty from "@/components/empty/empty";
const BrandList: FC = () => { const BrandList: FC = () => {
const params = useRouter().params as unknown as { id: number } const params = useRouter().params as unknown as { id: number }
@ -38,7 +39,7 @@ const BrandList: FC = () => {
return ( return (
<View className='p-2'> <View className='p-2'>
{ {
brands.length && brands.length > 0 ?
brands.map((d) => brands.map((d) =>
<View className={styles.box}> <View className={styles.box}>
<View className={styles.rightBox}> <View className={styles.rightBox}>
@ -46,15 +47,16 @@ const BrandList: FC = () => {
<> <>
{ {
d.articles?.map((d) => d.articles?.map((d) =>
<View onClick={() => {Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})}} className='mt-2 font-28 ml-5'>{d.title}</View> <View onClick={() => {
Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})
}} className='mt-2 font-28 ml-5'>{d.title}</View>
) )
} }
</> </>
}></Collapse> }></Collapse>
</View> </View>
</View> </View>
) ):<Empty name='暂无数据'/>
} }
</View> </View>
) )

@ -53,7 +53,7 @@ const Sort: FC = () => {
<View className={styles.secondaryBox}> <View className={styles.secondaryBox}>
{ {
d.resource_category?.map(c => <View d.resource_category?.map(c => <View
onClick={() => jump(d.id)} onClick={() => jump(c.id)}
key={d.id} key={d.id}
className={styles.secondary}> className={styles.secondary}>
<View className='p-1'>{c.name}</View> <View className='p-1'>{c.name}</View>

Loading…
Cancel
Save