1.修改弹窗居中动画

2.修改收藏多次触发
v2
king 1 year ago
parent 358c3ee95c
commit aa4e006b00
  1. 21
      src/components/collect/collect.tsx
  2. 4
      src/components/custom-page-container/custom-page-container.module.scss
  3. 10
      src/components/custom-page-container/custom-page-container.tsx
  4. 14
      src/components/textCollapse/collapse.tsx
  5. 29
      src/components/videoList/videoList.tsx
  6. 4
      src/pages/preview/brand/article/article.module.scss
  7. 2
      src/pages/preview/brand/info/info.tsx
  8. 24
      src/pages/preview/health/health.module.scss
  9. BIN
      src/static/img/palyWhite.png
  10. BIN
      src/static/img/starWhite.png

@ -18,6 +18,17 @@ interface Props {
onUpdate?: (v: boolean) => void
}
const versions = new Map()
const collect = async (scope: string, params: Create, setSelect: (v: boolean) => void, value: boolean) => {
const localVersion = (versions.get(scope) || 0) + 1
versions.set(scope, localVersion)
await userApi.create(params)
if (localVersion === versions.get(scope)) {
setSelect(value)
}
}
/** 收藏 */
const Collect: FC<Props> = (props) => {
const {token} = Profile.useContainer()
@ -33,12 +44,16 @@ const Collect: FC<Props> = (props) => {
Taro.navigateTo({url: '/pages/login/login'})
return
}
if (loading) return;
props.onClick?.()
await userApi.create({owner_id: props.owner_id, owner_type: props.owner_type})
setSelect(!select)
setLoading(true)
props.onUpdate?.(!select)
collect(`${props.owner_id}#${props.owner_type}`, {
owner_id: props.owner_id,
owner_type: props.owner_type,
}, (v) => {
setSelect(v)
props.onUpdate?.(v)
}, !select)
setTimeout(() => {
setLoading(false)
}, 300)

@ -84,11 +84,11 @@
@keyframes childrenCenter {
from {
transform: scale(0);
transform: scale(0) translateY(calc(-50% - 100px));
padding: 0;
}
to {
transform: scale(1);
transform: scale(1) translateY(calc(-50% - 100px));
padding: 0 30px;
}
}

@ -49,7 +49,9 @@ export const PageContainerInner: FC<PageContainerProps> = (props) => {
case 'center':
style.width = '90%'
style.borderRadius = '10px'
style.padding = '0'
style.padding = '0 !important'
style.top = '50%'
// style.transform = 'translateY(-100px) !important'
break
}
@ -89,14 +91,14 @@ export const PageContainerInner: FC<PageContainerProps> = (props) => {
const CustomPageContainer: FC<PageContainerProps> = (props) => {
if (props.position === 'center') {
return <PageContainerInner {...props} />
return <PageContainerInner {...props} onAfterLeave={props.onClickOverlay}/>
}
if (process.env.TARO_ENV !== 'h5') {
return (<PageContainer {...props} round>
return (<PageContainer {...props} round onAfterLeave={props.onClickOverlay}>
<View className={styles.content} style={{position: 'relative'}}>{props.children}</View>
</PageContainer>)
}
return (<PageContainerInner {...props} />);
return (<PageContainerInner {...props} onAfterLeave={props.onClickOverlay}/>);
}
export default CustomPageContainer

@ -22,9 +22,8 @@ const LineEllipsis:FC<Props> = ({text}:Props) => {
const query = Taro.createSelectorQuery()
query.select('#Text').boundingClientRect()
query.exec((res) => {
console.log({res})
const height = res[0].height
if(height <= 30) {
if (height <= 105) {
setDisabled(true)
} else {
setOverflow(true)
@ -43,7 +42,7 @@ const LineEllipsis:FC<Props> = ({text}:Props) => {
e && e.stopPropagation();
setOverflow(true)
setIsExpansioned(false)
};
}
function toggle() {
if (disabled) return;
@ -62,7 +61,7 @@ const LineEllipsis:FC<Props> = ({text}:Props) => {
color: '#999795',
fontSize: '25rpx',
overflow: overflow ? 'hidden' : 'unset',
height: overflow ? '35rpx' : 'unset',
height: overflow ? '105rpx' : 'unset',
lineHeight: overflow ? '35rpx' : '35rpx',
marginTop: '24rpx',
}}>
@ -76,15 +75,14 @@ const LineEllipsis:FC<Props> = ({text}:Props) => {
</View>
{overflow && (
<Text
style={{position: "absolute", top: "70rpx", right: "0", background: "#fff"}}
className={styles.expansion}
onClick={handleExpend}
style={{position: 'absolute', top: '0', right: '0', background: '#fff'}}>
onClick={handleExpend}>
. . .
</Text>
)}
</View>
);
// }
)
}
export default LineEllipsis;

@ -2,10 +2,10 @@ import {FC, useEffect, useState} from "react";
import styles from "@/pages/preview/health/health.module.scss";
import {Image, Text, View} from "@tarojs/components";
import Img from "@/components/image/image";
import play from "@/static/img/play-back.png";
import {formatDate} from "@/utils/time";
import Taro from "@tarojs/taro";
import videoEvent from "@/hooks/videoEvent";
import palyWhite from '@/static/img/palyWhite.png'
import starWhite from '@/static/img/starWhite.png'
interface Props {
data: VideList
@ -40,13 +40,24 @@ const VideoList: FC<Props> = (props) => {
return (
<View key={data.id} className={styles.health} onClick={jump}>
<Img src={data.url_path} mode='widthFix' errorType={props.errorType} height={346}/>
<Image src={play} className={styles.play} mode='aspectFit'/>
<View className='p-1'>
<View className='text-ellipsis-2 text-dark'>{data.title}</View>
<View className='text-ellipsis-2 mt-1 font-26 text-secondary'>{data.introduction}</View>
<View className='font-24 text-muted my-2 flex justify-between'>
<Text>{formatDate(new Date(data.publish_time), "YY-MM-dd")}</Text>
<Text>{(data.video_view || 0)}</Text>
<View className='p-2 relative'>
<View className='text-ellipsis-1 font-28 text-dark'>{data.title}</View>
<View className='text-ellipsis-2 mt-2 font-24 text-secondary'>{data.introduction}</View>
<View className={styles.info}>
<View className='flex'>
<View className='flex align-center mr-3'>
<Image src={palyWhite}/>
<Text>{(data.video_view || 0)}</Text>
</View>
<View className='flex align-center'>
<Image src={starWhite}/>
<Text>{(data.video_view || 0)}</Text>
</View>
</View>
<View>1:00</View>
</View>
</View>
</View>)

@ -46,9 +46,9 @@ page{
z-index: 99;
position: fixed;
bottom: 0;
width: 690rpx;
width: 650rpx;
height: 100rpx;
padding: 0 30rpx env(safe-area-inset-bottom);
padding: 0 50rpx env(safe-area-inset-bottom);
display: flex;
justify-content: flex-end;
align-items: center;

@ -112,7 +112,7 @@ const BrandInfo: FC = () => {
<View className={styles['top']}>
<View className='flex justify-between'>
<Text className={`${styles['title']} flex-1`}>{brandInfo?.name}</Text>
<Collect owner_type={4} owner_id={id} select={brandInfo?.collect}/>
<Collect owner_type={4} owner_id={id} select={brandInfo?.collect} styles={{width: 'auto'}}/>
</View>
<LineEllipsis text={brandInfo?.graphic_introduction || '暂无简介'}/>
</View>

@ -25,3 +25,27 @@
right: 20rpx;
background: transparent !important;
}
.info {
font-size: 24rpx;
padding: 0 20rpx;
height: 52rpx;
display: flex;
align-items: center;
justify-content: space-between;
position: absolute;
top: 0;
left: 0;
width: 100%;
transform: translateY(-100%);
box-sizing: border-box;
color: #fff;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%);
Image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
vertical-align: inherit;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Loading…
Cancel
Save