From 34ffb6ed62d197a2e65e78d886c3914f15a0ff9e Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 28 Aug 2023 14:09:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/videoCover/videoCover.scss | 6 ++++- src/pages/home/components/curRecommended.tsx | 4 ++-- src/pages/home/components/feature.tsx | 2 +- src/pages/home/home.module.scss | 10 ++++---- src/pages/home/home.tsx | 2 +- .../preview/profession/profession.module.scss | 4 +++- src/pages/preview/profession/profession.tsx | 23 +++++++++++-------- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/components/videoCover/videoCover.scss b/src/components/videoCover/videoCover.scss index df662ed..840c184 100644 --- a/src/components/videoCover/videoCover.scss +++ b/src/components/videoCover/videoCover.scss @@ -51,7 +51,7 @@ .box { box-sizing: border-box; - padding: 15rpx; + padding: 20rpx; .title { width: 100%; @@ -61,6 +61,10 @@ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; + font-size: 28rpx; + font-family: PingFang SC-Medium, PingFang SC; + font-weight: 500; + color: #323635; } } diff --git a/src/pages/home/components/curRecommended.tsx b/src/pages/home/components/curRecommended.tsx index 1685a93..07f5e59 100644 --- a/src/pages/home/components/curRecommended.tsx +++ b/src/pages/home/components/curRecommended.tsx @@ -37,9 +37,9 @@ const CurRecommended: FC = () => { return ( <> { - data.length > 0 && + data.length > 0 && - + { data.map(c => { } return ( - + { list.map(d => jump(d.url)}> diff --git a/src/pages/home/home.module.scss b/src/pages/home/home.module.scss index 4fb817b..8820c50 100644 --- a/src/pages/home/home.module.scss +++ b/src/pages/home/home.module.scss @@ -71,8 +71,8 @@ .courseTag { - width: 200px; - margin: auto; + width: 162px; + margin: 0 auto 30rpx; display: block; } @@ -80,7 +80,7 @@ color: #323635; background: #fff; padding: 30rpx 0 30rpx 30rpx; - margin-bottom: 40rpx; + margin-bottom: 50rpx; border-radius: 30rpx; } @@ -119,8 +119,8 @@ .ranking { position: absolute; left: 24rpx; - width: 40px; - height: 40px; + width: 30px; + height: 30px; } .featureImage { diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index bbd407a..acc1adf 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -28,7 +28,7 @@ const Home: FC = () => { }, []) return ( - + {/**/} diff --git a/src/pages/preview/profession/profession.module.scss b/src/pages/preview/profession/profession.module.scss index e2c9fc3..57291c2 100644 --- a/src/pages/preview/profession/profession.module.scss +++ b/src/pages/preview/profession/profession.module.scss @@ -13,8 +13,10 @@ Image, image { - width: 200rpx; + width: 320rpx; + max-height: 180rpx; margin-right: 20rpx; border-radius: 10rpx; + background: #eee; } } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index e3516b7..404d374 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -21,16 +21,20 @@ const Profession = () => { * more 开启加载更多 */ async function getData(more = false) { - if (categoryId) { - const oldData = new Map(data) - const categoryData = oldData.get(categoryId) - const page = more ? (categoryData?.page || 0) + 1 : categoryData?.page || 1 + if (!categoryId) return; + const oldData = new Map(data) + const categoryData = oldData.get(categoryId) + const page = more ? (categoryData?.page || 0) + 1 : categoryData?.page || 1 + + /** 无更多 */ + if (more && categoryData && categoryData.data.length >= categoryData.total) { + return + } - /** 无更多 */ - if (more && categoryData && categoryData.data.length >= categoryData.total) { - return + try { + if (!data.has(categoryId)) { + Taro.showLoading() } - const res = await HomeApi.skillList(categoryId!, page, 10) const dataList = res.data.reduce((pre, cur) => { const index = pre.findIndex(d => d.id === cur.id) @@ -42,14 +46,15 @@ const Profession = () => { return pre }, categoryData?.data || []) oldData.delete(categoryId) - oldData.set(categoryId, { data: dataList, total: res.total, page: page }) setData(oldData) + } catch (e) { } + Taro.hideLoading() } useEffect(() => { From 7d1d3475618b49077048ea8ee931db158f8bbf70 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 28 Aug 2023 14:35:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=96=BE=E7=97=85=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/illness/sort/sort.module.scss | 3 +- src/pages/preview/illness/sort/sort.tsx | 76 ++++++++++++------- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/pages/preview/illness/sort/sort.module.scss b/src/pages/preview/illness/sort/sort.module.scss index efab5db..c59026b 100644 --- a/src/pages/preview/illness/sort/sort.module.scss +++ b/src/pages/preview/illness/sort/sort.module.scss @@ -1,11 +1,12 @@ .scrollView { + height: auto !important; position: fixed; top: 0; bottom: 0; left: 0; right: 0; + width: 100%; margin: auto; - display: flex; } .firstOrder { diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx index 3c0bbe7..695f3ea 100644 --- a/src/pages/preview/illness/sort/sort.tsx +++ b/src/pages/preview/illness/sort/sort.tsx @@ -1,4 +1,4 @@ -import {Image, ScrollView, View} from "@tarojs/components"; +import {Image, ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; import {FC, useEffect, useMemo, useState} from "react"; import {Category, HomeApi} from "@/api"; import Taro from "@tarojs/taro"; @@ -11,8 +11,8 @@ import leftArrow from "@/static/img/leftArrow.png" const prefix = 'SORT' const Sort: FC = () => { const [data, setData] = useState([]) - const [firstId, setFirstId] = useState(undefined) - const [secondId, setSecondId] = useState(undefined) + const [firstId, setFirstId] = useState(undefined) // 一级分类 + const [secondId, setSecondId] = useState(undefined) // 二级分类 const [list, setList] = useState([]) const globalData = Taro.getApp().globalData const menu = Taro.getMenuButtonBoundingClientRect() @@ -67,6 +67,13 @@ const Sort: FC = () => { } }, [secondId]) + function swiperChange(e) { + const firstData = data[e.target.current] + if (!firstData) return; + setFirstId(firstData.id) + setSecondId(firstData?.resource_category?.[0]?.id) + } + return ( @@ -78,6 +85,7 @@ const Sort: FC = () => { firstIdChange(data.tab?.value as number)}/> @@ -85,32 +93,42 @@ const Sort: FC = () => { {/**/} - - - { - data.find(d => d.id === firstId)?.resource_category?.map(d => setSecondId(d.id)} - className={secondId === d.id && styles.select}> - {d.name} - ) - } - - - - { - list.length ? - list.map(d => jump(d.id)}>{d.name}) - : - } - - + d.id === firstId)} + style={{top: `${globalData.statusBarHeight + 59}px`}}> + { + data.map(d => + + { + d.resource_category?.map(d => setSecondId(d.id)} + className={secondId === d.id && styles.select}> + {d.name} + ) + } + + + + { + list.length ? + list.map(d => jump(d.id)}>{d.name}) + : + } + + ) + } + + + ) }