Commit 45e3861d authored by hewenhao's avatar hewenhao

feat: userInfo

parent a11177bb
...@@ -39,7 +39,7 @@ const MainHeader = () => { ...@@ -39,7 +39,7 @@ const MainHeader = () => {
> >
<View className={styles.inner} style={innerStyle}> <View className={styles.inner} style={innerStyle}>
<View className={styles.avatar}> <View className={styles.avatar}>
<Text className={styles.name}>{userInfo?.nickname ?? ''}</Text> <Text className={styles.name}>{userInfo?.nickName ?? ''}</Text>
</View> </View>
<View className={classNames(styles.score, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover}> <View className={classNames(styles.score, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover}>
<Image src={require('../assets/score.png')} className={styles.icon} /> <Image src={require('../assets/score.png')} className={styles.icon} />
......
...@@ -24,6 +24,7 @@ const MainPage = () => { ...@@ -24,6 +24,7 @@ const MainPage = () => {
const fetchStage = useStoreActions(actions => actions.mainModel.fetchStage) const fetchStage = useStoreActions(actions => actions.mainModel.fetchStage)
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount) const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const updateUserInfo = useStoreActions(actions => actions.userModel.updateUserInfo)
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo) const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const [nav] = useState(getMenuButtonBoundingClientRect()) const [nav] = useState(getMenuButtonBoundingClientRect())
const router = useRouter<{ groupId: string, inviteId: string }>() const router = useRouter<{ groupId: string, inviteId: string }>()
...@@ -40,6 +41,7 @@ const MainPage = () => { ...@@ -40,6 +41,7 @@ const MainPage = () => {
useDidShow(() => { useDidShow(() => {
fetchAccount() fetchAccount()
updateUserInfo('曾牛逼')
const tabbar = getTabBar<TabbarRef>(page) const tabbar = getTabBar<TabbarRef>(page)
tabbar?.setSelected(0) tabbar?.setSelected(0)
......
...@@ -34,11 +34,11 @@ const userModel: UserModel = { ...@@ -34,11 +34,11 @@ const userModel: UserModel = {
actions.updateState({ setting: { pointToCard: Infinity } }) actions.updateState({ setting: { pointToCard: Infinity } })
} }
}), }),
updateUserInfo: thunk(async (actions, nickname, helpers) => { updateUserInfo: thunk(async (actions, nickName, helpers) => {
try { try {
await updateUserInfo(nickname) await updateUserInfo(nickName)
const { userInfo } = helpers.getState() const { userInfo } = helpers.getState()
const current = { ...userInfo, nickname } const current = { ...userInfo, nickName }
updateStorage(StorageKeys.userInfo, current) updateStorage(StorageKeys.userInfo, current)
actions.updateState({ actions.updateState({
userInfo: current userInfo: current
......
...@@ -4,7 +4,7 @@ export type UserInfo = { ...@@ -4,7 +4,7 @@ export type UserInfo = {
openId: string; openId: string;
userId?: number; userId?: number;
city?: string; city?: string;
nickname?: string | null; nickName?: string | null;
phone?: string | null; phone?: string | null;
} }
......
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