# Conflicts:
#	src/utils/marked/marked.ts
#	src/utils/marked/utils.ts
main
一杯沧海 1 year ago
commit f04e74c325
  1. 4
      .env
  2. 11
      src/api/illness.ts
  3. 7
      src/app.config.ts
  4. 3
      src/pages/business/sort/sort.config.ts
  5. 21
      src/pages/business/sort/sort.tsx
  6. 2
      src/pages/check/check.tsx
  7. 6
      src/pages/home/components/feature_recommended.tsx
  8. 2
      src/pages/home/home.module.scss
  9. 16
      src/pages/index/components/videoList.tsx
  10. 2
      src/pages/preview/illness/article/article.config.ts
  11. 1
      src/pages/preview/illness/article/article.tsx
  12. 4
      src/pages/preview/illness/list/list.config.ts
  13. 38
      src/pages/preview/illness/list/list.module.scss
  14. 53
      src/pages/preview/illness/list/list.tsx
  15. 20
      src/pages/preview/illness/sort/sort.module.scss
  16. 31
      src/pages/preview/illness/sort/sort.tsx
  17. 13
      src/pages/preview/videoFull/videoFull.tsx
  18. 2666
      src/utils/marked/marked.esm.js

@ -1,5 +1,5 @@
TARO_APP_API=https://yjx.dev.yaojiankang.top
#TARO_APP_API=https://mooc.yaojiankang.top
#TARO_APP_API=https://yjx.dev.yaojiankang.top
TARO_APP_API=https://mooc.yaojiankang.top
#TARO_APP_API=https://shopfix.yaojiankang.top
#TARO_APP_API=https://playedu.yaojiankang.top
TARO_APP_LGOIN=true

