|
|
@ -6,13 +6,14 @@ 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"; |
|
|
|
import {parse} from "@/utils/marked/marked"; |
|
|
|
|
|
|
|
import Empty from "@/components/empty/empty"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const article:FC = () => { |
|
|
|
const article: FC = () => { |
|
|
|
const {token,} = 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]) |
|
|
|
const {children} = useMemo(() => parse(articleInfo?.content || ''), [articleInfo]) |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
getData() |
|
|
|
getData() |
|
|
|
}, [id]) |
|
|
|
}, [id]) |
|
|
@ -20,16 +21,23 @@ const article:FC = () => { |
|
|
|
const getData = async () => { |
|
|
|
const getData = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const data = await brandApi.articleInfo(id) |
|
|
|
const data = await brandApi.articleInfo(id) |
|
|
|
Taro.setNavigationBarTitle({title:data.title}) |
|
|
|
Taro.setNavigationBarTitle({title: data.title}) |
|
|
|
setArticleInfo(data) |
|
|
|
setArticleInfo(data) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function helloWorld() { |
|
|
|
function helloWorld() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<View style={{padding:'10px',height:!token ? Taro.getWindowInfo().windowHeight-60+'px' : 'auto',overflow:!token ? 'hidden':'auto'}}> |
|
|
|
<View style={{ |
|
|
|
{ children } |
|
|
|
padding: '10px', |
|
|
|
|
|
|
|
height: !token ? Taro.getWindowInfo().windowHeight - 60 + 'px' : 'auto', |
|
|
|
|
|
|
|
overflow: !token ? 'hidden' : 'auto' |
|
|
|
|
|
|
|
}}> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
children.length > 0 ? children : <Empty name='暂无数据'/> |
|
|
|
|
|
|
|
} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
{ |
|
|
|
{ |
|
|
|
!token && |
|
|
|
!token && |
|
|
@ -38,16 +46,19 @@ 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={()=>{Taro.navigateTo({url: '/pages/login/login'})}}> |
|
|
|
<View className={styles['fixedBox-inner-box']} onClick={() => { |
|
|
|
|
|
|
|
Taro.navigateTo({url: '/pages/login/login'}) |
|
|
|
|
|
|
|
}}> |
|
|
|
<Text>登录查看更多内容</Text> |
|
|
|
<Text>登录查看更多内容</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
} |
|
|
|
} |
|
|
|
</> |
|
|
|
</> |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return helloWorld() |
|
|
|
return helloWorld() |
|
|
|
} |
|
|
|
} |
|
|
|
export default article |
|
|
|
export default article |
|
|
|