From 58214fffc633645879837e726e2e8c44f414f3ad Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 22 Nov 2024 11:21:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/getPhoneModal/index.tsx | 19 +++++++++++++++++++ src/pages/Home/index.tsx | 3 +-- src/pages/UserHome/index.tsx | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/components/getPhoneModal/index.tsx b/src/components/getPhoneModal/index.tsx index 2c2aa55..5073908 100644 --- a/src/components/getPhoneModal/index.tsx +++ b/src/components/getPhoneModal/index.tsx @@ -40,6 +40,23 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on }, 0) }; + // 消息推送授权 + const publicNotice = () => { + Taro.requestSubscribeMessage({ + tmplIds: ['F5kG9ryTuf3U09liOVIqqZDDEwNwiuWbLPPdoVpKPWI', 'cnMggWGwr0_cVw7Hf_fg3u74EDJdA0b4e56Ioy-Vr_Q'], + success (res) { + + }, + fail (err) { + Taro.showToast({ + title: err, + duration: 2000, + icon: 'error' + }); + } + }) + } + const handleGetUserPhone = (e: any) => { console.log('注册接口:',e.detail, Taro.getStorageSync('othersInviteCode')) @@ -63,6 +80,8 @@ export default function GetPhoneNumber({ onClose, scene = null, modalVisible, on Taro.setStorageSync('UserToken', res.data.token) Taro.removeStorageSync('othersInviteCode') + publicNotice() + if(scene){ Taro.request({ url: 'https://interapi.jm-kid.com/api/product/exchange', diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 2b1a71c..7659cb6 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -299,8 +299,7 @@ export default function Home() { else{ //已订阅,跳转详情页 Taro.navigateTo({ - url: index ? '/pages/CollectionDetail/index?id=' + item.prdt_id : '/pages/Share/index' - // url: '/pages/Share/index' + url: '/pages/Share/index' }) } } diff --git a/src/pages/UserHome/index.tsx b/src/pages/UserHome/index.tsx index 2204198..b45bf8e 100644 --- a/src/pages/UserHome/index.tsx +++ b/src/pages/UserHome/index.tsx @@ -168,6 +168,25 @@ export default function UserHome() { // } // }) + // 消息推送授权 + const publicNotice = (url) => { + Taro.requestSubscribeMessage({ + tmplIds: ['F5kG9ryTuf3U09liOVIqqZDDEwNwiuWbLPPdoVpKPWI', 'cnMggWGwr0_cVw7Hf_fg3u74EDJdA0b4e56Ioy-Vr_Q'], + success (res) { + Taro.navigateTo({ + url: url, + }) + }, + fail (err) { + Taro.showToast({ + title: err, + duration: 2000, + icon: 'error' + }); + } + }) + } + const handlePush = (index: number,url: string) => { if(!Taro.getStorageSync('UserToken')){ setisLoginOpen(true) @@ -178,6 +197,9 @@ export default function UserHome() { } else if (index === 2) { // 兑换码 setisUserExchangeModalOpen(true) + } else if (index === 4) { + // 联系客服 + publicNotice(url) } else { Taro.navigateTo({ url: url,