Commit ef1c7b37 authored by hewenhao's avatar hewenhao

feat: update

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