Commit 45e3861d authored by hewenhao's avatar hewenhao

feat: userInfo

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