This commit is contained in:
hackrobot
2024-04-11 10:41:28 +08:00
parent b64a0a013e
commit 61e588affe

View File

@@ -55,27 +55,7 @@ const Index = () => {
// // 获取用户标识符
// useEffect(() => {
// // 获取路由参数
// const params = Taro.getCurrentInstance().router.params;
// console.log("params", params);
// let localwxid = window.localStorage.getItem("wxid");
// let localh5openid = window.localStorage.getItem("h5openid");
// if (
// params?.wxid &&
// (!localh5openid ||
// localh5openid == "undefined" ||
// localh5openid == "null")
// ) {
// // 本地存储
// window.localStorage.setItem("wxid", params?.wxid ?? "");
// // alert(params?.wxid);
// setwxid(params?.wxid);
// getopenId();
// }
// }, []);
const onBridgeReady = () => {
WeixinJSBridge.call("hideOptionMenu");
@@ -90,9 +70,6 @@ const Index = () => {
const params = Taro.getCurrentInstance().router.params;
let hashopenid = window.localStorage.getItem("h5openid");
let localwxid = window.localStorage.getItem("wxid");
// window.alert("hashopenid1", hashopenid);
// window.alert("localwxid2", localwxid);
//发起网络请求
Taro.request({
// url: "/api/addH5openid",
@@ -108,7 +85,6 @@ const Index = () => {
},
});
} catch (e) {
// alert(e);
} finally {
}
};
@@ -145,10 +121,8 @@ const Index = () => {
if (params?.wxid) {
// 本地存储
window.localStorage.setItem("wxid", params?.wxid ?? "");
// alert(params?.wxid);
setwxid(params?.wxid);
let nowUrl = window.location.href;
// alert(nowUrl);
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
window.location.href = payUrl;
}else{
@@ -159,17 +133,8 @@ const Index = () => {
}
};
// useEffect(() => {
// let nowUrl = window.location.href;
// let localh5openid = window.localStorage.getItem("h5openid");
// let localwxid = window.localStorage.getItem("wxid");
// alert("localh5openid==>" + localh5openid);
// alert("localwxid==>" + localwxid);
// alert(nowUrl);
// });
const joinmeet = () => {
// alert(window.localStorage.getItem("openid"));
Taro.request({
method: "POST",
url: "/api/payh5", //仅为示例,并非真实的接口地址
@@ -227,7 +192,6 @@ const Index = () => {
},
success: function (resUser) {
console.log("resUser--", resUser);
// alert(resUser?.data?.success);
console.log("加入微信群成功");
if (resUser?.data?.success == "fail") {
//已经在群聊中