From d9bb1f258f500045b7c4a2fa42b38820dd080ccb Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 19 Nov 2024 16:47:44 +0800 Subject: [PATCH] fix --- src/components/getPhoneModal/index.tsx | 11 ++++----- src/pages/DisplayVideo/index.less | 2 +- src/pages/Listen/index.tsx | 34 +++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/components/getPhoneModal/index.tsx b/src/components/getPhoneModal/index.tsx index fa61d53..2c2aa55 100644 --- a/src/components/getPhoneModal/index.tsx +++ b/src/components/getPhoneModal/index.tsx @@ -9,8 +9,6 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on //管理关闭动画状态 const [isAnimationOpen, setisAnimationOpen] = useState(false) - const [inviteCode, setInviteCode] = useState() - // 兑换成功弹窗 const [isUserExchangeSuccessModalOpen, setisUserExchangeSuccessModalOpen] = useState(false) @@ -24,8 +22,8 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on const [prdtList, setPrdtList] = useState([]) useLoad((query)=> { - console.log(query.inviteCode) - setInviteCode(query.inviteCode || '') + console.log('通过分享拿到的邀请码是:',query.inviteCode) + query.inviteCode && Taro.setStorageSync('othersInviteCode', query.inviteCode) }) if(!modalVisible){ @@ -43,7 +41,7 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on }; const handleGetUserPhone = (e: any) => { - console.log(e.detail) + console.log('注册接口:',e.detail, Taro.getStorageSync('othersInviteCode')) const open_id = Taro.getStorageSync('LoginKey') if (open_id) { @@ -54,7 +52,7 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on MCODE: e.detail.code, channel: 'wusehua_mini', open_id, - invite_code: inviteCode + invite_code: Taro.getStorageSync('othersInviteCode') }, success: (res: any) => { console.log('用户注册信息=>',res) @@ -63,6 +61,7 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on Taro.setStorageSync('UserPhoneNumber', res.data.user.Mobile) Taro.setStorageSync('UserInviteCode', res.data.user.InviteCode) Taro.setStorageSync('UserToken', res.data.token) + Taro.removeStorageSync('othersInviteCode') if(scene){ Taro.request({ diff --git a/src/pages/DisplayVideo/index.less b/src/pages/DisplayVideo/index.less index 97dde43..be522b5 100644 --- a/src/pages/DisplayVideo/index.less +++ b/src/pages/DisplayVideo/index.less @@ -17,7 +17,7 @@ .select-epi { z-index: 1000; position: absolute; - bottom: 7.4rem; + bottom: 7.28rem; right: 3rem; color: #fff; } diff --git a/src/pages/Listen/index.tsx b/src/pages/Listen/index.tsx index afa0c9e..5176637 100644 --- a/src/pages/Listen/index.tsx +++ b/src/pages/Listen/index.tsx @@ -86,6 +86,8 @@ export default function Listen() { //管理登录弹窗 const [isLoginOpen, setisLoginOpen] = useState(false) + const [memberInfo, setMemberInfo] = useState({}) + useDidShow(() => { if(Taro.getStorageSync('UserToken')){ Taro.request({ @@ -118,6 +120,24 @@ export default function Listen() { setareaList(res.data.data.show) } }) + + // 获取会员跳转链接 + 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){ + setMemberInfo(res.data.data.main) + } + }, + }) }else{ Taro.request({ method: 'POST', @@ -214,9 +234,17 @@ export default function Listen() { if(!Taro.getStorageSync('UserToken')){ //提醒用户登录 setisLoginOpen(true) - }else{ - Taro.navigateTo({ - url: '/pages/Vip/index' + } else { + // 跳转到熏听会员 + Taro.navigateToMiniProgram({ + appId: 'wxbd3d383851fea776', + path: memberInfo?.MallLink || '', + success: (res) => { + console.log('打开成功=>',res) + }, + fail: (res) => { + console.log('打开失败=>',res) + } }) } }