yujialong 4 weeks ago
parent 10fc0dd24e
commit 27eef168b3
  1. 5
      src/app.ts
  2. 21
      src/components/getPhoneModal/index.tsx
  3. 8
      src/pages/Home/index.tsx
  4. 15
      src/pages/Listen/index.tsx
  5. 8
      src/pages/Share/index.tsx
  6. 10
      src/pages/UserHome/UserMessage/index.less
  7. 67
      src/pages/UserHome/UserMessage/index.tsx
  8. 8
      src/pages/UserHome/UserPersonalInfo/index.less
  9. 18
      src/pages/UserHome/UserPersonalInfo/index.tsx
  10. 48
      src/pages/UserHome/index.tsx
  11. 47
      src/pages/Vip/index.less
  12. 18
      src/pages/Vip/index.tsx

@ -26,6 +26,7 @@ export default function App(props: any) {
Taro.setStorageSync('UserAvatar', sres.data.data.user.Avatar)
Taro.setStorageSync('UserNickName', sres.data.data.user.NickName)
Taro.setStorageSync('UserPhoneNumber', sres.data.data.user.Mobile)
Taro.setStorageSync('UserInviteCode', sres.data.data.user.InviteCode)
Taro.setStorageSync('UserToken', sres.data.token)
}else{
//注册key
@ -33,7 +34,7 @@ export default function App(props: any) {
}
}
})
}
}
})
})
@ -62,6 +63,6 @@ export default function App(props: any) {
return (
props.children
)
}

@ -1,6 +1,6 @@
import { Button, View, Text } from '@tarojs/components'
import { useState } from 'react'
import Taro from '@tarojs/taro'
import Taro, { useLoad } from '@tarojs/taro'
import './index.less'
export default function GetPhoneNumber({ onClose, scene = null, modalVisible, onModalClose}) {
@ -8,6 +8,13 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on
//管理关闭动画状态
const [isAnimationOpen, setisAnimationOpen] = useState(false)
const [inviteCode, setInviteCode] = useState()
useLoad((query)=> {
console.log(query.inviteCode)
setInviteCode(query.inviteCode || '')
})
if(!modalVisible){
return null
}
@ -31,12 +38,14 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on
MCODE: e.detail.code,
channel: 'wusehua_mini',
open_id: Taro.getStorageSync('LoginKey'),
invite_code: inviteCode
},
success: (res: any) => {
console.log('用户注册信息=>',res)
Taro.setStorageSync('UserAvatar', res.data.user.Avatar)
Taro.setStorageSync('UserNickName', res.data.user.NickName)
Taro.setStorageSync('UserPhoneNumber', res.data.user.Mobile)
Taro.setStorageSync('UserInviteCode', res.data.user.InviteCode)
Taro.setStorageSync('UserToken', res.data.token)
if(scene){
@ -110,7 +119,7 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on
<View className='light_border'>
<View className='phone_modal'>
<View className='phone_modal_logo'></View>
<Button
className='phone_modal_container'
@ -124,14 +133,14 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on
</View>
</Button>
<Text
<Text
className='phone_modal_desc'
onClick={handleOverlayClick}
onClick={handleOverlayClick}
></Text>
</View>
</View>
</>
)
}

