import React, { useState } from "react"; import { Form, Input, Space, Button } from "antd"; import baseRequest from "../../utils/baseRequest"; export default function QuerryMidAndUserId() { const [result, setResult] = useState({}); //搜索 const search = async (value) => { if (value.mid && value.user_id) { alert("不可同时查询mid和user_id"); return; } let type = "list_by_mid"; if (!value.mid) type = "list_by_user_id"; try { const base = baseRequest(); const response = await fetch(`/op/account/${type}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ user_id: value.user_id ? parseInt(value.user_id, 10) : 0, mid: value.mid ? parseInt(value.mid, 10) : 0, ...base, }), }); const data = await response.json(); if (data.ret === -1) { alert(data.msg); return; } if (type === "list_by_user_id") { setResult({ user_id: null, mid: data.data.account.mid }); return; } setResult({ user_id: data.data.account.user_id, mid: null }); } catch (error) { console.error(error); } }; //表单提交失败 const onFinishFailed = (errorInfo) => { console.log("Failed:", errorInfo); }; return (
user_id:{result?.user_id}
)} {result?.mid &&mid:{result?.mid}
}