新需求开发

master
yujialong 4 weeks ago
parent b60efdbdb3
commit 9d1518eb8a
  1. 2
      src/app.config.ts
  2. 21617
      src/assets/images/share.svg
  3. 3
      src/pages/Home/index.tsx
  4. 5
      src/pages/Share/index.config.ts
  5. 9
      src/pages/Share/index.less
  6. 66
      src/pages/Share/index.tsx
  7. 30
      src/pages/Subscribe/index.less
  8. 10
      src/pages/Subscribe/index.tsx
  9. 5
      src/pages/UserHome/UserMessage/index.config.ts
  10. 56
      src/pages/UserHome/UserMessage/index.less
  11. 94
      src/pages/UserHome/UserMessage/index.tsx
  12. 32
      src/pages/UserHome/index.less
  13. 117
      src/pages/UserHome/index.tsx

@ -6,6 +6,7 @@ export default defineAppConfig({
'pages/UserHome/index',
'pages/UserHome/UserPersonalInfo/index',
'pages/UserHome/UserSubscribe/index',
'pages/UserHome/UserMessage/index',
'pages/CollectionDetail/index',
'pages/SingleDetail/index',
'pages/AudioInterface/index',
@ -19,6 +20,7 @@ export default defineAppConfig({
'pages/ListenDisplay/index',
'pages/ListenSearch/index',
'pages/ListenBookDisplay/index',
'pages/Share/index',
],
tabBar: {
color: '#999',

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.6 MiB

@ -268,7 +268,8 @@ export default function Home() {
else{
//已订阅,跳转详情页
Taro.navigateTo({
url: '/pages/CollectionDetail/index?id=' + item.prdt_id
// url: '/pages/CollectionDetail/index?id=' + item.prdt_id
url: '/pages/Share/index'
})
}
}

@ -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>
)
}

@ -157,11 +157,37 @@
}
}
}
.cover_wrap {
position: relative;
border-radius: .75rem;
overflow: hidden;
}
.expire {
position: absolute;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
.expire_icon {
position: absolute;
top: .3rem;
right: .3rem;
width: 1.5rem;
height: 1.5rem;
}
.expire_text {
font-size: .8rem;
color: #f00;
}
}
.subscribe_content_singleItem_cover {
width: 100%;
border-radius: .75rem;
margin-bottom: auto;
}
.subscribe_content_singleItem_title {

@ -563,12 +563,22 @@ export default function Subscribe() {
)
}
<View className='cover_wrap'>
<Image
className='subscribe_content_singleItem_cover'
src={item.PrdtCover}
mode='widthFix'
lazyLoad
></Image>
{
!item.isFree1 && (
<View className='expire'>
<Image src='https://oss.jm-kid.com/wx_5colorflower/error.png' className='expire_icon'></Image>
<View className='expire_text'> </View>
</View>
)
}
</View>
<View className='subscribe_content_singleItem_title'>{item.PrdtTitle}</View>
</View>
))

@ -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'>&gt; &gt;</Text>
<View></View>
</View>
</View>
))
}
{
userSubuscribed && userSubuscribed.length === 0 &&
<DefaultPage2></DefaultPage2>
}
</ScrollView>
</View>
)
}

@ -65,29 +65,43 @@
width: 100%;
height: 3.125rem;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0;
background-color: #fff;
.user_home_content_item_inline {
display: inline-flex;
align-items: center;
}
.user_home_content_item_icon {
width: 2.5rem;
height: 2.5rem;
margin: auto .5rem auto 1rem;
}
.user_home_content_item_name {
width: auto;
height: 1rem;
line-height: 1rem;
font-size: 1rem;
text-align: center;
margin: auto auto auto .5rem;
margin-left: 1rem;
}
.user_home_content_item_des {
font-size: .9rem;
color: #909090;
}
&:nth-child(7) {
.user_home_content_item_des {
display: flex;
padding: .2rem .3rem;
color: #fff;
background-color: #ea2b2b;
border-radius: 50%;
}
}
.user_home_content_item_btn {
width: 1.5rem;
height: 1.5rem;
margin: auto 1rem auto auto;
margin: 0 1rem;
}
}

