| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>门店接口测试页面</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- padding: 20px;
- font-family: Arial, sans-serif;
- max-width: 800px;
- margin: 0 auto;
- }
- .title {
- text-align: center;
- margin: 20px 0;
- color: #333;
- }
- .btn-box {
- display: flex;
- gap: 10px;
- margin-bottom: 20px;
- flex-wrap: wrap;
- }
- button {
- padding: 12px 20px;
- background: #409eff;
- color: white;
- border: none;
- border-radius: 6px;
- cursor: pointer;
- font-size: 16px;
- flex: 1;
- min-width: 150px;
- }
- button:active {
- background: #337ecc;
- }
- .result {
- padding: 15px;
- background: #f5f7fa;
- border-radius: 8px;
- min-height: 100px;
- white-space: pre-wrap;
- word-break: break-all;
- font-size: 14px;
- line-height: 1.6;
- }
- .tip {
- color: #666;
- margin: 10px 0;
- font-size: 12px;
- }
- </style>
- </head>
- <body>
- <h2 class="title">门店接口测试(无Token,纯前端调用)</h2>
- <p class="tip">✅ 页面不携带任何Token,彻底解决401问题</p>
- <div class="btn-box">
- <button onclick="getMoreStores()">获取推荐门店列表</button>
- <button onclick="getStoreDetail()">获取门店详情</button>
- </div>
- <div class="result" id="result">请求结果将展示在这里...</div>
- <script>
- // 接口基础地址
- const baseUrl = 'http://120.26.186.130:8000';
- // 1. 获取更多推荐门店
- async function getMoreStores() {
- const resultDom = document.getElementById('result');
- resultDom.textContent = '加载中...';
-
- try {
- // 核心:无Token、无请求头,纯GET请求
- const res = await fetch(`${baseUrl}/alienStore/store/info/getMoreRecommendedStores?lat=38.925771&lon=121.662472&businessSection=3`);
- const data = await res.json();
- resultDom.textContent = JSON.stringify(data, null, 2);
- } catch (err) {
- resultDom.textContent = '请求失败:' + err.message;
- }
- }
- // 2. 获取门店详情
- async function getStoreDetail() {
- const resultDom = document.getElementById('result');
- resultDom.textContent = '加载中...';
-
- try {
- // 核心:无Token、无请求头,纯GET请求
- const res = await fetch(`${baseUrl}/alienStore/store/info/getClientStoreDetail?id=436&userId=628&jingdu=121.6574543718373&weidu=38.92492394348767`);
- const data = await res.json();
- resultDom.textContent = JSON.stringify(data, null, 2);
- } catch (err) {
- resultDom.textContent = '请求失败:' + err.message;
- }
- }
- </script>
- </body>
- </html>
|