Commit c3d86c0c authored by raca's avatar raca

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

Merge branch 'feature/2023-06-12-v1.1' of https://118.24.71.244/hewenhao/GeekLearnMathWeapp into feature/2023-06-12-v1.1
parents 1167b821 e9438007
...@@ -10,5 +10,101 @@ ...@@ -10,5 +10,101 @@
"w": 80, "w": 80,
"h": 80, "h": 80,
"ossName": "/pk-math/3rh5MFpZF96fZE91zu7G1dcjdnsX/80x80" "ossName": "/pk-math/3rh5MFpZF96fZE91zu7G1dcjdnsX/80x80"
},
"pk-fail-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/4HKPvzCid6i65r3KFKMsG6fUQoPW/390x372",
"w": 390,
"h": 372,
"ossName": "/pk-math/4HKPvzCid6i65r3KFKMsG6fUQoPW/390x372"
},
"pk-fail-right.png": {
"u": "https://cdn.jkwljy.com/pk-math/3o3ESnEoAoPvNauDuLxjPPGmoyRv/390x372",
"w": 390,
"h": 372,
"ossName": "/pk-math/3o3ESnEoAoPvNauDuLxjPPGmoyRv/390x372"
},
"pk-fail.png": {
"u": "https://cdn.jkwljy.com/pk-math/o67P39ZoFCqbsKQMLoF5MHfrN8m/520x460",
"w": 520,
"h": 460,
"ossName": "/pk-math/o67P39ZoFCqbsKQMLoF5MHfrN8m/520x460"
},
"pk-success-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/kPpvGxHFYGFh5V8cU56WBDuHH3c/390x372",
"w": 390,
"h": 372,
"ossName": "/pk-math/kPpvGxHFYGFh5V8cU56WBDuHH3c/390x372"
},
"pk-success-right.png": {
"u": "https://cdn.jkwljy.com/pk-math/WXobLoPkgcg1iRqdaoDYhgzPvFF/390x372",
"w": 390,
"h": 372,
"ossName": "/pk-math/WXobLoPkgcg1iRqdaoDYhgzPvFF/390x372"
},
"pk-success.png": {
"u": "https://cdn.jkwljy.com/pk-math/4MEYpXTDweEFKUg4noHtZkoTeP2U/520x460",
"w": 520,
"h": 460,
"ossName": "/pk-math/4MEYpXTDweEFKUg4noHtZkoTeP2U/520x460"
},
"btn_bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/3k3He53c4T1SHnmWtit4JSbPtYgu/348x116",
"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"
} }
} }
...@@ -28,7 +28,7 @@ export const enum StageType { ...@@ -28,7 +28,7 @@ export const enum StageType {
Strong = '强化', Strong = '强化',
Enhance = '练习', Enhance = '练习',
OneStop = '一战到底', OneStop = '一战到底',
Special = '奖励关卡' Special = '挑战'
} }
export const enum StageGear { export const enum StageGear {
...@@ -57,6 +57,11 @@ export interface Stage { ...@@ -57,6 +57,11 @@ export interface Stage {
type?: StageType; type?: StageType;
upGear: boolean; upGear: boolean;
part?: number; part?: number;
/** pk负 */
pkLoseNum: number | null;
/** pk胜场 */
pkWinNum: number | null;
} }
export type StageRank = { export type StageRank = {
......
export * from './auth' export * from './auth'
export * from './game' export * from './game'
export * from './share' export * from './share'
export * from './pk'
...@@ -10,5 +10,85 @@ export default { ...@@ -10,5 +10,85 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/3rh5MFpZF96fZE91zu7G1dcjdnsX/80x80", "u": "https://cdn.jkwljy.com/pk-math/3rh5MFpZF96fZE91zu7G1dcjdnsX/80x80",
"w": 80, "w": 80,
"h": 80 "h": 80
},
"pk-fail-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/4HKPvzCid6i65r3KFKMsG6fUQoPW/390x372",
"w": 390,
"h": 372
},
"pk-fail-right.png": {
"u": "https://cdn.jkwljy.com/pk-math/3o3ESnEoAoPvNauDuLxjPPGmoyRv/390x372",
"w": 390,
"h": 372
},
"pk-fail.png": {
"u": "https://cdn.jkwljy.com/pk-math/o67P39ZoFCqbsKQMLoF5MHfrN8m/520x460",
"w": 520,
"h": 460
},
"pk-success-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/kPpvGxHFYGFh5V8cU56WBDuHH3c/390x372",
"w": 390,
"h": 372
},
"pk-success-right.png": {
"u": "https://cdn.jkwljy.com/pk-math/WXobLoPkgcg1iRqdaoDYhgzPvFF/390x372",
"w": 390,
"h": 372
},
"pk-success.png": {
"u": "https://cdn.jkwljy.com/pk-math/4MEYpXTDweEFKUg4noHtZkoTeP2U/520x460",
"w": 520,
"h": 460
},
"btn_bg.png": {
"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 } as const
...@@ -16,7 +16,7 @@ const defaultParamsFn = <T extends object = {}>() => ({ ...@@ -16,7 +16,7 @@ const defaultParamsFn = <T extends object = {}>() => ({
path: undefined, path: undefined,
}) })
const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>) => { const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>, getNextIdIfShare?: boolean) => {
const [shareIds, setShareIds] = useState<number[]>([]) const [shareIds, setShareIds] = useState<number[]>([])
const router = useRouter<{ scene?: string; shareId?: string }>() const router = useRouter<{ scene?: string; shareId?: string }>()
...@@ -63,6 +63,10 @@ const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>) => { ...@@ -63,6 +63,10 @@ const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>) => {
}).catch((error) => { }).catch((error) => {
console.log('save share occur error', error) console.log('save share occur error', error)
}) })
if (getNextIdIfShare) {
getSeeds()
}
// failback // failback
const queryString = qs(safeParams) const queryString = qs(safeParams)
sharePath = `${sharePath}?scene=${encodeURIComponent(`shareId=${defaultShareId}`)}${queryString ? `&${queryString}` : ''}` sharePath = `${sharePath}?scene=${encodeURIComponent(`shareId=${defaultShareId}`)}${queryString ? `&${queryString}` : ''}`
...@@ -83,7 +87,7 @@ const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>) => { ...@@ -83,7 +87,7 @@ const useShare = <T extends object = {}>(paramsFn?: UseShareParams<T>) => {
} }
}) })
return shareIds return getSeeds
} }
export { useShare } export { useShare }
.wrap {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(0,0,0,0.85);
}
.pk_result {
width: 520px;
height: 460px;
animation-name: roomIn;
animation-timing-function: ease-in-out;
animation-duration: .5s;
animation-fill-mode: backwards;
}
@keyframes roomIn {
0% {
transform: scale3d(2, 2, 1) translateY(230px);
}
100% {
transform: scale3d(1, 1, 1) translateY(0px);
}
}
.game_bonus {
display: flex;
align-items: center;
font-size: 48px;
font-weight: bold;
color: #FFFFFF;
line-height: 58px;
animation-name: fadeInUp;
animation-timing-function: ease-in-out;
animation-duration: .5s;
animation-fill-mode: backwards;
animation-delay: 0.5s;
}
@keyframes fadeInUp {
0% {
opacity: 0;
transform: scale3d(1, 1, 1) translateY(80px);
}
100% {
opacity: 1;
transform: scale3d(1, 1, 1) translateY(0px);
}
}
.diamond {
width: 100px;
height: 100px;
display: block;
margin-right: 20px;
}
.game_role {
width: 750px;
display: flex;
justify-content: space-between;
padding-top: 40px;
}
.game_role_left {
width: 390px;
height: 372px;
background-image: url(https://cdn.jkwljy.com/pk-math/kPpvGxHFYGFh5V8cU56WBDuHH3c/390x372);
background-size: 100% 100%;
animation-name: slideLeft;
animation-timing-function: ease-in-out;
animation-duration: .5s;
animation-fill-mode: backwards;
animation-delay: .5s;
&.is_fail {
background-image: url(https://cdn.jkwljy.com/pk-math/4HKPvzCid6i65r3KFKMsG6fUQoPW/390x372);
.info {
color: #FF5B5E;
background: rgba(255,255,255,0.7);
}
}
}
@keyframes slideLeft {
0% {
transform: translate3d(-100%, 0, 0);
}
100% {
transform: translate3d(0, 0, 0);
}
}
.user_name {
font-size: 32px;
font-weight: 600;
color: #FFFFFF;
line-height: 44px;
padding: 40px 0 0 32px;
}
.info {
height: 64px;
border-radius: 0px 32px 32px 0px;
display: flex;
padding-left: 32px;
align-items: center;
width: 312px;
box-sizing: border-box;
font-size: 28px;
font-weight: 500;
line-height: 40px;
color: #009AFB;
background: rgba(255,255,255,0.7);
margin-top: 28px;
&.is_info_2 {
width: 292px;
}
}
.user_level {
display: flex;
align-items: center;
padding-left: 32px;
font-size: 28px;
font-weight: 400;
color: #FFFFFF;
line-height: 40px;
}
.level_icon {
width: 60px;
height: 60px;
margin-right: 4px;
}
.game_role_right {
width: 390px;
height: 372px;
background-image: url(https://cdn.jkwljy.com/pk-math/WXobLoPkgcg1iRqdaoDYhgzPvFF/390x372);
background-size: 100% 100%;
margin-top: 60px;
animation-name: slideRight;
animation-timing-function: ease-in-out;
animation-duration: .5s;
animation-fill-mode: backwards;
animation-delay: 0.75s;
.user_name {
text-align: right;
padding: 40px 32px 0 0;
}
.user_level {
justify-content: flex-end;
padding-left: 0;
padding-right: 32px;
}
.info {
border-radius: 32px 0 0 32px;
margin-left: auto;
}
&.is_fail {
background-image: url(https://cdn.jkwljy.com/pk-math/3o3ESnEoAoPvNauDuLxjPPGmoyRv/390x372);
.info {
color: #FF5B5E;
background: rgba(255,255,255,0.7);
}
}
}
@keyframes slideRight {
0% {
transform: translate3d(100%, 0, 0);
}
100% {
transform: translate3d(0, 0, 0);
}
}
.footer {
display: flex;
align-items: center;
animation-name: fadeIn;
animation-timing-function: ease-in-out;
animation-duration: .5s;
animation-fill-mode: backwards;
animation-delay: 1s;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.share {
width: 280px;
height: 108px;
border-radius: 54px;
border: 4px solid #FFFFFF;
margin-right: 28px;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
font-weight: 500;
color: #FFFFFF;
line-height: 50px;
}
.back_main {
width: 348px;
height: 116px;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
font-weight: 500;
color: #FFFFFF;
line-height: 50px;
box-sizing: border-box;
background-image: url(https://cdn.jkwljy.com/pk-math/3k3He53c4T1SHnmWtit4JSbPtYgu/348x116);
background-size: 100% 100%;
}
.gap_1 {
flex: 4;
}
.gap_2 {
flex: 2;
}
.gap_3 {
flex: 3;
}
import { View, Image } from '@tarojs/components'
import assetsGame from '@/assets/oss/assets-game'
import assetsPrepare from '@/assets/oss/assets-prepare'
import assetsPk from '@/assets/oss/assets-pk'
import classNames from 'classnames'
import styles from './battle-complete.module.scss'
type BattleCompleteProps = {
data?: {}
}
const BattleComplete = (props: BattleCompleteProps) => {
const { data } = props
if (!data) {
return null
}
return (
<View className={styles.wrap}>
<View className={styles.gap_1}></View>
<Image src={assetsGame['pk-fail.png'].u} className={styles.pk_result} mode="heightFix"></Image>
<View className={styles.game_bonus}>
<Image src={assetsPrepare['diamond.png'].u} className={styles.diamond}></Image>
水晶 +5
</View>
<View className={styles.game_role}>
<View className={styles.game_role_left}>
<View className={styles.user_name}>用户名称用户名</View>
<View className={styles.user_level}>
<Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ
</View>
<View className={styles.info}>答题对错:全对</View>
<View className={classNames(styles.info, styles.is_info_2)}>答题用时:21.3s</View>
</View>
<View className={classNames(styles.game_role_right, styles.is_fail)}>
<View className={styles.user_name}>用户名称用户名</View>
<View className={styles.user_level}>
<Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ
</View>
<View className={styles.info}>答题对错:全对</View>
<View className={classNames(styles.info, styles.is_info_2)}>答题用时:21.3s</View>
</View>
</View>
<View className={styles.gap_2}></View>
<View className={styles.footer}>
<View className={styles.share}>分享结果</View>
<View className={styles.back_main}>提升自己</View>
</View>
<View className={styles.gap_3}></View>
</View>
)
}
export default BattleComplete
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
.btn_right { .btn_right {
flex: 1; flex: 1;
height: 112px; height: 112px;
background-image: url(../assets/btn-next.png); background-image: url(https://cdn.jkwljy.com/pk-math/USktMvCPNs9FbQZZUT8GK1Ey1ah/400x112);
background-size: 100% 100%; background-size: 100% 100%;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
position: relative; position: relative;
&.is_active { &.is_active {
background-image: url(../assets//btn-next-active.png); background-image: url(https://cdn.jkwljy.com/pk-math/25tFcedKUnTL1DbfGhrB6ns4HLNz/400x112);
} }
&.disabled { &.disabled {
...@@ -106,19 +106,18 @@ ...@@ -106,19 +106,18 @@
margin-right: 20px; margin-right: 20px;
width: 260px; width: 260px;
height: 112px; height: 112px;
background-image: url(../assets/btn-clear.png); background-image: url(https://cdn.jkwljy.com/pk-math/4WRje86GrgRkDRiUoq5oQCaqU9ug/260x112);
background-size: 100% 100%; background-size: 100% 100%;
font-size: 40px; font-size: 40px;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
line-height: 56px; line-height: 56px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
&.is_active { &.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 @@ ...@@ -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 { .footer_inner {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -17,7 +42,6 @@ ...@@ -17,7 +42,6 @@
.btn_right { .btn_right {
flex: 1; flex: 1;
height: 112px; height: 112px;
background-image: url(../assets/btn-next.png);
background-size: 100% 100%; background-size: 100% 100%;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -25,10 +49,20 @@ ...@@ -25,10 +49,20 @@
font-size: 40px; font-size: 40px;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
background-image: url(https://cdn.jkwljy.com/pk-math/X8iQwJ6hQKGRJC9KR9twdBxsUsM/260x120);
line-height: 56px; 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 { &.is_active {
background-image: url(../assets//btn-next-active.png); background-image: url(https://cdn.jkwljy.com/pk-math/2hHPTgP7zZfQ2L9ZmWMZcp3ZQdKx/260x120);
} }
&.disabled { &.disabled {
...@@ -38,11 +72,12 @@ ...@@ -38,11 +72,12 @@
border-radius: 32px; border-radius: 32px;
} }
} }
.btn_left { .btn_left {
margin-right: 20px; margin-right: 20px;
width: 260px; width: 260px;
height: 112px; height: 112px;
background-image: url(../assets/btn-clear.png); background-image: url(https://cdn.jkwljy.com/pk-math/3LgHrGgzyViNf2jteJnar44k8qVP/260x120);
background-size: 100% 100%; background-size: 100% 100%;
font-size: 40px; font-size: 40px;
font-weight: 500; font-weight: 500;
...@@ -53,8 +88,16 @@ ...@@ -53,8 +88,16 @@
align-items: center; align-items: center;
justify-content: 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 { &.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 { View, Image, CustomWrapper } from '@tarojs/components'
import classNames from 'classnames' import classNames from 'classnames'
import assetsGame from '@/assets/oss/assets-game'
import styles from './page-footer.module.scss' import styles from './page-footer.module.scss'
...@@ -9,26 +10,37 @@ type PageFooterProps = { ...@@ -9,26 +10,37 @@ type PageFooterProps = {
clearUserAnswer: () => void; clearUserAnswer: () => void;
handleGoNext: () => void; handleGoNext: () => void;
confirmText?: string; confirmText?: string;
hasLittleDot?: boolean;
onType: (arg: { detail: string }) => void;
} }
const PageFooter = (props: PageFooterProps) => { 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 ( return (
<CustomWrapper> <CustomWrapper>
<View className={styles.footer}> <View className={styles.footer}>
<View className={styles.footer_inner}> <View className={styles.footer_inner}>
{hasLittleDot && (
<View className={styles.dot_wrap} hoverClass={styles.is_active} onTouchStart={handleTouchStart}>
<View className={styles.dot}>.</View>
</View>
)}
<View <View
className={styles.btn_left} className={classNames(styles.btn_left, !hasLittleDot && styles.is_long)}
hoverClass={styles.is_active} hoverClass={styles.is_active}
id="question_clear_btn" id="question_clear_btn"
onClick={() => clearUserAnswer()} 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>
<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} hoverClass={canGoNext ? styles.is_active : null}
onClick={() => handleGoNext()} onClick={() => handleGoNext()}
id="question_continue_btn" id="question_continue_btn"
......
...@@ -11,6 +11,7 @@ import PageHead from './components/page-head' ...@@ -11,6 +11,7 @@ import PageHead from './components/page-head'
import PageFooter from './components/page-footer' import PageFooter from './components/page-footer'
import Question from './components/question' import Question from './components/question'
import CountUp from './components/count-up' import CountUp from './components/count-up'
import BattleComplete from './components/battle-complete'
// import NumberKeyboard from './components/number-keyboard' // import NumberKeyboard from './components/number-keyboard'
import styles from './index.module.scss' import styles from './index.module.scss'
...@@ -89,11 +90,14 @@ const GamePlay = () => { ...@@ -89,11 +90,14 @@ const GamePlay = () => {
handleGoNext={handleGoNext} handleGoNext={handleGoNext}
isLastQuestion={isLastQuestion} isLastQuestion={isLastQuestion}
canGoNext={canGoNext} canGoNext={canGoNext}
onType={updateUserAnswer}
hasLittleDot={currentQuestion?.questionType !== '选择题'}
/> />
</> </>
)} )}
</EyeProtectionView> </EyeProtectionView>
<ModalContinue /> <ModalContinue />
<BattleComplete />
</> </>
) )
} }
......
...@@ -144,6 +144,8 @@ const Scene3 = (props: Scene3Props) => { ...@@ -144,6 +144,8 @@ const Scene3 = (props: Scene3Props) => {
canGoNext={canGoNext} canGoNext={canGoNext}
confirmText="继续" confirmText="继续"
handleGoNext={handleGoNext} handleGoNext={handleGoNext}
onType={() => {}}
hasLittleDot
clearUserAnswer={actions.clearUserAnswers} clearUserAnswer={actions.clearUserAnswers}
isLastQuestion={state.current === 2} isLastQuestion={state.current === 2}
></PageFooter> ></PageFooter>
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
position: absolute; position: absolute;
top: 64px; top: 64px;
width: 468px; width: 468px;
height: 168px; height: 224px;
left: 250px; 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%; background-size: 100% 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 28px 28px 28px 56px; padding: 28px 28px 28px 56px;
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
font-weight: 600; font-weight: 600;
color: #465164; color: #465164;
line-height: 50px; line-height: 50px;
margin-right: 32px;
} }
.input_tip { .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 classNames from 'classnames'
import { useState, useCallback, useEffect, useRef } from 'react' import { useState, useCallback, useEffect, useRef, useMemo } from 'react'
import { useStoreActions } from '@/store/hooks' import { useStoreActions } from '@/store/hooks'
import { showToast } from '@tarojs/taro'
import assets from '@/assets/oss/assets-guide' import assets from '@/assets/oss/assets-guide'
import { useBoolean } from '@/hooks' import { useBoolean } from '@/hooks'
import { report, SkynetEvent } from '@/utils/skynet' import { report, SkynetEvent } from '@/utils/skynet'
...@@ -81,6 +82,20 @@ const Scene6 = (props: Scene6Props) => { ...@@ -81,6 +82,20 @@ const Scene6 = (props: Scene6Props) => {
_getNickNameWords() _getNickNameWords()
}, [_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 ( return (
<View className={cs.viewport}> <View className={cs.viewport}>
<View className={cs.viewport_body}> <View className={cs.viewport_body}>
...@@ -89,14 +104,16 @@ const Scene6 = (props: Scene6Props) => { ...@@ -89,14 +104,16 @@ const Scene6 = (props: Scene6Props) => {
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}> <View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src={assets['cat-5.png'].u} className={cs.cat} /> <Image src={assets['cat-5.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}> <View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>请选择你的昵称</View> <View>请输入你的角色名(7字以内)</View>
<View className={styles.tips}>*仅用于排行榜展示哦</View> <View className={styles.tips}>*仅用于排行榜展示哦</View>
</View> </View>
</View> </View>
<View className={styles.top}></View> <View className={styles.top}></View>
<View> <View>
<View className={styles.input}> <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 <Image
src={assets['touzi.png'].u} src={assets['touzi.png'].u}
className={classNames(styles.input_icon, isGenerating && styles.is_gen)} className={classNames(styles.input_icon, isGenerating && styles.is_gen)}
...@@ -115,10 +132,11 @@ const Scene6 = (props: Scene6Props) => { ...@@ -115,10 +132,11 @@ const Scene6 = (props: Scene6Props) => {
<View className={cs.footer}> <View className={cs.footer}>
<View className={cs.footer_inner}> <View className={cs.footer_inner}>
<View className={styles.btn_tip}>同时为保存你的闯关数据,请进行授权</View> <View className={styles.btn_tip}>同时为保存你的闯关数据,请进行授权</View>
{!name {disabled
? ( ? (
<View <View
className={classNames(cs.btn, cs.disabled)} className={classNames(cs.btn, cs.disabled)}
onClick={handleClick}
>确定</View> >确定</View>
) )
: ( : (
......
...@@ -146,20 +146,14 @@ ...@@ -146,20 +146,14 @@
.pk_flash_left, .pk_flash_right { .pk_flash_left, .pk_flash_right {
width: 360px; width: 360px;
height: 200px; height: 200px;
animation-name: flash;
animation-timing-function: ease-in; animation-timing-function: ease-in;
animation-duration: 0.8s; animation-duration: 0.8s;
animation-fill-mode: backwards; animation-fill-mode: backwards;
animation-delay: 0.5s; animation-delay: 0.5s;
} }
.pk_flash_left { @keyframes flash {
animation-name: flash_shake_1;
}
.pk_flash_right {
animation-name: flash_shake_1;
}
@keyframes flash_shake_1 {
0% { 0% {
opacity: 0; opacity: 0;
} }
......
...@@ -15,11 +15,12 @@ type CreatePkProps = { ...@@ -15,11 +15,12 @@ type CreatePkProps = {
const CreatePk = (props: CreatePkProps) => { const CreatePk = (props: CreatePkProps) => {
const { visible } = props const { visible } = props
const userInfo = useStoreState(states => states.userModel.userInfo) const userInfo = useStoreState(states => states.userModel.userInfo)
const currentPkStage = useStoreState(states => states.mainModel.currentPkStage)
const nav = useMemo(getMenuButtonBoundingClientRect, []) const nav = useMemo(getMenuButtonBoundingClientRect, [])
const updateState = useStoreActions(actions => actions.mainModel.updateState) const updateState = useStoreActions(actions => actions.mainModel.updateState)
const closeModal = () => { const closeModal = () => {
updateState({ isCreatePkShow: false }) updateState({ isCreatePkShow: false, currentPkStage: null })
} }
const closeStyle = useMemo(() => { const closeStyle = useMemo(() => {
...@@ -52,7 +53,7 @@ const CreatePk = (props: CreatePkProps) => { ...@@ -52,7 +53,7 @@ const CreatePk = (props: CreatePkProps) => {
<View className={styles.me_info}> <View className={styles.me_info}>
<View>{userInfo.nickName}</View> <View>{userInfo.nickName}</View>
<View className={styles.info_detail}><Image src={assetsPk['bronze-small.png'].u} className={styles.pk_level} />青铜Ⅰ</View> <View className={styles.info_detail}><Image src={assetsPk['bronze-small.png'].u} className={styles.pk_level} />青铜Ⅰ</View>
<View className={styles.info_detail}>本关战绩:胜 2 负 3</View> <View className={styles.info_detail}>本关战绩:胜 {currentPkStage?.pkWinNum ?? 0} 负 {currentPkStage?.pkLoseNum ?? 0}</View>
<View className={styles.info_detail}>最佳表现:全对丨29.3s</View> <View className={styles.info_detail}>最佳表现:全对丨29.3s</View>
</View> </View>
</View> </View>
......
...@@ -50,7 +50,7 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList ...@@ -50,7 +50,7 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList
if (currentIndex === -1) { if (currentIndex === -1) {
showList = newList showList = newList
} else { } else {
showList = newList.slice(0, Math.max(currentIndex + 3, 5)) showList = newList.slice(0, Math.max(currentIndex + 80, 5))
} }
let currentPart let currentPart
......
...@@ -43,15 +43,17 @@ const Scene = (props: SceneProps) => { ...@@ -43,15 +43,17 @@ const Scene = (props: SceneProps) => {
useEffect(() => { useEffect(() => {
if (props.stageList.length < 1) return if (props.stageList.length < 1) return
nextTick(() => { nextTick(() => {
if (!domRef.current) return setTimeout(() => {
createSelectorQuery() if (!domRef.current) return
.select(`#${domRef.current.uid}`) createSelectorQuery()
.boundingClientRect().exec(([rect]) => { .select(`#${domRef.current.uid}`)
if (!rect) { .boundingClientRect().exec(([rect]) => {
return if (!rect) {
} return
setContainerHeight(rect.height) }
}) setContainerHeight(rect.height)
})
})
}) })
}, [props.stageList]) }, [props.stageList])
......
...@@ -109,6 +109,21 @@ const getScoreIcon = (score?: StageLevel): ImageSource => { ...@@ -109,6 +109,21 @@ const getScoreIcon = (score?: StageLevel): ImageSource => {
return assets['score-b.png'] 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) => { const getStarSrc = (index: number, star: number) => {
if (star >= index) { if (star >= index) {
return assetsRoundNext['star-on.png'].u return assetsRoundNext['star-on.png'].u
...@@ -141,7 +156,9 @@ const StageComp = (props: StageProps) => { ...@@ -141,7 +156,9 @@ const StageComp = (props: StageProps) => {
} }
const handleLongPress = () => { const handleLongPress = () => {
updateMainModelState({ isCreatePkShow: true }) if (stage.status === StageStatus.PASSED) {
updateMainModelState({ isCreatePkShow: true, currentPkStage: stage })
}
} }
const handleCompleteGuide = () => { const handleCompleteGuide = () => {
...@@ -181,17 +198,18 @@ const StageComp = (props: StageProps) => { ...@@ -181,17 +198,18 @@ const StageComp = (props: StageProps) => {
case StageStatus.PASSED: { case StageStatus.PASSED: {
const tag = getTagIcon(stage.gear) const tag = getTagIcon(stage.gear)
const starNum = getStarNum(stage.level)
return ( return (
<View className={styles.clear}> <View className={styles.clear}>
<StageTag url={tag?.u} className={styles.tag} id={stage.id} ready={ready} /> <StageTag url={tag?.u} className={styles.tag} id={stage.id} ready={ready} />
<Image src={getScoreIcon(stage.level).u} className={styles.score} /> <Image src={getScoreIcon(stage.level).u} className={styles.score} />
<Image src={getClearIcon(stage.type).u} className={getIconClassNames(stage.type, [styles.clearIcon])} /> <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(1, starNum)} className={styles.star_1}></Image>
<Image src={getStarSrc(2, 2)} className={styles.star_2}></Image> <Image src={getStarSrc(2, starNum)} className={styles.star_2}></Image>
<Image src={getStarSrc(3, 2)} className={styles.star_3}></Image> <Image src={getStarSrc(3, starNum)} className={styles.star_3}></Image>
<View className={styles.pk}> <View className={styles.pk}>
<View className={styles.pk_item}>2</View> <View className={styles.pk_item}>{stage.pkWinNum ?? 0}</View>
<View className={classNames(styles.pk_item, styles.is_right)}>2</View> <View className={classNames(styles.pk_item, styles.is_right)}>{stage.pkLoseNum ?? 0}</View>
</View> </View>
</View> </View>
) )
......
...@@ -6,6 +6,7 @@ import { useShare } from '@/hooks' ...@@ -6,6 +6,7 @@ import { useShare } from '@/hooks'
import { setNavigationBarColor, useRouter } from '@tarojs/taro' import { setNavigationBarColor, useRouter } from '@tarojs/taro'
import { handleShare } from '@/utils/share' import { handleShare } from '@/utils/share'
import Loading from '@/components/Loading' import Loading from '@/components/Loading'
import { useStoreState } from '@/store/hooks'
import styles from './main.module.scss' import styles from './main.module.scss'
import MainComponent from './main-underground/main-component' import MainComponent from './main-underground/main-component'
import Guide from './guide' import Guide from './guide'
...@@ -15,19 +16,34 @@ const MainPage = () => { ...@@ -15,19 +16,34 @@ const MainPage = () => {
const [isReady, setIsReady] = useState(false) const [isReady, setIsReady] = useState(false)
const router = useRouter() const router = useRouter()
const currentPkStage = useStoreState(states => states.mainModel.currentPkStage)
useEffect(() => { useEffect(() => {
handleShare(router.params) handleShare(router.params)
}, [router.params]) }, [router.params])
const getShareParams = useCallback(() => { const getShareParams = useCallback(() => {
const userInfo = getStorage(StorageKeys.userInfo)
if (currentPkStage && userInfo?.userId) {
return {
title: '听说你的能力不错,我们battle一下',
path: 'pages/accept-pk/index',
imageUrl: 'https://cdn.jkwljy.com/pk-math/4LHyu63hfeteRxAKNb2cj2uCrahf/420x336',
pageParams: {
initiator: userInfo.userId,
stageId: currentPkStage.id
}
}
}
return { return {
title: '邀请你来一起PKmath,快乐提升哦', title: '邀请你来一起PKmath,快乐提升哦',
path: 'pages/main/main', path: 'pages/main/main',
imageUrl: 'https://cdn.jkwljy.com/pk-math/4LHyu63hfeteRxAKNb2cj2uCrahf/420x336', imageUrl: 'https://cdn.jkwljy.com/pk-math/4LHyu63hfeteRxAKNb2cj2uCrahf/420x336',
} }
}, []) }, [currentPkStage])
useShare(getShareParams) useShare(getShareParams, true)
const handleDone = useCallback(() => { const handleDone = useCallback(() => {
setIsDone(true) setIsDone(true)
......
...@@ -25,11 +25,13 @@ export interface MainModel { ...@@ -25,11 +25,13 @@ export interface MainModel {
fetchStage: Thunk<MainModel, void, void, AppStoreModel, Promise<[Stage[], Stage[]]>>; fetchStage: Thunk<MainModel, void, void, AppStoreModel, Promise<[Stage[], Stage[]]>>;
isCreatePkShow: boolean; isCreatePkShow: boolean;
currentPkStage: Stage | null;
} }
const mainModel: MainModel = { const mainModel: MainModel = {
isReady: false, isReady: false,
player: getPlayer(), player: getPlayer(),
currentPkStage: null,
isCreatePkShow: false, isCreatePkShow: false,
stageList: [], stageList: [],
updateState: action((state, payload) => { updateState: action((state, payload) => {
......
...@@ -131,7 +131,7 @@ const Prepare = () => { ...@@ -131,7 +131,7 @@ const Prepare = () => {
getQuestionList(+router.params.id || 1).then(() => { getQuestionList(+router.params.id || 1).then(() => {
isClickRef.current = false isClickRef.current = false
navigateTo({ navigateTo({
url: `/pages/game/play/index?id=${router.params.id}` url: `/pages/game/play/index?id=${router.params.id}&isBattle=true`
}) })
}) })
} }
......
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