首次提交
This commit is contained in:
4
src/cms/about.config.ts
Normal file
4
src/cms/about.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '关于我们',
|
||||
navigationBarBackgroundColor: '#ffe0e0'
|
||||
})
|
||||
7
src/cms/about.tsx
Normal file
7
src/cms/about.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
function About() {
|
||||
return (
|
||||
<div>About</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default About
|
||||
3
src/cms/article.config.ts
Normal file
3
src/cms/article.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '文章列表'
|
||||
})
|
||||
51
src/cms/article.tsx
Normal file
51
src/cms/article.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {ArrowRight} from '@nutui/icons-react-taro'
|
||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
|
||||
/**
|
||||
* 文章终极列表
|
||||
* @constructor
|
||||
*/
|
||||
const Article = () => {
|
||||
const {params} = useRouter();
|
||||
const [categoryId, setCategoryId] = useState<number>(3494)
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
|
||||
const reload = () => {
|
||||
if (params.id) {
|
||||
setCategoryId(Number(params.id))
|
||||
}
|
||||
pageCmsArticle({categoryId}).then(res => {
|
||||
if (res?.list) {
|
||||
setList(res?.list)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className={'px-3 mb-10'}>
|
||||
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-4'}>
|
||||
<div className={'bg-white min-h-36 w-full'}>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex justify-between items-center py-2'} onClick={() => Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }>
|
||||
<div className={'text-sm'}>{item.title}</div>
|
||||
<ArrowRight color={'#cccccc'} size={18} />
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default Article
|
||||
3
src/cms/detail.config.ts
Normal file
3
src/cms/detail.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '文章详情'
|
||||
})
|
||||
4
src/cms/detail.scss
Normal file
4
src/cms/detail.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
.content{
|
||||
padding: 32px;
|
||||
line-height: 2.4rem;
|
||||
}
|
||||
96
src/cms/detail.tsx
Normal file
96
src/cms/detail.tsx
Normal file
@@ -0,0 +1,96 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import {Image, Tag} from '@nutui/nutui-react-taro'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {Divider} from '@nutui/nutui-react-taro'
|
||||
import dayjs from 'dayjs'
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model"
|
||||
import {Eye, Clock, PickedUp, Purse, Coupon} from '@nutui/icons-react-taro'
|
||||
import AddCartBar from "@/components/AddCartBar";
|
||||
// 显示html富文本
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import './detail.scss'
|
||||
import Line from "@/components/Gap";
|
||||
import {wxParse} from "@/utils/common";
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
|
||||
function Detail() {
|
||||
const {params} = useRouter();
|
||||
// 文章详情
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
// 浏览量
|
||||
const [views, setViews] = useState<number>()
|
||||
// 报名人数
|
||||
const [bmUsers, setBmUsers] = useState<number>()
|
||||
|
||||
const reload = () => {
|
||||
getCmsArticle(Number(params.id)).then(data => {
|
||||
if(data){
|
||||
data.content = wxParse(data.content)
|
||||
setItem(data)
|
||||
setViews(data.actualViews)
|
||||
setBmUsers(data.bmUsers)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'bg-white'}>
|
||||
<Image src={item?.image} height={375} className={'bg-gray-50'}/>
|
||||
<div className={'p-3 font-bold text-lg'}>{item?.title}</div>
|
||||
<div className={'flex justify-between px-3'}>
|
||||
<Tag type={'success'}>{item?.categoryName}</Tag>
|
||||
<div className={'flex items-center gap-2 text-sm text-gray-400'}><Eye size={14}/>{views}</div>
|
||||
</div>
|
||||
{
|
||||
item?.model == 'pay' ? '' :
|
||||
<div className={'pt-2'}>
|
||||
{
|
||||
!item?.endTime ? '' :
|
||||
<div className={'flex px-3 py-1 items-center gap-2'}>
|
||||
<Clock size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>{dayjs(item?.startTime).format('YYYY-MM-DD')} 至 {dayjs(item?.endTime).format('YYYY-MM-DD')}</div>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!item?.price ? '' :
|
||||
<>
|
||||
<div className={'flex px-3 py-1 items-center gap-2'}>
|
||||
<Purse size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>{item?.price == 0 ? '线下收费' : '¥' + item?.price}
|
||||
</div>
|
||||
</div>
|
||||
<Divider/>
|
||||
</>
|
||||
}
|
||||
<div className={'flex px-3 items-center gap-2'}>
|
||||
<PickedUp size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>已报名 {bmUsers} 人 / 仅限校友报名
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<Divider/>
|
||||
<div className={'flex px-3 items-center gap-2'}>
|
||||
<Coupon size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold bg-white'}>活动详情
|
||||
</div>
|
||||
</div>
|
||||
<View className={'content text-gray-700 text-sm'}>
|
||||
<RichText nodes={item?.content}/>
|
||||
</View>
|
||||
<Line height={44}/>
|
||||
<AddCartBar />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Detail
|
||||
3
src/cms/help.config.ts
Normal file
3
src/cms/help.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '帮助中心'
|
||||
})
|
||||
45
src/cms/help.tsx
Normal file
45
src/cms/help.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model"
|
||||
// import ReactMarkdown from 'react-markdown';
|
||||
// 显示html富文本
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import './detail.scss'
|
||||
import Line from "@/components/Gap";
|
||||
import {wxParse} from "@/utils/common";
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
|
||||
function Detail() {
|
||||
const {params} = useRouter();
|
||||
// 文章详情
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
const reload = () => {
|
||||
getCmsArticle(Number(params.id)).then(data => {
|
||||
if(data){
|
||||
data.content = wxParse(data.content)
|
||||
setItem(data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'bg-white'}>
|
||||
<div className={'p-4 font-bold text-lg'}>{item?.title}</div>
|
||||
<div className={'text-gray-400 text-sm px-4 '}>{item?.createTime}</div>
|
||||
<View className={'content text-gray-700 text-sm'}>
|
||||
{
|
||||
item?.editor === 1 ?
|
||||
<RichText nodes={item?.content} /> :
|
||||
null
|
||||
}
|
||||
</View>
|
||||
<Line height={44}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Detail
|
||||
Reference in New Issue
Block a user