2025-05-22 16:08:45 +08:00

65 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="keywords"
content="123"
/>
<meta
name="description"
content="123"
/>
<link rel="icon" href="/logo.png" />
<script type="module" src="/lodop.js"></script>
<script type="module" src="/src/main.ts"></script>
<title>Maxcess SCEP</title>
</head>
<body>
<div id="app"></div>
<script>
/**
* 从金蝶添加订单的GET请求挂载到window可在控制台直接调用
* @param {string} token 认证token
*/
window.addOrderFromKingDee = function() {
const apiUrl = 'https://maxcessth.gatedge.cn:91/api/Test2/AddOrderFromKingDee';
const token = document.cookie.split('; ').find(row => row.startsWith(`token=`))?.split('=')[1];
console.log(`正在请求 ${apiUrl}...`); // 提示请求开始
const xhr = new XMLHttpRequest();
xhr.open('GET', apiUrl, true);
xhr.setRequestHeader('Authorization', token); // 设置 token 请求头
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
try {
const response = xhr.responseText ? JSON.parse(xhr.responseText) : null;
console.log('✅ 请求成功:', response);
} catch (e) {
console.error('❌ 解析响应数据失败:', e);
console.log('原始响应:', xhr.responseText);
}
} else {
console.error(`❌ 请求失败,状态码: ${xhr.status}`, xhr.statusText);
}
};
xhr.onerror = function() {
console.error('❌ 网络请求失败,请检查:');
console.log('- 是否跨域?');
console.log('- 接口地址是否正确?');
console.log('- 网络是否正常?');
};
xhr.send();
};
// 示例(在控制台调用):
// addOrderFromKingDee("你的token");
</script>
</body>
</html>