|
|
|
@ -1,7 +1,6 @@ |
|
|
|
|
import { ScrollView, View, Text } from '@tarojs/components' |
|
|
|
|
import React, { useState } from 'react' |
|
|
|
|
import Taro, { useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro' |
|
|
|
|
import DefaultPage2 from '../../../components/defaultPage2' |
|
|
|
|
import './index.less' |
|
|
|
|
|
|
|
|
|
interface subscribeProps { |
|
|
|
@ -37,13 +36,16 @@ export default function UserMessage() { |
|
|
|
|
|
|
|
|
|
useLoad(() => { |
|
|
|
|
Taro.request({ |
|
|
|
|
url: 'https://interapi.jm-kid.com/api/user/subscribed', |
|
|
|
|
url: 'https://interapi.jm-kid.com/api/message/list', |
|
|
|
|
method: 'POST', |
|
|
|
|
header: { |
|
|
|
|
authorization: `bearer ${Taro.getStorageSync('UserToken')}`, |
|
|
|
|
}, |
|
|
|
|
data: { |
|
|
|
|
timestamp: Date.now(), |
|
|
|
|
}, |
|
|
|
|
success: (res: any) => { |
|
|
|
|
console.log('用户订阅查询成功=>', res.data) |
|
|
|
|
console.log('消息列表查询成功=>', res.data) |
|
|
|
|
setuserSubuscribed(res.data.data) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -58,37 +60,36 @@ export default function UserMessage() { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View className='subscribe_bg'> |
|
|
|
|
<ScrollView |
|
|
|
|
scrollY |
|
|
|
|
scrollWithAnimation |
|
|
|
|
className='subscribe_scrollview' |
|
|
|
|
> |
|
|
|
|
{ |
|
|
|
|
userSubuscribed && userSubuscribed.length > 0 && userSubuscribed.map((item: any, index: number) => ( |
|
|
|
|
<View |
|
|
|
|
className='subscribe_item' |
|
|
|
|
key={index} |
|
|
|
|
onClick={()=>handleToCollectionDetail(item.PrdtId)} |
|
|
|
|
> |
|
|
|
|
<View className='item_header'> |
|
|
|
|
<Text className='item_header_title'>{item.PrdtTitle}</Text> |
|
|
|
|
<Text className='item_header_date'>10-01</Text> |
|
|
|
|
<View className='item_header_dot'></View> |
|
|
|
|
</View> |
|
|
|
|
<View className='item_content'> |
|
|
|
|
<Text className='item_header_des'>{item.PrdtTitle}</Text> |
|
|
|
|
<Text className='item_header_link'>立即查看> ></Text> |
|
|
|
|
<View></View> |
|
|
|
|
{ |
|
|
|
|
userSubuscribed && userSubuscribed.length ? |
|
|
|
|
<ScrollView |
|
|
|
|
scrollY |
|
|
|
|
scrollWithAnimation |
|
|
|
|
className='subscribe_scrollview' |
|
|
|
|
> |
|
|
|
|
{ |
|
|
|
|
userSubuscribed.map((item: any, index: number) => ( |
|
|
|
|
<View |
|
|
|
|
className='subscribe_item' |
|
|
|
|
key={index} |
|
|
|
|
onClick={()=>handleToCollectionDetail(item.PrdtId)} |
|
|
|
|
> |
|
|
|
|
<View className='item_header'> |
|
|
|
|
<Text className='item_header_title'>{item.title}</Text> |
|
|
|
|
<Text className='item_header_date'>{item.created_at}</Text> |
|
|
|
|
{ item.read_at && <View className='item_header_dot'></View> } |
|
|
|
|
</View> |
|
|
|
|
<View className='item_content'> |
|
|
|
|
<Text className='item_des'>{item.content}</Text> |
|
|
|
|
<Text className='item_link'>立即查看> ></Text> |
|
|
|
|
<View></View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
userSubuscribed && userSubuscribed.length === 0 && |
|
|
|
|
<DefaultPage2></DefaultPage2> |
|
|
|
|
} |
|
|
|
|
</ScrollView> |
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
</ScrollView> : |
|
|
|
|
<View className='none'>暂无消息~</View> |
|
|
|
|
} |
|
|
|
|
</View> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|