Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
GeekLearnMathWeapp
Commits
28824dd9
Commit
28824dd9
authored
Apr 13, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
9a4fe75b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
80 additions
and
17 deletions
+80
-17
global.d.ts
global.d.ts
+6
-3
keyboard-active.png
...ive-components/number-keyboard/assets/keyboard-active.png
+0
-0
keyboard.png
src/native-components/number-keyboard/assets/keyboard.png
+0
-0
index.js
src/native-components/number-keyboard/index.js
+16
-0
index.json
src/native-components/number-keyboard/index.json
+3
-0
index.module.scss
src/native-components/number-keyboard/index.module.scss
+30
-0
index.wxml
src/native-components/number-keyboard/index.wxml
+5
-0
number-keyboard.module.scss
src/pages/game/play/components/number-keyboard.module.scss
+2
-2
index.config.ts
src/pages/game/play/index.config.ts
+2
-1
index.tsx
src/pages/game/play/index.tsx
+2
-2
index.ts
src/pages/game/play/model/index.ts
+3
-3
scene-3.tsx
src/pages/main/guide/scene-3.tsx
+9
-5
main.config.ts
src/pages/main/main.config.ts
+2
-1
No files found.
global.d.ts
View file @
28824dd9
/// <reference types="@tarojs/taro" />
declare
module
'*.png'
;
declare
module
'*.gif'
;
declare
module
'*.jpg'
;
...
...
@@ -10,8 +11,6 @@ declare module '*.scss';
declare
module
'*.sass'
;
declare
module
'*.styl'
;
type
CountUptime
=
React
.
FC
<
{
maxNum
}
>
type
CountUpTime
=
React
.
DetailedHTMLProps
<
React
.
HTMLAttributes
<
HTMLElement
>
&
{
'maxValue'
?:
number
;
'isDown'
?:
boolean
;
...
...
@@ -24,8 +23,12 @@ type CountUpTime = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
declare
namespace
JSX
{
interface
IntrinsicElements
{
// 扩展 IntrinsicElements 否则无法识别自定义标签
'count-up-time'
:
CountUpTime
'count-up-time'
:
CountUpTime
;
'number-keyboard'
:
React
.
DetailedHTMLProps
<
React
.
HTMLAttributes
<
HTMLElement
>
&
{
onType
?:
(
a
:
{
detail
:
string
})
=>
void
;
},
HTMLElement
>
}
}
declare
namespace
NodeJS
{
...
...
src/native-components/number-keyboard/assets/keyboard-active.png
0 → 100644
View file @
28824dd9
2.62 KB
src/native-components/number-keyboard/assets/keyboard.png
0 → 100644
View file @
28824dd9
3.7 KB
src/native-components/number-keyboard/index.js
0 → 100644
View file @
28824dd9
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
import
styles
from
'./index.module.scss'
Component
({
data
:
{
list
:
'1234567890'
.
split
(
''
),
styles
},
methods
:
{
handleClick
(
event
)
{
this
.
triggerEvent
(
'type'
,
event
.
currentTarget
.
dataset
.
letter
)
},
}
})
src/native-components/number-keyboard/index.json
0 → 100644
View file @
28824dd9
{
"component"
:
true
}
src/native-components/number-keyboard/index.module.scss
0 → 100644
View file @
28824dd9
.keyboard
{
padding
:
16px
34px
0
36px
;
margin
:
-16px
-10px
;
display
:
flex
;
flex-wrap
:
wrap
;
}
.keyboard_item_wrap
{
padding
:
16px
10px
;
}
.keyboard_item
{
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%
;
}
.keyboard_item_wrap.is_active
{
.keyboard_item
{
background-image
:
url(./assets/keyboard-active.png)
;
color
:
#ffffff
;
}
}
src/native-components/number-keyboard/index.wxml
0 → 100644
View file @
28824dd9
<view class="{{styles.keyboard}}">
<view wx:for="{{list}}" class="{{styles.keyboard_item_wrap}}" data-letter="{{item}}" wx:key="*this" hover-class="{{styles.is_active}}" catchtouchstart="handleClick">
<view class="{{styles.keyboard_item}}">{{item}}</view>
</view>
</view>
src/pages/game/play/components/number-keyboard.module.scss
View file @
28824dd9
...
...
@@ -17,11 +17,11 @@
font-size
:
52px
;
font-weight
:
500
;
color
:
#465164
;
background-image
:
url(../assets/
/
keyboard.png)
;
background-image
:
url(../assets/keyboard.png)
;
background-size
:
100%
100%
;
&
.is_active
{
color
:
#ffffff
;
background-image
:
url(../assets/
/
keyboard-active.png)
;
background-image
:
url(../assets/keyboard-active.png)
;
}
}
src/pages/game/play/index.config.ts
View file @
28824dd9
...
...
@@ -3,6 +3,7 @@ export default definePageConfig({
navigationStyle
:
'custom'
,
// renderer: 'skyline',
usingComponents
:
{
'count-up-time'
:
'../../../native-components/count-up/index'
'count-up-time'
:
'../../../native-components/count-up/index'
,
'number-keyboard'
:
'../../../native-components/number-keyboard/index'
,
}
})
src/pages/game/play/index.tsx
View file @
28824dd9
...
...
@@ -10,7 +10,7 @@ import PageHead from './components/page-head'
import
PageFooter
from
'./components/page-footer'
import
Question
from
'./components/question'
import
CountUp
from
'./components/count-up'
import
NumberKeyboard
from
'./components/number-keyboard'
//
import NumberKeyboard from './components/number-keyboard'
import
styles
from
'./index.module.scss'
...
...
@@ -66,7 +66,7 @@ const GamePlay = () => {
{
currentQuestion
&&
(
<>
{
currentQuestion
?.
questionType
!==
'选择题'
&&
(
<
NumberKeyboard
onClick
=
{
updateUserAnswer
}
/>
<
number
-
keyboard
onType
=
{
updateUserAnswer
}
/>
)
}
{
rightIcon
&&
(
<
Image
src=
{
rightIcon
}
className=
{
styles
.
right_icon
}
></
Image
>
...
...
src/pages/game/play/model/index.ts
View file @
28824dd9
...
...
@@ -68,7 +68,7 @@ export interface GameModel extends GameModelState {
/** 更新当前输入框下标 */
updateCurrentInputIndex
:
Action
<
GameModel
,
number
>
;
/** 更新用户输入 */
updateUserAnswer
:
Action
<
GameModel
,
string
>
;
updateUserAnswer
:
Action
<
GameModel
,
{
detail
:
string
}
>
;
/** 清空所有输入 */
clearUserAnswer
:
Action
<
GameModel
,
void
>
;
updateSelectionAnswer
:
Action
<
GameModel
,
number
>
;
...
...
@@ -142,7 +142,7 @@ const gameModel: GameModel = {
}
}),
updateUserAnswer
:
action
((
state
,
char
)
=>
{
updateUserAnswer
:
action
((
state
,
{
detail
}
)
=>
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
vibrateShort
()
}
...
...
@@ -150,7 +150,7 @@ const gameModel: GameModel = {
const
answers
=
state
.
questionList
[
state
.
currentQuestionIndex
]?.
answers
const
val
=
answers
?.[
index
]
if
(
answers
&&
val
)
{
val
.
userAnswer
=
`
${
val
.
userAnswer
===
'0'
?
''
:
(
val
.
userAnswer
||
''
)}${
char
}
`
val
.
userAnswer
=
`
${
val
.
userAnswer
===
'0'
?
''
:
(
val
.
userAnswer
||
''
)}${
detail
}
`
const
maxLen
=
answers
.
length
state
.
questionList
=
state
.
questionList
.
slice
()
if
(
answers
.
length
>
1
&&
index
<
maxLen
-
1
)
{
...
...
src/pages/main/guide/scene-3.tsx
View file @
28824dd9
...
...
@@ -4,7 +4,7 @@ import classNames from 'classnames'
import
{
useMemo
}
from
'react'
import
assets
from
'@/assets/oss/assets-guide'
import
{
getCurrentInstance
}
from
'@tarojs/taro'
import
NumberKeyboard
from
'@/pages/game/play/components/number-keyboard'
//
import NumberKeyboard from '@/pages/game/play/components/number-keyboard'
import
MathSymbol
from
'@/pages/game/play/components/math-symbol'
import
PageFooter
from
'@/pages/game/play/components/page-footer'
import
cs
from
'./index.module.scss'
...
...
@@ -24,7 +24,7 @@ type QuestionModel = {
current
:
number
;
isSubmit
:
boolean
;
updateState
:
Action
<
QuestionModel
,
Partial
<
State
<
QuestionModel
>>>
;
updateAnswer
:
Action
<
QuestionModel
,
string
>
;
updateAnswer
:
Action
<
QuestionModel
,
{
detail
:
string
}
>
;
goNext
:
Thunk
<
QuestionModel
,
((
val
:
number
)
=>
void
)
|
void
>
;
clearUserAnswers
:
Action
<
QuestionModel
>
;
updateWrong
:
Action
<
QuestionModel
,
boolean
>
;
...
...
@@ -53,9 +53,13 @@ const Scene3 = (props: Scene3Props) => {
updateWrong
:
action
((
_state
,
p
)
=>
{
_state
.
wrong
=
p
}),
updateAnswer
:
action
((
_state
,
str
)
=>
{
updateAnswer
:
action
((
_state
,
{
detail
}
)
=>
{
const
pre
=
_state
.
values
[
_state
.
current
]
_state
.
values
[
_state
.
current
]
=
pre
+
str
if
(
pre
===
'0'
)
{
_state
.
values
[
_state
.
current
]
=
detail
}
else
{
_state
.
values
[
_state
.
current
]
=
pre
+
detail
}
}),
goNext
:
thunk
((
_act
,
cb
,
helpers
)
=>
{
const
{
current
,
values
}
=
helpers
.
getState
()
...
...
@@ -135,7 +139,7 @@ const Scene3 = (props: Scene3Props) => {
</
ScrollView
>
</
View
>
<
View
>
<
NumberKeyboard
onClick=
{
actions
.
updateAnswer
}
></
NumberKeyboard
>
<
number
-
keyboard
onType=
{
actions
.
updateAnswer
}
/
>
<
PageFooter
canGoNext=
{
canGoNext
}
confirmText=
"继续"
...
...
src/pages/main/main.config.ts
View file @
28824dd9
...
...
@@ -4,6 +4,7 @@ export default definePageConfig({
navigationBarTextStyle
:
'white'
,
enableShareAppMessage
:
true
,
usingComponents
:
{
'count-up-time'
:
'../../native-components/count-up/index'
'count-up-time'
:
'../../native-components/count-up/index'
,
'number-keyboard'
:
'../../native-components/number-keyboard/index'
}
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment