Commit 8e81da7c authored by hewenhao's avatar hewenhao

feat: update

parent 0c073857
...@@ -48,19 +48,28 @@ const Group = () => { ...@@ -48,19 +48,28 @@ const Group = () => {
const getGroupNo = useCallback(() => { const getGroupNo = useCallback(() => {
const { noun, adj } = dataRef.current const { noun, adj } = dataRef.current
const nam = `${randomPick(adj)}${randomPick(noun)}` const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
setGroupNo(nam) setGroupNo(nam)
}, []) }, [])
useEffect(() => { const getWords = useCallback(async () => {
const fn = async () => {
const words = await getNickNameWords('words') const words = await getNickNameWords('words')
dataRef.current = words dataRef.current = words
getGroupNo() getGroupNo()
}
fn()
}, [getGroupNo]) }, [getGroupNo])
const _genGroundNo = useCallback(() => {
if (dataRef.current.adj.length < 1) {
getWords()
} else {
getGroupNo()
}
}, [getGroupNo, getWords])
useEffect(() => {
getWords()
}, [getWords])
useDidShow(async () => { useDidShow(async () => {
const tabbar = getTabBar<TabbarRef>(page) const tabbar = getTabBar<TabbarRef>(page)
tabbar?.setSelected(1) tabbar?.setSelected(1)
...@@ -137,7 +146,7 @@ const Group = () => { ...@@ -137,7 +146,7 @@ const Group = () => {
<Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}> <Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}>
<View className={styles.modal}> <View className={styles.modal}>
<View className={styles.modal_body} onClick={getGroupNo}> <View className={styles.modal_body} onClick={_genGroundNo}>
<Input className={styles.modal_input} disabled value={groupNo} /> <Input className={styles.modal_input} disabled value={groupNo} />
<Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} /> <Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} />
</View> </View>
......
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