@ -9,30 +9,52 @@ import './index.less'
import GetPhoneNumber from '../../components/getPhoneModal'
const userOperateList = [
{
index: 0,
name: '兑换码',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate1.svg',
pushUrl: '',
},
{
index: 1,
name: '我的订阅',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate2.svg',
pushUrl: '/pages/UserHome/UserSubscribe/index',
des: 10,
},
{
index: 2,
name: '联系客服',
icon: serviceIcon,
pushUrl: '',
name: '熏听会员',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate2.svg',
pushUrl: '/pages/UserHome/UserSubscribe/index',
des: '未开通',
},
{
index: 3,
name: '兑换码',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate1.svg',
pushUrl: '',
},
{
index: 4,
name: '商城',
icon: storeIcon,
pushUrl: '',
},
{
index: 5,
name: '邀请好友',
icon: storeIcon,
pushUrl: '/pages/Share/index',
des: '免费领绘本',
},
{
index: 6,
name: '联系客服',
icon: serviceIcon,
pushUrl: '',
},
{
index: 7,
name: '消息',
icon: storeIcon,
pushUrl: '/pages/UserHome/UserMessage/index',
des: 10,
},
]
export default function UserHome() {
@ -117,12 +139,16 @@ export default function UserHome() {
if(!Taro.getStorageSync('UserToken')){
setisLoginOpen(true)
}else{
if(index === 1){
if (index === 3) {
// 商城
handleNavigateToMiniProgram()
} else if (index === 2) {
// 兑换码
setisUserExchangeModalOpen(true)
} else {
Taro.navigateTo({
url: url,
})
} else if (index === 0) {
setisUserExchangeModalOpen(true)
}
}
}
@ -159,43 +185,40 @@ export default function UserHome() {
<View className='user_home_content'>
{
userOperateList.map((item: any, index: number) => (
index < 2 && <View
key={index}
className='user_home_content_item'
onClick={()=>handlePush(item.index ,item.pushUrl)}
>
<Image className='user_home_content_item_icon' src={item.icon}></Image>
<Text className='user_home_content_item_name'>{item.name}</Text>
<Image
className='user_home_content_item_btn'
src='https://oss.jm-kid.com/wx_5colorflower/next.svg'
></Image>
</View>
index === 5 ?
<Button
key={index}
className='user_home_content_item'
openType='contact'
>
<View className='user_home_content_item_inline'>
<Image className='user_home_content_item_icon' src={item.icon}></Image>
<Text className='user_home_content_item_name'>{item.name}</Text>
</View>
<Image
className='user_home_content_item_btn'
src='https://oss.jm-kid.com/wx_5colorflower/next.svg'
></Image>
</Button> :
<View
key={index}
className='user_home_content_item'
onClick={()=>handlePush(index ,item.pushUrl)}
>
<View className='user_home_content_item_inline'>
<Image className='user_home_content_item_icon' mode='widthFix' src={item.icon}></Image>
<Text className='user_home_content_item_name'>{item.name}</Text>
</View>
<View className='user_home_content_item_inline'>
{item.des && <Text className='user_home_content_item_des'>{item.des}</Text>}
<Image
className='user_home_content_item_btn'
src='https://oss.jm-kid.com/wx_5colorflower/next.svg'
></Image>
</View>
</View>
))
}
<Button
className='user_home_content_item'
openType='contact'
>
<Image className='user_home_content_item_icon' src={userOperateList[2].icon}></Image>
<Text className='user_home_content_item_name'>{userOperateList[2].name}</Text>
<Image
className='user_home_content_item_btn'
src='https://oss.jm-kid.com/wx_5colorflower/next.svg'
></Image>
</Button>
<View
className='user_home_content_item'
onClick={()=>handleNavigateToMiniProgram()}
>
<Image className='user_home_content_item_icon' src={userOperateList[3].icon}></Image>
<Text className='user_home_content_item_name'>{userOperateList[3].name}</Text>
<Image
className='user_home_content_item_btn'
src='https://oss.jm-kid.com/wx_5colorflower/next.svg'
></Image>
</View>
</View>
<UserExchangeModal isOpen={isUserExchangeModalOpen} setIsOpen={setisUserExchangeModalOpen}></UserExchangeModal>

Loading…
Cancel
Save