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