diff --git a/src/api/brand.ts b/src/api/brand.ts index 9967ddb..a1187f7 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -1,4 +1,5 @@ import {request} from "@/api/request"; +import {Illness} from "@/api/illness"; export type BrandRecord = { logo: string; @@ -21,8 +22,10 @@ export type ArticleRecord = { created_at: string content: string brands: BrandRecord[] + illness: Illness[] collect: boolean - cover:string + cover: string + owner_type: 1 | 2 // 疾病 } export const brandApi = { diff --git a/src/api/illness.ts b/src/api/illness.ts index 1fd9c3e..5d26a16 100644 --- a/src/api/illness.ts +++ b/src/api/illness.ts @@ -1,5 +1,16 @@ import {request} from "@/api/request"; +export interface Illness { + name: string; + description: string; + resource: any; + album: string[] + created_at:string + list: { + list: any[], + total: number + } +} export const illnessApi = { /** 疾病列表 */ @@ -7,7 +18,7 @@ export const illnessApi = { return request<{ list: any[], total: number }>(`/home/v1/illness/list`, "GET", {page, page_size, id}) }, articleInfo(owner_id: number, page: number, page_size: number) { - return request<{ illness:{name:string;description:string;resource:any;album:string[]};list:{list: any[], total: number} }> + return request<{ illness: Illness }> (`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id}) }, } diff --git a/src/components/collect/collect.module.scss b/src/components/collect/collect.module.scss index 8608a6f..37eab1a 100644 --- a/src/components/collect/collect.module.scss +++ b/src/components/collect/collect.module.scss @@ -20,14 +20,16 @@ } .zoom { - top: 0; - left: 0; + //top: 0; + //left: 0; position: absolute; content: ''; width: 32rpx; height: 32rpx; border-radius: 50%; border: 1px solid #FF9E5F; + padding: 0 !important; + margin: 0 !important; animation: Zooms 300ms ease forwards; opacity: 1; transform-origin: -100%, -100% 0; diff --git a/src/components/collect/collect.tsx b/src/components/collect/collect.tsx index 1e7ba86..a1c57fb 100644 --- a/src/components/collect/collect.tsx +++ b/src/components/collect/collect.tsx @@ -35,11 +35,9 @@ const Collect: FC = (props) => { } if (loading) return; props.onClick?.() - console.log(select) + await userApi.create({owner_id: props.owner_id, owner_type: props.owner_type}) setSelect(!select) setLoading(true) - // fixme: 动画逻辑不对,应该是先 loading, 然后只有操作成功之后才是 select 动画 - await userApi.create({owner_id: props.owner_id, owner_type: props.owner_type}) props.onUpdate?.(!select) setTimeout(() => { setLoading(false) diff --git a/src/pages/preview/brand/article/article.module.scss b/src/pages/preview/brand/article/article.module.scss index 6f0e96f..164b692 100644 --- a/src/pages/preview/brand/article/article.module.scss +++ b/src/pages/preview/brand/article/article.module.scss @@ -54,12 +54,6 @@ page{ align-items: center; background: #F5F8F7; color: #909795; - - View { - font-size: 26rpx; - padding: 0 10px; - text-align: center; - } } .article { diff --git a/src/pages/preview/brand/article/article.tsx b/src/pages/preview/brand/article/article.tsx index 0663ec9..cb9db52 100644 --- a/src/pages/preview/brand/article/article.tsx +++ b/src/pages/preview/brand/article/article.tsx @@ -97,9 +97,10 @@ const article: FC = () => { onUpdate={onCollect} /> - setShow(true)}> - - 目录 + setShow(true)}> + + 目录 } @@ -110,12 +111,12 @@ const article: FC = () => { style={{ height: !token ? globalData.pageHeight - 60 + 'px' : 'auto', overflow: !token ? 'hidden' : 'auto', - boxSizing:'border-box' + boxSizing: 'border-box' }}> {articleInfo?.title} { - articleInfo?.brands?.map(d => ( + articleInfo?.owner_type === 1 && articleInfo?.brands?.map(d => ( @@ -141,6 +142,34 @@ const article: FC = () => { )) } + + { + articleInfo?.owner_type === 2 && articleInfo?.illness?.map(d => ( + + + + + {d?.name} + + {beforeTime(articleInfo?.created_at)} . + 阅读 {articleInfo.page_view || 1} + + + + + + + + )) + } { children.length > 0 ? {children} diff --git a/src/pages/preview/search/search/components/list.tsx b/src/pages/preview/search/search/components/list.tsx index 5f3d28f..6928569 100644 --- a/src/pages/preview/search/search/components/list.tsx +++ b/src/pages/preview/search/search/components/list.tsx @@ -5,9 +5,9 @@ import Taro from "@tarojs/taro"; import Empty from "@/components/empty/empty"; import Img from "@/components/image/image"; import {SearchApi} from "@/api/search"; -import {AtLoadMore} from 'taro-ui' import {rfc33392time} from "@/utils/day"; import play from "@/static/img/play-back.png"; +import Spin from "@/components/spinner"; type Props = { name: string @@ -95,10 +95,9 @@ const SearchList: FC = ({name, clear}) => { className='scrollview' scrollY scrollWithAnimation - style={{height: `${globalData.screenHeight - 140}px`, backgroundColor: `#f5f5f5`}} - onScrollToLower={onScrollToLower} - > - {loading && } + style={{height: `${globalData.screenHeight - 140}px`, backgroundColor: `#f5f5f5`, position: 'relative'}} + onScrollToLower={onScrollToLower}> + { brands.length >= 1 && !loading && <>