feat:微信群加入按钮/提示
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
|||||||
AtSteps,
|
AtSteps,
|
||||||
AtForm,
|
AtForm,
|
||||||
AtInput,
|
AtInput,
|
||||||
|
AtToast,
|
||||||
|
AtMessage,
|
||||||
} from "taro-ui";
|
} from "taro-ui";
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
import beijing from "@/images/city/beijing.jpg";
|
import beijing from "@/images/city/beijing.jpg";
|
||||||
@@ -22,14 +24,17 @@ import shenzhen from "@/images/city/shenzhen.jpg";
|
|||||||
import touxiang from "@/images/index/touxiang.jpg";
|
import touxiang from "@/images/index/touxiang.jpg";
|
||||||
import TabbarCom from "@/componments/TabbarCom";
|
import TabbarCom from "@/componments/TabbarCom";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { set } from "lodash";
|
||||||
const KeywordJoin = () => {
|
const KeywordJoin = () => {
|
||||||
const [current, setcurrent] = useState(0);
|
const [current, setcurrent] = useState(0);
|
||||||
const [value, setvalue] = useState(null);
|
const [value, setvalue] = useState(null);
|
||||||
|
const [disabled, setdisabled] = useState(false);
|
||||||
const [localuserInfo, setlocaluserInfo] = useState(Taro.getStorageSync("userInfo"));
|
const [btntext, setbtntext] = useState('立即加入');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const [localuserInfo, setlocaluserInfo] = useState(
|
||||||
|
Taro.getStorageSync("userInfo")
|
||||||
|
);
|
||||||
|
|
||||||
// 获取用户标识符
|
// 获取用户标识符
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -51,8 +56,6 @@ const KeywordJoin = () => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// // 更新分享-minipro
|
// // 更新分享-minipro
|
||||||
// Taro.updateShareMenu({
|
// Taro.updateShareMenu({
|
||||||
@@ -68,6 +71,13 @@ const KeywordJoin = () => {
|
|||||||
|
|
||||||
// }, []);
|
// }, []);
|
||||||
|
|
||||||
|
const handleClick = (text, type) => {
|
||||||
|
Taro.atMessage({
|
||||||
|
message: text,
|
||||||
|
type: type,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="KeywordJoin">
|
<View className="KeywordJoin">
|
||||||
{/* 步骤栏 */}
|
{/* 步骤栏 */}
|
||||||
@@ -128,8 +138,12 @@ const KeywordJoin = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="tabbbarDiv"></View>
|
<AtMessage />
|
||||||
<AtButton type="primary" className="jsonWechatBtn" onClick={()=>{
|
<AtButton
|
||||||
|
type="primary"
|
||||||
|
className="jsonWechatBtn"
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={() => {
|
||||||
// 通过hook加入微信群邀请
|
// 通过hook加入微信群邀请
|
||||||
//发起网络请求
|
//发起网络请求
|
||||||
Taro.request({
|
Taro.request({
|
||||||
@@ -139,12 +153,25 @@ const KeywordJoin = () => {
|
|||||||
wxid: localuserInfo?.wxid ?? null, //debug eric 的wxid
|
wxid: localuserInfo?.wxid ?? null, //debug eric 的wxid
|
||||||
},
|
},
|
||||||
success: function (resUser) {
|
success: function (resUser) {
|
||||||
console.log('resUser--',resUser)
|
console.log("resUser--", resUser);
|
||||||
console.log('加入微信群成功');
|
console.log("加入微信群成功");
|
||||||
|
if (resUser?.data?.success == "fail") {
|
||||||
|
//已经在群聊中
|
||||||
|
handleClick("已经在群聊中", "warning");
|
||||||
|
setbtntext("已经在群聊中")
|
||||||
|
|
||||||
|
} else if (resUser?.data?.success == "ok") {
|
||||||
|
// 发送群聊邀请
|
||||||
|
handleClick("已发送群聊邀请", "warning");
|
||||||
|
setbtntext("已发送群聊邀请")
|
||||||
|
}
|
||||||
|
setdisabled(true);
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}>
|
}}
|
||||||
点击加入
|
>
|
||||||
|
{btntext}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user