|
|
@ -1,16 +1,18 @@ |
|
|
|
import {FC, useEffect, useState} from "react"; |
|
|
|
import {FC, useEffect, useMemo, useState} from "react"; |
|
|
|
import {Image, Text, View} from "@tarojs/components"; |
|
|
|
import {Image, Text, View} from "@tarojs/components"; |
|
|
|
import Taro, {useRouter} from "@tarojs/taro"; |
|
|
|
import Taro, {useRouter} from "@tarojs/taro"; |
|
|
|
import {ArticleRecord, brandApi} from "@/api"; |
|
|
|
import {ArticleRecord, brandApi} from "@/api"; |
|
|
|
import styles from "@/pages/preview/illness/article/article.module.scss"; |
|
|
|
import styles from "@/pages/preview/illness/article/article.module.scss"; |
|
|
|
import down from "@/static/img/doubleDown.png"; |
|
|
|
import down from "@/static/img/doubleDown.png"; |
|
|
|
import {Profile} from "@/store"; |
|
|
|
import {Profile} from "@/store"; |
|
|
|
|
|
|
|
import {parse} from "@/utils/marked/marked"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const article:FC = () => { |
|
|
|
const article:FC = () => { |
|
|
|
const {token,empty} = Profile.useContainer() |
|
|
|
const {token,} = Profile.useContainer() |
|
|
|
const {id} = useRouter().params as unknown as { id: number} |
|
|
|
const {id} = useRouter().params as unknown as { id: number} |
|
|
|
const [articleInfo,setArticleInfo] = useState<ArticleRecord>() |
|
|
|
const [articleInfo,setArticleInfo] = useState<ArticleRecord>() |
|
|
|
|
|
|
|
const { children } = useMemo(() => parse(articleInfo?.content || ''), [articleInfo]) |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
getData() |
|
|
|
getData() |
|
|
|
}, [id]) |
|
|
|
}, [id]) |
|
|
@ -24,10 +26,11 @@ const article:FC = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function helloWorld() { |
|
|
|
function helloWorld() { |
|
|
|
const html = articleInfo?.content; |
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<View style={{padding:'10px',height:!token ? Taro.getWindowInfo().windowHeight-60+'px' : 'auto',overflow:!token ? 'hidden':'auto'}} dangerouslySetInnerHTML={{ __html: html! }}></View> |
|
|
|
<View style={{padding:'10px',height:!token ? Taro.getWindowInfo().windowHeight-60+'px' : 'auto',overflow:!token ? 'hidden':'auto'}}> |
|
|
|
|
|
|
|
{ children } |
|
|
|
|
|
|
|
</View> |
|
|
|
{ |
|
|
|
{ |
|
|
|
!token && |
|
|
|
!token && |
|
|
|
<View className={styles.fixedBox}> |
|
|
|
<View className={styles.fixedBox}> |
|
|
@ -35,7 +38,7 @@ const article:FC = () => { |
|
|
|
<View className={styles['fixedBox-inner-icon']}> |
|
|
|
<View className={styles['fixedBox-inner-icon']}> |
|
|
|
<Image src={down}></Image> |
|
|
|
<Image src={down}></Image> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
<View className={styles['fixedBox-inner-box']} onClick={empty}> |
|
|
|
<View className={styles['fixedBox-inner-box']} onClick={()=>{Taro.navigateTo({url: '/pages/login/login'})}}> |
|
|
|
<Text>登录查看更多内容</Text> |
|
|
|
<Text>登录查看更多内容</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|