From 3836a222b4cbcf2c540230cf880604d786d7cee1 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Sat, 13 Jul 2024 23:20:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.jsx | 222 ++------------------------------------ 1 file changed, 7 insertions(+), 215 deletions(-) diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index 72966e1..60e1362 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -26,7 +26,7 @@ const Index = () => { const [joinMeetup, setjoinMeetup] = useState(false); // 获取openid - const getWxid = () => { + const getOpenid = () => { // let newparams = Taro.getCurrentInstance().router.params; // let urlopenid = newparams.openid; @@ -34,8 +34,6 @@ const Index = () => { // http://192.168.31.245:10086/?openid=o7LFAwR32hWGq9XOpd7ZxK1wZxq8#/pages/index/index let hashopenid = null; if (window.location.href.includes("openid")) { - // window.alert(window.location.href); - hashopenid = window.location.href .split("#")[0] .split("?")[1] @@ -44,235 +42,29 @@ const Index = () => { hashopenid = window.localStorage.getItem("openid"); } - // window.alert(hashopenid) let newOpenid = window.localStorage.getItem("openid"); - - // window.alert(newOpenid) if ( - (!!newOpenid && newOpenid != "undefined" &&newOpenid != "null") || - (!!hashopenid && hashopenid != "undefined"&&hashopenid != "null") + (!!newOpenid && newOpenid != "undefined" && newOpenid != "null") || + (!!hashopenid && hashopenid != "undefined" && hashopenid != "null") ) { - // window.alert('存在') - // window.alert(hashopenid); - // window.alert(newOpenid); - window.localStorage.setItem("openid", hashopenid); - setopenId(hashopenid) + setopenId(hashopenid); } else { - // window.alert('不存在') let nowUrl = window.location.href; - - // window.alert(nowUrl) let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`; window.location.href = payUrl; } }; useEffect(() => { - getWxid(); - let newjoinMeetup = window.localStorage.getItem("joinMeetup"); - setjoinMeetup(newjoinMeetup); + getOpenid(); }, []); - const handleClick = (value) => { - console.log("value", value); - setcurrent(value); - if (value == 2) { - // 跳转到目的页面,在当前页面打开 - Taro.navigateTo({ - url: "/pages/my/index", - }); - } else if (value == 0) { - Taro.navigateTo({ - url: "/pages/index/index", - }); - } else { - Taro.navigateTo({ - url: "/pages/meetup/index", - }); - } - // - }; - const goBack = () => { - // window.history.back(); - Taro.navigateBack({ - // delta: 2 - }); + Taro.navigateBack({}); }; - return ( - - - {/* Hello world! */} - {/* */} - - - {}} - onActionClick={() => {}} - /> - - - {" "} - - - - {" "} - - - - - - {" "} - - - - - - {" "} - - - - - - - { - console.log("item", item); - console.log("index", index); - if (index == 0) { - setisOpened(true); - setTimeout(() => { - setisOpened(false); - }, 3500); - } - if (index == 1) { - Taro.navigateTo({ - url: "/pages/meetup/index", - }); - } - if (index == 2) { - setisOpened(true); - setTimeout(() => { - setisOpened(false); - }, 3500); - } - }} - /> - - { - // Taro.navigateTo({ - // url: "/pages/meetup/Detail/index?id=20231206", - // }); - }} - note="" - extra="" - title="[副业交流] 沙龙茶话会" - thumb="http://www.logoquan.com/upload/list/20180421/logoquan15259400209.PNG" - > - - {" "} - - {" "} - - - - - [报名中] 4/10 - - 2023/12/06 星期三 - - { - // window.alert(window.location.href) - // return false - Taro.navigateTo({ - url: "/pages/meetup/Detail/index?id=20231206", - }); - }} - > - {!!joinMeetup ? "已报名" : "立即报名"} - - - - - - - - handleClick(value)} - current={current} - /> - - - ); + return ; }; export default Index;