diff --git a/src/app.config.ts b/src/app.config.ts index 86018b2..9013469 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -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', diff --git a/src/assets/images/share.svg b/src/assets/images/share.svg new file mode 100644 index 0000000..98280cd --- /dev/null +++ b/src/assets/images/share.svg @@ -0,0 +1,21617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index be4a54f..7acdf1b 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -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' }) } } diff --git a/src/pages/Share/index.config.ts b/src/pages/Share/index.config.ts new file mode 100644 index 0000000..e45288a --- /dev/null +++ b/src/pages/Share/index.config.ts @@ -0,0 +1,5 @@ +export default { + navigationBarTitleText: '邀请好友', + enableShareAppMessage: true, + enableShareTimeline: true, +} diff --git a/src/pages/Share/index.less b/src/pages/Share/index.less new file mode 100644 index 0000000..2d16fef --- /dev/null +++ b/src/pages/Share/index.less @@ -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; +} diff --git a/src/pages/Share/index.tsx b/src/pages/Share/index.tsx new file mode 100644 index 0000000..817e904 --- /dev/null +++ b/src/pages/Share/index.tsx @@ -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 ( + // + + ) +} diff --git a/src/pages/Subscribe/index.less b/src/pages/Subscribe/index.less index a895a5b..fa4f8d2 100644 --- a/src/pages/Subscribe/index.less +++ b/src/pages/Subscribe/index.less @@ -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 { diff --git a/src/pages/Subscribe/index.tsx b/src/pages/Subscribe/index.tsx index 2096548..f4ada81 100644 --- a/src/pages/Subscribe/index.tsx +++ b/src/pages/Subscribe/index.tsx @@ -563,12 +563,22 @@ export default function Subscribe() { ) } + + { + !item.isFree1 && ( + + + 已 过 期 + + ) + } + {item.PrdtTitle} )) diff --git a/src/pages/UserHome/UserMessage/index.config.ts b/src/pages/UserHome/UserMessage/index.config.ts new file mode 100644 index 0000000..b19925c --- /dev/null +++ b/src/pages/UserHome/UserMessage/index.config.ts @@ -0,0 +1,5 @@ +export default { + navigationBarTitleText: '消息', + enableShareAppMessage: true, + enableShareTimeline: true, +} diff --git a/src/pages/UserHome/UserMessage/index.less b/src/pages/UserHome/UserMessage/index.less new file mode 100644 index 0000000..959bb68 --- /dev/null +++ b/src/pages/UserHome/UserMessage/index.less @@ -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; + } + } + } +} diff --git a/src/pages/UserHome/UserMessage/index.tsx b/src/pages/UserHome/UserMessage/index.tsx new file mode 100644 index 0000000..6b6526b --- /dev/null +++ b/src/pages/UserHome/UserMessage/index.tsx @@ -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() + + 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 ( + + + { + userSubuscribed && userSubuscribed.length > 0 && userSubuscribed.map((item: any, index: number) => ( + handleToCollectionDetail(item.PrdtId)} + > + + {item.PrdtTitle} + 10-01 + + + + {item.PrdtTitle} + 立即查看> > + + + + )) + } + + { + userSubuscribed && userSubuscribed.length === 0 && + + } + + + ) +} diff --git a/src/pages/UserHome/index.less b/src/pages/UserHome/index.less index dc3780f..429cc1c 100644 --- a/src/pages/UserHome/index.less +++ b/src/pages/UserHome/index.less @@ -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; } } diff --git a/src/pages/UserHome/index.tsx b/src/pages/UserHome/index.tsx index 4e372a6..db0a040 100644 --- a/src/pages/UserHome/index.tsx +++ b/src/pages/UserHome/index.tsx @@ -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() { { userOperateList.map((item: any, index: number) => ( - index < 2 && handlePush(item.index ,item.pushUrl)} - > - - {item.name} - - + index === 5 ? + : + handlePush(index ,item.pushUrl)} + > + + + {item.name} + + + {item.des && {item.des}} + + + )) } - - - handleNavigateToMiniProgram()} - > - - {userOperateList[3].name} - -