Commit e1145a9c authored by hewenhao's avatar hewenhao

feat: 发起pk

parent 0daa1323
.wrap {
.close_wrap {
position: fixed;
z-index: 2199999;
left: 0;
top: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .5);
z-index: 2200000;
display: none;
&.is_show {
display: block;
}
}
.pk_history {
position: absolute;
top: 20px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
right: 32px;
font-size: 28px;
font-weight: 500;
color: #FFFFFF;
padding: 10px 24px;
margin-right: -24px;
.pk_history_arrow {
width: 20px;
height: 20px;
display: block;
}
}
.close {
margin-top: -20px;
padding: 20px;
}
.close_icon {
width: 60px;
height: 60px;
}
.top, .bottom {
flex: 1;
position: relative;
width: 100%;
animation-timing-function: ease-out;
animation-duration: .5s;
animation-fill-mode: backwards;
transition: transform .5s ease-out;
}
.top {
position: fixed;
z-index: 2199999;
left: 0;
right: 0;
top: 0;
bottom: 50%;
margin-bottom: -62px;
animation-name: stepDown;
}
.bottom {
margin-top: -62px;
animation-name: stepUp;
}
@keyframes stepDown {
0% {
transform: translate3d(0, -100%, 0);
}
transform: translate3d(0, -100%, 0);
100% {
&.is_show {
transform: translate3d(0, 0, 0);
}
}
@keyframes stepUp {
0% {
transform: translate3d(0, 100%, 0);
}
100% {
.bottom {
position: fixed;
margin-top: -62px;
z-index: 2199999;
left: 0;
right: 0;
top: 50%;
bottom: 0;
transform: translate3d(0, 100%, 0);
&.is_show {
transform: translate3d(0, 0, 0);
}
}
......@@ -92,10 +116,11 @@
}
.center {
position: absolute;
position: fixed;
left: 0;
right: 0;
top: 50%;
z-index: 2200000;
}
.pk_flash_left, .pk_flash_right {
......@@ -142,7 +167,6 @@
.challenge_2 {
width: 248px;
height: 248px;
flex-shrink: 0;
}
.share_btn {
......
import { View, Image, Button } from '@tarojs/components'
import assetsPk from '@/assets/oss/assets-pk'
import { useMemo } from 'react'
import { getMenuButtonBoundingClientRect } from '@tarojs/taro'
import classNames from 'classnames'
import assetsMainNext from '@/assets/oss/assets-main-next'
import { cs } from '@/styles'
import { useStoreState } from '@/store/hooks'
import { useStoreActions, useStoreState } from '@/store/hooks'
import styles from './create-pk.module.scss'
type CreatePkProps = {
......@@ -10,16 +13,41 @@ type CreatePkProps = {
}
const CreatePk = (props: CreatePkProps) => {
const { visible } = props
const userInfo = useStoreState(states => states.userModel.userInfo)
if (props.visible) {
return null
const nav = useMemo(getMenuButtonBoundingClientRect, [])
const updateState = useStoreActions(actions => actions.mainModel.updateState)
const closeModal = () => {
updateState({ isCreatePkShow: false })
}
const closeStyle = useMemo(() => {
return {
paddingTop: `${nav.top + 5}px`
}
}, [nav])
const historyStyle = useMemo(() => {
return {
marginTop: `${nav.height + nav.top + 5}px`
}
}, [nav])
return (
<View className={styles.wrap}>
<View className={styles.top}>
<>
<View className={classNames(styles.close_wrap, visible && styles.is_show)} style={closeStyle}>
<View className={styles.close} onClick={closeModal} data-name="关闭发起PK">
<Image src={assetsMainNext['pk-close.png'].u} className={styles.close_icon}></Image>
</View>
</View>
<View className={classNames(styles.top, visible && styles.is_show)}>
<Image src={assetsMainNext['pk-top.png'].u} className={styles.bg_top} mode="widthFix"></Image>
<View className={styles.top_content}>
<Image src={assetsMainNext['challenge-avatar.png'].u} className={styles.challenge_2} />
<View className={styles.pk_history} style={historyStyle}>
PK记录 <Image src={assetsMainNext['pk-history-arrow.png'].u} className={styles.pk_history_arrow} />
</View>
<Image src={assetsMainNext['challenge-avatar.png'].u} className={styles.challenge_2} mode="heightFix" />
<View className={styles.me_info}>
<View>{userInfo.nickName}</View>
<View className={styles.info_detail}><Image src={assetsPk['bronze-small.png'].u} className={styles.pk_level} />青铜Ⅰ</View>
......@@ -28,7 +56,7 @@ const CreatePk = (props: CreatePkProps) => {
</View>
</View>
</View>
<View className={styles.bottom}>
<View className={classNames(styles.bottom, visible && styles.is_show)}>
<Image src={assetsMainNext['pk-slogen.png'].u} className={styles.pk_slogan}></Image>
<Image src={assetsMainNext['pk-bottom.png'].u} className={styles.bg_bottom} mode="widthFix"></Image>
<View className={styles.bottom_content}>
......@@ -42,14 +70,16 @@ const CreatePk = (props: CreatePkProps) => {
<View className={styles.tips}>会以你的最佳表现与对方答题数据进行PK</View>
</View>
</View>
<View className={styles.center}>
<View className={styles.pk_flash}>
<Image src={assetsMainNext['pk-flash.png'].u} className={styles.pk_flash_left}></Image>
<Image src={assetsMainNext['pk-flash-right.png'].u} className={styles.pk_flash_right}></Image>
{visible && (
<View className={styles.center}>
<View className={styles.pk_flash}>
<Image src={assetsMainNext['pk-flash.png'].u} className={styles.pk_flash_left}></Image>
<Image src={assetsMainNext['pk-flash-right.png'].u} className={styles.pk_flash_right}></Image>
</View>
<Image src={assetsMainNext['pk-logo.png'].u} className={styles.pk_logo} />
</View>
<Image src={assetsMainNext['pk-logo.png'].u} className={styles.pk_logo} />
</View>
</View>
)}
</>
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment