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
d16282d8
Commit
d16282d8
authored
Apr 08, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 引导页
parent
df5f52d7
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
209 additions
and
24 deletions
+209
-24
nickname-words.json
assets/setting/nickname-words.json
+4
-0
words.json
assets/setting/words.json
+4
-0
upload-words.js
scripts/upload-words.js
+46
-0
auth.ts
src/api/auth.ts
+17
-0
server.ts
src/config/server.ts
+2
-2
index.tsx
src/custom-tab-bar/index.tsx
+1
-1
scene-1.tsx
src/pages/main/guide/scene-1.tsx
+1
-1
scene-2.module.scss
src/pages/main/guide/scene-2.module.scss
+11
-1
scene-2.tsx
src/pages/main/guide/scene-2.tsx
+2
-2
scene-4.tsx
src/pages/main/guide/scene-4.tsx
+42
-5
scene-5.tsx
src/pages/main/guide/scene-5.tsx
+7
-1
scene-6.module.scss
src/pages/main/guide/scene-6.module.scss
+34
-5
scene-6.tsx
src/pages/main/guide/scene-6.tsx
+36
-4
text-printer.tsx
src/pages/main/guide/text-printer.tsx
+1
-1
main.tsx
src/pages/main/main.tsx
+1
-1
No files found.
assets/setting/nickname-words.json
0 → 100644
View file @
d16282d8
{
"noun"
:
[
"白菜"
,
"西瓜"
,
"萝卜"
],
"adj"
:
[
"快乐的"
,
"英勇的"
,
"奋斗的"
]
}
assets/setting/words.json
0 → 100644
View file @
d16282d8
{
"ad"
:
[
"你的"
],
"none"
:
[
"我的"
]
}
scripts/upload-words.js
0 → 100644
View file @
d16282d8
const
path
=
require
(
'path'
)
const
fastglob
=
require
(
'fast-glob'
)
const
COS
=
require
(
'cos-nodejs-sdk-v5'
)
const
rootFolderPath
=
path
.
resolve
(
__dirname
,
'../assets/setting'
)
const
config
=
{
SecretId
:
'AKIDJG6HEyXfdP5dw05OhldO2RaV9Xgbe6Wh'
,
// 'AKIDmMhgQGAJbkjZ8bfpa5LNAoJfuvkJJuwh',
SecretKey
:
'Kdg05SKVRb4qMnUv51nRwCHAAuOMULzM'
,
// 'gCTs8h8btRo00mIcgYBZh16zd7YpvqRn',
Bucket
:
'frontend-bkt-1257124244'
// 'test-1257124244'
}
const
cos
=
new
COS
({
SecretId
:
config
.
SecretId
,
SecretKey
:
config
.
SecretKey
})
const
folderList
=
fastglob
.
sync
(
'**'
,
{
onlyFiles
:
false
,
deep
:
1
,
cwd
:
rootFolderPath
})
if
(
folderList
.
length
<
1
)
{
console
.
log
(
'empty folder'
,
rootFolderPath
)
}
folderList
.
forEach
(
item
=>
{
return
uploadFile
({
filePath
:
path
.
resolve
(
rootFolderPath
,
item
),
ossName
:
`/pk-math/setting/
${
item
}
`
})
})
function
uploadFile
({
filePath
,
ossName
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
cos
.
sliceUploadFile
({
Bucket
:
config
.
Bucket
,
Region
:
'ap-chengdu'
,
Key
:
ossName
,
ContentType
:
'application/json'
,
CacheControl
:
'max-age=0'
,
FilePath
:
filePath
,
},
function
(
err
,
data
)
{
if
(
err
)
{
reject
(
err
)
}
else
{
console
.
log
(
`https://
${
data
.
Location
}
`
.
replace
(
`
${
config
.
Bucket
}
.cos.ap-chengdu.myqcloud.com`
,
'cdn.jkwljy.com'
))
}
})
})
}
src/api/auth.ts
View file @
d16282d8
import
{
request
,
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
request
,
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
request
as
requesNative
}
from
'@tarojs/taro'
import
type
{
UserInfo
}
from
'@/types'
import
type
{
UserInfo
}
from
'@/types'
type
LoginResult
=
UserInfo
type
LoginResult
=
UserInfo
...
@@ -63,3 +64,19 @@ export function updateUserPhone (code: string) {
...
@@ -63,3 +64,19 @@ export function updateUserPhone (code: string) {
data
:
{
code
,
userId
:
userInfo
?.
userId
}
data
:
{
code
,
userId
:
userInfo
?.
userId
}
}))
}))
}
}
export
type
NickNameWord
=
{
noun
:
string
[];
adj
:
string
[];
}
const
NickNameUrl
=
'https://cdn.jkwljy.com/pk-math/setting/nickname-words.json'
export
function
getNickNameWords
()
{
return
requesNative
<
NickNameWord
>
({
method
:
'GET'
,
url
:
`
${
NickNameUrl
}
?d=
${
Date
.
now
()}
`
,
header
:
{
'Cache-Control'
:
'no-cache'
},
timeout
:
800
}).
then
(({
data
})
=>
data
)
}
src/config/server.ts
View file @
d16282d8
import
Taro
from
'@tarojs/taro'
import
{
request
}
from
'@tarojs/taro'
const
RE
=
/^https
?
:
\/\/
/
const
RE
=
/^https
?
:
\/\/
/
const
buildVersion
=
String
(
process
.
env
.
TARO_BUILD_VERSION
)
||
'
\
0_not_find'
const
buildVersion
=
String
(
process
.
env
.
TARO_BUILD_VERSION
)
||
'
\
0_not_find'
...
@@ -34,7 +34,7 @@ export const getBaseUrl = () => {
...
@@ -34,7 +34,7 @@ export const getBaseUrl = () => {
// 开发阶段不使用服务端配置
// 开发阶段不使用服务端配置
if
(
process
.
env
.
SERVER_ENDPOINT
===
'https://geek.jkwljy.com'
)
{
if
(
process
.
env
.
SERVER_ENDPOINT
===
'https://geek.jkwljy.com'
)
{
console
.
log
(
'init base url from'
,
WeappConfigUrl
)
console
.
log
(
'init base url from'
,
WeappConfigUrl
)
requestInstance
=
Taro
.
request
<
ServerConfig
>
({
requestInstance
=
request
<
ServerConfig
>
({
method
:
'GET'
,
method
:
'GET'
,
url
:
WeappConfigUrl
,
url
:
WeappConfigUrl
,
header
:
{
'Cache-Control'
:
'no-cache'
},
header
:
{
'Cache-Control'
:
'no-cache'
},
...
...
src/custom-tab-bar/index.tsx
View file @
d16282d8
...
@@ -27,7 +27,7 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
...
@@ -27,7 +27,7 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
}
}
})
})
if
(
!
userInfo
.
nickName
)
{
if
(
userInfo
.
nickName
)
{
return
null
return
null
}
}
...
...
src/pages/main/guide/scene-1.tsx
View file @
d16282d8
...
@@ -91,7 +91,7 @@ const Scene1 = ({ onNext }: Scene1Props) => {
...
@@ -91,7 +91,7 @@ const Scene1 = ({ onNext }: Scene1Props) => {
<
View
className=
{
cs
.
footer_inner
}
>
<
View
className=
{
cs
.
footer_inner
}
>
<
View
<
View
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
hoverClass=
{
!
isActive
?
cs
.
is_hover
:
''
}
hoverClass=
{
isActive
?
cs
.
is_hover
:
''
}
onClick=
{
handleClick
}
onClick=
{
handleClick
}
>
继续
</
View
>
>
继续
</
View
>
</
View
>
</
View
>
...
...
src/pages/main/guide/scene-2.module.scss
View file @
d16282d8
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
background-image
:
url(https://cdn.jkwljy.com/pk-math/3hFqx2truFemx4DtRgZ4Q3mgEH6/468x168)
;
background-image
:
url(https://cdn.jkwljy.com/pk-math/3hFqx2truFemx4DtRgZ4Q3mgEH6/468x168)
;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
28px
2
8px
28px
56
px
;
padding
:
28px
2
0px
28px
50
px
;
font-size
:
40px
;
font-size
:
40px
;
font-weight
:
500
;
font-weight
:
500
;
...
@@ -19,6 +19,16 @@
...
@@ -19,6 +19,16 @@
color
:
#1786F7
;
color
:
#1786F7
;
}
}
.select
{
background
:
#F0F2F9
;
border-radius
:
24px
;
font-size
:
28px
;
font-weight
:
500
;
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
line-height
:
40px
;
padding
:
2px
12px
;
}
.option
{
.option
{
bottom
:
-64px
;
bottom
:
-64px
;
position
:
absolute
;
position
:
absolute
;
...
...
src/pages/main/guide/scene-2.tsx
View file @
d16282d8
...
@@ -25,7 +25,7 @@ const Scene2 = (props: Scene2Props) => {
...
@@ -25,7 +25,7 @@ const Scene2 = (props: Scene2Props) => {
<
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=
"https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300"
className=
{
cs
.
cat
}
/>
<
Image
src=
"https://cdn.jkwljy.com/pk-math/2G8dDyjuzbMbZ94UhwCpn7zUpw7V/300x300"
className=
{
cs
.
cat
}
/>
<
View
className=
{
styles
.
modal_4
}
style=
{
{
marginTop
:
`${spriteTop}px`
}
}
>
<
View
className=
{
styles
.
modal_4
}
style=
{
{
marginTop
:
`${spriteTop}px`
}
}
>
<
Text
>
请问同学有哪些
<
Text
className=
{
styles
.
em
}
>
计算问题
</
Text
>
需要提高呢
?
</
Text
>
<
Text
>
请问同学有哪些
<
Text
className=
{
styles
.
em
}
>
计算问题
</
Text
>
需要提高呢
?
<
Text
className=
{
styles
.
select
}
>
多选
</
Text
>
</
Text
>
</
View
>
</
View
>
<
View
className=
{
styles
.
option
}
>
<
View
className=
{
styles
.
option
}
>
...
@@ -56,7 +56,7 @@ const Scene2 = (props: Scene2Props) => {
...
@@ -56,7 +56,7 @@ const Scene2 = (props: Scene2Props) => {
<
View
className=
{
cs
.
footer_inner
}
>
<
View
className=
{
cs
.
footer_inner
}
>
<
View
<
View
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
hoverClass=
{
!
isActive
?
cs
.
is_hover
:
''
}
hoverClass=
{
isActive
?
cs
.
is_hover
:
''
}
onClick=
{
onNext
}
onClick=
{
onNext
}
>
继续
</
View
>
>
继续
</
View
>
</
View
>
</
View
>
...
...
src/pages/main/guide/scene-4.tsx
View file @
d16282d8
import
{
View
,
Text
,
Image
,
ScrollView
}
from
'@tarojs/components'
import
{
View
,
Text
,
Image
,
ScrollView
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
useFormatTick
}
from
'@/hooks'
import
{
useFormatTick
}
from
'@/hooks'
import
{
useMemo
}
from
'react'
import
assets
from
'@/assets/oss/assets-guide'
import
assets
from
'@/assets/oss/assets-guide'
import
cs
from
'./index.module.scss'
import
cs
from
'./index.module.scss'
...
@@ -12,9 +13,45 @@ type Scene4Props = {
...
@@ -12,9 +13,45 @@ type Scene4Props = {
onNext
:
()
=>
void
;
onNext
:
()
=>
void
;
}
}
function
getIcon
(
level
:
'S'
|
'A'
|
'B'
)
{
switch
(
level
)
{
case
'S'
:
{
return
[
assets
[
's.png'
].
u
,
assets
[
'top10.png'
].
u
]
}
case
'A'
:
{
return
[
assets
[
'a.png'
].
u
,
assets
[
'top20.png'
].
u
]
}
case
'B'
:
{
return
[
assets
[
'b.png'
].
u
,
assets
[
'top30.png'
].
u
]
}
}
}
function
getLevelName
(
level
:
'S'
|
'A'
|
'B'
)
{
switch
(
level
)
{
case
'S'
:
{
return
'十'
}
case
'A'
:
{
return
'二十'
}
case
'B'
:
{
return
'三十'
}
}
}
const
Scene4
=
(
props
:
Scene4Props
)
=>
{
const
Scene4
=
(
props
:
Scene4Props
)
=>
{
const
{
spriteTop
,
onNext
,
time
}
=
props
const
{
spriteTop
,
onNext
,
time
}
=
props
const
level
=
useMemo
(()
=>
{
if
(
time
<=
10
)
return
'S'
if
(
time
<=
15
)
return
'A'
return
'B'
},
[
time
])
const
icons
=
useMemo
(()
=>
getIcon
(
level
),
[
level
])
const
isActive
=
true
const
isActive
=
true
const
timeFmt
=
useFormatTick
(
time
*
1000
)
const
timeFmt
=
useFormatTick
(
time
*
1000
)
...
@@ -42,18 +79,18 @@ const Scene4 = (props: Scene4Props) => {
...
@@ -42,18 +79,18 @@ const Scene4 = (props: Scene4Props) => {
<
View
>
<
View
>
<
View
className=
{
styles
.
title
}
>
达标等级:
</
View
>
<
View
className=
{
styles
.
title
}
>
达标等级:
</
View
>
<
View
className=
{
styles
.
card
}
>
<
View
className=
{
styles
.
card
}
>
<
Image
src=
{
assets
[
's.png'
].
u
}
className=
{
styles
.
icon
}
></
Image
>
<
Image
src=
{
icons
[
0
]
}
className=
{
styles
.
icon
}
></
Image
>
<
View
className=
{
styles
.
text
}
>
以本次练习的水准,继续答对15题,那你就达到
<
Text
className=
{
styles
.
glod
}
>
B
级实力
</
Text
>
了
</
View
>
<
View
className=
{
styles
.
text
}
>
以本次练习的水准,继续答对15题,那你就达到
<
Text
className=
{
styles
.
glod
}
>
{
level
}
级实力
</
Text
>
了
</
View
>
</
View
>
</
View
>
<
View
className=
{
styles
.
tips
}
>
* 共有 B → A → S 三个水准
</
View
>
<
View
className=
{
styles
.
tips
}
>
* 共有 B → A → S 三个水准
</
View
>
</
View
>
</
View
>
<
View
>
<
View
>
<
View
className=
{
styles
.
title
}
>
排行成就:
</
View
>
<
View
className=
{
styles
.
title
}
>
排行成就:
</
View
>
<
View
className=
{
styles
.
card
}
>
<
View
className=
{
styles
.
card
}
>
<
Image
src=
{
assets
[
'top10.png'
].
u
}
className=
{
styles
.
icon
}
></
Image
>
<
Image
src=
{
icons
[
1
]
}
className=
{
styles
.
icon
}
></
Image
>
<
View
className=
{
styles
.
text
}
>
<
View
className=
{
styles
.
text
}
>
<
View
>
本次练习非常优秀哦,
</
View
>
<
View
>
本次练习非常优秀哦,
</
View
>
<
View
>
排在所有同学前百分
<
Text
className=
{
styles
.
glod
}
>
前百分之
三十
</
Text
></
View
>
<
View
>
排在所有同学前百分
<
Text
className=
{
styles
.
glod
}
>
前百分之
{
getLevelName
(
level
)
}
</
Text
></
View
>
</
View
>
</
View
>
</
View
>
</
View
>
<
View
className=
{
styles
.
tips
}
>
* 共有 TOP30% → TOP20% → TOP10% 三个成就
</
View
>
<
View
className=
{
styles
.
tips
}
>
* 共有 TOP30% → TOP20% → TOP10% 三个成就
</
View
>
...
@@ -65,7 +102,7 @@ const Scene4 = (props: Scene4Props) => {
...
@@ -65,7 +102,7 @@ const Scene4 = (props: Scene4Props) => {
<
View
className=
{
styles
.
btn_tips
}
>
如果每个技能达到S水准,那面对考试,就胜券在握了
</
View
>
<
View
className=
{
styles
.
btn_tips
}
>
如果每个技能达到S水准,那面对考试,就胜券在握了
</
View
>
<
View
<
View
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
hoverClass=
{
!
isActive
?
cs
.
is_hover
:
''
}
hoverClass=
{
isActive
?
cs
.
is_hover
:
''
}
onClick=
{
onNext
}
onClick=
{
onNext
}
>
继续
</
View
>
>
继续
</
View
>
</
View
>
</
View
>
...
...
src/pages/main/guide/scene-5.tsx
View file @
d16282d8
...
@@ -41,24 +41,30 @@ const Scene5 = (props: Scene5Props) => {
...
@@ -41,24 +41,30 @@ const Scene5 = (props: Scene5Props) => {
<
View
>
<
View
>
<
View
className=
{
styles
.
tips3
}
>
帮助你
<
Text
className=
{
styles
.
gold
}
>
从易到难
</
Text
>
,逐个掌握。
</
View
>
<
View
className=
{
styles
.
tips3
}
>
帮助你
<
Text
className=
{
styles
.
gold
}
>
从易到难
</
Text
>
,逐个掌握。
</
View
>
<
View
className=
{
styles
.
card_wrap
}
>
<
View
className=
{
styles
.
card_wrap
}
>
{
active1
&&
(
<
View
className=
{
styles
.
card
}
>
<
View
className=
{
styles
.
card
}
>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'book-1.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
Image
src=
{
assets
[
'book-1.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
</
View
>
</
View
>
)
}
{
active2
&&
(
<
View
className=
{
styles
.
card
}
>
<
View
className=
{
styles
.
card
}
>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'book-2.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
Image
src=
{
assets
[
'book-2.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
</
View
>
</
View
>
)
}
{
active3
&&
(
<
View
className=
{
styles
.
card
}
>
<
View
className=
{
styles
.
card
}
>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'right.png'
].
u
}
className=
{
styles
.
right
}
/>
<
Image
src=
{
assets
[
'book-3.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
Image
src=
{
assets
[
'book-3.png'
].
u
}
className=
{
styles
.
card_icon
}
></
Image
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip1
}
>
常考应用题
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
<
View
className=
{
styles
.
tip2
}
>
每学期近30类
</
View
>
</
View
>
</
View
>
)
}
</
View
>
</
View
>
</
View
>
</
View
>
)
}
)
}
...
@@ -85,7 +91,7 @@ const Scene5 = (props: Scene5Props) => {
...
@@ -85,7 +91,7 @@ const Scene5 = (props: Scene5Props) => {
<
View
className=
{
cs
.
footer_inner
}
>
<
View
className=
{
cs
.
footer_inner
}
>
<
View
<
View
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
className=
{
classNames
(
cs
.
btn
,
!
isActive
&&
cs
.
disabled
)
}
hoverClass=
{
!
isActive
?
cs
.
is_hover
:
''
}
hoverClass=
{
isActive
?
cs
.
is_hover
:
''
}
onClick=
{
handleClick
}
onClick=
{
handleClick
}
>
{
isSubmit
?
'开启我的快乐提升之旅'
:
'继续'
}
</
View
>
>
{
isSubmit
?
'开启我的快乐提升之旅'
:
'继续'
}
</
View
>
</
View
>
</
View
>
...
...
src/pages/main/guide/scene-6.module.scss
View file @
d16282d8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
font-size
:
40px
;
font-size
:
40px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
rgba
(
70
,
81
,
100
,
0
.8
);
color
:
rgba
(
70
,
81
,
100
,
0
.8
);
line-height
:
56px
;
line-height
:
56px
;
}
}
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
.tips
{
.tips
{
font-size
:
28px
;
font-size
:
28px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
line-height
:
40px
;
line-height
:
40px
;
margin-top
:
8px
;
margin-top
:
8px
;
}
}
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
display
:
flex
;
display
:
flex
;
font-size
:
28px
;
font-size
:
28px
;
font-weight
:
600
;
font-weight
:
600
;
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
line-height
:
40px
;
line-height
:
40px
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
...
@@ -81,12 +81,41 @@
...
@@ -81,12 +81,41 @@
display
:
block
;
display
:
block
;
}
}
.is_gen
{
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
);
}
}
.btn_tip
{
.btn_tip
{
font-size
:
28px
;
font-size
:
28px
;
font-weight
:
600
;
font-weight
:
600
;
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
line-height
:
40px
;
line-height
:
40px
;
text-align
:
center
;
text-align
:
center
;
padding-bottom
:
32px
;
padding-bottom
:
32px
;
}
}
src/pages/main/guide/scene-6.tsx
View file @
d16282d8
import
{
View
,
Text
,
Image
,
ScrollView
,
Button
,
CommonEventFunction
,
ButtonProps
}
from
'@tarojs/components'
import
{
View
,
Text
,
Image
,
ScrollView
,
Button
,
CommonEventFunction
,
ButtonProps
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
useState
,
useCallback
}
from
'react'
import
{
useState
,
useCallback
,
useEffect
,
useRef
}
from
'react'
import
{
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreActions
}
from
'@/store/hooks'
import
assets
from
'@/assets/oss/assets-guide'
import
assets
from
'@/assets/oss/assets-guide'
import
{
useBoolean
}
from
'@/hooks'
import
{
getNickNameWords
,
type
NickNameWord
}
from
'@/api'
import
cs
from
'./index.module.scss'
import
cs
from
'./index.module.scss'
import
styles
from
'./scene-6.module.scss'
import
styles
from
'./scene-6.module.scss'
...
@@ -11,9 +13,23 @@ type Scene6Props = {
...
@@ -11,9 +13,23 @@ type Scene6Props = {
onNext
:
()
=>
void
;
onNext
:
()
=>
void
;
}
}
const
randomPick
=
(
arr
:
string
[])
=>
{
const
len
=
arr
.
length
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
len
)
return
arr
[
randomIndex
]
}
const
Scene6
=
(
props
:
Scene6Props
)
=>
{
const
Scene6
=
(
props
:
Scene6Props
)
=>
{
const
{
spriteTop
,
onNext
}
=
props
const
{
spriteTop
,
onNext
}
=
props
const
[
name
,
setName
]
=
useState
(
'好娃娃'
)
const
[
name
,
setName
]
=
useState
(
''
)
const
dataRef
=
useRef
<
NickNameWord
>
({
noun
:
[],
adj
:
[]
})
const
[
isGenerating
,
genActions
]
=
useBoolean
(
false
)
const
genName
=
useCallback
(()
=>
{
const
{
noun
,
adj
}
=
dataRef
.
current
const
nam
=
`
${
randomPick
(
adj
)}${
randomPick
(
noun
)}
`
setName
(
nam
)
},
[])
const
updateNickNameAndPhone
=
useStoreActions
(
actions
=>
actions
.
userModel
.
updateNickNameAndPhone
)
const
updateNickNameAndPhone
=
useStoreActions
(
actions
=>
actions
.
userModel
.
updateNickNameAndPhone
)
...
@@ -22,6 +38,22 @@ const Scene6 = (props: Scene6Props) => {
...
@@ -22,6 +38,22 @@ const Scene6 = (props: Scene6Props) => {
.
then
(()
=>
onNext
())
.
then
(()
=>
onNext
())
},
[
updateNickNameAndPhone
,
onNext
,
name
])
},
[
updateNickNameAndPhone
,
onNext
,
name
])
const
handleGen
=
useCallback
(
async
()
=>
{
genActions
.
setTrue
()
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
1000
))
genName
()
genActions
.
setFalse
()
},
[
genName
,
genActions
])
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
const
words
=
await
getNickNameWords
()
dataRef
.
current
=
words
genName
()
}
fn
()
},
[
genName
])
return
(
return
(
<
View
className=
{
cs
.
viewport
}
>
<
View
className=
{
cs
.
viewport
}
>
<
View
className=
{
cs
.
viewport_body
}
>
<
View
className=
{
cs
.
viewport_body
}
>
...
@@ -37,8 +69,8 @@ const Scene6 = (props: Scene6Props) => {
...
@@ -37,8 +69,8 @@ const Scene6 = (props: Scene6Props) => {
<
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
}
>
阳光学习帮
</
View
>
<
View
className=
{
styles
.
input_item
}
>
{
name
}
</
View
>
<
Image
src=
{
assets
[
'touzi.png'
].
u
}
className=
{
styles
.
input_ico
n
}
></
Image
>
<
Image
src=
{
assets
[
'touzi.png'
].
u
}
className=
{
classNames
(
styles
.
input_icon
,
isGenerating
&&
styles
.
is_gen
)
}
onClick=
{
handleGe
n
}
></
Image
>
</
View
>
</
View
>
<
View
className=
{
styles
.
input_tip
}
>
<
View
className=
{
styles
.
input_tip
}
>
确定后奖励
<
Image
src=
{
assets
[
'score.png'
].
u
}
className=
{
styles
.
score
}
></
Image
><
Text
className=
{
styles
.
em
}
>
+100
</
Text
>
确定后奖励
<
Image
src=
{
assets
[
'score.png'
].
u
}
className=
{
styles
.
score
}
></
Image
><
Text
className=
{
styles
.
em
}
>
+100
</
Text
>
...
...
src/pages/main/guide/text-printer.tsx
View file @
d16282d8
...
@@ -9,7 +9,7 @@ type TextPrinterProps = {
...
@@ -9,7 +9,7 @@ type TextPrinterProps = {
}
}
const
TextPrinter
=
(
props
:
TextPrinterProps
)
=>
{
const
TextPrinter
=
(
props
:
TextPrinterProps
)
=>
{
const
{
textList
,
onEnd
,
speed
=
200
,
pauseTime
=
2
00
}
=
props
const
{
textList
,
onEnd
,
speed
=
100
,
pauseTime
=
4
00
}
=
props
const
[
visibleText
,
setVisibleText
]
=
useState
(
''
)
const
[
visibleText
,
setVisibleText
]
=
useState
(
''
)
const
charIndex
=
useRef
(
0
)
const
charIndex
=
useRef
(
0
)
const
currentTextIndex
=
useRef
(
0
)
const
currentTextIndex
=
useRef
(
0
)
...
...
src/pages/main/main.tsx
View file @
d16282d8
...
@@ -19,7 +19,7 @@ const MainPage = () => {
...
@@ -19,7 +19,7 @@ const MainPage = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
silentLoginDeferred
.
getPromise
().
then
(()
=>
{
silentLoginDeferred
.
getPromise
().
then
(()
=>
{
const
userInfo
=
getStorage
(
StorageKeys
.
userInfo
)
const
userInfo
=
getStorage
(
StorageKeys
.
userInfo
)
if
(
userInfo
?.
nickName
)
{
if
(
!
userInfo
?.
nickName
)
{
setIsDone
(
true
)
setIsDone
(
true
)
}
}
setIsReady
(
true
)
setIsReady
(
true
)
...
...
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