diff --git a/src/api/brand.ts b/src/api/brand.ts index 9d7d020..6770503 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -7,6 +7,7 @@ export type BrandRecord = { brand_album: string[] graphic_introduction: string disabled: number + introductory_video_resource:any } export type ArticleRecord = { title: string diff --git a/src/app.config.ts b/src/app.config.ts index 094ed13..8e793b3 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -6,7 +6,6 @@ export default defineAppConfig({ 'pages/login/login', 'pages/check/check', 'pages/my/my', - 'pages/health/health', ], window: { backgroundTextStyle: 'light', @@ -59,7 +58,6 @@ export default defineAppConfig({ 'curHistory/curHistory', 'hourHistory/hourHistory', 'courType/courType', - 'videoFull/videoFull', // 资源id 视频全屏 'sort/sort', // 公共二级分类 ] }, @@ -80,13 +78,15 @@ export default defineAppConfig({ ] }, { - root: 'pages/brand', + root: 'pages/preview', pages: [ - 'list/list', - 'info/info', - 'article/article', + 'brand/list/list', + 'brand/info/info', + 'brand/article/article', + 'health/health', // 健康 + 'videoFull/videoFull', // 资源id 视频全屏 ] - } + }, ], lazyCodeLoading: "requiredComponents" }) diff --git a/src/components/textCollapse/collapse.tsx b/src/components/textCollapse/collapse.tsx index bd2666f..dac317a 100644 --- a/src/components/textCollapse/collapse.tsx +++ b/src/components/textCollapse/collapse.tsx @@ -8,7 +8,7 @@ interface Props { text: string } -const LineEllipsis:FC = ({text}:Props) => { +const LineEllipsis:FC = ({text}:Props) => { const [disabled, setDisabled] = useState(false) const [isExpansioned, setIsExpansioned] = useState(false) const [overflow, setOverflow] = useState(false) diff --git a/src/pages/brand/article/article.config.ts b/src/pages/brand/article/article.config.ts deleted file mode 100644 index 1029aac..0000000 --- a/src/pages/brand/article/article.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '文章详情', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/article/article.tsx b/src/pages/brand/article/article.tsx deleted file mode 100644 index e2b3556..0000000 --- a/src/pages/brand/article/article.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import {FC, useEffect, useState} from "react"; -import {View} from "@tarojs/components"; -import Taro, {useRouter} from "@tarojs/taro"; -import {ArticleRecord, brandApi} from "@/api"; - - -const article:FC = () => { - const {id} = useRouter().params as unknown as { id: number} - const [articleInfo,setArticleInfo] = useState() - useEffect(() => { - getData() - }, [id]) - - const getData = async () => { - try { - const data = await brandApi.articleInfo(id) - Taro.setNavigationBarTitle({title:data.title}) - setArticleInfo(data) - } catch (e) { - } - } - function helloWorld() { - const html = articleInfo?.content; - return - } - return helloWorld() -} -export default article diff --git a/src/pages/brand/info/info.config.ts b/src/pages/brand/info/info.config.ts deleted file mode 100644 index 2a0a86b..0000000 --- a/src/pages/brand/info/info.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/info/info.module.scss b/src/pages/brand/info/info.module.scss deleted file mode 100644 index 11abb71..0000000 --- a/src/pages/brand/info/info.module.scss +++ /dev/null @@ -1,65 +0,0 @@ -.swiper{ - width:750rpx; - height:600rpx; - background-color: pink; -} -.body{ - border-radius: 32rpx 32rpx 0 0; - background-color:cadetblue; - width: 750rpx; - box-sizing: border-box; - display: flex; - flex-direction: column; - min-height: 80vh; - position: absolute; - top: 520rpx; - .top{ - padding:40rpx 30rpx 30rpx 30rpx; - border-radius: 32rpx; - background-color: #fff; - .title{ - font-size: 32rpx; - font-weight: bold; - color: #323635; - line-height:44rpx; - } - } - .bottom{ - margin-top: 20rpx; - flex:1; - background-color: #fff; - border-radius: 32rpx 32rpx 0 0; - width: 100%; - .box { - display: flex; - background-color: #fff; - border-radius: 16rpx; - padding: 30rpx; - box-sizing: border-box; - } - .inner{ - flex:1; - display: flex; - padding-bottom: 24rpx; - border-bottom: 2rpx solid #F5F8F7; - .image{ - width: 172rpx; - height:128rpx; - background-color: pink; - border-radius: 8rpx; - } - .leftBox{ - padding-right: 24rpx; - box-sizing: border-box; - flex: 1; - } - .desc{ - font-size: 22rpx; - font-weight: 500; - color: #909795; - line-height: 32rpx - } - } - - } -} diff --git a/src/pages/brand/info/info.tsx b/src/pages/brand/info/info.tsx deleted file mode 100644 index aae011c..0000000 --- a/src/pages/brand/info/info.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {Image, Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; -import {ArticleRecord, brandApi, BrandRecord} from "@/api"; -import styles from './info.module.scss' -import Taro, {useRouter} from "@tarojs/taro"; -import LineEllipsis from "@/components/textCollapse/collapse"; -import Empty from "@/components/empty/empty"; - -type Params = { - id: number -} -const BrandInfo: FC = () => { - const {id} = useRouter().params as unknown as Params - const [brandInfo, setBrandInfo] = useState() - const [articleList,setArticleList] = useState() - - useEffect(() => { - getData() - }, [id]) - - const getData = async () => { - try { - const data = await brandApi.info(id) - Taro.setNavigationBarTitle({title:data.name}) - setBrandInfo(data) - const data1 = await brandApi.articleList(id) - setArticleList(data1.list) - } catch (e) { - // setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']}) - } - } - - - return ( - - { - - - ) - { brandInfo?.brand_album?.length - && brandInfo?.brand_album.map((d) => - - - ) - } - - - } - - - {brandInfo?.name} - - - - { - articleList?.length ? - articleList.map((i)=> - {Taro.navigateTo({url: `/pages/brand/article/article?id=${i.id}`})}}> - - - {i.title} - {i.created_at} {i.page_view}阅读 - - {/**/} - - - - ) - : - } - - - - - ); -} - -export default BrandInfo diff --git a/src/pages/brand/list/list.config.ts b/src/pages/brand/list/list.config.ts deleted file mode 100644 index 89c2e86..0000000 --- a/src/pages/brand/list/list.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '品牌列表', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/list/list.module.scss b/src/pages/brand/list/list.module.scss deleted file mode 100644 index 25cd50a..0000000 --- a/src/pages/brand/list/list.module.scss +++ /dev/null @@ -1,32 +0,0 @@ -.box { - display: flex; - margin-bottom: 20rpx; - background-color: #fff; - border-radius: 16rpx; - padding: 24rpx; - 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; - 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; -} - diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx deleted file mode 100644 index cbe848e..0000000 --- a/src/pages/brand/list/list.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {Image, View} from "@tarojs/components"; -import {brandApi, BrandRecord} from "@/api"; -import styles from './list.module.scss' -import Taro, {useReachBottom} from "@tarojs/taro"; -import Empty from "@/components/empty/empty"; - -const BrandList: FC = () => { - const [page, setPage] = useState(1) - const [brands, setBrands] = useState([]) - const [total, setTotal] = useState(0) - - useEffect(() => { - getData() - }, [page]) - - const getData = useCallback( async () => { - try { - const res = await brandApi.list(1, 10) - setTotal(res.total) - setBrands([ - ...res.data - ]) - } catch (e) { - } - }, [page]) - - - function jumpInfo(id: number) { - Taro.navigateTo({url: `/pages/brand/info/info?id=${id}`}) - } - - useReachBottom(useCallback(() => { - if (brands?.length < total) { - setPage(page + 1) - } - }, [total, brands])) - - - - return ( - - { - brands.length ? brands.map((d) => - jumpInfo(d.id)} className={styles.box} key={d.id}> - - - {d.name} - {d.graphic_introduction.repeat(30)} - - ) - : - } - - ) -} - -export default BrandList diff --git a/src/pages/home/components/feature.tsx b/src/pages/home/components/feature.tsx index c70cd79..f82dd0b 100644 --- a/src/pages/home/components/feature.tsx +++ b/src/pages/home/components/feature.tsx @@ -8,7 +8,7 @@ import Taro from "@tarojs/taro"; const Feature: FC = () => { const list = [ - {url: '/pages/brand/list/list', image: article, text: '品牌'}, + {url: '/pages/preview/brand/list/list', image: article, text: '品牌'}, {url: '', image: health, text: '健康管理'}, {url: '', image: profession, text: '专业技能'}, {url: '', image: illness, text: '疾病知识'}, diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 3222604..1444989 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -27,14 +27,14 @@ const FeatureRecommended: FC = () => { {title: "品牌TOP3", url: '', detailsUrl: '', data: []}, { title: "健康知识TOP3", - url: '/pages/health/health', - detailsUrl: '/pages/business/videoFull/videoFull?url=', + url: '/pages/preview/health/health', + detailsUrl: '/pages/preview/videoFull/videoFull?url=', data: [] }, { url: '', title: "专业技能TOP3", - detailsUrl: '/pages/business/videoFull/videoFull?url=', + detailsUrl: '/pages/preview/videoFull/videoFull?url=', data: [] }, {title: "疾病知识TOP3", url: '', detailsUrl: '', data: []}, diff --git a/src/pages/health/health.config.ts b/src/pages/preview/health/health.config.ts similarity index 100% rename from src/pages/health/health.config.ts rename to src/pages/preview/health/health.config.ts diff --git a/src/pages/health/health.module.scss b/src/pages/preview/health/health.module.scss similarity index 100% rename from src/pages/health/health.module.scss rename to src/pages/preview/health/health.module.scss diff --git a/src/pages/health/health.tsx b/src/pages/preview/health/health.tsx similarity index 94% rename from src/pages/health/health.tsx rename to src/pages/preview/health/health.tsx index 60e0f18..b85116a 100644 --- a/src/pages/health/health.tsx +++ b/src/pages/preview/health/health.tsx @@ -26,7 +26,7 @@ const Health: FC = () => { function jump(url: string, id: number) { HomeApi.healthSetPlay(id) - Taro.navigateTo({url: '/pages/business/videoFull/videoFull?url=' + url}) + Taro.navigateTo({url: '/pages/preview/videoFull/videoFull?url=' + url}) } return ( diff --git a/src/pages/business/videoFull/videoFull.config.ts b/src/pages/preview/videoFull/videoFull.config.ts similarity index 100% rename from src/pages/business/videoFull/videoFull.config.ts rename to src/pages/preview/videoFull/videoFull.config.ts diff --git a/src/pages/business/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx similarity index 100% rename from src/pages/business/videoFull/videoFull.tsx rename to src/pages/preview/videoFull/videoFull.tsx