|
@@ -1,6 +1,6 @@
|
|
|
-import { useState } from 'react'
|
|
|
+import { useEffect, useState } from 'react'
|
|
|
import Taro, { useDidHide, useShareAppMessage } from '@tarojs/taro'
|
|
|
-import { View, Text, Image, Navigator } from '@tarojs/components'
|
|
|
+import { View, Text, Image, Navigator, Button } from '@tarojs/components'
|
|
|
import { observer, inject } from 'mobx-react'
|
|
|
import './index.less'
|
|
|
import { Store } from '@src/app'
|
|
@@ -15,7 +15,7 @@ interface Props {
|
|
|
function My(props: Props) {
|
|
|
let { userInfoStore, indexStore } = props.store
|
|
|
const [payType, setPayType] = useState<"shubi" | "vip">("shubi")
|
|
|
-
|
|
|
+ let [wxUser, setWxUser] = useState<any>(null)
|
|
|
//支付弹窗
|
|
|
const payBtn = (e, type) => {
|
|
|
e.stopPropagation()
|
|
@@ -45,20 +45,51 @@ function My(props: Props) {
|
|
|
}
|
|
|
return {}
|
|
|
})
|
|
|
+ useEffect(() => {
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ const getUserInfo = () => {
|
|
|
+ // if(!wxUser){
|
|
|
+ // Taro.getUserProfile({
|
|
|
+ // desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
+ // success: (res) => {
|
|
|
+ // // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
|
|
+ // console.log("res", res)
|
|
|
+ // setWxUser(res.userInfo)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ const copy = () => {
|
|
|
+ Taro.setClipboardData({
|
|
|
+ data: userInfoStore?.userInfo?.openId || "",
|
|
|
+ success: function (res) {
|
|
|
+ Taro.getClipboardData({
|
|
|
+ success: function (res) {
|
|
|
+ Taro.showToast({
|
|
|
+ title: "复制成功",
|
|
|
+ icon: "success"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
return <View className='my'>
|
|
|
<View className="userInfo">
|
|
|
<View className="userInfo_box">
|
|
|
{/* 个人信息 */}
|
|
|
- <View className="top" >
|
|
|
- <View className="left">
|
|
|
+ <View className="top" onClick={getUserInfo}>
|
|
|
+ <View className="left" >
|
|
|
<View className="avtai">
|
|
|
- <Image mode="widthFix" lazy-load src={userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')} />
|
|
|
+ {/* || (userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')) */}
|
|
|
+ <Image mode="widthFix" lazy-load src={"https://test-book-content.oss-cn-hangzhou.aliyuncs.com/bookImageFE90FDA493CE46C694B423F4F4EA7BCB.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>
|
|
|
- }
|
|
|
+ <View className='name_id'>
|
|
|
+ <Text className="ID">ID:{userInfoStore?.userInfo?.nickname || userInfoStore?.userInfo?.openId}</Text>
|
|
|
+ <Image onClick={copy} className='copy' lazy-load src={require('../../icon/copy.png')} />
|
|
|
+ </View>
|
|
|
{
|
|
|
userInfoStore.isVip && <View className="grade">
|
|
|
<Image lazy-load src={require('../../icon/grade.png')} />
|