清空首页

This commit is contained in:
hackrobot
2024-07-13 23:20:08 +08:00
parent 15d8704089
commit 3836a222b4

View File

@@ -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 (
<View className="index">
<AtToast isOpened={isOpened} text="活动暂未开始" icon="blocked"></AtToast>
{/* <Text>Hello world!</Text> */}
{/* <AtNavBar
// onClickRgIconSt={handleClick}
// onClickRgIconNd={handleClick}
// onClickLeftIcon={goBack}
// leftIconType="chevron-left"
color="#000"
title="异度星球"
// leftText='返回'
// rightFirstIconType='bullet-list'
// rightSecondIconType='user'
/> */}
<View>
<AtSearchBar
showActionButton
value={""}
onChange={() => {}}
onActionClick={() => {}}
/>
</View>
<View className="indexSwiper">
{" "}
<Swiper
indicatorColor="#999"
indicatorActiveColor="#333"
// vertical
circular
indicatorDots
autoplay
>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"http://cdn.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30775083495267465.jpg"
}
/>
</View>
</SwiperItem>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
</SwiperItem>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
</SwiperItem>
</Swiper>
</View>
<AtGrid
data={[
{
image:
"https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png",
value: "签到",
},
{
image:
"https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png",
value: "活动",
},
{
image:
"https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png",
value: "视频",
},
]}
onClick={(item, index) => {
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);
}
}}
/>
<AtCard
onClick={() => {
// Taro.navigateTo({
// url: "/pages/meetup/Detail/index?id=20231206",
// });
}}
note=""
extra=""
title="[副业交流] 沙龙茶话会"
thumb="http://www.logoquan.com/upload/list/20180421/logoquan15259400209.PNG"
>
<View className="meetupCard">
{" "}
<View className="left">
{" "}
<Image
style="width: 150px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
<View className="right">
<View className="up">
<span style={{ color: "green" }}>[报名中]</span> 4/10
</View>
<View className="middle">2023/12/06 星期三</View>
<View className="down">
<AtButton
type="primary"
size="small"
className="submitBtn"
disabled={joinMeetup}
onClick={() => {
// window.alert(window.location.href)
// return false
Taro.navigateTo({
url: "/pages/meetup/Detail/index?id=20231206",
});
}}
>
{!!joinMeetup ? "已报名" : "立即报名"}
</AtButton>
</View>
</View>
</View>
</AtCard>
<View className="indexTablebar">
<AtTabBar
tabList={[
{ title: "首页", text: "" },
{ title: "活动" },
{ title: "我的" },
]}
onClick={(value) => handleClick(value)}
current={current}
/>
</View>
</View>
);
return <View className="index"></View>;
};
export default Index;