修复无法在第一次获取微信的bug
This commit is contained in:
parent
a2e25cd973
commit
6a2a635584
|
@ -65,7 +65,6 @@ export default function Purchased() {
|
|||
getData();
|
||||
}, []);
|
||||
|
||||
const [currentWechat, setCurrentWechat] = useState("");
|
||||
const getWechat = async (streamerMid) => {
|
||||
// 获取微信
|
||||
try {
|
||||
|
@ -94,7 +93,7 @@ export default function Purchased() {
|
|||
});
|
||||
return;
|
||||
}
|
||||
setCurrentWechat(detailData.data.wechat_contact);
|
||||
return detailData.data.wechat_contact;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -103,14 +102,12 @@ export default function Purchased() {
|
|||
const DirectGetWechatItem = ({ item }) => {
|
||||
//点击查看微信
|
||||
const handleClick = async () => {
|
||||
await getWechat(item?.account.mid);
|
||||
setTimeout(
|
||||
() =>
|
||||
const wechat = await getWechat(item?.account.mid);
|
||||
Modal.alert({
|
||||
showCloseButton: true,
|
||||
confirmText: "复制",
|
||||
onConfirm: () => {
|
||||
copy(currentWechat);
|
||||
copy(wechat);
|
||||
Toast.show({
|
||||
content: "复制成功",
|
||||
});
|
||||
|
@ -118,13 +115,11 @@ export default function Purchased() {
|
|||
content: (
|
||||
<div className="p-2">
|
||||
<p className="text-white text-base font-medium text-center mb-4">
|
||||
Ta的微信号:<span>{currentWechat}</span>
|
||||
Ta的微信号:<span>{wechat}</span>
|
||||
</p>
|
||||
</div>
|
||||
),
|
||||
}),
|
||||
100
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
//点击主播
|
||||
|
|
Loading…
Reference in New Issue