diff --git a/src/assets/images/service.svg b/src/assets/images/service.svg deleted file mode 100644 index 594a7c7..0000000 --- a/src/assets/images/service.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/images/share.svg b/src/assets/images/share.svg deleted file mode 100644 index 98280cd..0000000 --- a/src/assets/images/share.svg +++ /dev/null @@ -1,21617 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/images/store.png b/src/assets/images/store.png deleted file mode 100644 index ef5124b..0000000 Binary files a/src/assets/images/store.png and /dev/null differ diff --git a/src/components/gift/index.tsx b/src/components/gift/index.tsx index 15c204f..de30790 100644 --- a/src/components/gift/index.tsx +++ b/src/components/gift/index.tsx @@ -1,7 +1,6 @@ import { Image } from '@tarojs/components' import Taro from '@tarojs/taro'; import './index.less' -import giftIcon from '../../assets/images/gift.svg' export default function Gift() { const toCustomer = () => { @@ -11,6 +10,6 @@ export default function Gift() { } return ( - + ) } diff --git a/src/pages/Customer/index.tsx b/src/pages/Customer/index.tsx index d1329b5..e51049d 100644 --- a/src/pages/Customer/index.tsx +++ b/src/pages/Customer/index.tsx @@ -1,12 +1,11 @@ import { Image } from '@tarojs/components' import './index.less' -import customerPic from '../../assets/images/customer.svg' export default function Customer() { return ( diff --git a/src/pages/Share/index.less b/src/pages/Share/index.less index a8801bf..1c68664 100644 --- a/src/pages/Share/index.less +++ b/src/pages/Share/index.less @@ -1,7 +1,10 @@ page { overflow: hidden; } -.pic { - width: 100vw; - height: 100vh; +.share_btn { + padding: 0; + .pic { + width: 100vw; + height: 100vh; + } } diff --git a/src/pages/Share/index.tsx b/src/pages/Share/index.tsx index cbd7425..bcda7ea 100644 --- a/src/pages/Share/index.tsx +++ b/src/pages/Share/index.tsx @@ -1,8 +1,6 @@ -import { View, Image } from '@tarojs/components' -import Taro, { useLoad, useShareAppMessage, useShareTimeline, updateShareMenu, showShareMenu } from '@tarojs/taro' -import React, { useState } from 'react' +import { Image, Button } from '@tarojs/components' +import Taro, { useShareAppMessage, useShareTimeline } from '@tarojs/taro' import './index.less' -import sharePic from '../../assets/images/share.svg' export default function Share() { const inviteCode = Taro.getStorageSync('UserInviteCode') // 邀请码 @@ -24,45 +22,13 @@ export default function Share() { } }) - 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 fa4f8d2..9859eeb 100644 --- a/src/pages/Subscribe/index.less +++ b/src/pages/Subscribe/index.less @@ -125,7 +125,6 @@ .subscribe_container { display: grid; grid-template-columns: repeat(3, 1fr); - // height: auto; gap: .8rem .625rem; .subscribe_content_singleItem { @@ -133,35 +132,22 @@ height: calc((100vw - 2rem - 1.25rem) / 3 + .5rem + 2.5rem); display: flex; flex-direction: column; - - .relative_container { - position: relative; - width: 100%; - height: 0; - top: 0; - left: 0; - - .subscribe_content_singleItem_label { - position: absolute; - left: calc(100% - 3rem); - top: calc((100vw - 2rem - 1.25rem) / 3 - 1rem); - width: 3rem; - height: 1rem; - border-radius: .75rem 0; - background-color: #fcca1e; - display: flex; - - .subscribe_content_singleItem_label_text { - font-size: .5rem; - margin: auto; - } - } - } .cover_wrap { position: relative; border-radius: .75rem; overflow: hidden; } + .subscribe_content_singleItem_label { + position: absolute; + right: 0; + bottom: 0; + width: 3rem; + font-size: .5rem; + text-align: center; + line-height: 1rem; + border-radius: .75rem 0; + background-color: #fcca1e; + } .expire { position: absolute; @@ -188,6 +174,7 @@ .subscribe_content_singleItem_cover { width: 100%; + border-radius: .75rem; } .subscribe_content_singleItem_title { @@ -203,29 +190,22 @@ width: 100%; display: flex; flex-direction: column; - - .relative_container { + .cover_wrap { position: relative; - width: 100%; - height: 0; - top: 0; - left: 0; - - .subscribe_content_singleItem_label { - position: absolute; - left: calc(100% - 3rem); - top: calc(((100vw - 2rem - .625rem) / 2) * .5625 - 1rem); - width: 3rem; - height: 1rem; - border-radius: .75rem 0; - background-color: #fcca1e; - display: flex; + border-radius: .75rem; + overflow: hidden; + } - .subscribe_content_singleItem_label_text { - font-size: .5rem; - margin: auto; - } - } + .subscribe_content_singleItem_label { + position: absolute; + right: 0; + bottom: 0; + width: 3rem; + font-size: .5rem; + text-align: center; + line-height: 1rem; + border-radius: .75rem 0; + background-color: #fcca1e; } .subscribe_content_singleItem_cover { @@ -234,7 +214,6 @@ max-height: 5.8rem; min-height: 5.8rem; border-radius: .75rem; - margin-bottom: .625rem; } .subscribe_content_singleItem_title { diff --git a/src/pages/Subscribe/index.tsx b/src/pages/Subscribe/index.tsx index 363837c..0093c80 100644 --- a/src/pages/Subscribe/index.tsx +++ b/src/pages/Subscribe/index.tsx @@ -422,16 +422,52 @@ export default function Subscribe() { } //跳转详情页 - const handleToCollectionDetail = (id: string) => { - Taro.navigateTo({ - url: '/pages/CollectionDetail/index?id=' + id - }) + const handleToCollectionDetail = (item: any) => { + if (item.SubscribedState === -1) { + // 已过期,直接删除 + Taro.request({ + url: 'https://interapi.jm-kid.com/api/mark/subscribed', + method: 'POST', + header: { + authorization: `bearer ${Taro.getStorageSync('UserToken')}` + }, + data: { + timestamp: Date.now(), + prdt_id: item.PrdtId + }, + success: () => { + requestUserSubscribe() + }, + }) + } else { + Taro.navigateTo({ + url: '/pages/CollectionDetail/index?id=' + item.PrdtId + }) + } } - const handleToSingleDetail = (id: string) => { - Taro.navigateTo({ - url: '/pages/SingleDetail/index?id=' + id - }) + const handleToSingleDetail = (item: any) => { + if (item.SubscribedState === -1) { + // 已过期,直接删除 + Taro.request({ + url: 'https://interapi.jm-kid.com/api/mark/subscribed', + method: 'POST', + header: { + authorization: `bearer ${Taro.getStorageSync('UserToken')}` + }, + data: { + timestamp: Date.now(), + prdt_id: item.ParentPrdtId + }, + success: () => { + requestUserSubscribe() + }, + }) + } else { + Taro.navigateTo({ + url: '/pages/SingleDetail/index?id=' + item.PrdtId + }) + } } const handleNavigateToMiniProgram = () => { @@ -550,18 +586,8 @@ export default function Subscribe() { handleToSingleDetail(item.PrdtId)} + onClick={() => handleToSingleDetail(item)} > - { - item.isFree === 1 && ( - - - 免费绘本 - - - ) - } - { - !item.isFree1 && ( + item.SubscribedState === -1 && ( 已 过 期 ) } + { + item.isFree === 1 && 免费绘本 + } + { + item.OrdRefer === 3 && 免费赠送 + } + {item.PrdtTitle} )) @@ -590,21 +623,20 @@ export default function Subscribe() { key={index} onClick={() => handleToCollectionDetail(item.PrdtId)} > - { - item.isFree === 1 && ( - - - 免费绘本 - - - ) - } - + + + { + item.isFree === 1 && 免费绘本 + } + { + item.OrdRefer === 3 && 免费赠送 + } + {item.PrdtTitle} {`共${item.ChildCount}本`} diff --git a/src/pages/UserHome/index.tsx b/src/pages/UserHome/index.tsx index c9fa6be..665507c 100644 --- a/src/pages/UserHome/index.tsx +++ b/src/pages/UserHome/index.tsx @@ -18,7 +18,7 @@ const userOperateList = [ }, { name: '熏听会员', - icon: 'https://oss.jm-kid.com/wx_5colorflower/operate2.svg', + icon: 'https://oss.jm-kid.com/wx_5colorflower/icons/operate5.svg', pushUrl: '/pages/Vip/index', des: '未开通', }, @@ -29,23 +29,23 @@ const userOperateList = [ }, { name: '商城', - icon: storeIcon, + icon: 'https://oss.jm-kid.com/wx_5colorflower/icons/operate4.svg', pushUrl: '', }, { name: '邀请好友', - icon: storeIcon, + icon: 'https://oss.jm-kid.com/wx_5colorflower/icons/operate7.svg', pushUrl: '/pages/Share/index', des: '免费领绘本', }, { name: '联系客服', - icon: serviceIcon, + icon: 'https://oss.jm-kid.com/wx_5colorflower/icons/operate8.svg', pushUrl: '/pages/Customer/index', }, { name: '消息', - icon: storeIcon, + icon: 'https://oss.jm-kid.com/wx_5colorflower/icons/operate6.svg', pushUrl: '/pages/UserHome/UserMessage/index', des: 10, }, diff --git a/src/pages/Vip/index.less b/src/pages/Vip/index.less index b5ca028..684fd47 100644 --- a/src/pages/Vip/index.less +++ b/src/pages/Vip/index.less @@ -20,7 +20,7 @@ .vip_list_info { display: flex; justify-content: space-between; - margin-bottom: .3rem; + margin-bottom: .5rem; font-size: .95rem; color: #714135; } diff --git a/src/pages/Vip/index.tsx b/src/pages/Vip/index.tsx index a312c84..a6f4af1 100644 --- a/src/pages/Vip/index.tsx +++ b/src/pages/Vip/index.tsx @@ -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() + + // 开通记录 + const [records, setRecords] = useState() + 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() { > {userNickName} - 未开通 + {info?.SubscribedState ? info?.PrdtDeadline.split(' ')[0] + '日到期' : '未开通'} - 立即开通 + 立即{info?.SubscribedState ? '续费' : '开通'} - 暂无开通记录~ - - - 开通记录 - - - - - 熏听会员年卡 - 1年 - - - 开通时间:2024 - 到期时间:2024 - + + { + records && records.length ? + ( + 开通记录 + + + { + records.map((item: any, index: number) => ( + + + {item.Title} + 1年 + + + 开通时间:{item.CreateTime.split(' ')[0]} + 到期时间:{item.PrdtDeadline.split(' ')[0]} + + + )) + } - - + ) : + 暂无开通记录~ + } ) }