@ -3,13 +3,10 @@ import {request} from "@/api/request";
export const illnessApi = {
/** 疾病列表 */
list(id:number,page: number , page_size: number) {
return request<{
list: any[],
total: number,
}>(`/home/v1/illness/list?page=${page}&page_size=${page_size}&id=${id}` , "GET")
list(id: number, page: number, page_size: number) {
return request<{ list: any[], total: number }>(`/home/v1/illness/list`, "GET", {page, page_size, id})
},
articleInfo(id: number ) {
return request<{ content: string }>(`/home/v1/article/${id}` , "GET")
articleInfo(owner_id: number, page: number, page_size: number) {
return request<{ list: any[], total: number }>(`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id})
},
}

@ -45,6 +45,10 @@ export default defineAppConfig({
'pages/my/my': {
network: 'all',
packages: ['pages/manage']
},
'pages/home/home': {
network: 'all',
packages: ['pages/preview']
}
},
subpackages: [
@ -57,8 +61,7 @@ export default defineAppConfig({
'history/history',
'curHistory/curHistory',
'hourHistory/hourHistory',
'courType/courType',
'sort/sort', // 公共二级分类
'courType/courType'
]
},
{

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '分类'
})

@ -1,21 +0,0 @@
import {FC} from "react";
import {View} from "@tarojs/components";
import {useRouter} from "@tarojs/taro";
type SortType = ''
interface Params {
id: number
type: SortType
jumpUrl: (data:Record<string, any>) => void
}
const Sort: FC = () => {
const params = useRouter().params as unknown as Params
return (
<View>ds</View>
)
}
export default Sort

@ -50,7 +50,7 @@ const Bing: FC = () => {
setCompany(res.company)
setUser(res.user)
setToken(res.token)
Taro.switchTab({url: '/pages/index/index'})
Taro.switchTab({url: '/pages/home/home'})
}
} catch (e) {
}

@ -80,7 +80,7 @@ const FeatureRecommended: FC = () => {
title: d.title,
imageUrl: d.url_path,
description: d.introduction,
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.resource?.name}`
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}`
}))
} catch (e) {
}
@ -95,8 +95,8 @@ const FeatureRecommended: FC = () => {
id: d.id,
imageUrl: d.url_path,
description: d.introduction,
title: d.resource?.name,
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.resource?.name}`
title: d.title,
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}`
}))
} catch (e) {
}

@ -75,7 +75,7 @@
}
.featureTitle {
height: 50rpx;
height: 42rpx;
padding-bottom: 30rpx;
}

@ -1,4 +1,4 @@
import {FC, useEffect, useState} from "react";
import {FC, useEffect, useMemo, useState} from "react";
import {useDidShow} from "@tarojs/taro";
import {ScrollView, Swiper, SwiperItem, View} from "@tarojs/components";
import {Courses, CoursesKey, publicApi} from "@/api/public";
@ -16,9 +16,9 @@ interface Props {
export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => {
const [data, setData] = useState<Courses>({
is_finished: [],
is_not_required: [],
is_required: [],
is_not_required: [],
is_finished: [],
is_not_finished: [],
})
const [page, setPage] = useState(1)
@ -105,9 +105,15 @@ export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => {
setCategoryKey(categoryKeys[index])
}
const categoryIndex = useMemo(() => {
const index = Object.keys(data).findIndex(d => d === categoryKey)
return index < 0 ? 0 : index
}, [data, categoryKey])
return (
<Swiper className={styles.swiper} onChange={changeSwiper}
current={Object.keys(data).findIndex(d => d === categoryKey)}>
<Swiper className={styles.swiper}
onChange={changeSwiper}
current={categoryIndex}>
{
Object.values(data).map((value) => <SwiperItem>
<ScrollView scrollY className={styles.swiper} onScrollToLower={() => setPage(page + 1)}>

@ -1,4 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '',
onReachBottomDistance: 30
onReachBottomDistance: 50
})

@ -13,7 +13,6 @@ const article:FC = () => {
const [show,setShow] = useState(false)
const [articleInfo,setArticleInfo] = useState<ArticleRecord>()
const { children, headings } = useMemo(() => parse(articleInfo?.content || ''), [articleInfo])
console.log(headings,'headings')
const query = Taro.createSelectorQuery()

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

@ -1,34 +1,8 @@
page{
background-color: #fff !important;
}
.box {
display: flex;
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 16rpx;
box-sizing: border-box;
}
.image{
width: 128rpx;
height:128rpx;
background-color: pink;
border-radius: 8rpx;
}
.rightBox{
padding-left: 24rpx;
box-sizing: border-box;
flex: 1;
}
.desc{
font-size: 24rpx;
.brands {
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #909795;
line-height: 34rpx;
display: -webkit-box;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
color: #323635;
padding: 30rpx;
border-bottom: 1px solid #F5F8F7;
}

@ -2,7 +2,6 @@ import {FC, useCallback, useEffect, useState} from "react";
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";
@ -11,32 +10,28 @@ const BrandList: FC = () => {
const [page, setPage] = useState(1)
const [brands, setBrands] = useState<any[]>([])
const [total, setTotal] = useState(0)
const [fetchDone,setFetchDone] = useState(false)
const [fetchDone, setFetchDone] = useState(false)
useEffect(() => {
Taro.showLoading({
title: '加载中',
mask: true
})
setTimeout(function () {
Taro.hideLoading()
setFetchDone(true)
}, 800)
getData()
Taro.showLoading({title: '加载中', mask: true})
getData().then()
}, [page])
const getData = useCallback(async () => {
try {
const data = await illnessApi.list(params.id, 1, 100)
const data = await illnessApi.articleInfo(params.id, page, 20)
setTotal(data.total)
setBrands([
...data.list
])
Taro.setNavigationBarTitle({title: data.list?.[0].resourceCategories?.[0]?.name ?? '文章列表'})
setBrands([...brands, ...data.list])
} catch (e) {
}
setFetchDone(true)
Taro.hideLoading()
}, [page])
function jump(id: number) {
Taro.navigateTo({url: '/pages/preview/illness/article/article?id=' + id})
}
useReachBottom(useCallback(() => {
if (brands?.length < total) {
@ -46,29 +41,13 @@ const BrandList: FC = () => {
return (
<View className='p-2' style={{display:fetchDone?'block':'none'}}>
<View style={{display: fetchDone ? 'block' : 'none'}} className='px-2 mt-2 bg-white'>
{
brands.length > 0 ?
brands.map((d) =>
<View className={styles.box}>
<View className={styles.rightBox}>
<Collapse title={d.name} children={
<>
{
d.articles?.map((d) => <View
onClick={() => {
Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})
}}
className='py-3 font-36'
style={{borderBottom: "1px solid #ddd"}}
>{d.title}</View>
)
}
</>
}></Collapse>
</View>
</View>
) : <Empty name='暂无数据'/>
brands.map((d, index) => <View key={d.id} className={styles.brands} onClick={() => jump(d.id)}>
{index + 1} . {d.title}
</View>)
: <Empty name='暂无文章'/>
}
</View>
)

@ -1,6 +1,16 @@
.scrollView{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
display: flex;
}
.firstOrder {
width: 300rpx;
height: calc(100vh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 200rpx);
height: 100%;
View {
width: 100%;
@ -54,10 +64,16 @@
padding: 0 15rpx;
background: #fff;
box-sizing: border-box;
height: calc(100vh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 200rpx)
height: 100%;
}
.list {
padding: 20rpx;
border-bottom: 1px solid #F5F8F7;
width: 100%;
min-height: 100rpx;
color: #323635;
box-sizing: border-box;
display: flex;
align-items: center;
}

@ -4,7 +4,6 @@ import {Category, HomeApi} from "@/api";
import Taro from "@tarojs/taro";
import styles from './sort.module.scss'
import Tabs, {TabList} from "@/components/tabs/tabs";
import {Search} from "@/pages/home/components/search";
import {illnessApi} from "@/api/illness";
import Empty from "@/components/empty/empty";
import leftArrow from "@/static/img/leftArrow.png"
@ -16,10 +15,10 @@ const Sort: FC = () => {
const [secondId, setSecondId] = useState<number | undefined>(undefined)
const [list, setList] = useState<any[]>([])
const globalData = Taro.getApp().globalData
const menu = Taro.getMenuButtonBoundingClientRect()
async function getData() {
const res = await HomeApi.category(3)
setData(res)
@ -30,7 +29,7 @@ const Sort: FC = () => {
}
function jump(id: number) {
Taro.navigateTo({url: '/pages/preview/illness/article/article?id=' + id})
Taro.navigateTo({url: '/pages/preview/illness/list/list?id=' + id})
}
const getTabList = useMemo((): TabList[] => {
@ -48,10 +47,6 @@ const Sort: FC = () => {
paddingLeft: '10px'
}
function onConfirm(value: string) {
console.log(value)
}
function firstIdChange(id: number) {
setFirstId(id)
const resource_category = data.find(d => d.id === id)?.resource_category
@ -64,16 +59,14 @@ const Sort: FC = () => {
if (secondId) {
Taro.showLoading({title: '加载中'})
illnessApi.list(secondId, 1, 100).then(res => {
const data = []
res.list.forEach(d => {
data.push(...d.articles as [])
})
setList(data)
setList(res.list)
}).finally(() => {
Taro.hideLoading()
}).catch(() => {
setList([])
})
} else {
setList([])
}
}, [secondId])
@ -86,13 +79,11 @@ const Sort: FC = () => {
onClick={() => Taro.navigateBack()}/>
<Tabs tabList={getTabList} onChange={(data) => firstIdChange(data.tab?.value as number)}/>
</View>
<Search onConfirm={onConfirm}/>
<View className='flex'>
<ScrollView
scrollY
scrollWithAnimation
scrollIntoView={`${prefix}-${secondId}`}
className={styles.firstOrder}>
{/*<Search onConfirm={onConfirm}/>*/}
<View className={styles.scrollView} style={{top: `${globalData.statusBarHeight + 59}px`}}>
<ScrollView scrollY className={styles.firstOrder}>
{
data.find(d => d.id === firstId)?.resource_category?.map(d => <View
id={`${prefix}-${d.id}`}
@ -110,7 +101,7 @@ const Sort: FC = () => {
scrollWithAnimation>
{
list.length ?
list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.title}</View>)
list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.name}</View>)
: <Empty name='暂无数据'/>
}
</ScrollView>

@ -34,10 +34,22 @@ const VideoFull: FC = () => {
}
}
function onError() {
Taro.showModal({
title: '视频播放错误',
confirmText: '退出',
showCancel: true,
success() {
Taro.navigateBack()
}
})
}
return (
<>
{params.title && <View className={styles.title}>{params.title}</View>}
<Video
posterSize='cover'
id={'myVideo'}
onClick={click}
className={styles.video}
@ -53,6 +65,7 @@ const VideoFull: FC = () => {
enableProgressGesture={false}
onPlay={() => setpalying(true)}
onPause={() => setpalying(false)}
onError={onError}
/>
</>
)

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save