h5裂变
This commit is contained in:
BIN
src/images/group.png
Normal file
BIN
src/images/group.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
src/images/see.png
Normal file
BIN
src/images/see.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
@@ -16,26 +16,42 @@ import { AtNavBar } from "taro-ui";
|
|||||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui";
|
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui";
|
||||||
import { AtToast } from "taro-ui";
|
import { AtToast } from "taro-ui";
|
||||||
import { AtIcon } from "taro-ui";
|
import { AtIcon } from "taro-ui";
|
||||||
|
import see from "../../images/see.png";
|
||||||
|
import group from "../../images/group.png";
|
||||||
|
|
||||||
// export default class Index extends Component {
|
// export default class Index extends Component {
|
||||||
const Index = () => {
|
const Index = () => {
|
||||||
const [current, setcurrent] = useState(0);
|
const [current, setcurrent] = useState(0);
|
||||||
const [openId, setopenId] = useState(null);
|
const [openId, setopenId] = useState(null);
|
||||||
|
const [wxiid, setwxid] = useState(null);
|
||||||
|
|
||||||
const [isOpened, setisOpened] = useState(false);
|
const [isOpened, setisOpened] = useState(false);
|
||||||
const [joinMeetup, setjoinMeetup] = useState(false);
|
const [joinMeetup, setjoinMeetup] = useState(false);
|
||||||
|
|
||||||
|
const [id, setid] = useState(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let newparams = Taro.getCurrentInstance().router.params;
|
||||||
|
let newId = newparams.id;
|
||||||
|
if (newId) {
|
||||||
|
setid(newId);
|
||||||
|
}
|
||||||
|
let newjoinMeetup = window.localStorage.getItem("joinMeetup");
|
||||||
|
setjoinMeetup(newjoinMeetup);
|
||||||
|
}, []);
|
||||||
|
const onBridgeReady = () => {
|
||||||
|
WeixinJSBridge.call("hideOptionMenu");
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let $instance = Taro.getCurrentInstance();
|
||||||
|
console.log($instance.router.params);
|
||||||
|
}, []);
|
||||||
|
|
||||||
// 获取openid
|
// 获取openid
|
||||||
const getWxid = () => {
|
const getWxid = () => {
|
||||||
// let newparams = Taro.getCurrentInstance().router.params;
|
|
||||||
// let urlopenid = newparams.openid;
|
|
||||||
|
|
||||||
// hash模式
|
|
||||||
// http://192.168.31.245:10086/?openid=o7LFAwR32hWGq9XOpd7ZxK1wZxq8#/pages/index/index
|
|
||||||
let hashopenid = null;
|
let hashopenid = null;
|
||||||
if (window.location.href.includes("openid")) {
|
if (window.location.href.includes("openid")) {
|
||||||
// window.alert(window.location.href);
|
|
||||||
|
|
||||||
hashopenid = window.location.href
|
hashopenid = window.location.href
|
||||||
.split("#")[0]
|
.split("#")[0]
|
||||||
.split("?")[1]
|
.split("?")[1]
|
||||||
@@ -43,234 +59,162 @@ const Index = () => {
|
|||||||
} else {
|
} else {
|
||||||
hashopenid = window.localStorage.getItem("openid");
|
hashopenid = window.localStorage.getItem("openid");
|
||||||
}
|
}
|
||||||
|
// let newOpenid = window.localStorage.getItem("openid");
|
||||||
// window.alert(hashopenid)
|
|
||||||
let newOpenid = window.localStorage.getItem("openid");
|
|
||||||
|
|
||||||
// window.alert(newOpenid)
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!!newOpenid && newOpenid != "undefined" &&newOpenid != "null") ||
|
// (!!newOpenid && newOpenid != "undefined" && newOpenid != "null") ||
|
||||||
(!!hashopenid && hashopenid != "undefined"&&hashopenid != "null")
|
!!hashopenid &&
|
||||||
|
hashopenid != "undefined" &&
|
||||||
|
hashopenid != "null"
|
||||||
) {
|
) {
|
||||||
// window.alert('存在')
|
|
||||||
// window.alert(hashopenid);
|
|
||||||
// window.alert(newOpenid);
|
|
||||||
|
|
||||||
window.localStorage.setItem("openid", hashopenid);
|
window.localStorage.setItem("openid", hashopenid);
|
||||||
setopenId(hashopenid)
|
setopenId(hashopenid);
|
||||||
} else {
|
} else {
|
||||||
// window.alert('不存在')
|
|
||||||
let nowUrl = window.location.href;
|
let nowUrl = window.location.href;
|
||||||
|
|
||||||
// window.alert(nowUrl)
|
|
||||||
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
|
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
|
||||||
window.location.href = payUrl;
|
window.location.href = payUrl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const joinmeet = () => {
|
||||||
|
// alert(window.localStorage.getItem("openid"));
|
||||||
|
Taro.request({
|
||||||
|
method: "POST",
|
||||||
|
url: "/api/payh5", //仅为示例,并非真实的接口地址
|
||||||
|
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
|
||||||
|
|
||||||
|
data: {
|
||||||
|
callback_url: window.location.href,
|
||||||
|
openid: window.localStorage.getItem("openid"),
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"content-type": "application/json", // 默认值
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res.data);
|
||||||
|
// window.alert(res.data.jsapi);
|
||||||
|
WeixinJSBridge.invoke(
|
||||||
|
"getBrandWCPayRequest",
|
||||||
|
{
|
||||||
|
// 以下6个支付参数通过payjs的jsapi接口获取
|
||||||
|
// appId: "wxc5205a653b0259bf",
|
||||||
|
// timeStamp: "1701401644",
|
||||||
|
// nonceStr: "KhOYB0wFV6j9qyQK",
|
||||||
|
// package: "prepay_id=wx01113404850024729b35f4d69b73500000",
|
||||||
|
// signType: "MD5",
|
||||||
|
// paySign: "2A823C8D47CCF871C6C65A56DC228CF8",
|
||||||
|
...(res?.data?.jsapi ?? {}),
|
||||||
|
},
|
||||||
|
function (res) {
|
||||||
|
//发起网络请求
|
||||||
|
|
||||||
|
// 付款成功
|
||||||
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||||
|
// 邀请加入微信群
|
||||||
|
joinWechat();
|
||||||
|
WeixinJSBridge.call("closeWindow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const joinWechat = () => {
|
||||||
|
Taro.request({
|
||||||
|
url: "/api/joinwechat",
|
||||||
|
// url: "https://kunpeng.hackrobot.cn/joingroup",
|
||||||
|
data: {
|
||||||
|
wxid: "wxid_haqoszjheyuz22",
|
||||||
|
// wxid:wxid ?? null, //debug eric 的wxid
|
||||||
|
},
|
||||||
|
method: "POST",
|
||||||
|
header: {
|
||||||
|
"content-type": "application/json", // 默认值
|
||||||
|
},
|
||||||
|
success: function (resUser) {
|
||||||
|
console.log("resUser--", resUser);
|
||||||
|
alert(resUser?.data?.success);
|
||||||
|
console.log("加入微信群成功");
|
||||||
|
if (resUser?.data?.success == "fail") {
|
||||||
|
//已经在群聊中
|
||||||
|
handleClick("已经在群聊中", "warning");
|
||||||
|
setbtntext("已经在群聊中");
|
||||||
|
} else if (resUser?.data?.success == "ok") {
|
||||||
|
// 发送群聊邀请
|
||||||
|
handleClick("已发送群聊邀请", "warning");
|
||||||
|
setbtntext("已发送群聊邀请");
|
||||||
|
}
|
||||||
|
setdisabled(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getWxid();
|
getWxid();
|
||||||
let newjoinMeetup = window.localStorage.getItem("joinMeetup");
|
let newjoinMeetup = window.localStorage.getItem("joinMeetup");
|
||||||
setjoinMeetup(newjoinMeetup);
|
setjoinMeetup(newjoinMeetup);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
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
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<View className="index">
|
<View className="index">
|
||||||
<AtToast isOpened={isOpened} text="活动暂未开始" icon="blocked"></AtToast>
|
<View className="at-article">
|
||||||
{/* <Text>Hello world!</Text> */}
|
<View className="at-article__h1">微信群加入规则,请知悉</View>
|
||||||
{/* <AtNavBar
|
<View className="at-article__info">
|
||||||
// onClickRgIconSt={handleClick}
|
2024-04-10 hackrobot
|
||||||
// onClickRgIconNd={handleClick}
|
</View>
|
||||||
// onClickLeftIcon={goBack}
|
<View className="at-article__content">
|
||||||
// leftIconType="chevron-left"
|
<View className="at-article__section">
|
||||||
color="#000"
|
<View className="at-article__h2">免费入群</View>
|
||||||
title="异度星球"
|
{/* <View className="at-article__h3">请给公众号文章点击:"在看"</View> */}
|
||||||
// leftText='返回'
|
|
||||||
// rightFirstIconType='bullet-list'
|
|
||||||
// rightSecondIconType='user'
|
|
||||||
/> */}
|
|
||||||
|
|
||||||
<View>
|
<View className="at-article__p">
|
||||||
<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>
|
</View>
|
||||||
</SwiperItem>
|
<View className="at-article__p">
|
||||||
<SwiperItem>
|
1. 请点击下方蓝色文字,跳转到公众号文章
|
||||||
<View className="demo-text">
|
|
||||||
{" "}
|
|
||||||
<Image
|
|
||||||
// style="width: 300px;height: 100px;background: #fff;"
|
|
||||||
src={
|
|
||||||
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
</SwiperItem>
|
<View className="at-article__p">2. 阅读到最底部,点击"在看"</View>
|
||||||
<SwiperItem>
|
<View className="at-article__p">如图所示:</View>
|
||||||
<View className="demo-text">
|
<Image className="at-article__img" src={see} mode="widthFix" />
|
||||||
{" "}
|
<View className="at-article__p">
|
||||||
<Image
|
<span>点击跳转</span>
|
||||||
// style="width: 300px;height: 100px;background: #fff;"
|
<AtIcon value="arrow-right" size="30" color="#F00"></AtIcon>
|
||||||
src={
|
<a href="https://mp.weixin.qq.com/s/MttWjccHsMbLD0pMv1LfYQ">
|
||||||
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
|
云手机6:内网穿透-frp
|
||||||
}
|
</a>
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
</SwiperItem>
|
<View className="at-article__p">
|
||||||
</Swiper>
|
稍等几分钟.机器人检测后,会自动发送群聊邀请
|
||||||
</View>
|
</View>
|
||||||
|
<Image className="at-article__img" src={group} mode="widthFix" />
|
||||||
|
|
||||||
<AtGrid
|
{/* <View className="at-article__p">
|
||||||
data={[
|
如果不想点击"在看",也可以选择点击
|
||||||
{
|
<AtIcon value="arrow-right" size="30" color="#F00"></AtIcon>
|
||||||
image:
|
<Button
|
||||||
"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={() => {
|
onClick={() => {
|
||||||
// window.alert(window.location.href)
|
joinmeet();
|
||||||
// return false
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: "/pages/meetup/Detail/index?id=20231206",
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
className="payBtn"
|
||||||
>
|
>
|
||||||
{!!joinMeetup ? "已报名" : "立即报名"}
|
付费入群
|
||||||
</AtButton>
|
</Button>
|
||||||
|
</View> */}
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<View className="at-article__p lastWord">
|
||||||
|
声明:
|
||||||
|
<br />
|
||||||
|
本群是交流平台,请不要发送广告以及敏感内容
|
||||||
|
<br />
|
||||||
|
仅聊天,不承诺其他服务和支持
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</AtCard>
|
|
||||||
|
|
||||||
<View className="indexTablebar">
|
|
||||||
<AtTabBar
|
|
||||||
tabList={[
|
|
||||||
{ title: "首页", text: "" },
|
|
||||||
{ title: "活动" },
|
|
||||||
{ title: "我的" },
|
|
||||||
]}
|
|
||||||
onClick={(value) => handleClick(value)}
|
|
||||||
current={current}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
|
{/* <AtButton type="primary">立即加入</AtButton> */}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,59 +1,13 @@
|
|||||||
.index {
|
.index {
|
||||||
display: flex;
|
// font-size: 28px;
|
||||||
flex-direction: column;
|
|
||||||
// align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
.indexSwiper {
|
|
||||||
// margin-top: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
|
|
||||||
.demo-text {
|
.payBtn{
|
||||||
// display: flex;
|
// font-size: 30px;
|
||||||
// flex-direction: column;
|
margin-left: 20px;
|
||||||
// align-items: center;
|
top: 10px;
|
||||||
// justify-content: center;
|
}
|
||||||
// background-color: yellow;
|
|
||||||
height: 300px;
|
.lastWord{
|
||||||
width: 100%;
|
font-size: 25px;
|
||||||
// padding: 20px;
|
}
|
||||||
// Image{
|
|
||||||
// width: 90%;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.meetupCard {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
.right {
|
|
||||||
// background-color: yellow;
|
|
||||||
width: 100%;
|
|
||||||
margin-left: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
.down {
|
|
||||||
width: 200px;
|
|
||||||
// background-color: aqua;
|
|
||||||
position: relative;
|
|
||||||
bottom: 10px;
|
|
||||||
right: -120px;
|
|
||||||
// display: flex;
|
|
||||||
// flex-direction: column-reverse;
|
|
||||||
// justify-content:flex-end
|
|
||||||
// position: relative;
|
|
||||||
.submitBtn {
|
|
||||||
// width: 200px;
|
|
||||||
// position: absolute;
|
|
||||||
// right: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.indexTablebar {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const Detail = () => {
|
|||||||
...res?.data?.jsapi??{},
|
...res?.data?.jsapi??{},
|
||||||
},
|
},
|
||||||
function (res) {
|
function (res) {
|
||||||
|
// 付款成功
|
||||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||||
setjoinMeetup(true)
|
setjoinMeetup(true)
|
||||||
window.localStorage.setItem('joinMeetup',true)
|
window.localStorage.setItem('joinMeetup',true)
|
||||||
|
|||||||
Reference in New Issue
Block a user