|
|
|
@ -3,21 +3,55 @@ import Taro, { useLoad } from '@tarojs/taro' |
|
|
|
|
import React, { useState } from 'react' |
|
|
|
|
import './index.less' |
|
|
|
|
|
|
|
|
|
interface RecordProps { |
|
|
|
|
CreateTime: string, |
|
|
|
|
PrdtDeadline: string, |
|
|
|
|
Title: string, |
|
|
|
|
SubscribedState?: number, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default function Share() { |
|
|
|
|
const [userAvator, setuserAvator] = useState('') |
|
|
|
|
|
|
|
|
|
const [userNickName, setuserNickName] = useState('') |
|
|
|
|
|
|
|
|
|
// 会员信息
|
|
|
|
|
const [info, setInfo] = useState<RecordProps>() |
|
|
|
|
|
|
|
|
|
// 开通记录
|
|
|
|
|
const [records, setRecords] = useState<RecordProps[]>() |
|
|
|
|
|
|
|
|
|
const handleShare = () => { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useLoad((query)=> { |
|
|
|
|
if(Taro.getStorageSync('UserToken')){ |
|
|
|
|
setuserAvator(Taro.getStorageSync('UserAvatar')) |
|
|
|
|
setuserNickName(Taro.getStorageSync('UserNickName')) |
|
|
|
|
} |
|
|
|
|
useLoad(()=> { |
|
|
|
|
setuserAvator(Taro.getStorageSync('UserAvatar')) |
|
|
|
|
setuserNickName(Taro.getStorageSync('UserNickName')) |
|
|
|
|
|
|
|
|
|
Taro.request({ |
|
|
|
|
url: 'https://interapi.jm-kid.com/api/member/data', |
|
|
|
|
method: 'POST', |
|
|
|
|
header: { |
|
|
|
|
authorization: `bearer ${Taro.getStorageSync('UserToken')}` |
|
|
|
|
}, |
|
|
|
|
data: { |
|
|
|
|
timestamp: Date.now(), |
|
|
|
|
member_type: 'audio' |
|
|
|
|
}, |
|
|
|
|
success: (res: any) => { |
|
|
|
|
if(res.data.state === 200){ |
|
|
|
|
const { list, main } = res.data.data |
|
|
|
|
console.log(11, list,records) |
|
|
|
|
setRecords(list) |
|
|
|
|
main && setInfo(main) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail: (err: any) => { |
|
|
|
|
console.log('兑换失败=>', err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -28,28 +62,35 @@ export default function Share() { |
|
|
|
|
></Image> |
|
|
|
|
<View className='vip_info'> |
|
|
|
|
<View className='vip_name'>{userNickName}</View> |
|
|
|
|
<View className='vip_status'>未开通</View> |
|
|
|
|
<View className='vip_status'>{info?.SubscribedState ? info?.PrdtDeadline.split(' ')[0] + '日到期' : '未开通'}</View> |
|
|
|
|
</View> |
|
|
|
|
<View className='vip_open'>立即开通</View> |
|
|
|
|
<View className='vip_open'>立即{info?.SubscribedState ? '续费' : '开通'}</View> |
|
|
|
|
</View> |
|
|
|
|
<View className='vip_none'>暂无开通记录~</View> |
|
|
|
|
|
|
|
|
|
<View className='vip_record'> |
|
|
|
|
<Text className='vip_title'>开通记录</Text> |
|
|
|
|
|
|
|
|
|
<View className='vip_list'> |
|
|
|
|
<View className='vip_list_item'> |
|
|
|
|
<View className='vip_list_info'> |
|
|
|
|
<Text>熏听会员年卡</Text> |
|
|
|
|
<Text>1年</Text> |
|
|
|
|
</View> |
|
|
|
|
<View className='vip_list_date'> |
|
|
|
|
<Text>开通时间:2024</Text> |
|
|
|
|
<Text>到期时间:2024</Text> |
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
records && records.length ? |
|
|
|
|
(<View className='vip_record'> |
|
|
|
|
<Text className='vip_title'>开通记录</Text> |
|
|
|
|
|
|
|
|
|
<View className='vip_list'> |
|
|
|
|
{ |
|
|
|
|
records.map((item: any, index: number) => ( |
|
|
|
|
<View className='vip_list_item' key={index}> |
|
|
|
|
<View className='vip_list_info'> |
|
|
|
|
<Text>{item.Title}</Text> |
|
|
|
|
<Text>1年</Text> |
|
|
|
|
</View> |
|
|
|
|
<View className='vip_list_date'> |
|
|
|
|
<Text>开通时间:{item.CreateTime.split(' ')[0]}</Text> |
|
|
|
|
<Text>到期时间:{item.PrdtDeadline.split(' ')[0]}</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</View>) : |
|
|
|
|
<View className='vip_none'>暂无开通记录~</View> |
|
|
|
|
} |
|
|
|
|
</View> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|