65 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2025-03-21 09:20:29 +08:00
<!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"
2025-04-23 17:47:28 +08:00
content="123"
2025-03-21 09:20:29 +08:00
/>
<meta
name="description"
2025-04-23 17:47:28 +08:00
content="123"
2025-03-21 09:20:29 +08:00
/>
2025-05-12 09:22:57 +08:00
<link rel="icon" href="/logo.png" />
2025-05-16 11:54:35 +08:00
<script type="module" src="/lodop.js"></script>
<script type="module" src="/src/main.ts"></script>
2025-05-12 09:22:57 +08:00
<title>Maxcess SCEP</title>
2025-03-21 09:20:29 +08:00
</head>
<body>
<div id="app"></div>
2025-05-22 16:08:45 +08:00
<script>
/**
* 从金蝶添加订单的GET请求挂载到window可在控制台直接调用
* @param {string} token 认证token
*/
2025-06-06 15:51:12 +08:00
window.getMaxcessData = function() {
2025-05-22 16:08:45 +08:00
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}...`); // 提示请求开始
2025-04-23 17:47:28 +08:00
2025-05-22 16:08:45 +08:00
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>
2025-03-21 09:20:29 +08:00
</body>
</html>