Commit 104617a2 authored by m's avatar m
parents ea53d2ed ec748e03
......@@ -47,3 +47,14 @@
margin-right: 4PX;
}
}
.ph {
display: flex;
align-items: center;
flex: 1;
.icon {
width: 32PX;
height: 32PX;
margin-right: 4PX;
}
}
import { View, Text, Image } from '@tarojs/components'
import { getMenuButtonBoundingClientRect, getSystemInfoSync, navigateTo } from '@tarojs/taro'
import { useMemo, useState } from 'react'
import { useMemo } from 'react'
import { useStoreState } from '@/store/hooks'
import styles from './top-header.module.scss'
......@@ -12,8 +12,8 @@ const goStore = () => {
}
const TopHeader = () => {
const [nav] = useState(getMenuButtonBoundingClientRect())
const [sys] = useState(getSystemInfoSync())
const nav = useMemo(getMenuButtonBoundingClientRect, [])
const sys = useMemo(getSystemInfoSync, [])
const innerStyle = useMemo(() => {
return {
height: `${nav.height + 10}px`,
......@@ -42,7 +42,7 @@ const TopHeader = () => {
<Image src={require('@/pages/main/assets/score.png')} className={styles.icon} />
<Text>{point}</Text>
</View>
<View className={styles.score} onClick={goStore}>
<View className={styles.ph} onClick={goStore}>
<Image src={require('@/pages/main/assets/ph.png')} className={styles.icon} />
<Text>{cardNum}</Text>
</View>
......
import { View, Text, Image } from '@tarojs/components'
import { getMenuButtonBoundingClientRect, getSystemInfoSync, navigateTo } from '@tarojs/taro'
import { useMemo, useState } from 'react'
import { useMemo } from 'react'
import classNames from 'classnames'
import { useStoreState } from '@/store/hooks'
import { cs } from '@/styles'
......@@ -14,8 +14,9 @@ const goStore = () => {
}
const MainHeader = () => {
const [nav] = useState(getMenuButtonBoundingClientRect())
const [sys] = useState(getSystemInfoSync())
const nav = useMemo(getMenuButtonBoundingClientRect, [])
const sys = useMemo(getSystemInfoSync, [])
const innerStyle = useMemo(() => {
return {
height: `${nav.height + 10}px`,
......
......@@ -24,8 +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 [nav] = useState(getMenuButtonBoundingClientRect())
const nav = useMemo(getMenuButtonBoundingClientRect, [])
useShowShareModal()
......@@ -40,7 +39,6 @@ const MainPage = () => {
useDidShow(() => {
fetchAccount()
updateUserInfo('曾牛逼')
const tabbar = getTabBar<TabbarRef>(page)
tabbar?.setSelected(0)
......@@ -63,6 +61,7 @@ const MainPage = () => {
<MainHeader />
<View className={styles.body} style={{ paddingTop: `${nav.height + nav.top + 5}px` }}>
<MainChapter />
{/* <Button openType="getPhoneNumber" onGetPhoneNumber={handleClick}>shouji</Button> */}
<SceneContext.Provider value={{ ready: isReady }}>
<MainScene stageList={stageList} />
</SceneContext.Provider>
......
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