Commit e9438007 authored by hewenhao's avatar hewenhao

feat: 昵称修改、键盘优化

parent 7c18cb1e
......@@ -52,5 +52,59 @@
"w": 348,
"h": 116,
"ossName": "/pk-math/3k3He53c4T1SHnmWtit4JSbPtYgu/348x116"
},
"btn-clear-off-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112",
"w": 260,
"h": 112,
"ossName": "/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112"
},
"btn-clear-off.png": {
"u": "https://cdn.jkwljy.com/pk-math/3LgHrGgzyViNf2jteJnar44k8qVP/260x120",
"w": 260,
"h": 120,
"ossName": "/pk-math/3LgHrGgzyViNf2jteJnar44k8qVP/260x120"
},
"btn-clear-on-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/3p4x4jpHm3n8QpF2yqiuhNMixv4Y/260x112",
"w": 260,
"h": 112,
"ossName": "/pk-math/3p4x4jpHm3n8QpF2yqiuhNMixv4Y/260x112"
},
"btn-clear-on.png": {
"u": "https://cdn.jkwljy.com/pk-math/4RayK5aFF9X2kNuMxmtu3FYho6s3/260x120",
"w": 260,
"h": 120,
"ossName": "/pk-math/4RayK5aFF9X2kNuMxmtu3FYho6s3/260x120"
},
"btn-next-off-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112",
"w": 400,
"h": 112,
"ossName": "/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112"
},
"btn-next-off.png": {
"u": "https://cdn.jkwljy.com/pk-math/X8iQwJ6hQKGRJC9KR9twdBxsUsM/260x120",
"w": 260,
"h": 120,
"ossName": "/pk-math/X8iQwJ6hQKGRJC9KR9twdBxsUsM/260x120"
},
"btn-next-on-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112",
"w": 400,
"h": 112,
"ossName": "/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112"
},
"btn-next-on.png": {
"u": "https://cdn.jkwljy.com/pk-math/2hHPTgP7zZfQ2L9ZmWMZcp3ZQdKx/260x120",
"w": 260,
"h": 120,
"ossName": "/pk-math/2hHPTgP7zZfQ2L9ZmWMZcp3ZQdKx/260x120"
},
"btn-clear-icon.png": {
"u": "https://cdn.jkwljy.com/pk-math/4ZHYpvj1KLEypcgoBmhjEsN2bvC4/48x48",
"w": 48,
"h": 48,
"ossName": "/pk-math/4ZHYpvj1KLEypcgoBmhjEsN2bvC4/48x48"
}
}
export * from './auth'
export * from './game'
export * from './share'
export * from './pk'
export const test = 1
......@@ -45,5 +45,50 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/3k3He53c4T1SHnmWtit4JSbPtYgu/348x116",
"w": 348,
"h": 116
},
"btn-clear-off-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112",
"w": 260,
"h": 112
},
"btn-clear-off.png": {
"u": "https://cdn.jkwljy.com/pk-math/3LgHrGgzyViNf2jteJnar44k8qVP/260x120",
"w": 260,
"h": 120
},
"btn-clear-on-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/3p4x4jpHm3n8QpF2yqiuhNMixv4Y/260x112",
"w": 260,
"h": 112
},
"btn-clear-on.png": {
"u": "https://cdn.jkwljy.com/pk-math/4RayK5aFF9X2kNuMxmtu3FYho6s3/260x120",
"w": 260,
"h": 120
},
"btn-next-off-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112",
"w": 400,
"h": 112
},
"btn-next-off.png": {
"u": "https://cdn.jkwljy.com/pk-math/X8iQwJ6hQKGRJC9KR9twdBxsUsM/260x120",
"w": 260,
"h": 120
},
"btn-next-on-long.png": {
"u": "https://cdn.jkwljy.com/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112",
"w": 400,
"h": 112
},
"btn-next-on.png": {
"u": "https://cdn.jkwljy.com/pk-math/2hHPTgP7zZfQ2L9ZmWMZcp3ZQdKx/260x120",
"w": 260,
"h": 120
},
"btn-clear-icon.png": {
"u": "https://cdn.jkwljy.com/pk-math/4ZHYpvj1KLEypcgoBmhjEsN2bvC4/48x48",
"w": 48,
"h": 48
}
} as const
......@@ -80,7 +80,7 @@
.btn_right {
flex: 1;
height: 112px;
background-image: url(../assets/btn-next.png);
background-image: url(https://cdn.jkwljy.com/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112);
background-size: 100% 100%;
display: flex;
align-items: center;
......@@ -92,7 +92,7 @@
position: relative;
&.is_active {
background-image: url(../assets//btn-next-active.png);
background-image: url(https://cdn.jkwljy.com/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112);
}
&.disabled {
......@@ -106,19 +106,18 @@
margin-right: 20px;
width: 260px;
height: 112px;
background-image: url(../assets/btn-clear.png);
background-image: url(https://cdn.jkwljy.com/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112);
background-size: 100% 100%;
font-size: 40px;
font-weight: 500;
color: #FFFFFF;
line-height: 56px;
display: flex;
align-items: center;
justify-content: center;
&.is_active {
background-image: url(../assets//btn-clear-active.png);
background-image: url(https://cdn.jkwljy.com/pk-math/3p4x4jpHm3n8QpF2yqiuhNMixv4Y/260x112);
}
}
}
......
......@@ -9,6 +9,31 @@
}
}
.dot {
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
font-size: 52px;
font-weight: 500;
color: #465164;
background-image: url(../assets/keyboard.png);
background-size: 100% 100%;
}
.dot_wrap {
padding: 16px 10px;
margin: -16px 20px -16px -10px;
}
.dot_wrap.is_active {
.dot {
background-image: url(../assets/keyboard-active.png);
color: #ffffff;
}
}
.footer_inner {
display: flex;
align-items: center;
......@@ -17,7 +42,6 @@
.btn_right {
flex: 1;
height: 112px;
background-image: url(../assets/btn-next.png);
background-size: 100% 100%;
display: flex;
align-items: center;
......@@ -25,10 +49,20 @@
font-size: 40px;
font-weight: 500;
color: #FFFFFF;
background-image: url(https://cdn.jkwljy.com/pk-math/X8iQwJ6hQKGRJC9KR9twdBxsUsM/260x120);
line-height: 56px;
&.is_long {
background-image: url(https://cdn.jkwljy.com/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112);
&.is_active {
background-image: url(https://cdn.jkwljy.com/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112);
}
}
&.is_active {
background-image: url(../assets//btn-next-active.png);
background-image: url(https://cdn.jkwljy.com/pk-math/2hHPTgP7zZfQ2L9ZmWMZcp3ZQdKx/260x120);
}
&.disabled {
......@@ -38,11 +72,12 @@
border-radius: 32px;
}
}
.btn_left {
margin-right: 20px;
width: 260px;
height: 112px;
background-image: url(../assets/btn-clear.png);
background-image: url(https://cdn.jkwljy.com/pk-math/3LgHrGgzyViNf2jteJnar44k8qVP/260x120);
background-size: 100% 100%;
font-size: 40px;
font-weight: 500;
......@@ -53,8 +88,16 @@
align-items: center;
justify-content: center;
&.is_long {
background-image: url(https://cdn.jkwljy.com/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112);
&.is_active {
background-image: url(https://cdn.jkwljy.com/pk-math/3p4x4jpHm3n8QpF2yqiuhNMixv4Y/260x112);
}
}
&.is_active {
background-image: url(../assets//btn-clear-active.png);
background-image: url(https://cdn.jkwljy.com/pk-math/4RayK5aFF9X2kNuMxmtu3FYho6s3/260x120);
}
}
}
......
import { View, Image, CustomWrapper } from '@tarojs/components'
import classNames from 'classnames'
import assetsGame from '@/assets/oss/assets-game'
import styles from './page-footer.module.scss'
......@@ -9,26 +10,37 @@ type PageFooterProps = {
clearUserAnswer: () => void;
handleGoNext: () => void;
confirmText?: string;
hasLittleDot?: boolean;
onType: (arg: { detail: string }) => void;
}
const PageFooter = (props: PageFooterProps) => {
const { clearUserAnswer, handleGoNext, isLastQuestion, canGoNext, confirmText = '提交' } = props
const { clearUserAnswer, handleGoNext, isLastQuestion, canGoNext, confirmText = '提交', hasLittleDot, onType } = props
const handleTouchStart = () => {
onType({ detail: '.' })
}
return (
<CustomWrapper>
<View className={styles.footer}>
<View className={styles.footer_inner}>
{hasLittleDot && (
<View className={styles.dot_wrap} hoverClass={styles.is_active} onTouchStart={handleTouchStart}>
<View className={styles.dot}>.</View>
</View>
)}
<View
className={styles.btn_left}
className={classNames(styles.btn_left, !hasLittleDot && styles.is_long)}
hoverClass={styles.is_active}
id="question_clear_btn"
onClick={() => clearUserAnswer()}
>
<Image src={require('../assets/btn-clear-icon.png')} className={styles.icon}></Image>
<Image src={assetsGame['btn-clear-icon.png'].u} className={styles.icon}></Image>
清除
</View>
<View
className={classNames(styles.btn_right, !canGoNext && styles.disabled)}
className={classNames(styles.btn_right, !hasLittleDot && styles.is_long, !canGoNext && styles.disabled)}
hoverClass={canGoNext ? styles.is_active : null}
onClick={() => handleGoNext()}
id="question_continue_btn"
......
......@@ -90,6 +90,8 @@ const GamePlay = () => {
handleGoNext={handleGoNext}
isLastQuestion={isLastQuestion}
canGoNext={canGoNext}
onType={updateUserAnswer}
hasLittleDot={currentQuestion?.questionType !== '选择题'}
/>
</>
)}
......
......@@ -144,6 +144,8 @@ const Scene3 = (props: Scene3Props) => {
canGoNext={canGoNext}
confirmText="继续"
handleGoNext={handleGoNext}
onType={() => {}}
hasLittleDot
clearUserAnswer={actions.clearUserAnswers}
isLastQuestion={state.current === 2}
></PageFooter>
......
......@@ -2,9 +2,9 @@
position: absolute;
top: 64px;
width: 468px;
height: 168px;
height: 224px;
left: 250px;
background-image: url(https://cdn.jkwljy.com/pk-math/3hFqx2truFemx4DtRgZ4Q3mgEH6/468x168);
background-image: url(https://cdn.jkwljy.com/pk-math/2LAQN5FBeoW6UrQEaRVQVP6HTU25/468x224);
background-size: 100% 100%;
box-sizing: border-box;
padding: 28px 28px 28px 56px;
......@@ -56,6 +56,7 @@
font-weight: 600;
color: #465164;
line-height: 50px;
margin-right: 32px;
}
.input_tip {
......
import { View, Text, Image, ScrollView, Button, CommonEventFunction, ButtonProps } from '@tarojs/components'
import { View, Input, Image, ScrollView, Button, CommonEventFunction, ButtonProps } from '@tarojs/components'
import classNames from 'classnames'
import { useState, useCallback, useEffect, useRef } from 'react'
import { useState, useCallback, useEffect, useRef, useMemo } from 'react'
import { useStoreActions } from '@/store/hooks'
import { showToast } from '@tarojs/taro'
import assets from '@/assets/oss/assets-guide'
import { useBoolean } from '@/hooks'
import { report, SkynetEvent } from '@/utils/skynet'
......@@ -81,6 +82,20 @@ const Scene6 = (props: Scene6Props) => {
_getNickNameWords()
}, [_getNickNameWords])
const handleInput = useCallback((e) => {
setName(e.detail.value)
}, [])
const handleClick = () => {
if (!name) {
showToast({ title: '请输入昵称', icon: 'none' })
} else if (name.length > 7) {
showToast({ title: '昵称不能大于7个字', icon: 'none' })
}
}
const disabled = useMemo(() => !name || name.length > 7, [name])
return (
<View className={cs.viewport}>
<View className={cs.viewport_body}>
......@@ -89,14 +104,16 @@ const Scene6 = (props: Scene6Props) => {
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src={assets['cat-5.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>请选择你的昵称</View>
<View>请输入你的角色名(7字以内)</View>
<View className={styles.tips}>*仅用于排行榜展示哦</View>
</View>
</View>
<View className={styles.top}></View>
<View>
<View className={styles.input}>
<View className={styles.input_item}>{name}</View>
<View className={styles.input_item}>
<Input value={name} className={styles.input_inner} onInput={handleInput}></Input>
</View>
<Image
src={assets['touzi.png'].u}
className={classNames(styles.input_icon, isGenerating && styles.is_gen)}
......@@ -115,10 +132,11 @@ const Scene6 = (props: Scene6Props) => {
<View className={cs.footer}>
<View className={cs.footer_inner}>
<View className={styles.btn_tip}>同时为保存你的闯关数据,请进行授权</View>
{!name
{disabled
? (
<View
className={classNames(cs.btn, cs.disabled)}
onClick={handleClick}
>确定</View>
)
: (
......
......@@ -50,7 +50,7 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList
if (currentIndex === -1) {
showList = newList
} else {
showList = newList.slice(0, Math.max(currentIndex + 3, 5))
showList = newList.slice(0, Math.max(currentIndex + 80, 5))
}
let currentPart
......
......@@ -109,6 +109,21 @@ const getScoreIcon = (score?: StageLevel): ImageSource => {
return assets['score-b.png']
}
const getStarNum = (score?: StageLevel): number => {
switch (score) {
case StageLevel.S: {
return 3
}
case StageLevel.A: {
return 2
}
case StageLevel.B: {
return 1
}
}
return 0
}
const getStarSrc = (index: number, star: number) => {
if (star >= index) {
return assetsRoundNext['star-on.png'].u
......@@ -183,14 +198,15 @@ const StageComp = (props: StageProps) => {
case StageStatus.PASSED: {
const tag = getTagIcon(stage.gear)
const starNum = getStarNum(stage.level)
return (
<View className={styles.clear}>
<StageTag url={tag?.u} className={styles.tag} id={stage.id} ready={ready} />
<Image src={getScoreIcon(stage.level).u} className={styles.score} />
<Image src={getClearIcon(stage.type).u} className={getIconClassNames(stage.type, [styles.clearIcon])} />
<Image src={getStarSrc(1, 2)} className={styles.star_1}></Image>
<Image src={getStarSrc(2, 2)} className={styles.star_2}></Image>
<Image src={getStarSrc(3, 2)} className={styles.star_3}></Image>
<Image src={getStarSrc(1, starNum)} className={styles.star_1}></Image>
<Image src={getStarSrc(2, starNum)} className={styles.star_2}></Image>
<Image src={getStarSrc(3, starNum)} className={styles.star_3}></Image>
<View className={styles.pk}>
<View className={styles.pk_item}>{stage.pkWinNum ?? 0}</View>
<View className={classNames(styles.pk_item, styles.is_right)}>{stage.pkLoseNum ?? 0}</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