Commit af4c01c4 authored by hewenhao's avatar hewenhao

Merge branch 'feature/2023-06-12-v1.1' of…

Merge branch 'feature/2023-06-12-v1.1' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp into feature/2023-06-12-v1.1
parents c00c1964 746822a7
...@@ -106,5 +106,41 @@ ...@@ -106,5 +106,41 @@
"w": 160, "w": 160,
"h": 60, "h": 60,
"ossName": "/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60" "ossName": "/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60"
},
"accept-arrow.png": {
"u": "https://cdn.jkwljy.com/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60",
"w": 60,
"h": 60,
"ossName": "/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60"
},
"accept-click.png": {
"u": "https://cdn.jkwljy.com/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112",
"w": 532,
"h": 112,
"ossName": "/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112"
},
"accept-main-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648",
"w": 750,
"h": 1648,
"ossName": "/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648"
},
"accept-slogan.png": {
"u": "https://cdn.jkwljy.com/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80",
"w": 520,
"h": 80,
"ossName": "/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80"
},
"accept-top-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376",
"w": 750,
"h": 376,
"ossName": "/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376"
},
"accept-close.png": {
"u": "https://cdn.jkwljy.com/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40",
"w": 40,
"h": 40,
"ossName": "/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40"
} }
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
export default { export default {
pages: [ pages: [
'pages/main/main', 'pages/main/main',
'pages/accept-pk/index',
'pages/battles/index', 'pages/battles/index',
'pages/prepare/index', 'pages/prepare/index',
'pages/group/index', 'pages/group/index',
......
...@@ -90,5 +90,35 @@ export default { ...@@ -90,5 +90,35 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60", "u": "https://cdn.jkwljy.com/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60",
"w": 160, "w": 160,
"h": 60 "h": 60
},
"accept-arrow.png": {
"u": "https://cdn.jkwljy.com/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60",
"w": 60,
"h": 60
},
"accept-click.png": {
"u": "https://cdn.jkwljy.com/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112",
"w": 532,
"h": 112
},
"accept-main-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648",
"w": 750,
"h": 1648
},
"accept-slogan.png": {
"u": "https://cdn.jkwljy.com/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80",
"w": 520,
"h": 80
},
"accept-top-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376",
"w": 750,
"h": 376
},
"accept-close.png": {
"u": "https://cdn.jkwljy.com/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40",
"w": 40,
"h": 40
} }
} as const } as const
.mask {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 2000;
opacity: 0;
pointer-events: none;
transition: opacity .5s cubic-bezier(0.175,0.885,0.32,1.0);
&.is_show {
opacity: 1;
pointer-events: all;
}
}
.modal {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 2001;
background-color: #fff;
transform: translateY(100%);
transition: transform .5s cubic-bezier(0.175,0.885,0.32,1.0);
border-radius: 32px 32px 0px 0px;
&.is_show {
transform: translateY(0);
}
}
.close {
width: 40px;
height: 40px;
position: absolute;
right: 32px;
top: 32px;
}
.tips {
font-size: 28px;
font-weight: 400;
color: #586170;
line-height: 50px;
text-align: center;
}
.title {
padding: 64px 0 32px 0;
text-align: center;
font-size: 48px;
font-weight: 600;
color: #586170;
line-height: 66px;
}
.input {
display: flex;
align-items: center;
padding: 24px 28px 24px 48px;
margin:12px 120px 0;
background: #F4F6F8;
border-radius: 56px;
}
.inputName {
flex: 1;
font-size: 36px;
font-weight: 600;
color: #465164;
line-height: 50px;
}
.inputIcon {
width: 64px;
height: 64px;
display: block;
}
.generating {
animation-name: rotate_3d;
animation-duration: .3s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
}
@keyframes rotate_3d {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(90deg);
}
50% {
transform: rotate(180deg);
}
75% {
transform: rotate(270deg);
}
100% {
transform: rotate(360deg);
}
}
@supports (padding-bottom: constant(safe-area-inset-bottom)) or (padding-bottom: env(safe-area-inset-bottom)) {
.modal {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom : env(safe-area-inset-bottom);
}
}
.footer {
display: flex;
align-items: center;
padding: 32px 34px 80px 34px;
}
.footerButton {
flex: 1;
background-image: url('https://cdn.jkwljy.com/pk-math/gMAFXFRRH3frGsM2wCpyLUCdiNT/343x56');
}
.footerHoverButton {
background-image: url('https://cdn.jkwljy.com/pk-math/3UiwFgrVHVQEcaPdxdf1XinBb64o/343x56');
}
\ No newline at end of file
import { View, RootPortal, Image } from '@tarojs/components'
import classNames from 'classnames'
import { useCallback, useRef, useState } from 'react'
import { EyeProtectionView } from '@/components'
import Button from '@/components/Button'
import { useBoolean } from '@/hooks'
import { getNickNameWords, type NickNameWord } from '@/api'
import assetsPk from '@/assets/oss/assets-pk'
import assetsGuide from '@/assets/oss/assets-guide'
import styles from './modal-name.module.scss'
const randomPick = (arr: string[]) => {
const len = arr.length
const randomIndex = Math.floor(Math.random() * len)
return arr[randomIndex]
}
const ModalName = ({
isVisible,
onClose,
}: {
isVisible: boolean
onClose: () => void
}) => {
const [name, setName] = useState('小明')
const [generating, { setTrue, setFalse }] = useBoolean(false)
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null)
const generateName = useCallback(() => {
const { noun, adj } = dataRef.current
const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
setName(nam)
}, [])
const getNameWords = useCallback(async () => {
const words = await getNickNameWords()
dataRef.current = words
generateName()
}, [generateName])
const handleGenerate = useCallback(() => {
setTrue()
if (dataRef.current.adj.length < 1) {
getNameWords()
} else {
generateName()
}
if (timerRef.current) {
clearTimeout(timerRef.current)
}
timerRef.current = setTimeout(() => {
setFalse()
timerRef.current = null
}, 1000)
}, [generateName, setTrue, setFalse, getNameWords])
return (
<RootPortal>
<View
className={classNames(styles.mask, isVisible && styles.is_show)}
></View>
<EyeProtectionView
className={classNames(styles.modal, isVisible && styles.is_show)}
>
<Image
className={styles.close}
src={assetsPk['accept-close.png'].u}
onClick={onClose}
/>
<View className={styles.title}>请问大侠,尊姓大名</View>
<View className={styles.tips}>
请输入您的角色名(7字以内)或随机生成
</View>
<View className={styles.input}>
<View className={styles.inputName}>{name}</View>
<Image
src={assetsGuide['touzi.png'].u}
className={classNames(
styles.inputIcon,
generating && styles.generating
)}
onClick={handleGenerate}
data-name=""
></Image>
</View>
<View className={styles.footer}>
<Button
size="large"
image={styles.footerButton}
hoverImage={styles.footerHoverButton}
>
确定
</Button>
</View>
</EyeProtectionView>
</RootPortal>
)
}
export default ModalName
.header {
background-size: 100%;
background-image: url(https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376);
}
.inner {
position: relative;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.arrow {
position: absolute;
left: 10PX;
width: 30PX;
height: 30PX;
}
import { View, Image } from '@tarojs/components'
import { getMenuButtonBoundingClientRect, navigateBack } from '@tarojs/taro'
import { useState, } from 'react'
import classNames from 'classnames'
import assetsPk from '@/assets/oss/assets-pk'
import styles from './top-header.module.scss'
const TopHeader = () => {
const [nav] = useState(getMenuButtonBoundingClientRect())
return (
<View className={classNames(styles.header)}>
<View
style={{
height: `${nav.height + 10}px`,
paddingTop: `${nav.top - 5}px`
}}
>
<View className={styles.inner} style={{ height: `${nav.height + 10}px` }}>
<Image src={assetsPk['accept-arrow.png'].u} className={styles.arrow} onClick={() => navigateBack()}></Image>
</View>
</View>
</View>
)
}
export default TopHeader
export default definePageConfig({
navigationBarTitleText: 'pk-math',
navigationStyle: 'custom',
navigationBarTextStyle: 'black',
enableShareAppMessage: true,
})
.container {
position: relative;
color: #fff;
display: flex;
flex-direction: column;
height: 100vh;
.wrapper {
position: relative;
z-index: 10;
height: 100%;
background-size: 100%;
background-image: url(https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648);
background-repeat: no-repeat;
.pkFlash {
position: relative;
display: flex;
justify-content: center;
.flash {
position: absolute;
width: 360px;
height: 200px;
}
.pk {
position: relative;
z-index: 10;
width: 310px;
height: 200px;
}
}
.slogan {
text-align: center;
margin-bottom: 60px;
.sloganImage {
width: 520px;
height: 80px;
}
}
.inner {
display: flex;
flex-direction: column;
align-items: center;
.userSection {
display: flex;
gap: 12px;
font-weight: 600;
margin-bottom: 12px;
align-items: flex-end;
.userName {
font-size: 48px;
}
.challenge {
font-size: 40px;
}
}
}
.avatar {
width: 248px;
height: 248px;
margin: 48px 0 30px;
}
.record {
width: 440px;
background: linear-gradient(270deg, rgba(83,55,170,0) 0%, #5134A9 46%, rgba(82,53,169,0) 100%);
font-size: 28px;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
letter-spacing: 2px;
padding: 12px 0;
.rank {
display: flex;
align-items: center;
gap: 6px;
.badgeIcon {
width: 60px;
height: 60px;
}
}
}
.bottom {
bottom: 24px;
position: fixed;
left: 50%;
transform: translateX(-50%);
.clickImage {
width: 532px;
height: 112px;
margin-bottom: 50px;
}
}
}
}
\ No newline at end of file
import { View, Image, Text } from '@tarojs/components'
import { useBoolean } from '@/hooks'
import assetsPk from '@/assets/oss/assets-pk'
import assetsMainNext from '@/assets/oss/assets-main-next'
import { badgeImages } from '../battles/const'
import styles from './index.module.scss'
import TopHeader from './components/top-header'
import ModalName from './components/modal-name'
const AcceptPk = () => {
const [isVisible, { setTrue, setFalse }] = useBoolean(false)
return (
<View className={styles.container}>
<TopHeader />
<View className={styles.wrapper}>
<View style={{ position: 'relative', top: -20 }}>
<View className={styles.pkFlash}>
<Image
className={styles.flash}
style={{ left: 0 }}
src={assetsMainNext['pk-flash.png'].u}
/>
<Image className={styles.pk} src={assetsMainNext['pk-logo.png'].u} />
<Image
className={styles.flash}
style={{ right: 0 }}
src={assetsMainNext['pk-flash-right.png'].u}
/>
</View>
<View className={styles.slogan}>
<Image
className={styles.sloganImage}
src={assetsPk['accept-slogan.png'].u}
/>
</View>
<View className={styles.inner}>
<View className={styles.userSection}>
<Text className={styles.userName}>用户名称用户名</Text>
<Text className={styles.challenge}>向你发起挑战</Text>
</View>
<Text>关卡-连加连减</Text>
<Image
className={styles.avatar}
src={assetsMainNext['challenge-avatar.png'].u}
/>
<View className={styles.record}>
<View className={styles.rank}>
<Image
src={assetsPk[badgeImages.bronze.default].u}
className={styles.badgeIcon}
/>
<Text className={styles.rankText}>青铜</Text>
</View>
<Text>当前战绩:胜 2 负 3</Text>
<Text>最佳表现:全对 | 29.3s</Text>
</View>
</View>
</View>
<View className={styles.bottom}>
<Image
className={styles.clickImage}
onClick={setTrue}
src={assetsPk['accept-click.png'].u}
/>
</View>
</View>
<ModalName isVisible={isVisible} onClose={setFalse} />
</View>
)
}
export default AcceptPk
...@@ -82,8 +82,6 @@ ...@@ -82,8 +82,6 @@
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
max-height: 500px; max-height: 500px;
overflow: auto;
padding-right: 24px;
} }
.gameBody { .gameBody {
......
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image, ScrollView } from '@tarojs/components'
import classNames from 'classnames' import classNames from 'classnames'
import Modal from '@/components/Modal' import Modal from '@/components/Modal'
import { useStoreState, useStoreActions } from '@/store/hooks' import { useStoreState, useStoreActions } from '@/store/hooks'
...@@ -76,13 +76,13 @@ const BattlesModal = () => { ...@@ -76,13 +76,13 @@ const BattlesModal = () => {
</View> </View>
</View> </View>
<View className={styles.gameResult}> <ScrollView className={styles.gameResult} scrollY>
<GameResult levelInfo={levelInfo} players={players} /> <GameResult levelInfo={levelInfo} players={players} />
<GameResult levelInfo={levelInfo2} players={players} /> <GameResult levelInfo={levelInfo2} players={players} />
<GameResult levelInfo={levelInfo} players={players} /> <GameResult levelInfo={levelInfo} players={players} />
<GameResult levelInfo={levelInfo2} players={players} /> <GameResult levelInfo={levelInfo2} players={players} />
<GameResult levelInfo={levelInfo} players={players} /> <GameResult levelInfo={levelInfo} players={players} />
</View> </ScrollView>
</View> </View>
</Modal> </Modal>
) )
......
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