diff --git a/src/app.scss b/src/app.scss index b9402bd..886bc0d 100644 --- a/src/app.scss +++ b/src/app.scss @@ -13,6 +13,7 @@ .justify-around{justify-content:space-around} .justify-between{justify-content:space-between} .justify-center{justify-content:center} +.justify-stretch{justify-content:stretch} .flex-wrap{flex-wrap:wrap} @@ -35,6 +36,8 @@ .flex-5{flex: 5} .flex-shrink{flex-shrink: 0} +.gap20rpx{gap: 20rpx} + .w-1 {width: 10%;min-width: 75rpx} .w-2 {width: 20%;min-width: 150rpx} .w-3 {width: 30%;min-width: 225rpx} @@ -85,6 +88,7 @@ .mb-1 {margin-bottom: 10rpx} .mb-1_5 {margin-bottom: 15rpx} .mb-2 {margin-bottom: 20rpx} +.mb-2_4 {margin-bottom: 24rpx} .mb-3 {margin-bottom: 30rpx} .mb-4 {margin-bottom: 40rpx} .mb-5 {margin-bottom: 50rpx} @@ -329,6 +333,10 @@ .border-none{border: none} +.clip { + overflow: hidden; +} + .text-row1 { display: -webkit-box; text-overflow: ellipsis; @@ -337,4 +345,12 @@ -webkit-line-clamp:1; } +.text-row3 { + display: -webkit-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:3; +} + diff --git a/src/components/image/image.tsx b/src/components/image/image.tsx index 72499be..b726f93 100644 --- a/src/components/image/image.tsx +++ b/src/components/image/image.tsx @@ -5,8 +5,8 @@ import styles from './image.module.scss' import Taro from "@tarojs/taro"; interface Props extends ImageProps { - width?: number - height?: number + width?: number | string + height?: number | string fallback?: string } @@ -37,7 +37,11 @@ const Img: FC = ({src, mode = 'aspectFill', width, height, fallback = sha return ( {!isError && diff --git a/src/components/loginView/index.tsx b/src/components/loginView/index.tsx index 2805f5b..2475592 100644 --- a/src/components/loginView/index.tsx +++ b/src/components/loginView/index.tsx @@ -12,6 +12,7 @@ interface Props { paddingTop?: number style?: CSSProperties offImage?: boolean + onSuccess?: VoidFunction } const LoginView: FC = (props) => { @@ -39,7 +40,11 @@ const LoginView: FC = (props) => { setToken(token) setCompany(company) setLoading(false) - Taro.switchTab({url: '/pages/home/home'}) + if (props.onSuccess) { + props.onSuccess() + } else { + Taro.switchTab({url: '/pages/home/home'}) + } }, 1500) } else { Taro.setStorageSync('openid', catch_key) diff --git a/src/components/navigationBar/navigationBar.module.scss b/src/components/navigationBar/navigationBar.module.scss index 19430d7..1fe8856 100644 --- a/src/components/navigationBar/navigationBar.module.scss +++ b/src/components/navigationBar/navigationBar.module.scss @@ -12,6 +12,8 @@ .leftNode { position: absolute; display: flex; + left: 0; + bottom: 0; align-items: center; } diff --git a/src/components/navigationBar/navigationBar.tsx b/src/components/navigationBar/navigationBar.tsx index 15ced92..b77d49f 100644 --- a/src/components/navigationBar/navigationBar.tsx +++ b/src/components/navigationBar/navigationBar.tsx @@ -1,15 +1,15 @@ import {Image, View} from "@tarojs/components"; -import React, {FC, useMemo} from "react"; +import React, {FC, ReactNode, useMemo} from "react"; import styles from './navigationBar.module.scss' import Taro from "@tarojs/taro"; import leftArrow from '@/static/img/leftArrow.png' interface Props { // 文本 - text?: string | JSX.Element - children?: JSX.Element + text?: string | ReactNode + children?: ReactNode | ReactNode[] // 左边节点 - leftNode?: string | JSX.Element + leftNode?: string | ReactNode | ReactNode[] // 字体颜色 color?: string // 背景颜色 @@ -27,7 +27,8 @@ const NavigationBar: FC = (props) => { background: props.backgroundColor, position: props.inherit ? 'inherit' : "sticky", paddingTop: globalData.statusBarHeight + 'px', - height: globalData.textBarHeight + 'px', + height: globalData.textBarHeight + globalData.statusBarHeight + 'px', + boxSizing: 'border-box', }), [props]) @@ -36,11 +37,15 @@ const NavigationBar: FC = (props) => { height: globalData.textBarHeight + 'px', }), [props]) - return ( - {!props.cancelBack && } + {!props.cancelBack && Taro.navigateBack()}> + + } {props.leftNode} {props.children || props.text} diff --git a/src/components/tabs/tabs.scss b/src/components/tabs/tabs.scss index 50623dc..19991e0 100644 --- a/src/components/tabs/tabs.scss +++ b/src/components/tabs/tabs.scss @@ -19,7 +19,7 @@ View::-webkit-scrollbar { } .tabs-item { - padding: 20rpx; + padding: 16rpx 20rpx; font-size: 30rpx; font-family: PingFang SC-Medium, PingFang SC; font-weight: 500; diff --git a/src/components/tabs/tabs.tsx b/src/components/tabs/tabs.tsx index 8408d8c..67bb51a 100644 --- a/src/components/tabs/tabs.tsx +++ b/src/components/tabs/tabs.tsx @@ -19,6 +19,7 @@ export type OnChangOpt = { interface TabsProps { current?: number | string tabList: TabList[] + height?: number | string onChange?: (data: OnChangOpt) => void } @@ -47,8 +48,8 @@ const Tabs: FC = (opt: TabsProps) => { return ( - - + + {opt.tabList.map((d, index) => { + const globalData = Taro.getApp().globalData const {token} = Profile.useContainer() const [data, setData] = useState(null) const [enable, setEnable] = useState(true) + const [navbarOpacity, setNavbarOpacity] = useState('0') + const navbarHeight = globalData.statusBarHeight + globalData.textBarHeight; function unLogin() { Taro.clearStorage() @@ -34,14 +36,31 @@ const Home: FC = () => { }, 600) }, []) + Taro.usePageScroll((e) => { + const v = (Math.min(e.scrollTop / navbarHeight, 1) * 0.9).toFixed(6) + if (v != navbarOpacity) { + setNavbarOpacity(v) + } + }) return ( <> - } - cancelBack/> - - + + + 医学道 + + } + cancelBack + > + + + + @@ -54,9 +73,9 @@ const Home: FC = () => { {data && } { - !token && + !token && 登录后享受更多服务~ - 立即登录 + 立即登录 } diff --git a/src/pages/index/components/videoList.tsx b/src/pages/index/components/videoList.tsx index eb59fb4..5fba1bb 100644 --- a/src/pages/index/components/videoList.tsx +++ b/src/pages/index/components/videoList.tsx @@ -87,16 +87,13 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { // } // }) - useDidShow(() => { + const fetchData = () => { getData().then() getRecords().then() - }) - - useEffect(() => { - getData().then() - getRecords().then() - }, [page]) + } + useDidShow(fetchData) + useEffect(fetchData, [page]) function changeSwiper(e) { const index = e.detail.current @@ -121,7 +118,7 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { { !token && key === 'is_required' - ? : value?.length ? + ? : value?.length ? <> { value?.map(c => diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 4a97c22..3f77848 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -19,15 +19,17 @@ const Index: FC = () => { setCategoryKey(data.tab?.value as CoursesKey) } - return ( - } - backgroundColor={'transparent'}/> + } + backgroundColor={'transparent'} + /> setCategoryKey(categoryKey)}/> + setCategoryKey={(categoryKey) => setCategoryKey(categoryKey)} + /> ) } diff --git a/src/pages/preview/brand/list/list.module.scss b/src/pages/preview/brand/list/list.module.scss index f2d21e8..484ba5f 100644 --- a/src/pages/preview/brand/list/list.module.scss +++ b/src/pages/preview/brand/list/list.module.scss @@ -1,22 +1,54 @@ -.box { - display: flex; +.box2 { + //display: flex; margin-bottom: 20rpx; background-color: #fff; border-radius: 16rpx; + padding: 36rpx 24rpx; + box-sizing: border-box; + position: relative; + + .bnox2Info { + display: flex; + } +} + +.box { + display: flex; + //margin-bottom: 20rpx; + //background-color: #fff; + border-radius: 16rpx; + //margin-bottom: 6rpx; padding: 24rpx; box-sizing: border-box; + position: relative; + + &:not(:last-child)::after { + position: absolute; + left: 24rpx; + right: 24rpx; + bottom: 0; + display: block; + content: ""; + height: 0; + border-bottom: 1px solid rgba(0,0,0,0.2); + transform-origin: bottom center; + transform: scaleY(0.5); + } } + .image{ width: 128rpx; height:128rpx; background-color: #ededed; border-radius: 8rpx; } + .rightBox{ padding-left: 24rpx; box-sizing: border-box; flex: 1; } + .desc{ font-size: 24rpx; font-weight: 500; diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx index 224a82b..570c444 100644 --- a/src/pages/preview/brand/list/list.tsx +++ b/src/pages/preview/brand/list/list.tsx @@ -1,12 +1,60 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {View} from "@tarojs/components"; +import {FC, ReactNode, useCallback, useEffect, useState} from "react"; +import {Video, 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"; import Spinner from "@/components/spinner"; import Img from "@/components/image/image"; +const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onClick}) => { + let media: ReactNode + if (data.introductory_video_resource) { + media = ) } - - ) diff --git a/src/static/css/module.scss b/src/static/css/module.scss index 0865e60..38e89eb 100644 --- a/src/static/css/module.scss +++ b/src/static/css/module.scss @@ -11,6 +11,9 @@ page, View::-webkit-scrollbar, page::-webkit-scrollbar { display: none; + width: 0; + height: 0; + color: transparent; } .weui-cells_checkbox .weui-check:checked + .weui-icon-checked:before, diff --git a/src/static/img/logo.svg b/src/static/img/logo.svg new file mode 100644 index 0000000..8a520ba --- /dev/null +++ b/src/static/img/logo.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +