疾病知识

v2
king 1 year ago committed by xing
parent c2ee704cf9
commit cccb057722
  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

@ -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)
}

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

@ -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 (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight + 30}px`}>
<View className={styles.header} style={`paddingTop:${globalData.statusBarHeight}px`}></View>
<View className={styles.content} style={`paddingTop:${menu.bottom}px`}>
<View className={styles.header} style={headerStyle}></View>
<Search/>
<Adware/>
<Feature/>

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

@ -4,6 +4,7 @@ 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 }
@ -38,7 +39,7 @@ const BrandList: FC = () => {
return (
<View className='p-2'>
{
brands.length &&
brands.length > 0 ?
brands.map((d) =>
<View className={styles.box}>
<View className={styles.rightBox}>
@ -46,15 +47,16 @@ const BrandList: FC = () => {
<>
{
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>
</View>
</View>
)
):<Empty name='暂无数据'/>
}
</View>
)

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

Loading…
Cancel
Save