@ -251,7 +251,7 @@ export default function Home() {
}
}
const handleBannerClick = (item: any) => {
const handleBannerClick = (item: any, index: number) => {
if(item.is_subscribed === 0){
//提醒用户登录
setisLoginOpen(true)
@ -269,8 +269,8 @@ export default function Home() {
else{
//已订阅,跳转详情页
Taro.navigateTo({
// url: '/pages/CollectionDetail/index?id=' + item.prdt_id
url: '/pages/Share/index'
url: index ? '/pages/CollectionDetail/index?id=' + item.prdt_id : '/pages/Share/index'
// url: '/pages/Share/index'
})
}
}
@ -295,7 +295,7 @@ export default function Home() {
<SwiperItem
className='swiper_item'
key={index}
onClick={()=>handleBannerClick(item)}
onClick={()=>handleBannerClick(item, index)}
>
<Image className='swiper_item_img' src={item.url}></Image>
</SwiperItem>

@ -204,6 +204,19 @@ export default function Listen() {
})
}
const handleBannerClick = (item: any, index: number) => {
if (!index) {
if(!Taro.getStorageSync('UserToken')){
//提醒用户登录
setisLoginOpen(true)
}else{
Taro.navigateTo({
url: '/pages/Vip/index'
})
}
}
}
return (
<View className='listen_bg'>
<View
@ -232,7 +245,7 @@ export default function Listen() {
<SwiperItem
className='swiper_item'
key={index}
onClick={()=>{}}
onClick={()=>handleBannerClick(item, index)}
>
<Image className='swiper_item_img' src={item.url} mode='scaleToFill'></Image>
</SwiperItem>

@ -1,24 +1,26 @@
import { View, Image } from '@tarojs/components'
import { useLoad, useShareAppMessage, useShareTimeline, updateShareMenu, showShareMenu } from '@tarojs/taro'
import Taro, { 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 Share() {
const inviteCode = Taro.getStorageSync('UserInviteCode') // 邀请码
useShareAppMessage((res) => {
if (res.from === 'button') {
console.log(res.target);
}
return {
title: '五色花',
path: '/pages/Home/index'
path: `/pages/Home/index?inviteCode=${inviteCode}`
}
})
useShareTimeline(() => {
return {
title: '五色花',
path: '/pages/Home/index'
path: `/pages/Home/index?inviteCode=${inviteCode}`
}
})

@ -42,15 +42,21 @@
}
.item_header_des {
.item_des {
font-size: .9rem;
color: #333;
}
.item_header_link {
.item_link {
margin-left: .5rem;
font-size: .9rem;
color: #3BA366;
}
}
}
.none {
padding-top: 3rem;
font-size: .8rem;
text-align: center;
color: #9a9391;
}
}

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

@ -69,10 +69,16 @@
.info_content_btn_text {
text-align: center;
color: #ffffff;
color: #fff;
font-size: 1rem;
font-weight: 600;
margin: auto;
}
}
.logout {
background: #fcca1e;
.info_content_btn_text {
color: #333;
}
}
}

@ -110,6 +110,16 @@ export default function UserPersonalInfo() {
}
// 退出登录
const logout = () => {
try {
Taro.clearStorageSync()
Taro.switchTab({
url: '/pages/Home/index',
})
} catch (e) {}
}
return (
<View className='info_bg'>
<View className='info_header'>
@ -152,6 +162,14 @@ export default function UserPersonalInfo() {
className='info_content_btn_text'
></Text>
</View>
<View
className='info_content_btn logout'
onClick={logout}
>
<Text
className='info_content_btn_text'
>退</Text>
</View>
</View>
)
}

@ -11,46 +11,39 @@ import GetPhoneNumber from '../../components/getPhoneModal'
const userOperateList = [
{
index: 1,
name: '我的订阅',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate2.svg',
pushUrl: '/pages/UserHome/UserSubscribe/index',
des: 10,
},
{
index: 2,
name: '熏听会员',
icon: 'https://oss.jm-kid.com/wx_5colorflower/operate2.svg',
pushUrl: '/pages/Vip/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: '',
pushUrl: '/pages/Customer/index',
},
{
index: 7,
name: '消息',
icon: storeIcon,
pushUrl: '/pages/UserHome/UserMessage/index',
@ -186,38 +179,23 @@ export default function UserHome() {
<View className='user_home_content'>
{
userOperateList.map((item: any, index: number) => (
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>
<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>
</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>
</View>
))
}
</View>

@ -1,18 +1,59 @@
.vip {
padding: 1rem;
.vip_none {
font-size: .8rem;
text-align: center;
color: #9a9391;
}
.vip_record {
.vip_title {
font-size: 1rem;
font-weight: 600;
color: #333;
}
.vip_list {
margin-top: .5rem;
}
.vip_list_item {
margin-bottom: 1rem;
}
.vip_list_info {
display: flex;
justify-content: space-between;
margin-bottom: .3rem;
font-size: .95rem;
color: #714135;
}
.vip_list_date {
display: flex;
justify-content: space-between;
font-size: .8rem;
color: #696969;
}
}
}
.vip_card {
position: relative;
display: flex;
align-items: center;
padding: 1.5rem;
margin-bottom: 1rem;
border: 2px solid #ffd0c6;
border-radius: 1.5rem;
background: linear-gradient(to right, #fcc1b5 20%, #f8c8bd 50%, #fce4df 100%);
&::before {
content: '会员卡';
position: absolute;
top: .6rem;
right: 1rem;
font-size: .8rem;
color: #714135;
}
.vip_avatar{
width: 3.75rem;
height: 3.75rem;
margin-right: 1rem;
border: .0625rem solid #ccc;
border: .0625rem solid #444;
border-radius: 50%;
}
.vip_name {
@ -27,8 +68,8 @@
}
.vip_open {
position: absolute;
top: 4rem;
right: 3rem;
top: 3.5rem;
right: 2rem;
padding: .3rem .8rem;
font-size: .9rem;
font-weight: 600;

@ -32,6 +32,24 @@ export default function Share() {
</View>
<View className='vip_open'></View>
</View>
<View className='vip_none'>~</View>
<View className='vip_record'>
<Text className='vip_title'></Text>
<View className='vip_list'>
<View className='vip_list_item'>
<View className='vip_list_info'>
<Text></Text>
<Text>1</Text>
</View>
<View className='vip_list_date'>
<Text>2024</Text>
<Text>2024</Text>
</View>
</View>
</View>
</View>
</View>
)
}

Loading…
Cancel
Save