|
@@ -1,127 +1,138 @@
|
|
-import { Component } from 'react'
|
|
|
|
-import Taro from '@tarojs/taro'
|
|
|
|
|
|
+import { useState } from 'react'
|
|
|
|
+import Taro, { useDidHide } from '@tarojs/taro'
|
|
import { View, Text, Image, Button, Navigator } from '@tarojs/components'
|
|
import { View, Text, Image, Button, Navigator } from '@tarojs/components'
|
|
import { observer, inject } from 'mobx-react'
|
|
import { observer, inject } from 'mobx-react'
|
|
import './index.less'
|
|
import './index.less'
|
|
import { Store } from '@src/app'
|
|
import { Store } from '@src/app'
|
|
import ModalStore from '@src/store/modalStore'
|
|
import ModalStore from '@src/store/modalStore'
|
|
import IosShowPay from '@src/components/pay/IosShowPay'
|
|
import IosShowPay from '@src/components/pay/IosShowPay'
|
|
|
|
+import GlobalModal from '@src/components/bottomModal'
|
|
interface Props {
|
|
interface Props {
|
|
store: Store;
|
|
store: Store;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function My(props: Props) {
|
|
|
|
+ let { userInfoStore } = props.store
|
|
|
|
+ const [payType, setPayType] = useState<"shubi" | "vip">("shubi")
|
|
|
|
|
|
-@inject('store')
|
|
|
|
-@observer
|
|
|
|
-class My extends Component<Props> {
|
|
|
|
- state = {
|
|
|
|
|
|
+ //支付弹窗
|
|
|
|
+ const payBtn = (e, type) => {
|
|
|
|
+ e.stopPropagation()
|
|
|
|
+ setPayType(type)
|
|
|
|
+ ModalStore.showModal()
|
|
}
|
|
}
|
|
- render() {
|
|
|
|
- let { userInfoStore } = this.props.store
|
|
|
|
- let userInfo = userInfoStore?.userInfo || Taro.getStorageSync("userInfo")?.userInfo
|
|
|
|
- return <View className='my'>
|
|
|
|
- <View className="userInfo">
|
|
|
|
- {/* <Image src={require('../../icon/myBack.png')} /> */}
|
|
|
|
- <View className="userInfo_box">
|
|
|
|
- {/* 个人信息 */}
|
|
|
|
- <View className="top" >
|
|
|
|
- <View className="left">
|
|
|
|
- <View className="avtai">
|
|
|
|
- <Image mode="widthFix" lazy-load src={userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')} />
|
|
|
|
- </View>
|
|
|
|
- <View className="name" style={userInfoStore.isAuth ? { width: Taro.pxTransform(120) } : {}}>
|
|
|
|
- {
|
|
|
|
- userInfo?.nickName ? <View className="ID">{userInfo?.nickName || ""}</View> :
|
|
|
|
- <View className="ID">{userInfo?.openId}</View>
|
|
|
|
- }
|
|
|
|
- {
|
|
|
|
- userInfoStore.isVip && <View className="grade">
|
|
|
|
- <Image lazy-load src={require('../../icon/grade.png')} />
|
|
|
|
- <Text>V1</Text>
|
|
|
|
- </View>
|
|
|
|
- }
|
|
|
|
- </View>
|
|
|
|
|
|
+ // 使用 useDidHide 如果需要在页面隐藏时做一些处理
|
|
|
|
+ useDidHide(() => {
|
|
|
|
+ ModalStore.hideModal()
|
|
|
|
+ });
|
|
|
|
+ console.log(userInfoStore)
|
|
|
|
+ return <View className='my'>
|
|
|
|
+ <View className="userInfo">
|
|
|
|
+ {/* <Image src={require('../../icon/myBack.png')} /> */}
|
|
|
|
+ <View className="userInfo_box">
|
|
|
|
+ {/* 个人信息 */}
|
|
|
|
+ <View className="top" >
|
|
|
|
+ <View className="left">
|
|
|
|
+ <View className="avtai">
|
|
|
|
+ <Image mode="widthFix" lazy-load src={userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')} />
|
|
|
|
+ </View>
|
|
|
|
+ <View className="name" style={userInfoStore.isAuth ? { width: Taro.pxTransform(120) } : {}}>
|
|
|
|
+ {
|
|
|
|
+ userInfoStore?.userInfo?.nickname ? <View className="ID">{userInfoStore?.userInfo?.nickname || ""}</View> :
|
|
|
|
+ <View className="ID">{userInfoStore?.userInfo?.openId}</View>
|
|
|
|
+ }
|
|
|
|
+ {
|
|
|
|
+ userInfoStore.isVip && <View className="grade">
|
|
|
|
+ <Image lazy-load src={require('../../icon/grade.png')} />
|
|
|
|
+ <Text>V1</Text>
|
|
|
|
+ </View>
|
|
|
|
+ }
|
|
</View>
|
|
</View>
|
|
- {
|
|
|
|
- userInfoStore.isAuth && <View className="right">
|
|
|
|
- {
|
|
|
|
- userInfoStore.isAuth ?
|
|
|
|
- <Button onClick={() => { }} className="loginBt" >
|
|
|
|
- <Image lazy-load src={require('../../icon/loaginBt.png')} />
|
|
|
|
- </Button>
|
|
|
|
- : <View>
|
|
|
|
- <Button openType='chooseAvatar' onChooseAvatar={() => { }} className="loginBt">
|
|
|
|
- <Image lazy-load src={require('../../icon/loaginBt.png')} />
|
|
|
|
- </Button>
|
|
|
|
- {/* <Input type="nickname" placeholder="请输入昵称" /> */}
|
|
|
|
- </View>
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- </View>
|
|
|
|
- }
|
|
|
|
</View>
|
|
</View>
|
|
- {/* 付费功能 */}
|
|
|
|
- <IosShowPay>
|
|
|
|
- {/* vip续费 */}
|
|
|
|
- <View className="bottom">
|
|
|
|
- <View>
|
|
|
|
- <View className="left">
|
|
|
|
- <Image lazy-load src={require('../../icon/VIP.png')} />
|
|
|
|
- <View className="txt">
|
|
|
|
- <Text>会员尊享免费解锁权益</Text>
|
|
|
|
- {
|
|
|
|
- userInfoStore.isVip && <Text className="tfv">有效期至:{1111}</Text>
|
|
|
|
- }
|
|
|
|
- </View>
|
|
|
|
|
|
+ {
|
|
|
|
+ // userInfoStore.isAuth && <View className="right">
|
|
|
|
+ // {
|
|
|
|
+ // userInfoStore.isAuth ?
|
|
|
|
+ // <Button onClick={() => { }} className="loginBt" >
|
|
|
|
+ // <Image lazy-load src={require('../../icon/loaginBt.png')} />
|
|
|
|
+ // </Button>
|
|
|
|
+ // : <View>
|
|
|
|
+ // <Button openType='chooseAvatar' onChooseAvatar={() => { }} className="loginBt">
|
|
|
|
+ // <Image lazy-load src={require('../../icon/loaginBt.png')} />
|
|
|
|
+ // </Button>
|
|
|
|
+ // {/* <Input type="nickname" placeholder="请输入昵称" /> */}
|
|
|
|
+ // </View>
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ // </View>
|
|
|
|
+ }
|
|
|
|
+ </View>
|
|
|
|
+ {/* 付费功能 */}
|
|
|
|
+ <IosShowPay>
|
|
|
|
+ {/* vip续费 */}
|
|
|
|
+ <View className="bottom">
|
|
|
|
+ <View>
|
|
|
|
+ <View className="left">
|
|
|
|
+ <Image lazy-load src={require('../../icon/VIP.png')} />
|
|
|
|
+ <View className="txt">
|
|
|
|
+ <Text>会员尊享免费解锁权益</Text>
|
|
|
|
+ {
|
|
|
|
+ userInfoStore.isVip && <Text className="tfv">有效期至:{1111}</Text>
|
|
|
|
+ }
|
|
</View>
|
|
</View>
|
|
- <View className="right" onClick={() => { Taro.navigateTo({ url: '/pages/vipCore/index' }) }}>{userInfoStore.isVip ? '立即续费' : '立即开通'}</View>
|
|
|
|
</View>
|
|
</View>
|
|
- <Image lazy-load src={require('../../icon/vipBack.png')} />
|
|
|
|
|
|
+ <View className="right" onClick={(e) => {
|
|
|
|
+ payBtn(e, "vip")
|
|
|
|
+ }}>{userInfoStore.isVip ? '立即续费' : '立即开通'}</View>
|
|
</View>
|
|
</View>
|
|
- {/*我的账户 */}
|
|
|
|
- <View className='account_info'>
|
|
|
|
- <View className='account_info_title'>我的账户</View>
|
|
|
|
- <View className='account_info_content'>
|
|
|
|
- <View className='account_info_content_left'>
|
|
|
|
- <View className='account_info_content_text'>
|
|
|
|
- <Text>12</Text>
|
|
|
|
- <Text>书币</Text>
|
|
|
|
- </View>
|
|
|
|
- <View className='account_info_content_text' onClick={() => { }}>
|
|
|
|
- <Text>300</Text>
|
|
|
|
- <Text>赠币</Text>
|
|
|
|
- </View>
|
|
|
|
|
|
+ <Image lazy-load src={require('../../icon/vipBack.png')} />
|
|
|
|
+ </View>
|
|
|
|
+ {/*我的账户 */}
|
|
|
|
+ <View className='account_info'>
|
|
|
|
+ <View className='account_info_title'>我的账户</View>
|
|
|
|
+ <View className='account_info_content'>
|
|
|
|
+ <View className='account_info_content_left'>
|
|
|
|
+ <View className='account_info_content_text'>
|
|
|
|
+ <Text>{userInfoStore.userInfo?.coinNum || 0}</Text>
|
|
|
|
+ <Text>书币</Text>
|
|
</View>
|
|
</View>
|
|
- <View className='account_info_content_btn' onClick={() => { Taro.navigateTo({ url: '/pages/myAccount/index' }) }}>充值</View>
|
|
|
|
|
|
+ {/* <View className='account_info_content_text' onClick={() => { }}>
|
|
|
|
+ <Text>0</Text>
|
|
|
|
+ <Text>赠币</Text>
|
|
|
|
+ </View> */}
|
|
</View>
|
|
</View>
|
|
|
|
+ <View className='account_info_content_btn' onClick={(e) => {
|
|
|
|
+ payBtn(e, "shubi")
|
|
|
|
+ }}>充值</View>
|
|
</View>
|
|
</View>
|
|
- </IosShowPay>
|
|
|
|
- {/* 底部功能入口 */}
|
|
|
|
- <View className="list_bt" >
|
|
|
|
- <Navigator className="item" url="/pages/my/contactService/index">
|
|
|
|
- <View className="left">
|
|
|
|
- <Image lazy-load src={require('../../icon/phone.png')} mode="widthFix" />
|
|
|
|
- <Text>联系客服</Text>
|
|
|
|
- </View>
|
|
|
|
- <View className="right">
|
|
|
|
- <Image lazy-load src={require('../../icon/jtRight.png')} mode="widthFix" />
|
|
|
|
- </View>
|
|
|
|
- </Navigator>
|
|
|
|
- <View className="line"></View>
|
|
|
|
- <Navigator className="item" url="/pages/my/aboutUs/index">
|
|
|
|
- <View className="left">
|
|
|
|
- <Image lazy-load src={require('../../icon/we.png')} mode="widthFix" />
|
|
|
|
- <Text>关于我们</Text>
|
|
|
|
- </View>
|
|
|
|
- <View className="right">
|
|
|
|
- <Image lazy-load src={require('../../icon/jtRight.png')} mode="widthFix" />
|
|
|
|
- </View>
|
|
|
|
- </Navigator>
|
|
|
|
</View>
|
|
</View>
|
|
|
|
+ {/* 支付弹窗 */}
|
|
|
|
+ <GlobalModal type={payType} isBook={false} />
|
|
|
|
+ </IosShowPay>
|
|
|
|
+ {/* 底部功能入口 */}
|
|
|
|
+ <View className="list_bt" >
|
|
|
|
+ <Navigator className="item" url="/pages/my/contactService/index">
|
|
|
|
+ <View className="left">
|
|
|
|
+ <Image lazy-load src={require('../../icon/phone.png')} mode="widthFix" />
|
|
|
|
+ <Text>联系客服</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="right">
|
|
|
|
+ <Image lazy-load src={require('../../icon/jtRight.png')} mode="widthFix" />
|
|
|
|
+ </View>
|
|
|
|
+ </Navigator>
|
|
|
|
+ <View className="line"></View>
|
|
|
|
+ <Navigator className="item" url="/pages/my/aboutUs/index">
|
|
|
|
+ <View className="left">
|
|
|
|
+ <Image lazy-load src={require('../../icon/we.png')} mode="widthFix" />
|
|
|
|
+ <Text>关于我们</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="right">
|
|
|
|
+ <Image lazy-load src={require('../../icon/jtRight.png')} mode="widthFix" />
|
|
|
|
+ </View>
|
|
|
|
+ </Navigator>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
- }
|
|
|
|
|
|
+ </View>
|
|
}
|
|
}
|
|
-
|
|
|
|
-export default My
|
|
|
|
|
|
+export default inject('store')(observer(My));
|