Commit ef1c7b37 authored by hewenhao's avatar hewenhao

feat: update

parent 247e14c0
......@@ -59,11 +59,18 @@ export function getSetting () {
}
export function updateUserPhone (code: string) {
return requestAfterSilentLogin<void, { code: string; userId?: number }>((userInfo) => ({
url: '/service-idea/stage/user/getUserPhone',
method: 'GET',
data: { code, userId: userInfo?.userId, shareId: getCurrentShareId() }
}))
return requestAfterSilentLogin<void, { code: string; userId?: number }>((userInfo) => {
const shareId = getCurrentShareId()
return {
url: '/service-idea/stage/user/getUserPhone',
method: 'GET',
data: shareId
? { code, userId: userInfo?.userId, shareId }
: ({
code, userId: userInfo?.userId
})
}
})
}
export type NickNameWord = {
......
......@@ -24,6 +24,7 @@ const Scene6 = (props: Scene6Props) => {
const [name, setName] = useState('')
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null)
const [loading, setLoading] = useState(false)
const [isGenerating, genActions] = useBoolean(false)
const genName = useCallback(() => {
......@@ -39,9 +40,14 @@ const Scene6 = (props: Scene6Props) => {
console.log(e.detail.errMsg)
return
}
setLoading(true)
updateNickNameAndPhone({ code: e.detail.code!, name })
.then(() => onNext())
.then(() => {
setLoading(false)
onNext()
})
.catch(err => {
setLoading(false)
console.log(err)
})
}, [updateNickNameAndPhone, onNext, name])
......@@ -107,6 +113,7 @@ const Scene6 = (props: Scene6Props) => {
openType="getPhoneNumber"
onGetPhoneNumber={handleGetPhone}
className={cs.btn}
loading={loading}
hoverClass={cs.is_hover}
>确定</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