|
|
|
@ -45,35 +45,15 @@ export default function IndexPage() {
|
|
|
|
|
|
|
|
|
|
const onFinish = async (data: any) => {
|
|
|
|
|
setLoading(true)
|
|
|
|
|
fetch('http://127.0.0.1:8088/xgd/pcd/getPlugCordResult', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'Origin': 'http://127.0.0.1:8088'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
|
await getPlugCordResult(data).then(res => {
|
|
|
|
|
if (res?.result == 'success' && res?.data[0]?.data) {
|
|
|
|
|
setIsAuth(true)
|
|
|
|
|
localStorage.setItem('is_auth', JSON.stringify(true));
|
|
|
|
|
message.success("系统连接检测成功!")
|
|
|
|
|
} else if (!res?.data[0]?.data) {
|
|
|
|
|
message.error("系统连接检测失败!")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
message.info("接口调通!");
|
|
|
|
|
} else {
|
|
|
|
|
message.warning("接口无法访问,状态码:" + response.status);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
message.error("发生错误:", error);
|
|
|
|
|
});
|
|
|
|
|
// await getPlugCordResult(data).then(res => {
|
|
|
|
|
// message.info("Res",res);
|
|
|
|
|
|
|
|
|
|
// if (res?.result == 'success' && res?.data[0]?.data) {
|
|
|
|
|
// setIsAuth(true)
|
|
|
|
|
// localStorage.setItem('is_auth', JSON.stringify(true));
|
|
|
|
|
// message.success("系统连接检测成功!")
|
|
|
|
|
// } else if (!res?.data[0]?.data) {
|
|
|
|
|
// message.error("系统连接检测失败!")
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
setLoading(false)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|