parent
b60efdbdb3
commit
9d1518eb8a
13 changed files with 21987 additions and 59 deletions
After Width: | Height: | Size: 1.6 MiB |
@ -0,0 +1,5 @@ |
||||
export default { |
||||
navigationBarTitleText: '邀请好友', |
||||
enableShareAppMessage: true, |
||||
enableShareTimeline: true, |
||||
} |
@ -0,0 +1,9 @@ |
||||
.pic { |
||||
width: 100vw; |
||||
height: 100vh; |
||||
// background: url(../../assets/images/share.svg) 0 0/100% 100% no-repeat; |
||||
|
||||
// background-image: url(../../assets/images/share.svg); |
||||
// background-repeat: no-repeat; |
||||
// background-size: cover; |
||||
} |
@ -0,0 +1,66 @@ |
||||
import { View, Image } from '@tarojs/components' |
||||
import { useLoad, useShareAppMessage, useShareTimeline, updateShareMenu, showShareMenu } from '@tarojs/taro' |
||||
import React, { useState } from 'react' |
||||
import './index.less' |
||||
import sharePic from '../../assets/images/share.svg' |
||||
|
||||
export default function ListenDisplay() { |
||||
useShareAppMessage((res) => { |
||||
if (res.from === 'button') { |
||||
console.log(res.target); |
||||
} |
||||
return { |
||||
title: '五色花', |
||||
path: '/pages/Home/index' |
||||
} |
||||
}) |
||||
|
||||
useShareTimeline(() => { |
||||
return { |
||||
title: '五色花', |
||||
path: '/pages/Home/index' |
||||
} |
||||
}) |
||||
|
||||
const handleShare = () => { |
||||
// updateShareMenu({
|
||||
// success: () => {
|
||||
// // 更新成功
|
||||
// },
|
||||
// fail: err => {
|
||||
// // 更新失败
|
||||
// console.error('Failed to update share menu:', err);
|
||||
// }
|
||||
// });
|
||||
|
||||
// return {
|
||||
// title: '这是一个测试分享标题',
|
||||
// path: '/pages/index/index',
|
||||
// imageUrl: 'https://example.com/path/to/image.png'
|
||||
// };
|
||||
|
||||
showShareMenu({ |
||||
withShareTicket: true |
||||
}) |
||||
}; |
||||
|
||||
const [prdtId, setprdtId] = useState(-1) |
||||
|
||||
const [resId, setresId] = useState(-1) |
||||
|
||||
useLoad((query)=> { |
||||
// console.log(query.prdtId, query.resId)
|
||||
// setprdtId(query.prdtId)
|
||||
// setresId(query.resId)
|
||||
}) |
||||
|
||||
return ( |
||||
// <View className='pic'></View>
|
||||
<Image |
||||
src={sharePic} |
||||
className='pic' |
||||
mode='aspectFill' |
||||
onClick={handleShare} |
||||
></Image> |
||||
) |
||||
} |
@ -0,0 +1,5 @@ |
||||
export default { |
||||
navigationBarTitleText: '消息', |
||||
enableShareAppMessage: true, |
||||
enableShareTimeline: true, |
||||
} |
@ -0,0 +1,56 @@ |
||||
.subscribe_bg { |
||||
height: 100vh; |
||||
background: #f1f1f1; |
||||
padding: 1rem; |
||||
|
||||
.subscribe_scrollview { |
||||
height: 100vh; |
||||
display: flex; |
||||
flex-direction: column; |
||||
|
||||
.subscribe_item { |
||||
position: relative; |
||||
padding: 1rem 1.5rem; |
||||
background: #fff; |
||||
border-radius: .6rem; |
||||
gap: 1rem; |
||||
margin-bottom: 1rem; |
||||
|
||||
.item_header { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
margin-bottom: .3rem; |
||||
|
||||
.item_header_title { |
||||
font-size: .9rem; |
||||
font-weight: 600; |
||||
color: #333; |
||||
} |
||||
.item_header_date { |
||||
font-size: .8rem; |
||||
color: #ccc; |
||||
} |
||||
.item_header_dot { |
||||
position: absolute; |
||||
top: .8rem; |
||||
right: .8rem; |
||||
width: .5rem; |
||||
height: .5rem; |
||||
background-color: #f00; |
||||
border-radius: 50%; |
||||
} |
||||
|
||||
} |
||||
|
||||
.item_header_des { |
||||
font-size: .9rem; |
||||
color: #333; |
||||
} |
||||
.item_header_link { |
||||
margin-left: .5rem; |
||||
font-size: .9rem; |
||||
color: #3BA366; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,94 @@ |
||||
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 { |
||||
OrdDate: string, |
||||
OrdRefer: number, |
||||
PrdtCover: string, |
||||
PrdtDeadline: string, |
||||
PrdtId: number, |
||||
PrdtSubtitle: string, |
||||
PrdtTitle: string, |
||||
} |
||||
|
||||
export default function UserSubscribe() { |
||||
|
||||
useShareAppMessage((res) => { |
||||
if (res.from === 'button') { |
||||
console.log(res.target); |
||||
} |
||||
return { |
||||
title: '五色花', |
||||
path: '/pages/Home/index' |
||||
} |
||||
}) |
||||
|
||||
useShareTimeline(() => { |
||||
return { |
||||
title: '五色花', |
||||
path: '/pages/Home/index' |
||||
} |
||||
}) |
||||
|
||||
const [userSubuscribed, setuserSubuscribed] = useState<subscribeProps[]>() |
||||
|
||||
useLoad(() => { |
||||
Taro.request({ |
||||
url: 'https://interapi.jm-kid.com/api/user/subscribed', |
||||
method: 'POST', |
||||
header: { |
||||
authorization: `bearer ${Taro.getStorageSync('UserToken')}`, |
||||
}, |
||||
success: (res: any) => { |
||||
console.log('用户订阅查询成功=>', res.data) |
||||
setuserSubuscribed(res.data.data) |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
//跳转详情页
|
||||
const handleToCollectionDetail = (id: string) => { |
||||
Taro.navigateTo({ |
||||
url: '/pages/CollectionDetail/index?id=' + id |
||||
}) |
||||
} |
||||
|
||||
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> |
||||
</View> |
||||
</View> |
||||
)) |
||||
} |
||||
|
||||
{ |
||||
userSubuscribed && userSubuscribed.length === 0 && |
||||
<DefaultPage2></DefaultPage2> |
||||
} |
||||
</ScrollView> |
||||
</View> |
||||
) |
||||
} |
Loading…
Reference in new issue