Commit cf408658 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 c899ab2a b6dbfdd0
......@@ -121,11 +121,28 @@
padding: 32px 34px 80px 34px;
}
.footerButton {
.btn {
background-image: url(https://cdn.jkwljy.com/pk-math/wbVXwYUGCx63qjnAcoCW4mL2pvh/686x112);
background-size: 100% 100%;
height: 112px;
flex: 1;
background-image: url('https://cdn.jkwljy.com/pk-math/gMAFXFRRH3frGsM2wCpyLUCdiNT/343x56');
border-radius: 56px;
display: flex;
align-items: center;
justify-content: center;
font-size: 40px;
font-weight: 600;
color: #FFFFFF;
line-height: 56px;
background-color: #1786F7;
&.disabled {
background-image: none;
background-color: #E2E6ED;
color: #C2C8D1;
}
}
.footerHoverButton {
background-image: url('https://cdn.jkwljy.com/pk-math/3UiwFgrVHVQEcaPdxdf1XinBb64o/343x56');
.isHover {
background-image: url(https://cdn.jkwljy.com/pk-math/hijKKpX1GS7rJoezNKJwDFwMFQC/686x112);
}
\ No newline at end of file
import { View, RootPortal, Image } from '@tarojs/components'
import { View, RootPortal, Image, Button, ButtonProps, CommonEventFunction } 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 { useStoreActions } from '@/store/hooks'
import { getNickNameWords, type NickNameWord } from '@/api'
import assetsPk from '@/assets/oss/assets-pk'
import assetsGuide from '@/assets/oss/assets-guide'
import { report, SkynetEvent } from '@/utils/skynet'
import styles from './modal-name.module.scss'
......@@ -29,6 +30,7 @@ const ModalName = ({
const [generating, { setTrue, setFalse }] = useBoolean(false)
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null)
const updateNickNameAndPhone = useStoreActions(actions => actions.userModel.updateNickNameAndPhone)
const generateName = useCallback(() => {
const { noun, adj } = dataRef.current
......@@ -58,6 +60,26 @@ const ModalName = ({
}, 1000)
}, [generateName, setTrue, setFalse, getNameWords])
const [loading, setLoading] = useState(false)
const handleGetPhone = useCallback<CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>>((e) => {
if (loading) return
setLoading(true)
if (!e.detail.code && e.detail.errMsg) {
report(SkynetEvent.BizError, { errMsg: e.detail.errMsg, errType: 'AUTH_PHONE_ERR' })
}
updateNickNameAndPhone({ code: e.detail.code, name })
.then(() => {
setLoading(false)
onFinish()
})
.catch(err => {
setLoading(false)
console.log(err)
})
}, [onClose, updateNickNameAndPhone, onFinish, name, loading])
return (
<RootPortal>
<View
......@@ -88,10 +110,12 @@ const ModalName = ({
</View>
<View className={styles.footer}>
<Button
size="large"
image={styles.footerButton}
hoverImage={styles.footerHoverButton}
onClick={onFinish}
openType="getPhoneNumber"
onGetPhoneNumber={handleGetPhone}
data-name="接收PK"
className={styles.btn}
hoverClass={styles.isHover}
onClick={onClose}
>
确定
</Button>
......
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